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

bugfixes and new 3.3.2 patch #43

Merged
merged 5 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pelicun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

name = "pelicun"

__version__ = '3.3.1'
__version__ = '3.3.2'

__copyright__ = ("Copyright (c) 2018 Leland Stanford "
"Junior University and The Regents "
Expand Down
20 changes: 20 additions & 0 deletions pelicun/resources/auto/Hazus_Earthquake_IM.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ def auto_populate(AIM):
"MapApproach": "Automatic",
}
},
"Options": {
"NonDirectionalMultipliers": {
"ALL": 1.0
},
}
}

elif assetType == "TransportationNetwork":
Expand Down Expand Up @@ -441,6 +446,11 @@ def auto_populate(AIM):
"MapApproach": "Automatic",
}
},
"Options": {
"NonDirectionalMultipliers": {
"ALL": 1.0
},
}
}

elif inf_type == "HwyTunnel":
Expand Down Expand Up @@ -471,6 +481,11 @@ def auto_populate(AIM):
"MapApproach": "Automatic",
}
},
"Options": {
"NonDirectionalMultipliers": {
"ALL": 1.0
},
}
}
elif inf_type == "Roadway":
# get the road class
Expand Down Expand Up @@ -499,6 +514,11 @@ def auto_populate(AIM):
"MapApproach": "Automatic",
}
},
"Options": {
"NonDirectionalMultipliers": {
"ALL": 1.0
},
}
}
else:
print("subtype not supported in HWY")
Expand Down
5 changes: 5 additions & 0 deletions pelicun/resources/auto/Hazus_Earthquake_Story.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ def auto_populate(AIM):
"Damage": {"DamageProcess": "Hazus Earthquake"},
"Demands": {},
"Losses": {"Repair": repair_config},
"Options": {
"NonDirectionalMultipliers": {
"ALL": 1.0
},
}
}

else:
Expand Down
86 changes: 44 additions & 42 deletions pelicun/uq.py
Original file line number Diff line number Diff line change
Expand Up @@ -1245,9 +1245,9 @@ def __init__(

"""
super().__init__(
name,
f_map,
anchor,
name=name,
f_map=f_map,
anchor=anchor,
)

@abstractmethod
Expand Down Expand Up @@ -1281,9 +1281,7 @@ class SampleSizeRandomVariable(BaseRandomVariable):
@abstractmethod
def __init__(
self,
name,
theta,
truncation_limits=np.array((np.nan, np.nan)),
name,
f_map=None,
anchor=None,
):
Expand All @@ -1293,15 +1291,7 @@ def __init__(
Parameters
----------
name: string
A unique string that identifies the random variable.
theta: 2-element float ndarray
Set of parameters that define the Cumulative Distribution
Function (CDF) of the variable: Mean, coefficient of
variation.
truncation_limits: float ndarray, optional
Defines the np.array((a, b)) truncation limits for the
distribution. Use np.nan to assign no limit in one direction,
like so: np.array((a, np.nan)), or np.array((np.nan, b)).
A unique string that identifies the random variable.
f_map: function, optional
A user-defined function that is applied on the realizations before
returning a sample.
Expand All @@ -1313,9 +1303,9 @@ def __init__(

"""
super().__init__(
name,
f_map,
anchor,
name=name,
f_map=f_map,
anchor=anchor,
)

@abstractmethod
Expand Down Expand Up @@ -1349,9 +1339,11 @@ def __init__(
anchor=None,
):
super().__init__(
name,
f_map,
anchor,
name=name,
theta=theta,
truncation_limits=truncation_limits,
f_map=f_map,
anchor=anchor,
)
self.distribution = 'normal'
self.theta = np.atleast_1d(theta)
Expand Down Expand Up @@ -1469,9 +1461,11 @@ def __init__(
anchor=None,
):
super().__init__(
name,
f_map,
anchor,
name=name,
theta=theta,
truncation_limits=truncation_limits,
f_map=f_map,
anchor=anchor,
)
self.distribution = 'lognormal'
self.theta = np.atleast_1d(theta)
Expand Down Expand Up @@ -1583,9 +1577,11 @@ def __init__(
anchor=None,
):
super().__init__(
name,
f_map,
anchor,
name=name,
theta=theta,
truncation_limits=truncation_limits,
f_map=f_map,
anchor=anchor,
)
self.distribution = 'uniform'
self.theta = np.atleast_1d(theta)
Expand Down Expand Up @@ -1670,9 +1666,11 @@ def __init__(
anchor=None,
):
super().__init__(
name,
f_map,
anchor,
name=name,
theta=theta,
truncation_limits=truncation_limits,
f_map=f_map,
anchor=anchor,
)
self.distribution = 'multilinear_CDF'

Expand Down Expand Up @@ -1791,9 +1789,11 @@ def __init__(
anchor=None,
):
super().__init__(
name,
f_map,
anchor,
name=name,
theta=raw_samples,
truncation_limits=truncation_limits,
f_map=f_map,
anchor=anchor,
)
self.distribution = 'empirical'
if not np.all(np.isnan(truncation_limits)):
Expand Down Expand Up @@ -1871,9 +1871,9 @@ def __init__(

"""
super().__init__(
name,
f_map,
anchor,
name=name,
f_map=f_map,
anchor=anchor,
)
self.distribution = 'coupled_empirical'
if not np.all(np.isnan(truncation_limits)):
Expand Down Expand Up @@ -1957,9 +1957,9 @@ def __init__(

"""
super().__init__(
name,
f_map,
anchor,
name=name,
f_map=f_map,
anchor=anchor,
)
self.distribution = 'deterministic'
if not np.all(np.isnan(truncation_limits)):
Expand Down Expand Up @@ -2004,9 +2004,11 @@ def __init__(
anchor=None,
):
super().__init__(
name,
f_map,
anchor,
name=name,
theta=theta,
truncation_limits=truncation_limits,
f_map=f_map,
anchor=anchor,
)
if not np.all(np.isnan(truncation_limits)):
raise NotImplementedError(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def read(*filenames, **kwargs):
'numpy>=1.22.0, <2.0',
'scipy>=1.7.0, <2.0',
'pandas>=1.4.0, <3.0',
'tables>=3.7.0',
#'tables>=3.7.0',
],
classifiers=[
'Programming Language :: Python',
Expand Down
Loading