def test_get_response_spectrum(self): """ """ acc = read_cor(os.path.join(DATA_DIR, '004676xa.cor'))[-1] acc = Accelerogram.from_seismogram(acc) periods = np.logspace(-2, 2, 200) cal_rdis_rs = acc.get_response_spectrum(periods, damping=0.05, gmt='dis') cal_rvel_rs = acc.get_response_spectrum(periods, damping=0.05, gmt='vel') cal_aacc_rs = acc.get_response_spectrum(periods, damping=0.05, gmt='acc') cal_pvel_rs = ResponseSpectrum(periods, cal_rdis_rs.responses * (2*np.pi/periods), unit='m/s', damping=0.05) tgt_rss = read_spc(os.path.join(DATA_DIR, '004676xa.spc'))[2] tgt_rdis_rs, tgt_rvel_rs, tgt_aacc_rs, tgt_pvel_rs = tgt_rss fs1 = os.path.join(FIG_DIR, 'response_spectrum_rdis.png') fs2 = os.path.join(FIG_DIR, 'response_spectrum_rvel.png') fs3 = os.path.join(FIG_DIR, 'response_spectrum_aacc.png') fs4 = os.path.join(FIG_DIR, 'response_spectrum_pvel.png') plot.response_spectra([tgt_rdis_rs, cal_rdis_rs], png_filespec=fs1) plot.response_spectra([tgt_rvel_rs, cal_rvel_rs], png_filespec=fs2) plot.response_spectra([tgt_aacc_rs, cal_aacc_rs], png_filespec=fs3) plot.response_spectra([tgt_pvel_rs, cal_pvel_rs], png_filespec=fs4)
def test_get_response_spectrum_1(self): """ """ tgt_rss = read_spc(os.path.join(DATA_DIR, '004676xa.spc'))[2] tgt_rdis_rs, tgt_rvel_rs, tgt_aacc_rs, tgt_pvel_rs = tgt_rss periods = tgt_rdis_rs.periods cal_rdis_rs = self.acc.get_response_spectrum(periods, damping=0.05, gmt='dis') cal_rvel_rs = self.acc.get_response_spectrum(periods, damping=0.05, gmt='vel') cal_aacc_rs = self.acc.get_response_spectrum(periods, damping=0.05, gmt='acc') cal_pvel_rs = ResponseSpectrum(periods, cal_rdis_rs.responses * (2*np.pi/periods), unit='m/s', damping=0.05) labels = ['tgt', 'cal'] colors = ['r', 'b'] widths = [2, 0.5] fs1 = os.path.join(FIG_DIR, 'recordings.accelerogram.get_response_spectrum.1.rdis.png') fs2 = os.path.join(FIG_DIR, 'recordings.accelerogram.get_response_spectrum.1.rvel.png') fs3 = os.path.join(FIG_DIR, 'recordings.accelerogram.get_response_spectrum.1.aacc.png') fs4 = os.path.join(FIG_DIR, 'recordings.accelerogram.get_response_spectrum.1.pvel.png') plot.response_spectra([tgt_rdis_rs, cal_rdis_rs], labels=labels, colors=colors, widths=widths, png_filespec=fs1) plot.response_spectra([tgt_rvel_rs, cal_rvel_rs], labels=labels, colors=colors, widths=widths, png_filespec=fs2) plot.response_spectra([tgt_aacc_rs, cal_aacc_rs], labels=labels, colors=colors, widths=widths, png_filespec=fs3) plot.response_spectra([tgt_pvel_rs, cal_pvel_rs], labels=labels, colors=colors, widths=widths, png_filespec=fs4)
def test_get_response_spectrum_2(self): """ """ tgt_rss = read_rs(os.path.join(DATA_DIR, '15279_V.txt')) tgt_02_rs, tgt_05_rs, tgt_07_rs, tgt_10_rs, tgt_20_rs, tgt_30_rs = tgt_rss periods = tgt_02_rs.periods acc = read_acc(os.path.join(DATA_DIR, '15279_V.cor.acc')) cal_02_rs = acc.get_response_spectrum(periods, damping=0.02, gmt='acc') cal_05_rs = acc.get_response_spectrum(periods, damping=0.05, gmt='acc') cal_30_rs = acc.get_response_spectrum(periods, damping=0.30, gmt='acc') labels = ['tgt', 'cal'] colors = ['r', 'b'] widths = [2, 0.5] fs1 = os.path.join(FIG_DIR, 'recordings.accelerogram.get_response_spectrum.2.02.png') fs2 = os.path.join(FIG_DIR, 'recordings.accelerogram.get_response_spectrum.2.05.png') fs3 = os.path.join(FIG_DIR, 'recordings.accelerogram.get_response_spectrum.2.30.png') plot.response_spectra([tgt_02_rs, cal_02_rs], labels=labels, colors=colors, widths=widths, unit='m/s2', png_filespec=fs1) plot.response_spectra([tgt_05_rs, cal_05_rs], labels=labels, colors=colors, widths=widths, unit='m/s2', png_filespec=fs2) plot.response_spectra([tgt_30_rs, cal_30_rs], labels=labels, colors=colors, widths=widths, unit='m/s2', png_filespec=fs3)