Skip to content

Commit

Permalink
Minor update to test_damage_model.py
Browse files Browse the repository at this point in the history
- Streamline part of the new test for capacity scaling
  • Loading branch information
zsarnoczay authored Nov 27, 2024
1 parent a94dd44 commit 4d40b4a
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions pelicun/tests/basic/test_damage_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,7 @@ def test__create_dmg_RVs(self, assessment_instance: Assessment) -> None:
)

# Validate the scaling of the random variables are correct
# Use the midpoint method to generate samples for validating that
# theta_0 is scaled correctly
# Generate samples for validating that theta_0 is scaled correctly
capacity_rv_reg.generate_sample(
sample_size=len(operation_list), method='LHS'
)
Expand All @@ -593,19 +592,13 @@ def test__create_dmg_RVs(self, assessment_instance: Assessment) -> None:
uniform_sample = rv._uni_sample
sample = rv.sample
for i in range(len(operation_list)):
# test for cmp.A
if rv_name == 'FRG-cmp.A-1-2-3-1-1':
theta = 1.20 * 30.0
beta = 0.5
assert sample[i] == np.exp(
norm.ppf(uniform_sample[i], loc=np.log(theta), scale=beta)
)
elif rv_name == 'FRG-cmp.B-1-2-3-1-1':
theta = cmp_b_scaled_theta0[i]
beta = 0.5
assert sample[i] == np.exp(
norm.ppf(uniform_sample[i], loc=np.log(theta), scale=beta)
)
assert sample[i] == np.exp(
norm.ppf(uniform_sample[i], loc=np.log(theta), scale=0.5)
)

def test__evaluate_damage_state(self, assessment_instance: Assessment) -> None:
# We define a single component with 3 limit states.
Expand Down

0 comments on commit 4d40b4a

Please sign in to comment.