def quarter_wavelength_average(self): """ Compute quarter-wavelength parameters (velocity and density) and store them into the site database. """ self._check_frequency() for mod in self.model: # Compute average velocity qwl_par = _avg.quarter_wavelength_average(mod.geo['hl'], mod.geo['vs'], mod.geo['dn'], self.freq) mod.eng['qwl'] = {} mod.eng['qwl']['z'] = _ut.a_round(qwl_par[0], DECIMALS) mod.eng['qwl']['vs'] = _ut.a_round(qwl_par[1], DECIMALS) mod.eng['qwl']['dn'] = _ut.a_round(qwl_par[2], DECIMALS) # Perform statistics (log-normal) self.mean.eng['qwl'] = {} for key in ['z', 'vs', 'dn']: data = [mod.eng['qwl'][key] for mod in self.model] mn, sd = _ut.log_stat(data) self.mean.eng['qwl'][key] = (_ut.a_round(mn, DECIMALS), _ut.a_round(sd, DECIMALS))
def traveltime_velocity(self, depth=30.): """ Compute and store travel-time average velocity at a given depth. Multiple depths are also allowed (as list). Default is Vs30. :param float or list depth: calculation depth """ if not isinstance(depth, list): depth = [depth] for mod in self.model: mod.eng['vsz'] = {} for z in depth: vz = _avg.traveltime_velocity(mod.geo['hl'], mod.geo['vs'], depth=z) mod.eng['vsz'][z] = _ut.a_round(vz, DECIMALS) # Perform statistics (log-normal) self.mean.eng['vsz'] = {} for z in depth: data = [mod.eng['vsz'][z] for mod in self.model] mn, sd = _ut.log_stat(data) self.mean.eng['vsz'][z] = (_ut.a_round(mn, DECIMALS), _ut.a_round(sd, DECIMALS))
def attenuation_decay(self): """ Compute the frequency-dependent attenuation function for a given site Kappa (0). """ self._check_frequency() for mod in self.model: # Compute attenuation decay att_fun = _amp.attenuation_decay(self.freq, mod.eng['kappa']) mod.amp['kappa'] = _ut.a_round(att_fun, DECIMALS) # Perform statistics (log-normal) data = [mod.amp['kappa'] for mod in self.model] mn, sd = _ut.log_stat(data) self.mean.amp['kappa'] = (_ut.a_round(mn, DECIMALS), _ut.a_round(sd, DECIMALS))
def quarter_wavelength_amplification(self, vs_ref=[], dn_ref=[], inc_ang=0.): """ Compute the amplification as impedance contrast of quarter-wavelength parameters. Aribitrary reference can be provided, otherwise the last layer of the model is used. Angle of incidence is optional. :param float or numpy.array ref_vs: lowermost (reference) shear-wave velocity in m/s :param float or numpy.array ref_dn: lowermost (reference) density in kg/m3 :param float inc_ang: angle of incidence in degrees, relative to the vertical (default is vertical incidence) """ for mod in self.model: if _ut.is_empty(vs_ref): vs_ref = mod.geo['vs'][-1] if _ut.is_empty(dn_ref): dn_ref = mod.geo['dn'][-1] qwl_amp = _amp.impedance_amplification(mod.eng['qwl']['vs'], mod.eng['qwl']['dn'], vs_ref, dn_ref, inc_ang) mod.amp['qwl'] = _ut.a_round(qwl_amp, DECIMALS) # Perform statistics (log-normal) data = [mod.amp['qwl'] for mod in self.model] mn, sd = _ut.log_stat(data) self.mean.amp['qwl'] = (_ut.a_round(mn, DECIMALS), _ut.a_round(sd, DECIMALS))
def compute_site_kappa(self, depth=[]): """ Compute the Kappa parameter directly from the site model using harmonic averaging. Caculation depth can be speficied, otherwise the depth of the last layer interface is used. :param float depth: averaging depth in meters (optional) """ for mod in self.model: # Compute kappa attenuation kappa = _avg.compute_site_kappa(mod.geo['hl'], mod.geo['vs'], mod.geo['qs'], depth) mod.eng['kappa'] = _ut.a_round(kappa, DECIMALS) # Perform statistics (normal) data = [mod.eng['kappa'] for mod in self.model] mn, sd = _ut.lin_stat(data) self.mean.eng['kappa'] = (_ut.a_round(mn, DECIMALS), _ut.a_round(sd, DECIMALS))