Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent keys used in BooreThompson class (pyrvt version 0.7.2) #3

Open
ahnielsen opened this issue Jul 23, 2021 · 0 comments
Open

Comments

@ahnielsen
Copy link

The event keys expected by function pyrvt.tools._calc_fa are 'magnitude', 'distance' and 'region' (from tools.py, line 141):

event_keys = ['magnitude', 'distance', 'region']

These keys become parameters when the BooreThompson class is initialized (peak_calculators.py, line 1040). However, the parameters expected by the BooreThompson class (and its two subclasses) are 'mag', 'dist' and 'region'. This inconsistency seems to generate the following error:

  File "C:\ProgramData\Anaconda3\lib\site-packages\pyrvt\tools.py", line 201, in calc_compatible_spectra
    results = pool.map(

  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()

  File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 771, in get
    raise self._value

TypeError: __init__() missing 2 required positional arguments: 'mag' and 'dist'

The following script should replicate the error:

import pyrvt
import numpy as np

if __name__ == '__main__':
	e = {}
	# Dummy spectral accelerations
	e['psa'] = np.array([0.1, 0.5, 0.7, 1.0, 0.8, 0.6, 0.6])
	# Dummy periods
	T = np.array([100, 2, 0.67, 0.2, 0.125, 0.1, 0.01])
	e['magnitude'] = 6
	e['distance'] = 30
	e['region'] = 'cena'
	e['duration'] = 10
	freqs = pyrvt.tools.calc_compatible_spectra('BT15', T, [e], damping=0.05)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant