Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to AC temp normalization (previously not applied under certain conditions) #266

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
7 changes: 4 additions & 3 deletions msnoise/move2obspy.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ def mwcs(current, reference, freqmin, freqmax, df, tmin, window_length, step,
time_axis = []

window_length_samples = np.int(window_length * df)
step_samples = int(step * df)
# try:
# from sf.helper import next_fast_len
# except ImportError:
Expand All @@ -439,8 +440,8 @@ def mwcs(current, reference, freqmin, freqmax, df, tmin, window_length, step,
cri = scipy.signal.detrend(cri, type='linear')
cri *= tp

minind += int(step * df)
maxind += int(step * df)
minind += step_samples
maxind += step_samples

fcur = sf.fft(cci, n=padd)[:padd // 2]
fref = sf.fft(cri, n=padd)[:padd // 2]
Expand Down Expand Up @@ -502,7 +503,7 @@ def mwcs(current, reference, freqmin, freqmax, df, tmin, window_length, step,

delta_err.append(e)
delta_mcoh.append(np.real(mcoh))
time_axis.append(tmin + window_length / 2. + count * step)
time_axis.append(tmin + window_length / 2. + count * (step_samples/df))
count += 1

del fcur, fref
Expand Down
6 changes: 3 additions & 3 deletions msnoise/s03compute_no_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,9 @@ def main(loglevel="INFO"):
freqmax=filterhigh,
df=params.goal_sampling_rate,
corners=8)
if params.clip_after_whiten:
logger.debug("Winsorizing (clipping) data after bandpass (AC)")
tmp[i] = winsorizing(tmp[i], params, input="timeseries")
if params.clip_after_whiten:
logger.debug("Winsorizing (clipping) data after bandpass (AC)")
tmp = winsorizing(tmp, params, input="timeseries")


if params.cc_type_single_station_AC == "CC":
Expand Down
4 changes: 3 additions & 1 deletion msnoise/stretch.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def main():
ref_name = pair.replace(':', '_')
station1, station2 = pair.split(":")

s1 = get_station(db, station1.split('.')[0], station1.split('.')[1])
s2 = get_station(db, station2.split('.')[0], station2.split('.')[1])

dtt_lag = get_config(db, "dtt_lag")
dtt_v = float(get_config(db, "dtt_v"))
Expand All @@ -115,7 +117,7 @@ def main():
if dtt_lag == "static":
minlag = dtt_minlag
else:
minlag = get_interstation_distance(station1, station2, station1.coordinates) / dtt_v
minlag = get_interstation_distance(s1, s2, s1.coordinates) / dtt_v

maxlag2 = minlag + dtt_width
print("betweeen", minlag, "and", maxlag2)
Expand Down