Skip to content

Commit

Permalink
move iflag back.. may lower cov
Browse files Browse the repository at this point in the history
  • Loading branch information
niyiyu committed Feb 21, 2024
1 parent 0bc4220 commit 3e7033e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/noisepy/seis/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ def append_stacks(comp: str, tparameters: Dict[str, Any], stack_data: List[Tuple
stack_results.append(Stack(comp, name, tparameters, data))

# loop through cross-component for stacking
# iflag = 1
iflag = 1
for icomp in range(nccomp):
comp = enz_system[icomp]
indx = np.where(cc_comp.lower() == comp.lower())[0]
logger.debug(f"index to find the comp: {indx}")

# jump if there are not enough data
if len(indx) < 2:
# iflag = 0
iflag = 0
continue

# output stacked data
Expand Down Expand Up @@ -276,7 +276,7 @@ def append_stacks(comp: str, tparameters: Dict[str, Any], stack_data: List[Tuple
append_stacks(comp, tparameters, [(stack_name, cc_final[ii])])

# do rotation if needed
if fft_params.rotation:
if fft_params.rotation and iflag:
if np.all(bigstack == 0):
return stack_results
tparameters["station_source"] = src_sta.name
Expand Down
6 changes: 3 additions & 3 deletions tests/test_noise_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_taper(data: np.ndarray):
if data_taper.ndim == 1:
assert np.isclose(data_taper[0], 0)
assert np.isclose(data_taper[-1], 0)
elif data_taper.ndim == 2:
else:
assert np.isclose(np.linalg.norm(data_taper[:, 0]), 0)
assert np.isclose(np.linalg.norm(data_taper[:, -1]), 0)

Expand All @@ -23,7 +23,7 @@ def test_demean(data: np.ndarray):
data_demean = demean(data)
if data_demean.ndim == 1:
assert np.isclose(np.mean(data_demean), 0)
elif data_demean.ndim == 2:
else:
assert np.isclose(np.linalg.norm(np.mean(data_demean, axis=1)), 0)


Expand All @@ -32,7 +32,7 @@ def test_detrend(data: np.ndarray):
data_detrend = detrend(data)
if data_detrend.ndim == 1:
npts = data_detrend.shape[0]
elif data_detrend.ndim == 2:
else:
npts = data_detrend.shape[1]

X = np.ones((npts, 2))
Expand Down

0 comments on commit 3e7033e

Please sign in to comment.