# Write to file writer.writerow(headers) for row in self.data: row_dict = { 'Longitude': '%.5f' % row[0], 'Latitude': '%.5f' % row[1], 'Depth': '%.3f' % row[2], 'Observed Count': '%.5e' % row[3], 'Smoothed Rate': '%.5e' % row[4], 'b-value': '%.4f' % self.bval } writer.writerow(row_dict) fid.close() SMOOTHED_SEISMICITY_METHODS = CatalogueFunctionRegistry() @SMOOTHED_SEISMICITY_METHODS.add("run", completeness=True, b_value=np.float, use_3d=bool, grid_limits=Grid, Length_Limit=np.float, BandWidth=np.float, increment=bool) class IsotropicGaussianMethod(object): def run(self, catalogue, config, completeness=None): ss = SmoothedSeismicity(config['grid_limits'], config['use_3d'], config['b_value']) return ss.run_analysis(catalogue,
# -*- coding: utf-8 -*- """ """ import abc from hmtk.registry import CatalogueFunctionRegistry class SeismicityOccurrence(object): '''Implements recurrence calculations for instrumental seismicity''' __metaclass__ = abc.ABCMeta @abc.abstractmethod def calculate(self, catalogue, config, completeness=None): """Implements recurrence calculation :param catalogue: An instance of :class:`hmtk.seismicity.catalogue` :param dict config: The config contains the necessary information to run a specific algorithm. :param numpy.ndarray completeness: The completeness matrix """ return OCCURRENCE_METHODS = CatalogueFunctionRegistry()
Module :mod:`hmtk.parsers.catalogue.base` defines an abstract base class for :class:`CatalogueParser <BaseCatalogueDecluster>`. """ import abc from hmtk.registry import CatalogueFunctionRegistry class BaseCatalogueDecluster(object): """ Abstract base class for implementation of declustering algorithms """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def decluster(self, catalogue, config): """ Implements declustering algorithms :param catalogue: Catalogue of earthquakes :type catalogue: :param config: Declustering configuration dictionary :type config: Dictionary Returns two vectors """ return DECLUSTERER_METHODS = CatalogueFunctionRegistry()
# The GEM Foundation, and the authors of the software, assume no # liability for use of the software. """ Module :mod:'hmtk.seismicity.completeness.base' defines an abstract base class for :class:'CataloguCompleteness <BaseCatalogueCompleteness> """ import abc from hmtk.registry import CatalogueFunctionRegistry class BaseCatalogueCompleteness(object): ''' Abstract base class for implementation of the completeness algorithms ''' __metaclass__ = abc.ABCMeta @abc.abstractmethod def completeness(self, catalogue, config): ''' :param catalogue: Earthquake catalogue as instance of :class: hmtk.seismicity.catalogue.Catalogue :param dict config: Configuration parameters of the algorithm ''' return COMPLETENESS_METHODS = CatalogueFunctionRegistry()
return neq, mmin class BaseMaximumMagnitude(object): ''' Abstract base class for implementation of the maximum magnitude estimation based on instrumental/historical seismicity ''' __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_mmax(self, catalogue, config): ''' Analyses the catalogue to infer the maximum magnitude from a statistical process :param catalogue: Earthquake catalogue as instance of the :class: 'hmtk.seismicity.catalogue.Catalogue' :param dict config: Configuration parameters of the algorithm :returns: * Maximum magnitude (float) * Maximum magnitude uncertainty (float) ''' MAX_MAGNITUDE_METHODS = CatalogueFunctionRegistry()