Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
DV_INJ_dict[i].loc[:,
(FG._ID, PG_ID, d_tag)] = INJ_i
# remove the useless columns from DV_INJ
for i in range(self._inj_lvls):
DV_INJ = DV_INJ_dict[i]
DV_INJ_dict[i] = DV_INJ.loc[:, (DV_INJ != 0.0).any(axis=0)]
# sort the columns to enable index slicing later
for i in range(self._inj_lvls):
DV_INJ_dict[i] = DV_INJ_dict[i].sort_index(axis=1, ascending=True)
return DV_INJ_dict
class HAZUS_Assessment(Assessment):
"""
An Assessment class that implements the damage and loss assessment method
following the HAZUS Technical Manual and the HAZUS software.
Parameters
----------
hazard: {'EQ', 'HU'}
Identifies the type of hazard. EQ corresponds to earthquake, HU
corresponds to hurricane.
default: 'EQ'.
inj_lvls: int
Defines the discretization used to describe the severity of injuries.
The HAZUS earthquake methodology uses 4 levels.
default: 4
"""
def __init__(self, hazard='EQ', inj_lvls = 4):
COV_mod = np.outer(sig_mod, sig_mod) * demand_RV.corr
else:
COV_mod = np.sqrt(demand_RV.COV**2. + self.beta_tot**2.)
# redefine the random variable
demand_RV = RandomVariable(
ID=200,
dimension_tags=demand_RV.dimension_tags,
distribution_kind=demand_RV.distribution_kind,
theta=demand_RV.theta,
COV=COV_mod)
return demand_RV
class FEMA_P58_Assessment(Assessment):
"""
An Assessment class that implements the loss assessment method in FEMA P58.
"""
def __init__(self, inj_lvls = 2):
super(FEMA_P58_Assessment, self).__init__()
# constants for the FEMA-P58 methodology
self._inj_lvls = inj_lvls
self._hazard = 'EQ'
self._assessment_type = 'P58'
def read_inputs(self, path_DL_input, path_EDP_input, verbose=False):
"""
Read and process the input files to describe the loss assessment task.
Parameters