You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
produce_Darendeli_curves() raises TypeError when called with its default strain_in_pct=None #87
Found while reviewing #74. Pre-existing on main (b764057); #74 does not change the behavior.
Problem
produce_Darendeli_curves() documents strain_in_pct=None as "use numpy.geomspace(1e-4, 10, 400)". It does build that array as gamma, but later it takes len(strain_in_pct) instead of len(gamma). With the default, that is len(None), which raises TypeError. The two callers in the package (produce_HH_G_param() and Damping_Calibration.get_damping_curves()) and the tests always pass strain_in_pct, so the default is never run.
importnumpyasnpimportPySeismoSoil.helper_hh_calibrationashhcsigma_v0=np.array([3000.0, 6000.0, 9000.0])
GGmax, xi, gamma_r=hhc.produce_Darendeli_curves(
sigma_v0, strain_in_pct=np.geomspace(1e-4, 10, 400)
)
print(GGmax.shape)
# (400, 3)hhc.produce_Darendeli_curves(sigma_v0) # default: strain_in_pct=None# TypeError: object of type 'NoneType' has no len()# (expected the same result as the call above)
Fix
Change line 1025 to n_strain_pts = len(gamma). With that change, produce_Darendeli_curves(sigma_v0) returns the same three arrays as produce_Darendeli_curves(sigma_v0, strain_in_pct=np.geomspace(1e-4, 10, 400)).
Add a test that calls produce_Darendeli_curves() without strain_in_pct and compares it with the explicit call.
Activity