ligo.em_bright.em_bright

Module containing tools for EM-Bright classification of compact binaries using trained supervised classifier

ligo.em_bright.em_bright.mchirp(mass_1, mass_2)[source]
ligo.em_bright.em_bright.q(mass_1, mass_2)[source]
ligo.em_bright.em_bright.source_classification(mass_1, mass_2, chi1, chi2, snr, ns_classifier=None, emb_classifier=None, massgap_classifier=None)[source]

Computes HasNS, HasRemnant, and MassGap probabilities from point mass, spin and signal to noise ratio estimates.

Parameters:
  • mass_1 (float) – primary mass

  • mass_2 (float) – secondary mass

  • chi1 (float) – dimensionless primary spin

  • chi2 (float) – dimensionless secondary spin

  • snr (float) – signal to noise ratio of the signal

  • ns_classifier (object, optional) – pickled object for NS classification

  • emb_classifier (object, optional) – pickled object for EM brightness classification

  • massgap_classifier (object, optional) – pickled object for EM brightness classification

Returns:

(HasNS, HasRemnant, HasMassGap) predicted values.

Return type:

tuple

Notes

By default the classifiers, trained based on different nuclear equations of state (EoSs) are downloaded from the project page: https://git.ligo.org/emfollow/em-properties/em-bright. The methodology is described in arXiv:1911.00116. The score from each classifier is weighted based on the bayes factors of individual EoSs as mentioned in Table I of arXiv:2104.08681. However, if the trained classifiers are supplied via ns_classifier and emb_classifier, the score is reported based on the classifier instead of re-weighting the score.

Examples

>>> from ligo.em_bright import em_bright
>>> em_bright.source_classification(2.0 ,1.0 ,0. ,0. ,10.0)
(1.0, 1.0, 0.0)
ligo.em_bright.em_bright.source_classification_ssm(mass_1, mass_2, chi1, chi2, mc, snr, pipeline, ssm_classifier=None)[source]

Computes HasSSM, HasNS, HasMassGap probabilities from point mass, spin, chirp mass and signal to noise ratio estimates for SSM search.

Parameters:
  • mass_1 (float) – primary mass

  • mass_2 (float) – secondary mass

  • chi1 (float) – dimensionless primary spin

  • chi2 (float) – dimensionless secondary spin

  • mc (float) – chirp mass

  • snr (float) – signal to noise ratio of the signal

  • pipeline (string) – search pipeline

  • ssm_classifier (object, optional) – pickled object for gstlal ssm classification

Returns:

  • tuple – (HasSSM, HasNS, HasMassGap) predicted values.

  • ——–

  • >>> from ligo.em_bright import em_bright

  • >>> em_bright.source_classification_ssm(2.0 ,1.0 ,0. ,0. ,10.0, “gstlal”)

  • (1.0, 1.0, 0.0)

ligo.em_bright.em_bright.get_redshifts(distances, N=10000)[source]

Compute redshift using the Planck15 cosmology.

Parameters:
  • distances (float or numpy.ndarray) – distance(s) in Mpc

  • N (int, optional) – Number of steps for the computation of the interpolation function

Example

>>> distances = np.linspace(10, 100, 10)
>>> em_bright.get_redshifts(distances)
array([0.00225566, 0.00450357, 0.00674384, 0.00897655,
       0.01120181, 0.0134197 , 0.01563032, 0.01783375
       0.02003009, 0.02221941])

Notes

This function accepts HDF5 posterior samples file and computes redshift by interpolating the distance-redshift relation.

ligo.em_bright.em_bright.source_classification_pe(posterior_samples_file, **kwargs)[source]

Compute HasNS, HasRemnant, and HasMassGap probabilities from posterior samples file.

Parameters:
  • posterior_samples_file (str) – Posterior samples file

  • num_eos_draws (int) – providing an int here runs eos marginalization with the value determining how many eos’s to draw

  • eos_seed (int) – seed for random eos draws

  • eosname (str) – Equation of state name, inferred from lalsimulation. Supersedes eos marginalization method when provided.

Returns:

(HasSSM, HasNS, HasRemnant, HasMassGap) predicted values.

Return type:

tuple

Examples

>>> from ligo.em_bright import em_bright
>>> em_bright.source_classification_pe('posterior_samples.hdf5')
(1.0, 0.96, 0.0)
ligo.em_bright.em_bright.source_classification_pe_from_table(table, **kwargs)[source]

Compute HasNS, HasRemnant, and HasMassGap probabilities from posterior table

Parameters:
  • table (numpy.recarray, dict) – table containing the posterior samples

  • num_eos_draws (int) – providing an int here runs eos marginalization with the value determining how many eos’s to draw

  • eos_seed (int) – seed for random eos draws

  • eosname (str) – Equation of state name, inferred from lalsimulation. Supersedes eos marginalization method when provided.

Returns:

(HasSSM, HasNS, HasRemnant, HasMassGap) predicted values.

Return type:

tuple

ligo.em_bright.em_bright.source_classification_pe_from_samples(mass_1_source, mass_2_source, spin_1z, spin_2z, eosname=None, num_eos_draws=10000, eos_seed=None)[source]

Compute HasNS, HasRemnant, and HasMassGap probabilities from samples.

Parameters:
  • mass_1_source (np.ndarray) – Samples for the source mass of the primary object

  • mass_2_source (np.ndarray) – Samples for the source mass of the secondary object

  • spin_1z (np.ndarray) – Samples for the spin component aligned with the orbital angular momentum for the primary object

  • spin_2z (np.ndarray) – Samples for the spin component aligned with the orbital angular momentum for the secondary object

  • num_eos_draws (int, optional) – providing an int here runs eos marginalization with the value determining how many eos’s to draw

  • eos_seed (int, optional) – seed for random eos draws

  • eosname (str, optional) – Equation of state name, inferred from lalsimulation. Supersedes eos marginalization method when provided.

Returns:

(HasNS, HasRemnant, HasMassGap) predicted values.

Return type:

tuple