def test_get_response_spectrum_2(self): """ """ rss = read_rs(os.path.join(DATA_DIR, '15279_V.txt')) tgt_02_rs, tgt_05_rs, _, _, _, tgt_30_rs = 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', pgm_frequency=150) cal_05_rs = acc.get_response_spectrum( periods, damping=0.05, gmt='acc', pgm_frequency=150) cal_30_rs = acc.get_response_spectrum( periods, damping=0.30, gmt='acc', pgm_frequency=150) labels, colors, widths = ['tgt', 'cal'], ['r', 'b'], [3, 1] fs1 = os.path.join(OUTPUT_DIR, 'recordings.accelerogram.get_response_spectrum.2.02.png') fs2 = os.path.join(OUTPUT_DIR, 'recordings.accelerogram.get_response_spectrum.2.05.png') fs3 = os.path.join(OUTPUT_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', filespec=fs1) plot_response_spectra([tgt_05_rs, cal_05_rs], labels=labels, colors=colors, widths=widths, unit='m/s2', filespec=fs2) plot_response_spectra([tgt_30_rs, cal_30_rs], labels=labels, colors=colors, widths=widths, unit='m/s2', filespec=fs3)
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)
def test_read_acc(self): """ """ acc = read_acc(os.path.join(DATA_DIR, '15279_V.cor.acc')) f_amplitudes = [ 1.1307000E-01, 3.2800000E-03, -9.9200000E-02, -8.7720000E-02, 6.8530000E-02, -1.6225000E-01, 3.4440000E-01, 1.1594000E-01, -1.3037000E-01, -1.1941000E-01, -3.3900000E-02, 6.7750000E-02, -5.1100000E-03, -1.2273000E-01, 7.1140000E-02, 5.9760000E-02, ] l_amplitudes = [ -4.2900000E-03, -2.1100000E-03, -3.0000000E-03, -2.8600000E-03, -3.8600000E-03, -3.2900000E-03, -3.6000000E-03, -3.3200000E-03, -3.6700000E-03, -4.2200000E-03, -4.3900000E-03, -4.2100000E-03, -4.2500000E-03, -4.2000000E-03, -4.2300000E-03, -4.2200000E-03, ] self.assertEqual(acc.time_delta, 0.02) self.assertListEqual(list(acc.amplitudes[:+16]), f_amplitudes) self.assertListEqual(list(acc.amplitudes[-16:]), l_amplitudes) self.assertEqual(acc.unit, 'm/s2')