fast_interpolate
Utilities for fast interpolation of spectra.
Functions¶
load_data ¶
Load HDF5 file.
Read data from an HDF5 file and use it for interpolation of the spectrum. The file must have the following data sets:
parameter_names
: array of strings giving the names of the parameters in order.
The last parameter must be the gravitational wave frequency f
.
Each parameter name: array giving start and step values.
spectrum
: array indexed by parameters in order, giving omega_GW for these parameters.
PARAMETER | DESCRIPTION |
---|---|
file |
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tuple(list[tuple[str, float, float]], NDArray)
|
Returns info: list of (name, start, step) and multidimensional array of data points |
Source code in src/ptarcade/fast_interpolate.py
interp ¶
Do interpolation.
Called with info: list of (start, step, value) and multidimensional array of data points. Multiple values (in an np.array) are OK for the last value, but not earlier ones or else we will get confusion about array indexes.
PARAMETER | DESCRIPTION |
---|---|
info |
list of (start, step, value) |
data |
Multidimensional array of data points. Multiple values (in an np.array) are OK for the last value, but not earlier ones or else we will get confusion about array indexes.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
NDArray
|
Interpolated values |
Source code in src/ptarcade/fast_interpolate.py
reformat ¶
Convert an old-style file to our HDF5 format.
PARAMETER | DESCRIPTION |
---|---|
infile |
The input file.
TYPE:
|
outfile |
The output file where the reformatted
TYPE:
|
RAISES | DESCRIPTION |
---|---|
Exception
|
Raised if frequency is not last parameter |
RETURNS | DESCRIPTION |
---|---|
None
|
No explicit return value. The function creates |
Notes¶
The old-style has a header giving the parameter names including spectrum
,
then on each line the parameter values and the resulting omega_GW. The
last parameter must vary fastest, and for each earlier parameter,
the later parameters must go through precisely the same values. The values
must be evenly spaced and in ascending order. There is no error checking
in this code!