def get_gmroti50(fle): """ Retreive GMRotI50 from file (or calculate if not present) :param fle: Instance of :class: h5py.File """ periods = fle["IMS/X/Spectra/Response/Periods"].value periods = periods[periods > 0.] if not "H" in fle["IMS"].keys(): # Horizontal spectra not in record x_acc = ["Time Series/X/Original Record/Acceleration"] y_acc = ["Time Series/Y/Original Record/Acceleration"] sa_gmroti50 = ims.gmrotipp(x_acc.value, x_acc.attrs["Time-step"], y_acc.value, y_acc.attrs["Time-step"], periods, 50.0)[0] else: if "GMRotI50" in fle["IMS/H/Spectra/Response/Acceleration"].keys(): sa_gmroti50 =fle[ "IMS/H/Spectra/Response/Acceleration/GMRotI50/damping_05" ].value else: # Horizontal spectra not in record - calculate from time series x_acc = ["Time Series/X/Original Record/Acceleration"] y_acc = ["Time Series/Y/Original Record/Acceleration"] sa_gmroti50 = ims.gmrotipp(x_acc.value, x_acc.attrs["Time-step"], y_acc.value, y_acc.attrs["Time-step"], periods, 50.0) # Assumes Psuedo-spectral acceleration sa_gmroti50 = sa_gmroti50["PSA"] return sa_gmroti50
def add_data(self, percentile=50.0): """ :param float percentile: Percentile (pp) """ if len(self.periods) == 0: self.periods = self.fle["IMS/X/Spectra/Response/Periods"].value[1:] x_acc = self.fle["Time Series/X/Original Record/Acceleration"] y_acc = self.fle["Time Series/Y/Original Record/Acceleration"] sa_hor = ims.gmrotipp(x_acc.value, x_acc.attrs["Time-step"], y_acc.value, y_acc.attrs["Time-step"], self.periods, percentile, self.damping) nvals = len(sa_hor["Acceleration"]) dstring = "damping_" + str(int(100.0 * self.damping)).zfill(2) # Acceleration self._build_group("IMS/H/Spectra/Response", "Acceleration", "Acceleration", sa_hor, nvals, "cm/s/s", dstring) # Velocity self._build_group("IMS/H/Spectra/Response", "Velocity", "Velocity", sa_hor, nvals, "cm/s", dstring) # Displacement self._build_group("IMS/H/Spectra/Response", "Displacement", "Displacement", sa_hor, nvals, "cm", dstring) # Pseudo-Acceletaion self._build_group("IMS/H/Spectra/Response", "PSA", "Pseudo-Acceleration", sa_hor, nvals, "cm/s/s", dstring) # Pseudo-Velocity self._build_group("IMS/H/Spectra/Response", "PSV", "Pseudo-Velocity", sa_hor, nvals, "cm/s", dstring) self._add_periods()
def add_data(self, percentile=50.0): """ """ if len(self.periods) == 0: periods = self.fle["IMS/X/Spectra/Response/Periods"].value[1:] x_acc = self.fle["Time Series/X/Original Record/Acceleration"] y_acc = self.fle["Time Series/Y/Original Record/Acceleration"] sa_hor = ims.gmrotipp(x_acc.value, x_acc.attrs["Time-step"], y_acc.value, y_acc.attrs["Time-step"], periods, percentile, self.damping) nvals = len(sa_hor["Acceleration"]) dstring = "damping_" + str(int(100.0 * self.damping)).zfill(2) # Acceleration self._build_group("IMS/H/Spectra/Response", "Acceleration", "Acceleration", sa_hor, nvals, "cm/s/s", dstring) # Velocity self._build_group("IMS/H/Spectra/Response", "Velocity", "Velocity", sa_hor, nvals, "cm/s", dstring) # Displacement self._build_group("IMS/H/Spectra/Response", "Displacement", "Displacement", sa_hor, nvals, "cm", dstring) # Pseudo-Acceletaion self._build_group("IMS/H/Spectra/Response", "PSA", "Pseudo-Acceleration", sa_hor, nvals, "cm/s/s", dstring) # Pseudo-Velocity self._build_group("IMS/H/Spectra/Response", "PSV", "Pseudo-Velocity", sa_hor, nvals, "cm/s", dstring) self._add_periods(periods)
def test_gmroti50(self): # Tests the function to get GMRotI50 gmroti50 = ims.gmrotipp( self.fle["INPUTS/RECORD1/XRECORD"][:], self.fle["INPUTS/RECORD1/XRECORD"].attrs["timestep"], self.fle["INPUTS/RECORD1/YRECORD"][:], self.fle["INPUTS/RECORD1/YRECORD"].attrs["timestep"], self.periods, percentile=50.0, damping=0.05, units="cm/s/s", method="Nigam-Jennings") self._compare_sa_sets(gmroti50, "TEST1/GMRotI50/spectra")