csep.core.forecasts.CatalogForecast

class csep.core.forecasts.CatalogForecast(filename=None, catalogs=None, name=None, filter_spatial=False, filters=None, apply_mct=False, region=None, expected_rates=None, start_time=None, end_time=None, n_cat=None, event=None, loader=None, catalog_type='ascii', catalog_format='native', store=True, apply_filters=False)[source]

Catalog based forecast defined as a family of stochastic event sets.

__init__(filename=None, catalogs=None, name=None, filter_spatial=False, filters=None, apply_mct=False, region=None, expected_rates=None, start_time=None, end_time=None, n_cat=None, event=None, loader=None, catalog_type='ascii', catalog_format='native', store=True, apply_filters=False)[source]

The region information can be provided along side the data, if they are stored in one of the supported file formats. It is assumed that the region for each data is identical. If the regions are not provided with the data files, they must be provided explicitly. The california testing region can be loaded using csep.utils.spatial.california_relm_region().

There are a few different ways this class can be constructed, each

The region is not required to load a forecast or to perform basic operations on a forecast, such as counting events. Any binning of events in space or magnitude will require a spatial region or magnitude bin definitions, respectively.

Parameters:
  • filename (str) – Path to the file or directory containing the forecast.

  • catalogs – iterable of csep.core.catalogs.AbstractBaseCatalog

  • filter_spatial (bool) – if true, will filter to area defined in space region

  • apply_mct (bool) – this should be provided if a time-dependent magnitude completeness model should be applied to the forecast

  • filters (iterable) – list of data filter strings. these override the filter_magnitude and filter_time arguments

  • regioncsep.core.spatial.CartesianGrid2D including magnitude bins

  • start_time (datetime.datetime) – start time of the forecast

  • end_time (datetime.datetime) – end time of the forecast

  • name (str) – name of the forecast, will be used for defaults in plotting and other places

  • n_cat (int) – number of catalogs in the forecast

  • event (csep.models.Event) – if the forecast is associated with a particular event

  • store (bool) – if true, will store catalogs on object in memory. this should only be made false if working with very large forecast files that cannot be stored in memory

  • apply_filters (bool) – if true, filters will be applied automatically to the catalogs as the forecast is iterated through

Methods

__init__([filename, catalogs, name, ...])

The region information can be provided along side the data, if they are stored in one of the supported file formats.

get_dataframe()

Return a single dataframe with all of the events from all of the catalogs.

get_event_counts([verbose])

Returns a numpy array containing the number of event counts for each catalog.

get_expected_rates([verbose])

Compute the expected rates in space-magnitude bins

load_ascii(fname, **kwargs)

Loads ASCII format for data forecast.

magnitude_counts()

Returns expected magnitude counts from forecast

plot([plot_args, verbose])

spatial_counts([cartesian])

Returns the expected spatial counts from forecast

write_ascii(fname[, header, loader])

Writes data forecast to ASCII format

Attributes

end_epoch

log

magnitudes

Returns left bin-edges of magnitude bins

min_magnitude

Returns smallest magnitude bin edge of forecast

start_epoch