def peak_index(curve): """Find index to the peak of the provided curve.""" curve = curve.reshape((1, curve.size)) pot_peak_indices, _ = Hvsr.find_peaks(curve) pot_peak_indices = pot_peak_indices[0] pot_peak_amp = curve[0, pot_peak_indices] pot_peak_index = np.argwhere(pot_peak_amp == np.max(pot_peak_amp))[0][0] return pot_peak_indices[pot_peak_index]
def mc_peak_frq(self, distribution='log-normal'): """Frequency of the peak of the mean H/V curve. Parameters ---------- distribution : {'normal', 'log-normal'}, optional Refer to :meth:`mean_curve <Hvsr.mean_curve>` for details. Returns ------- float Frequency associated with the peak of the mean H/V curve. """ mc = self.mean_curve(distribution) return float(self.frq[np.where(mc == np.max(mc[Hvsr.find_peaks(mc)[0]]))])
def mc_peak_amp(self, distribution='log-normal'): """Amplitude of the peak of the mean H/V curve. Parameters ---------- distribution : {'normal', 'log-normal'}, optional Refer to :meth:`mean_curve <Hvsr.mean_curve>` for details. Returns ------- float Amplitude associated with the peak of the mean H/V curve. """ mc = self.mean_curve(distribution) return np.max(mc[Hvsr.find_peaks(mc)[0]])
def mc_peak_frq(self, distribution='lognormal'): """Frequency of the peak of the mean HVSR curve. Parameters ---------- distribution : {'normal', 'lognormal'}, optional Refer to :meth:`mean_curve <Hvsr.mean_curve>` for details. Returns ------- float Frequency associated with the peak of the mean HVSR curve. """ mc = self.mean_curve(distribution) mc = mc.reshape((1, mc.size)) i_low, i_high = self.hvsrs[0].i_low, self.hvsrs[0].i_high return self.frq[i_low + int(np.where(mc[0, i_low:i_high] == np.max(mc[0, Hvsr.find_peaks(mc[:, i_low:i_high], starting_index=i_low)[0]]))[0])]
def mc_peak_amp(self, distribution='lognormal'): """Amplitude of the peak of the mean HVSR curve. Parameters ---------- distribution : {'normal', 'lognormal'}, optional Refer to :meth:`mean_curve <Hvsr.mean_curve>` for details. Returns ------- float Amplitude associated with the peak of the mean HVSR curve. """ mc = self.mean_curve(distribution) mc = mc.reshape((1, mc.size)) i_low, i_high = self.hvsrs[0].i_low, self.hvsrs[0].i_high return np.max(mc[0, Hvsr.find_peaks(mc[:, i_low:i_high], starting_index=i_low)[0]])
def peak_index(curve): """Find index to the peak of the provided curve.""" pot_peak_indices, _ = Hvsr.find_peaks(curve) pot_peak_amp = curve[pot_peak_indices] pot_peak_index = np.argwhere(pot_peak_amp == np.max(pot_peak_amp))[0][0] return pot_peak_indices[pot_peak_index]