seisview 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
seisview/__init__.py ADDED
@@ -0,0 +1,14 @@
1
+ """
2
+ Interactive seismic data visualization.
3
+
4
+ Author & Copyright: Dr. Thomas Hertweck, geophysics@email.de
5
+
6
+ License: GNU General Public License, Version 3
7
+ https://www.gnu.org/licenses/gpl-3.0.html
8
+ """
9
+
10
+ __version__ = "0.1.0"
11
+ __author__ = "Thomas Hertweck"
12
+ __copyright__ = "(c) 2026 Thomas Hertweck"
13
+ __license__ = "GNU General Public License, Version 3"
14
+
seisview/colormaps.py ADDED
@@ -0,0 +1,264 @@
1
+ """
2
+ Useful colormaps in the context of seismic data.
3
+
4
+ Author & Copyright: Dr. Thomas Hertweck, geophysics@email.de
5
+
6
+ License: GNU Lesser General Public License, Version 3
7
+ https://www.gnu.org/licenses/lgpl-3.0.html
8
+ """
9
+
10
+ import matplotlib.pyplot as plt
11
+ from matplotlib.colors import LinearSegmentedColormap
12
+
13
+ def seismic_blwr(version=1):
14
+ """
15
+ Seismic black-white-red colormap.
16
+
17
+ Parameters
18
+ ----------
19
+ version : int, optional (default: 1)
20
+ Which version to return. Version 1 equals Matplotlib's standard 'RdGy',
21
+ while version 2 has a brighter 'red' component.
22
+
23
+ Returns
24
+ -------
25
+ Colormap
26
+ """
27
+ if version == 1:
28
+ return plt.get_cmap(name="RdGy")
29
+ else:
30
+ _seismic_blwr_colors = [[1, 0, 0], [1, 1, 1], [0, 0, 0]]
31
+ _seismic_blwr_nodes = [0, 0.5019607843137255, 1.0]
32
+ return LinearSegmentedColormap.from_list("seismic_blwr", list(zip(_seismic_blwr_nodes, _seismic_blwr_colors)))
33
+
34
+ #: Seismic black-white-red colormap.
35
+ cm_blwr = seismic_blwr()
36
+
37
+ def seismic_blwr_r(version=1):
38
+ """
39
+ Reversed seismic black-white-red colormap.
40
+
41
+ Parameters
42
+ ----------
43
+ version : int, optional (default: 1)
44
+ Which version to return. Version 1 equals Matplotlib's standard 'RdGy',
45
+ while version 2 has a brighter 'red' component.
46
+
47
+ Returns
48
+ -------
49
+ Colormap
50
+ """
51
+ return seismic_blwr(version=version).reversed()
52
+
53
+ #: Reversed seismic black-white-red colormap.
54
+ cm_blwr_r = seismic_blwr_r()
55
+
56
+ def seismic_bwr():
57
+ """
58
+ Seismic blue-white-red colormap.
59
+
60
+ Returns
61
+ -------
62
+ Colormap
63
+ """
64
+ _seismic_bwr_colors = [[0, 0, 1], [1, 1, 1], [1, 0, 0]]
65
+ _seismic_bwr_nodes = [0, 0.5019607843137255, 1.0]
66
+ return LinearSegmentedColormap.from_list("seismic_bwr", list(zip(_seismic_bwr_nodes, _seismic_bwr_colors)))
67
+
68
+ #: Seismic blue-white-red colormap.
69
+ cm_bwr = seismic_bwr()
70
+
71
+ def seismic_bwr_r():
72
+ """
73
+ Reversed seismic blue-white-red colormap.
74
+
75
+ Returns
76
+ -------
77
+ Colormap
78
+ """
79
+ return seismic_bwr().reversed()
80
+
81
+ #: Reversed seismic blue-white-red colormap.
82
+ cm_bwr_r = seismic_bwr_r()
83
+
84
+ def bwr(alpha=0.5):
85
+ """
86
+ Blue-white-red colormap with optional transparency in the center.
87
+
88
+ Parameters
89
+ ----------
90
+ alpha : float, optional (default: 0.5)
91
+ Transparency (alpha) value between 0 and 1.
92
+
93
+ Returns
94
+ -------
95
+ Colormap
96
+ """
97
+ bwr_dict = {'red': ((0, 0, 0), (0.25, 0, 0), (0.5, 1, 1), (0.75, 0.8314, 0.8314), (1, 0.5, 0.5)),
98
+ 'green': ((0, 0, 0), (0.25, 0.375, 0.375), (0.5, 1, 1), (0.75, 0.375, 0.375), (1, 0, 0)),
99
+ 'blue': ((0, 0.5, 0.5), (0.25, 0.8314, 0.8314), (0.5, 1, 1), (0.75, 0, 0), (1, 0, 0)),
100
+ 'alpha': ((0, 1, 1), (0.5, alpha, alpha), (1, 1, 1)),}
101
+ return LinearSegmentedColormap("bwr", bwr_dict)
102
+
103
+ def bwr_r(alpha=0.5):
104
+ """
105
+ Reversed blue-white-red colormap with optional transparency in the center.
106
+
107
+ Parameters
108
+ ----------
109
+ alpha : float, optional (default: 0.5)
110
+ Transparency (alpha) value between 0 and 1.
111
+
112
+ Returns
113
+ -------
114
+ Colormap
115
+ """
116
+ return bwr(alpha=alpha).reversed()
117
+
118
+ def opendtect():
119
+ """
120
+ Seismic colormap similar to opendtect's default seismic colormap.
121
+
122
+ Returns
123
+ -------
124
+ Colormap
125
+ """
126
+ _opendtect_colors = [[0.0078431372549020, 0.0078431372549020, 0.01568627450980392],
127
+ [0.1960784313725490, 0.2823529411764706, 0.50588235294117640],
128
+ [0.9529411764705882, 0.9490196078431372, 0.93725490196078430],
129
+ [1.0000000000000000, 0.7764705882352941, 0.00000000000000000],
130
+ [0.9921568627450981, 0.1058823529411765, 0.00000000000000000],
131
+ [0.6823529411764706, 0.0078431372549020, 0.00000000000000000]]
132
+ _opendtect_nodes = [0, 0.13725490196078433, 0.5019607843137255, 0.7764705882352941, 0.9372549019607843, 1.0]
133
+ return LinearSegmentedColormap.from_list("opendtect", list(zip(_opendtect_nodes, _opendtect_colors)))
134
+
135
+ #: Seismic colormap similar to opendtect's default seismic colormap.
136
+ cm_odtect = opendtect()
137
+
138
+ def opendtect_r():
139
+ """
140
+ Reversed seismic colormap similar to opendtect's default seismic colormap.
141
+
142
+ Returns
143
+ -------
144
+ Colormap
145
+ """
146
+ return opendtect().reversed()
147
+
148
+ #: Reversed seismic colormap similar to opendtect's default seismic colormap.
149
+ cm_odtect_r = opendtect_r()
150
+
151
+ def seismic_clip():
152
+ """
153
+ Seismic colormap with clipped extreme values.
154
+
155
+ Returns
156
+ -------
157
+ Colormap
158
+ """
159
+ _seismic_clip_colors = [[0.2235294117647059, 0.803921568627451, 0.8509803921568627],
160
+ [0.0000000000000000, 0.000000000000000, 1.0000000000000000],
161
+ [1.0000000000000000, 1.000000000000000, 1.0000000000000000],
162
+ [1.0000000000000000, 0.000000000000000, 0.0000000000000000],
163
+ [0.9333333333333333, 0.800000000000000, 0.2313725490196079]]
164
+ _seismic_clip_nodes = [0, 0.00392156862745098, 0.5019607843137255, 0.996078431372549, 1.0]
165
+ return LinearSegmentedColormap.from_list("seismic_clip", list(zip(_seismic_clip_nodes, _seismic_clip_colors)))
166
+
167
+ #: Seismic colormap with clipped extreme values.
168
+ cm_clip = seismic_clip()
169
+
170
+ def seismic_clip_r():
171
+ """
172
+ Reversed seismic colormap with clipped extreme values.
173
+
174
+ Returns
175
+ -------
176
+ Colormap
177
+ """
178
+ return seismic_clip().reversed()
179
+
180
+ #: Reversed seismic colormap with clipped extreme values.
181
+ cm_clip_r = seismic_clip_r()
182
+
183
+ def banded():
184
+ """
185
+ Banded colormap.
186
+
187
+ Returns
188
+ -------
189
+ Colormap
190
+ """
191
+ _banded_colors = [[0.5372549019607843, 0.0, 0.7764705882352941],
192
+ [0.0, 0.0, 0.45098039215686275],
193
+ [0.0, 0.0, 1.0],
194
+ [0.0, 0.1607843137254902, 0.5333333333333333],
195
+ [0.0, 0.5803921568627451, 1.0],
196
+ [0.0, 0.3137254901960784, 0.37254901960784315],
197
+ [0.0, 1.0, 1.0],
198
+ [0.0, 0.3843137254901961, 0.2549019607843137],
199
+ [0.5019607843137255, 1.0, 0.5019607843137255],
200
+ [0.3411764705882353, 0.4666666666666667, 0.0],
201
+ [1.0, 1.0, 0.0],
202
+ [0.47058823529411764, 0.34901960784313724, 0.0],
203
+ [1.0, 0.5098039215686274, 0.0],
204
+ [0.48627450980392156, 0.13725490196078433, 0.0],
205
+ [1.0, 0.0, 0.0],
206
+ [0.5058823529411764, 0.0, 0.0],
207
+ [0.7294117647058823, 0.0, 0.0],
208
+ [0.2901960784313726, 0.0, 0.0],
209
+ [0.5019607843137255, 0.0, 0.0]]
210
+ _banded_nodes = [0.0, 0.054901960784313725, 0.10980392156862745,
211
+ 0.16862745098039217, 0.2235294117647059, 0.2784313725490196,
212
+ 0.3333333333333333, 0.38823529411764707, 0.44313725490196076,
213
+ 0.5019607843137255, 0.5568627450980392, 0.611764705882353,
214
+ 0.6666666666666666, 0.7215686274509804, 0.7803921568627451,
215
+ 0.8352941176470589, 0.8901960784313725, 0.9450980392156862, 1.0]
216
+ return LinearSegmentedColormap.from_list("banded", list(zip(_banded_nodes, _banded_colors)))
217
+
218
+ #: Banded colormap.
219
+ cm_banded = banded()
220
+
221
+ def banded_r():
222
+ """
223
+ Reversed banded colormap.
224
+
225
+ Returns
226
+ -------
227
+ Colormap
228
+ """
229
+ return banded().reversed()
230
+
231
+ #: Reverse banded colormap.
232
+ cm_banded_r = banded_r()
233
+
234
+ def spectrum():
235
+ """
236
+ Spectrum colormap.
237
+
238
+ Returns
239
+ -------
240
+ Colormap
241
+ """
242
+ _spectrum_colors = [[0.0, 0.5568627450980392, 1.0],
243
+ [0.0, 1.0, 1.0],
244
+ [1.0, 1.0, 0.0],
245
+ [1.0, 0.0, 0.0],
246
+ [0.5019607843137255, 0.0, 0.0]]
247
+ _spectrum_nodes = [0.0, 0.24313725490196078, 0.6274509803921569, 0.8784313725490196, 1.0]
248
+ return LinearSegmentedColormap.from_list("spectrum", list(zip(_spectrum_nodes, _spectrum_colors)))
249
+
250
+ #: Spectrum colormap.
251
+ cm_spec = spectrum()
252
+
253
+ def spectrum_r():
254
+ """
255
+ Reversed spectrum colormap.
256
+
257
+ Returns
258
+ -------
259
+ Colormap
260
+ """
261
+ return spectrum().reversed()
262
+
263
+ #: Reversed spectrum colormap.
264
+ cm_spec_r = spectrum_r()