Allowed file formats

pesummary is able to read in a multitude of file formats through its universal read function. Below we document the allowed file formats.

dat

A dat file is read in through the pesummary.core.file.formats.dat.read_dat function. This function loads a dat file through the np.genfromtxt function. By default, we assume delimiter=None, meaning that each line is split by a single or multiple white spaces. Each column is assumed to contain samples drawn from a single posterior distribution.

pesummary.core.file.formats.dat.read_dat(path, delimiter=None)[source]

Grab the parameters and samples in a .dat file

Parameters:

path (str) – path to the result file you wish to read in

csv

A csv file is read in through the pesummary.core.file.formats.csv.read_csv function. This function loads a csv file through the np.genfromtxt function with delimiter=','. Each column is assumed to contain samples drawn from a single posterior distribution.

pesummary.core.file.formats.csv.read_csv(path)[source]

Grab the parameters and samples in a .csv file

Parameters:

path (str) – path to the result file you wish to read in

json

A json file is read in through the pesummary.core.file.formats.json.read_json function. By default, we assume path_to_samples=None meaning that the json file is recursively searched to find a posterior or posterior_samples group. Each key of this group should be a parameter name and value, samples drawn from the posterior distribution.

pesummary.core.file.formats.json.read_json(path, path_to_samples=None, decoder=<function PESummaryJsonDecoder>)[source]

Grab the parameters and samples in a .json file

Parameters:

path (str) – path to the result file you wish to read in

hdf5

A hdf5 file is read in through the pesummary.core.file.formats.hdf5.read_hdf5 function. By default, we assume path_to_samples=None meaning that the hdf5 file is recursively searched to find a posterior or posterior_samples group. Within this group, posterior samples should be stored stored as a numpy structured array with columns corresponding to samples drawn from a single posterior distribution.

pesummary.core.file.formats.hdf5.read_hdf5(path, **kwargs)[source]

Grab the parameters and samples in a .hdf5 file

Parameters:
  • path (str) – path to the result file you wish to read in

  • kwargs (dict) – all kwargs passed to _read_hdf5_with_deepdish or _read_hdf5_with_h5py functions

sql

An sql database is read in through the pesummary.core.file.formats.sql.read_sql function. If path_to_samples=None all tables in the sql database are extracted. Parameter names are the column descriptions and each column corresponds to the samples drawn from a single posterior distribution.

pesummary.core.file.formats.sql.read_sql(path, path_to_samples=None, remove_row_column='ROW', **kwargs)[source]

Grab the parameters and samples in an sql database file

Parameters:
  • path (str) – path to the result file you wish to read in

  • path_to_samples (str/list, optional) – table or list of tables that you wish to load

  • remove_row_column (str, optional) – remove the column with name ‘remove_row_column’ which indicates the row. Default ‘ROW’

npy

A npy file is read in through the pesummary.core.file.formats.numpy.read_numpy function. This function loads a npy file through the np.load function. The data stored in the npy file must be a Structured array with each column assumed to contain samples drawn from a single posterior distributions.

pesummary.core.file.formats.numpy.read_numpy(path, **kwargs)[source]

Grab the parameters and samples in a .npy file

Parameters:
  • path (str) – path to the result file you wish to read in

  • **kwargs (dict, optional) – all additional kwargs are passed to the np.load function

bilby

A file produced by the bilby parameter estimation code, is read in through the pesummary.core.file.formats.bilby.read_bilby function. We use the bilby.core.result.read_in_result function to load the file. Posterior samples are then extracted through the .posterior property.

pesummary.core.file.formats.bilby.read_bilby(path, disable_prior=False, complex_params=[], latex_dict={'220_quasinormal_mode_frequency': '$f_{220} [\\mathrm{Hz}]$', 'E1_matched_filter_snr_abs': '$\\mathrm{abs}(\\rho^{E}_{\\mathrm{mf}})$', 'E1_matched_filter_snr_angle': '$\\mathrm{arg}(\\rho^{E}_{\\mathrm{mf}})$', 'E1_optimal_snr': '$\\rho^{E}_{\\mathrm{opt}}$', 'E1_time': '$t_{E} [\\mathrm{s}]$', 'H1_L1_time_delay': '$\\Delta t_{HL} [\\mathrm{s}]$', 'H1_V1_time_delay': '$\\Delta t_{HV} [\\mathrm{s}]$', 'H1_matched_filter_snr': '$\\rho^{H}_{\\mathrm{mf}}$', 'H1_matched_filter_snr_abs': '$\\mathrm{abs}(\\rho^{H}_{\\mathrm{mf}})$', 'H1_matched_filter_snr_angle': '$\\mathrm{arg}(\\rho^{H}_{\\mathrm{mf}})$', 'H1_optimal_snr': '$\\rho^{H}_{\\mathrm{opt}}$', 'H1_time': '$t_{H} [\\mathrm{s}]$', 'L1_V1_time_delay': '$\\Delta t_{LV} [\\mathrm{s}]$', 'L1_matched_filter_snr': '$\\rho^{L}_{\\mathrm{mf}}$', 'L1_matched_filter_snr_abs': '$\\mathrm{abs}(\\rho^{L}_{\\mathrm{mf}})$', 'L1_matched_filter_snr_angle': '$\\mathrm{arg}(\\rho^{L}_{\\mathrm{mf}})$', 'L1_optimal_snr': '$\\rho^{L}_{\\mathrm{opt}}$', 'L1_time': '$t_{L} [\\mathrm{s}]$', 'V1_matched_filter_snr_abs': '$\\mathrm{abs}(\\rho^{V}_{\\mathrm{mf}})$', 'V1_matched_filter_snr_angle': '$\\mathrm{arg}(\\rho^{V}_{\\mathrm{mf}})$', 'V1_optimal_snr': '$\\rho^{V}_{\\mathrm{opt}}$', 'V1_time': '$t_{V} [\\mathrm{s}]$', '_b_bar': '$\\bar{b}$', '_precessing_harmonics_overlap': '$|\\mathrm{O}^{\\mathrm{prec}}_{0,1}|$', 'a_1': '$a_{1}$', 'a_2': '$a_{2}$', 'baryonic_mass_1': '$m_{1, \\mathrm{baryonic}} [M_{\\odot}]$', 'baryonic_mass_1_source': '$m^{\\mathrm{source}}_{1, \\mathrm{baryonic}} [M_{\\odot}]$', 'baryonic_mass_2': '$m_{2, \\mathrm{baryonic}} [M_{\\odot}]$', 'baryonic_mass_2_source': '$m^{\\mathrm{source}}_{2, \\mathrm{baryonic}} [M_{\\odot}]$', 'baryonic_torus_mass': '$M_{\\mathrm{torus}} [M_{\\odot}]$', 'baryonic_torus_mass_source': '$M^{\\mathrm{source}}_{\\mathrm{torus}} [M_{\\odot}]$', 'beta': '$\\beta$', 'chi_eff': '$\\chi_{\\mathrm{eff}}$', 'chi_eff_infinity': '$\\chi_{\\mathrm{eff},\\infty}$', 'chi_eff_infinity_only_prec_avg': '$\\chi_{\\mathrm{eff},\\infty}^{\\mathrm{only\\, prec\\, avg}}$', 'chi_p': '$\\chi_{\\mathrm{p}}$', 'chi_p_2spin': '$\\chi_{\\mathrm{p}}^{\\mathrm{2spin}}$', 'chi_p_infinity': '$\\chi_{\\mathrm{p},\\infty}$', 'chi_p_infinity_only_prec_avg': '$\\chi_{\\mathrm{p},\\infty}^{\\mathrm{only\\, prec\\, avg}}$', 'chirp_mass': '$\\mathcal{M} [M_{\\odot}]$', 'chirp_mass_source': '$\\mathcal{M}^{\\mathrm{source}} [M_{\\odot}]$', 'comoving_distance': '$d_{com} [\\mathrm{Mpc}]$', 'compactness_1': '$C_{1}$', 'compactness_2': '$C_{2}$', 'cos_iota': '$\\cos{\\iota}$', 'cos_theta_jn': '$\\cos{\\theta_{JN}}$', 'cos_tilt_1': '$\\cos{\\theta_{1}}$', 'cos_tilt_1_infinity': '$\\cos{\\theta_{1,\\infty}}$', 'cos_tilt_1_infinity_only_prec_avg': '$\\cos{\\theta_{1,\\infty}^{\\mathrm{only\\, prec\\, avg}}}$', 'cos_tilt_2': '$\\cos{\\theta_{2}}$', 'cos_tilt_2_infinity': '$\\cos{\\theta_{2,\\infty}}$', 'cos_tilt_2_infinity_only_prec_avg': '$\\cos{\\theta_{2,\\infty}^{\\mathrm{only\\, prec\\, avg}}}$', 'dec': '$\\delta [\\mathrm{rad}]$', 'delta_lambda': '$\\delta\\lambda$', 'final_kick': '$v_{\\mathrm{final}} [\\mathrm{km\\;s^{-1}}]$', 'final_mass': '$M_{\\mathrm{final}} [M_{\\odot}]$', 'final_mass_non_evolved': '$M_{\\mathrm{final}}^{\\mathrm{nonevol}} [M_{\\odot}]$', 'final_mass_source': '$M_{\\mathrm{final}}^{\\mathrm{source}} [M_{\\odot}]$', 'final_mass_source_non_evolved': '$M_{\\mathrm{final}}^{\\mathrm{source, nonevol}} [M_{\\odot}]$', 'final_spin': '$a_{\\mathrm{final}}$', 'final_spin_non_evolved': '$a_{\\mathrm{final}}^{\\mathrm{nonevol}}$', 'gamma_1': '$\\Gamma_{1}$', 'gamma_2': '$\\Gamma_{2}$', 'gamma_3': '$\\Gamma_{3}$', 'geocent_time': '$t_{c} [\\mathrm{s}]$', 'inverted_mass_ratio': '$1/q$', 'iota': '$\\iota [\\mathrm{rad}]$', 'lambda_1': '$\\lambda_{1}$', 'lambda_2': '$\\lambda_{2}$', 'lambda_tilde': '$\\tilde{\\lambda}$', 'log_likelihood': '$\\log{\\mathcal{L}}$', 'log_pressure': '$\\log{\\mathcal{P}}$', 'log_prior': '$\\log{P}$', 'luminosity_distance': '$d_{L} [\\mathrm{Mpc}]$', 'mass_1': '$m_{1} [M_{\\odot}]$', 'mass_1_source': '$m_{1}^{\\mathrm{source}} [M_{\\odot}]$', 'mass_2': '$m_{2} [M_{\\odot}]$', 'mass_2_source': '$m_{2}^{\\mathrm{source}} [M_{\\odot}]$', 'mass_ratio': '$q$', 'network_21_multipole_snr': '$\\rho_{21}$', 'network_33_multipole_snr': '$\\rho_{33}$', 'network_44_multipole_snr': '$\\rho_{44}$', 'network_matched_filter_snr': '$\\rho^{N}_{\\mathrm{mf}}$', 'network_optimal_snr': '$\\rho^{N}_{\\mathrm{opt}}$', 'network_precessing_snr': '$\\rho_{\\mathrm{p}}$', 'peak_luminosity': '$L_{\\mathrm{peak}} [10^{56} \\mathrm{ergs\\;s^{-1}}]$', 'peak_luminosity_non_evolved': '$L_{\\mathrm{peak}}^{\\mathrm{nonevol}} [10^{56} \\mathrm{ergs\\;s^{-1}}]$', 'phase': '$\\phi [\\mathrm{rad}]$', 'phi_1': '$\\phi_{1} [\\mathrm{rad}]$', 'phi_12': '$\\phi_{12} [\\mathrm{rad}]$', 'phi_2': '$\\phi_{2} [\\mathrm{rad}]$', 'phi_jl': '$\\phi_{JL} [\\mathrm{rad}]$', 'psi': '$\\Psi [\\mathrm{rad}]$', 'psi_J': '$\\Psi_{J} [\\mathrm{rad}]$', 'ra': '$\\alpha [\\mathrm{rad}]$', 'radiated_energy': '$E_{\\mathrm{rad}} [M_{\\odot}]$', 'radiated_energy_non_evolved': '$E_{\\mathrm{rad}}^{\\mathrm{nonevol}} [M_{\\odot}]$', 'redshift': '$z$', 'spectral_decomposition_gamma_0': '$\\gamma_{0}$', 'spectral_decomposition_gamma_1': '$\\gamma_{1}$', 'spectral_decomposition_gamma_2': '$\\gamma_{2}$', 'spectral_decomposition_gamma_3': '$\\gamma_{3}$', 'spin_1x': '$S_{1x}$', 'spin_1y': '$S_{1y}$', 'spin_1z': '$S_{1z}$', 'spin_1z_evolved': '$S_{1z}^{\\mathrm{evol}}$', 'spin_1z_infinity': '$S_{1z,\\infty}$', 'spin_1z_infinity_only_prec_avg': '$S_{1z,\\infty}^{\\mathrm{only\\, prec\\, avg}}$', 'spin_2x': '$S_{2x}$', 'spin_2y': '$S_{2y}$', 'spin_2z': '$S_{2z}$', 'spin_2z_evolved': '$S_{2z}^{\\mathrm{evol}}$', 'spin_2z_infinity': '$S_{2z,\\infty}$', 'spin_2z_infinity_only_prec_avg': '$S_{2z,\\infty}^{\\mathrm{only\\, prec\\, avg}}$', 'symmetric_mass_ratio': '$\\eta$', 'theta_jn': '$\\theta_{JN} [\\mathrm{rad}]$', 'tidal_disruption_frequency': '$f_{\\mathrm{td}} [\\mathrm{Hz}]$', 'tidal_disruption_frequency_ratio': '$f_{\\mathrm{td}} / f_{220}$', 'tilt_1': '$\\theta_{1} [\\mathrm{rad}]$', 'tilt_1_infinity': '$\\theta_{1,\\infty} [\\mathrm{rad}]$', 'tilt_1_infinity_only_prec_avg': '$\\theta_{1,\\infty}^{\\mathrm{only\\, prec\\, avg}} [\\mathrm{rad}]$', 'tilt_2': '$\\theta_{2} [\\mathrm{rad}]$', 'tilt_2_infinity': '$\\theta_{2,\\infty} [\\mathrm{rad}]$', 'tilt_2_infinity_only_prec_avg': '$\\theta_{2,\\infty}^{\\mathrm{only\\, prec\\, avg}} [\\mathrm{rad}]$', 'total_mass': '$M [M_{\\odot}]$', 'total_mass_source': '$M^{\\mathrm{source}} [M_{\\odot}]$', 'viewing_angle': '$\\Theta [\\mathrm{rad}]$'}, nsamples_for_prior=None, _bilby_class=None, **kwargs)[source]

Grab the parameters and samples in a bilby file

Parameters:
  • path (str) – path to the result file you wish to read in

  • disable_prior (Bool, optional) – if True, do not collect prior samples from the bilby result file. Default False

  • complex_params (list, optional) – list of parameters stored in the bilby result file which are complex and you wish to store the amplitude and angle as seperate posterior distributions

  • latex_dict (dict, optional) – list of latex labels for each parameter

  • nsamples_for_prior (int, optional) – number of samples to draw from the analytic priors