-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored calculation of intensity measures into measures.py
- Loading branch information
Showing
6 changed files
with
197 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.5.26" | ||
__version__ = "0.5.27" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
import os | ||
import sys | ||
|
||
import numpy as np | ||
|
||
from eqsig import AccSignal | ||
|
||
PACKAGE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
|
||
sys.path.append(PACKAGE_DIR) | ||
TEST_DIR = os.path.dirname(__file__) | ||
OPENSEES_DATA_DIR = os.path.join(TEST_DIR, 'test_data/opensees_data/') | ||
TEST_DATA_DIR = os.path.join(TEST_DIR, 'unit_test_data/') | ||
TEST_DATA_DIR = os.path.join(TEST_DIR, 'unit_test_data/') | ||
|
||
|
||
def t_asig(): | ||
record_path = TEST_DATA_DIR | ||
record_filename = 'test_motion_dt0p01.txt' | ||
motion_step = 0.01 | ||
rec = np.loadtxt(record_path + record_filename) | ||
return AccSignal(rec, motion_step) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import numpy as np | ||
|
||
from eqsig import measures | ||
|
||
from tests import conftest | ||
|
||
|
||
def test_cavdp(): | ||
asig = conftest.t_asig() | ||
|
||
cav_dp = measures.calc_cav_dp(asig)[-1] | ||
|
||
# 0.810412819 from eqsig 0.5.26 tested with several motions | ||
assert np.isclose(cav_dp, 0.81041282, rtol=0.001), cav_dp |