imr_utils module

class imr_utils.DataBaseSummary(filelist, live_time_program=None, veto_segments_name=None, data_segments_name='datasegments', tmp_path=None, verbose=False)[source]

Bases: object

This class stores summary information gathered across the databases

imr_utils.allowed_analysis_table_names()[source]
imr_utils.compute_search_efficiency_in_bins(found, total, ndbins, sim_to_bins_function=<function <lambda>>, sim_to_found_weight_function=<function <lambda>>)[source]

This program creates the search efficiency in the provided ndbins. The first dimension of ndbins must be the distance. You also must provide a function that maps a sim inspiral row to the correct tuple to index the ndbins.

imr_utils.compute_search_volume(eff)[source]

Integrate efficiency to get search volume.

imr_utils.get_event_fars(connection, table_name, segments=None)[source]

return the false alarm rate of the most rare zero-lag coinc by instruments

imr_utils.get_instruments_from_coinc_event_table(connection)[source]

This function returns a list of the instruments analyzed according to the coinc_event_table

imr_utils.get_max_snr_inspiral_injections(connection, segments=None, table_name='coinc_inspiral')[source]

Like get_min_far_inspiral_injections but uses SNR to rank injections.

imr_utils.get_min_far_inspiral_injections(connection, segments=None, table_name='coinc_inspiral')[source]

This function returns the found injections from a database and the minimum far associated with them as tuple of the form (far, sim). It also tells you all of the injections that should have been injected. Subtracting the two outputs should tell you the missed injections

imr_utils.get_segments(connection, xmldoc, table_name, live_time_program, veto_segments_name=None, data_segments_name='datasegments')[source]
imr_utils.get_thinca_zero_lag_segments(connection, program_name='thinca')[source]

Return the thinca rings from the database at the given connection. The rings are returned as a coalesced ligo.segments.segmentlistdict indexed by instrument.

Example:

>>> seglists = get_thinca_zero_lag_segments(connection)
>>> print(seglists.keys())
['H1', 'L1']

This function is most useful if only zero-lag segments are desired because it allows for more convenient manipulation of the segment lists using the methods in ligo.segments. If information about background segments or the original ring boundaries is desired the data returned by get_thinca_rings_by_available_instruments() is required.

imr_utils.get_veto_segments(connection, name)[source]

Return a coalesced ligo.segments.segmentlistdict object containing the segments of the given name extracted from the database at the given connection.

imr_utils.guess_distance_chirp_mass_bins_from_sims(sims, mbins=11, distbins=200)[source]

Given a list of the injections, guess at the chirp mass and distance bins.

imr_utils.guess_distance_effective_spin_parameter_bins_from_sims(sims, chibins=11, distbins=200)[source]

Given a list of the injections, guess at the chi = (m1*s1z + m2*s2z)/(m1+m2) and distance bins.

imr_utils.guess_distance_mass1_mass2_bins_from_sims(sims, mass1bins=11, mass2bins=11, distbins=200)[source]

Given a list of the injections, guess at the mass1, mass2 and distance bins.

imr_utils.guess_distance_mass_ratio_bins_from_sims(sims, qbins=11, distbins=200)[source]

Given a list of the injections, guess at the chi and distance bins.

imr_utils.guess_distance_spin1z_spin2z_bins_from_sims(sims, spin1bins=11, spin2bins=11, distbins=200)[source]

Given a list of the injections, guess at the spin1, spin2 and distance bins.

imr_utils.guess_distance_total_mass_bins_from_sims(sims, nbins=11, distbins=200)[source]

Given a list of the injections, guess at the mass1, mass2 and distance bins. Floor and ceil will be used to round down to the nearest integers.

imr_utils.guess_nd_bins(sims, bin_dict={'distance': (200, <class 'lal.rate.LinearBins'>)})[source]

Given a dictionary of bin counts and bin objects keyed by sim attribute, come up with a sensible NDBins scheme

imr_utils.make_sim_inspiral_row_from_columns_in_db(connection)[source]

get the unique mapping of a sim inspiral row from columns in this database

imr_utils.sim_to_distance_chirp_mass_bins_function(sim)[source]

create a function to map a sim to a distance, chirp mass NDBins based object

imr_utils.sim_to_distance_duration_bins_function(sim, f_low=15.0)[source]

create a function to map a sim to a distance, duration NDBins based object

imr_utils.sim_to_distance_effective_spin_parameter_bins_function(sim)[source]

Map a sim_inspiral row to a distance, “chi” spin parameter bin. For IMR waveforms, “chi” refers to the effective spin,

chi = (m1*s1z + m2*s2z)/(m1 + m2)

where s1z, s2z are the components of the spins along the direction of the total angular momentum. For inspiral waveforms, “chi” refers to the reduced spin,

chi_red = chi_s + delta*chi_a - 76.*eta/113*chi_s,

where chi_s and chi_a are the symmetric and anti-symmetric combinations of the spins, and delta=(m1-m2)/(m1+m2). Some waveforms, e.g., SpinTaylorT4, use different coordinate conventions and require a coordinate transformation before applying these definitions.

imr_utils.sim_to_distance_mass1_mass2_bins_function(sim)[source]

create a function to map a sim to a distance, mass1, mass2 NDBins based object

imr_utils.sim_to_distance_mass_ratio_bins_function(sim)[source]

create a function to map a sim to a distance, mass ratio NDBins based object

imr_utils.sim_to_distance_spin1z_spin2z_bins_function(sim)[source]

create a function to map a sim to a distance, spin1z, spin2z NDBins based object

imr_utils.sim_to_distance_total_mass_bins_function(sim)[source]

create a function to map a sim to a distance, total mass NDBins based object

imr_utils.symmetrize_sims(sims, col1, col2)[source]

symmetrize by two columns that should be symmetric. For example mass1 and mass2

imr_utils.time_within_segments(geocent_end_time, geocent_end_time_ns, zero_lag_segments=None)[source]

Return True if injection was made in the given segmentlist, if no segments just return True