Skip to content

Commit

Permalink
Reformatted.
Browse files Browse the repository at this point in the history
  • Loading branch information
arkottke committed Feb 7, 2024
1 parent 35acff6 commit b53b2e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
1 change: 0 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pathlib


Expand Down
22 changes: 7 additions & 15 deletions tests/test_peak_calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import numpy as np
import pyexcel
import pyrvt
import pystrata
import pytest
from numpy.testing import assert_allclose, assert_string_equal

import pyrvt
from numpy.testing import assert_allclose
from numpy.testing import assert_string_equal

from . import readers

Expand Down Expand Up @@ -41,12 +41,8 @@
],
)
def test_osc_accels(peak_calculator, abbrev, suffix):
fs = readers.load_fourier_spectrum(
str(fpath_data / f"test-{abbrev}.{suffix}_fs.col")
)
rs = readers.load_rvt_response_spectrum(
str(fpath_data / f"test-{abbrev}.{suffix}_rs.rv.col")
)
fs = readers.load_fourier_spectrum(str(fpath_data / f"test-{abbrev}.{suffix}_fs.col"))
rs = readers.load_rvt_response_spectrum(str(fpath_data / f"test-{abbrev}.{suffix}_rs.rv.col"))

rvt_motion = pyrvt.motions.RvtMotion(
freqs=fs["freqs"],
Expand Down Expand Up @@ -74,9 +70,7 @@ def test_abbrev(bj84_pc):
assert_string_equal(bj84_pc.ABBREV, "BJ84")


@pytest.mark.parametrize(
"method", ["V75", "D64", "DK85", "TM87", "BT12", "BT15", "WR18"]
)
@pytest.mark.parametrize("method", ["V75", "D64", "DK85", "TM87", "BT12", "BT15", "WR18"])
def test_formulations(method):
mag = 6.5
dist = 20
Expand Down Expand Up @@ -118,9 +112,7 @@ def read_wang_rathje_18_data(motion_id):
ws = wb[sheetname]
osc_freq = np.array(ws.column[0][2:303])
spec_acc = np.array(ws.column[1 + motion_id][2:303])
expected[key] = np.rec.fromarrays(
[osc_freq, spec_acc], names="osc_freq,spec_acc"
)
expected[key] = np.rec.fromarrays([osc_freq, spec_acc], names="osc_freq,spec_acc")

return motion, expected

Expand Down
7 changes: 2 additions & 5 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
import shutil
import tempfile

import pyrvt
import pytest
from numpy.testing import assert_allclose

import pyrvt

from . import make_relpath

exts = [".csv", ".xls", ".xlsx", ".ods"]
Expand Down Expand Up @@ -274,9 +273,7 @@ def test_calc_compatible_spectra():
src_fname = os.path.join(os.path.dirname(__file__), "data", "test_sa.csv")
ext, periods, events = pyrvt.tools.read_events(src_fname, "psa")

freqs, events_mod = pyrvt.tools.calc_compatible_spectra(
"LP99", periods, events[:1], 0.05
)
freqs, events_mod = pyrvt.tools.calc_compatible_spectra("LP99", periods, events[:1], 0.05)

# Test that the fit is within 2% of the target
assert_allclose(events[0]["psa"], events_mod[0]["psa_calc"], rtol=0.02)
Expand Down

0 comments on commit b53b2e9

Please sign in to comment.