8. detections object

class enveloc.core.detections(detects=[])[source]

Bases: object

detections object. Contains different event_list objects as properties. This object allows for lists all events, clustered events, and unclustered events to exist all in one place and be modified using the same class methods.

filter(min_t=None, max_t=None, min_lat=None, max_lat=None, min_lon=None, max_lon=None, min_horizontal_scatter=None, max_horizontal_scatter=None, min_depth=None, max_depth=None, min_rd=None, max_rd=None, min_vertical_scatter=None, max_vertical_scatter=None, min_num_channels=None, max_num_channels=None)[source]

Filter each event_list in the detections object by location properties and return a new detections object with modified event_lists

Parameters:

self-explanatory (Mostly) –

cluster(dx=25, dt=None, num_events=4)[source]

Cluster locations in the ‘detections’ event_list using sklearn.cluster.DBSCAN()

Parameters:
  • dx (float, optional) – Maximum horizontal distance in km. Default = 25.0

  • dt (float, optional) – Maximum time difference between detections, in minutes. Default = None

  • num_events (int, optional) – Number of events required within dx and dt. Default = 4.

The method leaves the ‘detections’ event_list untouched, but adds additional event_list properties in place:

  • core_clustered - events who all meet the criteria

  • edge_clustered - events within dx & dt distance of core_clustered’ event, but don’t themselves have num_events within dx & dt of them

  • noise - events that don’t meet either criteria above

  • all_clustered - core_clustered + edge_clustered combined for convenience

uncluster()[source]

Method to remove all event lists not named ‘detections’. Operates in place.

remove(max_scatter=3.0, rm_nan_loc=True, rm_nan_err=True, inplace=False)[source]

Method to remove locations from the ‘detections’ event list. Returns a new copy.

Parameters:
  • max_scatter (float, optional) – maximum horizontal scatter allowed for a give locationDefault = 3.0

  • rm_nan_loc (bool, optional) – True will remove all locations with nan locations. Default = True

  • rm_nan_err (bool, optional) – True will remove all locations with nan horizontal_scatter (not appropriate if not bootstrapping to obtain horizontal_scatter, eg. bootstrap=1), Default = True

  • inplace (bool, optional) – True to operate in place. False to return a copy. Default = False

remove_duplicates(distance=25.0, inplace=False)[source]

Method to remove locations within a list that have identical starttimes

Parameters:
  • distance (float, optional) – maximum horizontal distance (km) below which the locations of events with identical starttimes are averaged. Default = 25.0.

  • inplace (bool, optional) – True to operate in place or False to return a copy. Default = False

plot_locations(XC)[source]

Method to plot the locations from each event_list

Parameters:

XC (XCOR object, required) – XCOR object used to create detections object