7. event_list object

class enveloc.core.event_list(events=[])[source]

Bases: object

Define an events object, which is a list of location objects

get_lats()[source]

Return numpy array of all location latitudes in the list

get_lons()[source]

Return numpy array of all location longitudes in the list

get_depths()[source]

Return numpy array of all location depths in the list

get_times()[source]

Return two numpy arrays of all location window start and end times in the list

get_reduced_displacement()[source]

Return all location reduced displacements in the events list as a numpy array

get_numchannels()[source]

Returns a numpy array of number of channels used in each location

get_stations()[source]

Return a list of all stations used in all locations in event list

tolist()[source]

returns the attribute events as a list

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, highpass_loc=None, inplace=False)[source]

Filter this event list by location properties and return a new event list object

Parameters:

self-explanatory (Mostly) –

calc_reduced_displacement(st, XC, num_processors=1)[source]

Method to calculate a reduced displacement for all locations in the events list. The method updates the reduced_displacement property in each location object. XCOR can also do this internally while generating a location, but the idea with this method is to apply the calculation after obtaining all initial locations and throwing out bad locations via clustering or maximum horizontal scatter. That way you are not spending computation time for events you will never use.

Parameters:
  • st (stream, required) – Obspy stream of envelopes. Each trace must have stats.coordinates.latitude/longitude

  • XC (XCOR object, required) – XCOR object used to obtain locations within the event list

  • num_processors (int, optional) – Optional integer to parallelize when set >1, but this doesn’t appear to be faster. Default = 1.

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

Method to remove locations from the 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_highpass(inplace=False)[source]

Method to remove locations that also have a location with a highpass filter

Parameters:

inplace (bool, optional) – True to operate in place or 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

cluster(dx=10, dt=60, num_events=4)[source]

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

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

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

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

The method returns a core.detections object, which contains various different lists as attributes:

  • detections - events from original event list

  • 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

plot_locations(XC)[source]

Method to plot the locations for this event_list

Parameters:

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

copy()[source]

Return a copy of the events object