def _make_hvsr(self, method, resampling, bandwidth, f_low=None, f_high=None, azimuth=None): if method in ["squared-average", "geometric-mean"]: ffts = self.transform() hor = self._combine_horizontal_fd(method=method, ew=ffts["ew"], ns=ffts["ns"]) ver = ffts["vt"] del ffts elif method == "single-azimuth": hor = self._combine_horizontal_td(method=method, azimuth=azimuth) hor = FourierTransform.from_timeseries(hor) ver = FourierTransform.from_timeseries(self.vt) else: msg = f"`method`={method} has not been implemented." raise NotImplementedError(msg) self.meta["method"] = method self.meta["azimuth"] = azimuth if resampling["res_type"] == "linear": frq = np.linspace(resampling["minf"], resampling["maxf"], resampling["nf"]) elif resampling["res_type"] == "log": frq = np.geomspace(resampling["minf"], resampling["maxf"], resampling["nf"]) else: msg = f"`res_type`={resampling['res_type']} has not been implemented." raise NotImplementedError(msg) hor.smooth_konno_ohmachi_fast(frq, bandwidth) ver.smooth_konno_ohmachi_fast(frq, bandwidth) hor._amp /= ver._amp hvsr = hor del ver if self.ns.nseries == 1: window_length = max(self.ns.time) else: window_length = max(self.ns.time[0]) self.meta["Window Length"] = window_length return Hvsr(hvsr.amplitude, hvsr.frequency, find_peaks=False, f_low=f_low, f_high=f_high, meta=self.meta)
def _make_hvsr(self, method, resampling, bandwidth, azimuth=None): if method in ["squared-average", "geometric-mean"]: ffts = self.transform() hor = self.combine_horizontals(method=method, horizontals=ffts) ver = ffts["vt"] del ffts elif method == "single-azimuth": hor = self.combine_horizontals(method=method, horizontals={"ew": self.ew, "ns": self.ns}, azimuth=azimuth) if isinstance(hor, WindowedTimeSeries): hor = FourierTransformSuite.from_timeseries(hor) ver = FourierTransformSuite.from_timeseries(self.vt) elif isinstance(hor, TimeSeries): hor = FourierTransform.from_timeseries(hor) ver = FourierTransform.from_timeseries(self.vt) else: raise NotImplementedError else: msg = f"`method`={method} has not been implemented." raise NotImplementedError(msg) self.meta["method"] = method self.meta["azimuth"] = azimuth if resampling["res_type"] == "linear": frq = np.linspace(resampling["minf"], resampling["maxf"], resampling["nf"]) elif resampling["res_type"] == "log": frq = np.geomspace(resampling["minf"], resampling["maxf"], resampling["nf"]) else: raise NotImplementedError hor.smooth_konno_ohmachi_fast(frq, bandwidth) ver.smooth_konno_ohmachi_fast(frq, bandwidth) hor.amp /= ver.amp hvsr = hor del ver if self.ns.n_windows == 1: window_length = max(self.ns.time) else: window_length = max(self.ns.time[0]) self.meta["Window Length"] = window_length return Hvsr(hvsr.amp, hvsr.frq, find_peaks=False, meta=self.meta)
def transform(self, **kwargs): """Perform Fourier transform on components. Returns ------- dict With `FourierTransform`-like objects, one for for each component, indicated by the key 'ew','ns', 'vt'. """ ffts = {} for attr in ["ew", "ns", "vt"]: tseries = getattr(self, attr) fft = FourierTransform.from_timeseries(tseries, **kwargs) ffts[attr] = fft return ffts
def transform(self, **kwargs): """Perform Fourier transform on components. Returns ------- dict With `FourierTransform`-like objects, one for for each component, indicated by the key 'ew','ns', 'vt'. """ ffts = {} for attr in ["ew", "ns", "vt"]: tseries = getattr(self, attr) if isinstance(tseries, WindowedTimeSeries): fft = FourierTransformSuite.from_timeseries(tseries, **kwargs) elif isinstance(tseries, TimeSeries): fft = FourierTransform.from_timeseries(tseries, **kwargs) else: raise NotImplementedError ffts[attr] = fft return ffts
def new_fseries(self): self.applied_smoothing = False self.applied_resampling = False self.fseries = FourierTransform.from_timeseries(self.tseries) self.update_fseries_plot()