pyatoa.utils.asdf.load

Functions for extracting information from a Pyasdf ASDFDataSet object

Module Contents

Functions

load_windows(ds, net, sta, iteration, step_count[, ...])

Returns misfit windows from an ASDFDataSet for a given iteration, step,

load_adjsrcs(ds, net, sta, iteration, step_count)

Load adjoint sources from a pyasdf ASDFDataSet and return in the format

dataset_windows_to_pyflex_windows(windows, network, ...)

Convert the parameter dictionary of an ASDFDataSet MisfitWindow into a

previous_windows(windows, iteration, step_count)

Given an iteration and step count, find windows from the previous step

pyatoa.utils.asdf.load.load_windows(ds, net, sta, iteration, step_count, return_previous=False)[source]

Returns misfit windows from an ASDFDataSet for a given iteration, step, network and station, as well as a count of windows returned.

If given iteration and step are not present in dataset (e.g. during line search, new step), will try to search the previous step, which may or may not be contained in the previous iteration.

Returns windows as Pyflex Window objects which can be used in Pyadjoint or in the Pyatoa workflow.

Note

Expects that windows are saved into the dataset at each iteration and step such that there is a coherent structure within the dataset

Parameters:
  • ds (pyasdf.ASDFDataSet) – ASDF dataset containing MisfitWindows subgroup

  • net (str) – network code used to find the name of the misfit window

  • sta (str) – station code used to find the name of the misfit window

  • iteration (int or str) – current iteration, will be formatted by the function

  • step_count (int or str) – step count, will be formatted by the function

  • return_previous (bool) – search the dataset for available windows from the previous iteration/step given the current iteration/step

Rtype window_dict:

dict

Return window_dict:

dictionary containing misfit windows, in a format expected by Pyatoa Manager class

pyatoa.utils.asdf.load.load_adjsrcs(ds, net, sta, iteration, step_count)[source]

Load adjoint sources from a pyasdf ASDFDataSet and return in the format expected by the Manager class, that is a dictionary of adjoint sources

Parameters:
  • ds (pyasdf.ASDFDataSet) – ASDF dataset containing MisfitWindows subgroup

  • net (str) – network code used to find the name of the adjoint source

  • sta (str) – station code used to find the name of the adjoint source

  • iteration (int or str) – current iteration, will be formatted by the function

  • step_count (int or str) – step count, will be formatted by the function

Return type:

dict

Returns:

dictionary containing adjoint sources, in a format expected by Pyatoa Manager class

pyatoa.utils.asdf.load.dataset_windows_to_pyflex_windows(windows, network, station)[source]

Convert the parameter dictionary of an ASDFDataSet MisfitWindow into a dictionary of Pyflex Window objects, in the same format as Manager.windows

Returns empty dict and 0 if no windows are found

Parameters:
  • windows (pyasdf.utils.AuxiliaryDataAccessor) – ds.auxiliary_data.MisfitWindows[iter][step]

  • network (str) – network of the station related to the windows

  • station (str) – station related to the windows

Return type:

dict

Returns:

dictionary of window attributes in the same format that Pyflex outputs

pyatoa.utils.asdf.load.previous_windows(windows, iteration, step_count)[source]

Given an iteration and step count, find windows from the previous step count. If none are found for the given iteration, return the most recently available windows.

Note

Assumes that windows are saved at each iteration.

Parameters:
  • windows (pyasdf.utils.AuxiliaryDataAccessor) – ds.auxiliary_data.MisfitWindows[iter][step]

  • iteration (int or str) – the current iteration

  • step_count (int or str) – the current step count

Return type:

pyasdf.utils.AuxiliaryDataAccessor

Returns:

ds.auxiliary_data.MisfitWindows