Skip to content

Commit 32239f5

Browse files
RuslanRuslan
Ruslan
authored and
Ruslan
committed
Initial Commit
1 parent 65c1f35 commit 32239f5

23 files changed

+1003
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

Hello🤖.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import streamlit as st
2+
from PIL import Image
3+
import base64
4+
from pathlib import Path
5+
import os
6+
7+
def img_to_bytes(img_path):
8+
img_bytes = Path(img_path).read_bytes()
9+
encoded = base64.b64encode(img_bytes).decode()
10+
return encoded
11+
def img_to_html(img_path, link=''):
12+
img_html = "<a href='{}'><img src='data:image/png;base64,{}' class='img-fluid' width='64' height='64'>".format(
13+
link,
14+
img_to_bytes(img_path)
15+
)
16+
return img_html
17+
18+
st.set_page_config(layout="wide")
19+
20+
with st.sidebar:
21+
st.header('Seismic')
22+
st.write("- ")
23+
24+
col1, col2 = st.columns(2)
25+
with col1:
26+
st.markdown("# 🚀 Hey friends — I’m Ruslan.")
27+
28+
col1, col2 = st.columns(2)
29+
with col1:
30+
31+
st.markdown("I am **fascinated** by artificial intelligence and its applications in the oil and gas industry. I've spent the **5+** years learning, teaching, building, and deploying AI-based solutions for seismic interpretation, geological modeling, and reservoir simulation.", unsafe_allow_html=True)
32+
st.markdown("In 2021, I started a YouTube channel where I cover all aspects of our industry (drilling, exploration, production, and reservoir) as well as hands-on AI/ML programming using Python and Tensorflow/PyTorch")
33+
col1.markdown("The list of [Datasets](https://ruslanmiftakhov.com/blog#!/tfeeds/937619882821/c/Datasets) and [Tools](https://ruslanmiftakhov.com/blog#!/tfeeds/937619882821/c/Tools) I am updading from time to time on my website")
34+
with col2:
35+
st.video('https://youtu.be/6owwDkEhkgg')
36+
37+
38+
39+
col11, col22, col33, col44 = st.columns(4)
40+
col33.markdown('## YouTube '+img_to_html('images/YouTube.jpg', 'https://www.youtube.com/channel/UC1HyCbG5SO4hC7b_Ddl8cGg?sub_confirmation=1'), unsafe_allow_html=True)
41+
col44.markdown('## LinkedIn '+img_to_html('images/linkedin.png', 'https://www.linkedin.com/in/ruslan-miftakhov/'), unsafe_allow_html=True)
42+
43+
st.markdown('---')
44+
st.markdown('### What this app about❓')
45+
46+
47+
st.markdown('This app includes some of the best **open-source** O&G AI/ML tools so that you may test them out on your own data. \
48+
In most cases, I will include code that allows you to input the sample data *(or your own)*, perform the computation, and save the results in each application.')
49+
50+
col11, col22, col33 = st.columns(3)
51+
col11.markdown("""**Open AI/ML Algorithms**
52+
- 2D Self Supervised Denoising by [Claire](https://cebirnie92.github.io/) (Links: [GitHub](https://github.com/swag-kaust/Transform2022_SelfSupervisedDenoising) and [YouTube](https://youtu.be/d9yv90-JCZ0))✔️
53+
- 3D Seismic Fault Segmentation
54+
- 3D Seismic Denoising+SuperResolution
55+
- 2D/3D Seismic Facies Prediction
56+
- 3D Salt/Karst Delineation
57+
- Reconstruction of Missing Seismic Data
58+
- Neural Network for Acoustic Impedance prediction
59+
- Well-Log Lithology Prediction
60+
- Well-Log Synthesis
61+
- Well-to-well correlation
62+
- Centimeter-Scale Lithology and Facies Prediction using Core Images
63+
- First-Break Picking
64+
- and many more... """)
65+
col22.markdown("""**Import**
66+
- 2D/3D Post-Stacked Seismic import with SegyIO ✔️
67+
- 2D Post-Stacked Seismic import as Numpy Array ✔️
68+
- 3D Post-Stacked Seismic import as Numpy Array
69+
- Well-Log data
70+
- Well Trajectory data
71+
- Surface data (attributes, horizon, ...)
72+
- ...""")
73+
col33.markdown("""**Visualization**
74+
- 2D Seismic with user-defined colormap ✔️
75+
- 3D Interactive Seismic(section view) with user-defined colormap ✔️
76+
- Spectrum Frequency Plot ✔️
77+
- ...""")
78+
79+
80+
81+
image = Image.open('images/Check Out My AIML Solutions.png')
82+
col11.image(image)
83+
84+
with st.sidebar:
85+
col1, col2 = st.columns(2)
86+
st.markdown("""
87+
- **Seismic Type:** {}
88+
- **Seismic Name:** {}
89+
""".format(st.session_state.seismic_type if 'seismic_type' in st.session_state else "--", \
90+
os.path.basename(filename) if 'filename' in st.session_state else "--"))
7.22 KB
Binary file not shown.

__pycache__/utils.cpython-39.pyc

1.16 KB
Binary file not shown.
7.03 KB
Binary file not shown.

data_classes.py

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
from abc import ABC, abstractmethod
2+
import segyio
3+
import numpy as np
4+
import random
5+
random.seed(1)
6+
7+
class SeismicData(ABC):
8+
9+
@abstractmethod
10+
def __init__(self):
11+
pass
12+
13+
@abstractmethod
14+
def __del__(self):
15+
pass
16+
17+
@abstractmethod
18+
def get_iline(self, indx):
19+
pass
20+
21+
@abstractmethod
22+
def get_xline(self, indx):
23+
pass
24+
25+
@abstractmethod
26+
def get_zslice(self, indx):
27+
pass
28+
29+
# get total number of ilines
30+
@abstractmethod
31+
def get_n_ilines(self):
32+
pass
33+
34+
# get total number of xlines
35+
@abstractmethod
36+
def get_n_xlines(self):
37+
pass
38+
39+
# get total number of zslices
40+
@abstractmethod
41+
def get_n_zslices(self):
42+
pass
43+
44+
@abstractmethod
45+
def get_sample_rate(self):
46+
pass
47+
48+
@abstractmethod
49+
def get_vm(self):
50+
return self.vm
51+
52+
53+
54+
class SegyIO3D(SeismicData):
55+
56+
def __init__(self, file_name, iline_byte=189, xline_byte=193):
57+
self._segyfile = segyio.open(file_name, iline=int(iline_byte), xline=int(xline_byte))
58+
59+
# get statistics for visualization
60+
n_slices = 10
61+
seis = [self.get_iline(random.randint(0, self.get_n_ilines()-1)) for i in range(n_slices)]
62+
self.vm = np.percentile(seis, 95)
63+
64+
def __del__(self):
65+
self._segyfile.close()
66+
67+
def get_iline(self, indx):
68+
return self._segyfile.iline[self._segyfile.ilines[indx]]
69+
70+
71+
def get_xline(self,indx):
72+
return self._segyfile.xline[self._segyfile.xlines[indx]]
73+
74+
75+
def get_zslice(self,indx):
76+
return self._segyfile.depth_slice[indx]
77+
78+
# get total number of ilines
79+
def get_n_ilines(self):
80+
return len(self._segyfile.iline)
81+
82+
# get total number of xlines
83+
def get_n_xlines(self):
84+
return len(self._segyfile.xline)
85+
86+
# get total number of zslices
87+
def get_n_zslices(self):
88+
return self._segyfile.samples.size
89+
90+
def get_sample_rate(self):
91+
return segyio.tools.dt(self._segyfile)
92+
93+
def get_vm(self):
94+
return self.vm
95+
96+
class SegyIO2D(SeismicData):
97+
98+
def __init__(self, file_name):
99+
seismic_type = "2D"
100+
try:
101+
with segyio.open(file_name, strict=True) as segyfile:
102+
seismic_type = "3D"
103+
raise ValueError("You can only use 2D seismic file with this mode")
104+
except:
105+
if seismic_type == "3D":
106+
raise ValueError("You can only use 2D seismic file with this mode")
107+
with segyio.open(file_name, strict=False) as segyfile:
108+
self._data = np.stack(list((_.copy() for _ in segyfile.trace[:])))
109+
self._dt = segyio.tools.dt(segyfile)
110+
self.vm = np.percentile(self._data, 95)
111+
112+
def __del__(self):
113+
pass
114+
115+
def get_iline(self):
116+
return self._data.T
117+
118+
119+
def get_xline(self,):
120+
pass
121+
122+
def get_zslice(self,):
123+
pass
124+
125+
# get total number of ilines
126+
def get_n_ilines(self):
127+
return self._data.shape[0]
128+
129+
# get total number of xlines
130+
def get_n_xlines(self):
131+
pass
132+
133+
# get total number of zslices
134+
def get_n_zslices(self):
135+
return self._data.shape[1]
136+
137+
def get_sample_rate(self):
138+
return self._dt
139+
140+
def get_vm(self):
141+
return self.vm
142+
143+
def make_axis_devisable_by(self, factor):
144+
xlim = self._data.shape[0]//int(factor)*int(factor)
145+
ylim = self._data.shape[1]//int(factor)*int(factor)
146+
self._data = self._data[:xlim, :ylim]
147+
148+
class Numpy2D(SeismicData):
149+
150+
def __init__(self, file_name):
151+
self._data = np.load(file_name)
152+
153+
# get statistics for visualization
154+
seis = self.get_iline()
155+
self.vm = np.percentile(seis, 95)
156+
157+
def __del__(self):
158+
pass
159+
160+
def get_iline(self):
161+
return self._data
162+
163+
def get_xline(self):
164+
pass
165+
166+
def get_zslice(self):
167+
pass
168+
169+
def get_n_ilines(self):
170+
return self._data.shape[0]
171+
172+
# get total number of xlines
173+
def get_n_xlines(self):
174+
pass
175+
176+
def get_n_zslices(self):
177+
return self._data.shape[1]
178+
179+
def get_sample_rate(self):
180+
return 1000
181+
182+
def get_vm(self):
183+
return self.vm
184+
185+
def make_axis_devisable_by(self, factor):
186+
xlim = self._data.shape[0]//int(factor)*int(factor)
187+
ylim = self._data.shape[1]//int(factor)*int(factor)
188+
self._data = self._data[:xlim, :ylim]

0 commit comments

Comments
 (0)