lal_cuda.SimIMRPhenomP module

This submodule handles all interaction with the LALSuite C API.

It provides a class for inputs and a class for outputs and functions for reading/writing/comparing them. The inputs method has a ‘run’ method for calling the C API.

lal_cuda.SimIMRPhenomP.to_string(inputs, outputs)[source]

Convert a paired set of inputs/outputs to an ASCII table.

Parameters:
  • inputs – An instance of the inputs class.
  • outputs – An associated instance of the outputs class.
Returns:

A list of strings.

lal_cuda.SimIMRPhenomP.to_binary(inputs, outputs, filename_label=None)[source]

Convert a paired set of inputs/outputs to binary files.

Parameters:
  • inputs – An instance of the inputs class.
  • outputs – An associated instance of the outputs class.
  • filename_label – An optional label for the output files.
Returns:

None

lal_cuda.SimIMRPhenomP.calc_frac_diff(x, y)[source]

Calculate the fractional difference between two numbers.

If the reference value is 0 and the value to check is not, returns 1.

Parameters:
  • x – Value to check
  • y – Reference value
Returns:

Value

lal_cuda.SimIMRPhenomP.calc_difference_from_reference(inputs, outputs, verbose=True)[source]

Look for a match between the given inputs and the stored reference inputs. If found return a dictionary with absolute differences from the given outputs, otherwise print a warning to stdout if verbose=True.

All reference inputs/outputs were computed by running the PhenomPCore script of this package against a version of LALSuite compiled from the commit with hash “3494e18e6d”.

Parameters:
  • inputs – An instance of the inputs class
  • outputs – An associated instance of the outputs class
  • verbose – Boolean controlling whether logging information is reported
Returns:

None

class lal_cuda.SimIMRPhenomP.outputs(return_from_SimIMRPhenomPFrequencySequence=None, hp=None, hc=None)[source]

Bases: object

This class manages the output (hp and hc complex arrays) from a LALSUite model call.

An instance can be created using the default constructor or the read() method. An instance can be written using the write() method. Equivalence of two instances is defined by the element-wise equivalence of their hp and hc arrays.

Create an instance of the outputs class. Optionally pass complex arrays hp and hc to initialize from.

Parameters:
  • return_from_SimIMRPhenomPFrequencySequence – The data structure returned from the LALSUite C API.
  • hp – Complex floating point array
  • hc – Complex floating point array
classmethod read(filename_datafile_in)[source]

Create an instance of the outputs class from a binary file.

Parameters:filename_datafile_in – Filename to read from.
Returns:An instance of the outputs class.
write(filename_outputs_out, filename_label=None, verbose=True)[source]

Write the instance of the output class to a binary file.

Parameters:
  • filename_outputs_out – Filename to write to.
  • filename_label – Filename modifier.
  • verbose – Boolean flag indicating whether to write activity to the log.
Returns:

None

class lal_cuda.SimIMRPhenomP.inputs(chi1=0.1, chi2=0.2, m1=30, m2=30, chip=0.34, thetaJ=1.1, alpha0=1.5, distance=1000, phic=1.2566370614359172, fref=30, mode=1, freqs=[20, 80, -1], freqs_from_range=True, convert_units=True)[source]

Bases: object

Create an instance of the inputs class, for a given set of model parameters.

Parameters:
  • chi1 – See LALSuite documentation for a description of this model parameter.
  • chi2 – See LALSuite documentation for a description of this model parameter.
  • m1 – See LALSuite documentation for a description of this model parameter.
  • m2 – See LALSuite documentation for a description of this model parameter.
  • chip – See LALSuite documentation for a description of this model parameter.
  • thetaJ – See LALSuite documentation for a description of this model parameter.
  • alpha0 – See LALSuite documentation for a description of this model parameter.
  • distance – See LALSuite documentation for a description of this model parameter.
  • phic – See LALSuite documentation for a description of this model parameter.
  • fref – See LALSuite documentation for a description of this model parameter.
  • mode – See LALSuite documentation for a description of this model parameter.
  • freqs – Frequency array (either an element-wise array, or a 3-element description of range)
  • freqs_from_range – Set to True if the freqs describes a range, rather than an element-wise array
  • convert_units
np_floats()[source]

A numpy array of all floating-point inputs.

Returns:A numpy array of floats.
np_ints()[source]

A numpy array of all integer inputs.

Returns:A numpy array of integers.
classmethod read(filename_datafile_in)[source]

Create an instance of a inputs method from a binary file.

Parameters:filename_datafile_in – Filename storing inputs.
Returns:A object of class inputs
write(filename_inputs_out, filename_label=None, verbose=True)[source]

Write an instance of an object of class inputs to a binary file.

Parameters:
  • filename_inputs_out – Filename to write to
  • filename_label – Filename modifier.
  • verbose – Boolean flag indicating whether to write activity to the log.
Returns:

run(buf=None, legacy=False)[source]

Call the C-compiled model in lalsuite.

If legacy is true, then assume that the compiled version of lalsuite we are using does not have PhenomP buffer support.

Parameters:
  • buf – A buffer, as generated by the ADACS version of LALSuite
  • legacy – True if using a version of LALSuite not compiled with the ADACS GPU buffer support
Returns:

An instance of the outputs class