Skip to content

Commit

Permalink
ssp_correction: catch ValueError when correcting spectra
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiodsf committed Jan 27, 2025
1 parent 19a8d71 commit d4a62d4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sourcespec/ssp_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ def station_correction(spec_st, config):
spec_corr = spec.copy()
# uncorrected spectrum will have component name 'h'
spec.stats.channel = f'{spec.stats.channel[:-1]}h'
spec_corr.data_mag -= corr.data_mag
try:
spec_corr.data_mag -= corr.data_mag
except ValueError as msg:
logger.error(
f'Cannot correct spectrum {spec.id}: {msg}')
continue
# interpolate the corrected data_mag to logspaced frequencies
f = interp1d(freq, spec_corr.data_mag, fill_value='extrapolate')
spec_corr.data_mag_logspaced = f(spec_corr.freq_logspaced)
Expand Down

0 comments on commit d4a62d4

Please sign in to comment.