holodeck.librarian.fit_spectra

Script and methods to fit simulated GWB spectra with analytic functions.

Usage

For usage information, run the script with the -h or --help arguments, i.e.:

python -m holodeck.librarian.fit_spectra -h

Typically, the only argument required is the path to the folder containing the combined library file (sam_lib.hdf5).

Notes

As a script, this submodule runs in parallel, with the main processor loading a holodeck library (from a single, combined HDF5 file), and distributes simulations to the secondary processors. The secondary processors then perform analytic fits to the GWB spectra. What functional forms are fit, and using how many frequency bins, is easily adjustable. Currently, the implemented functions are:

  • A power-law, with two parameters (amplitude and spectral index),

  • A power-law with turnover model, using four parameters: the normal amplitude and spectral index, in addition to a break frequency, and a spectral index below the break frequency.

A variety of numbers-of-frequency-bins are also fit, which are specified in the FITS_NBINS_PLAW and FITS_NBINS_TURN variables.

The methods used in this submodule are easily adaptable as API methods.

holodeck.librarian.fit_spectra.fit_all_libraries_in_path(path, log, pattern=None, recreate=False)[source]

Recursively find all sam_lib.hdf5 files in the given path, and construct spectra fits for them.

holodeck.librarian.fit_spectra.fit_library_spectra(library_path, log, recreate=False)[source]

Calculate analytic fits to library spectra using MPI.