Skip to content

Commit 1a80649

Browse files
committed
Add useful deleted comments back
1 parent 243c16e commit 1a80649

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/mdio/ingestion/segy/header_analysis.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def analyze_streamer_headers(
105105
cable_chan_min[idx] = np.min(current_cable)
106106
cable_chan_max[idx] = np.max(current_cable)
107107

108+
# Check channel numbers do not overlap for case B
108109
geom_type = StreamerShotGeometryType.B
109110

110111
for idx1, cable1 in enumerate(unique_cables):
@@ -120,6 +121,7 @@ def analyze_streamer_headers(
120121
max_val2 = cable_chan_max[idx2]
121122
cable2_range = (min_val2, max_val2)
122123

124+
# Check for overlap and return early with Type A
123125
if min_val2 < max_val1 and max_val2 > min_val1:
124126
geom_type = StreamerShotGeometryType.A
125127

@@ -161,6 +163,7 @@ def analyze_lines_for_guns(
161163
unique_guns_per_line = {}
162164

163165
geom_type = ShotGunGeometryType.B
166+
# Check shot numbers are still unique if div/num_guns
164167
for line_val in unique_lines:
165168
line_mask = index_headers[line_field] == line_val
166169
shot_current = index_headers["shot_point"][line_mask]
@@ -170,6 +173,7 @@ def analyze_lines_for_guns(
170173
num_guns = unique_guns_in_line.shape[0]
171174
unique_guns_per_line[str(line_val)] = list(unique_guns_in_line)
172175

176+
# Skip gemoetry detection if we arlready know it's Type A
173177
if geom_type == ShotGunGeometryType.A:
174178
continue
175179

@@ -182,11 +186,12 @@ def analyze_lines_for_guns(
182186
msg = "%s %s has %s shots; div by %s guns gives %s unique mod shots."
183187
logger.info(msg, line_field, line_val, num_shots, num_guns, len(np.unique(mod_shots)))
184188
geom_type = ShotGunGeometryType.A
185-
break
189+
break # No need to check more guns for this line
186190

187191
return unique_lines, unique_guns_per_line, geom_type
188192

189193

194+
# Backward-compatible aliases for existing code
190195
def analyze_saillines_for_guns(
191196
index_headers: HeaderArray,
192197
) -> tuple[NDArray, dict[str, list], ShotGunGeometryType]:
@@ -222,11 +227,14 @@ def create_trace_index(
222227
) -> NDArray | None:
223228
"""Update dictionary counter tree for counting trace key for auto index."""
224229
if depth == 0:
230+
# If there's no hierarchical depth, no tracing needed.
225231
return None
226232

233+
# Add index header
227234
trace_no_field = np.zeros(index_headers.shape, dtype=dtype)
228235
index_headers = rfn.append_fields(index_headers, "trace", trace_no_field, usemask=False)
229236

237+
# Extract the relevant columns upfront
230238
headers = [index_headers[name] for name in header_names[:depth]]
231239
for idx, idx_values in enumerate(zip(*headers, strict=True)):
232240
if depth == 1:
@@ -255,6 +263,7 @@ def analyze_non_indexed_headers(index_headers: HeaderArray, dtype: DTypeLike = n
255263
Returns:
256264
Dict container header name as key and numpy array of values as value
257265
"""
266+
# Find unique cable ids
258267
t_start = time.perf_counter()
259268
unique_headers = {}
260269
total_depth = 0

0 commit comments

Comments
 (0)