Weights Component¶
In an inverse problem like full-waveform inversion, there is a problem of uneven distribution and quality of data. The weights component takes care of weighing your data up or down according to what is needed.
Contents:
-
class
lasif.components.weights.
WeightsComponent
(weights_folder, communicator, component_name)[source]¶ Component dealing with station and event weights.
- Parameters
weights_folder (pathlib.Path) – The folder with the weight toml files.
communicator – The communicator instance.
component_name – The name of this component for the communicator.
-
calculate_station_weight
(lat_1: float, lon_1: float, locations: numpy.ndarray)[source]¶ Calculates the weight set for a set of stations for one event
- Parameters
lat_1 (float) – latitude of station
lon_1 (float) – longitude of station
locations (numpy.ndarray) – array of latitudes and longitudes of other stations
- Returns
weight. weight for this specific station
- Return type
-
change_weight_set
(weight_set_name: str, weight_set: dict, events_dict: dict)[source]¶ Changes an existing weight set. Writes into a tempfile and if successful it will replace the old file with the tempfile.
-
create_folder_for_weight_set
(weight_set_name: str)[source]¶ Create the folder needed for weight set
- Parameters
weight_set_name (str) – name of weight set
-
get
(weight_set_name: str)[source]¶ Returns a weight_set object.
- Parameters
iteration_name (str) – The name of the iteration to retrieve.
-
get_filename_for_weight_set
(weight_set: str)[source]¶ Helper function returning the filename of a weight set.
- Parameters
weight_set (str) – Name of weight set
-
get_long_weight_set_name
(weight_set_name: str)[source]¶ Returns the long form of a weight set from its short name.
- Parameters
weight_set_name (str) – Name of weight set
-
get_weight_set_dict
()[source]¶ Returns a dictionary with the keys being the weight_set names and the values the weight_set filenames.