leakagelib.ps_fit package#

leakagelib.ps_fit.pcube module#

Do the PCUBE-level PD extraction

leakagelib.ps_fit.pcube.get_pcube(datas, bg_data=None)#

Get the PCUBE-level analysis of polarization degree (PD).

Parameters:
  • datas (list of IXPEData) – List of IXPEData objects. Does not need to be binned.

  • bg_data (tuple (list of IXPEData, float), optional) – Tuple where the first element is a list of IXPEData to use as background, and the second element is the area ratio between the source region and the background region.

Returns:

A tuple (q, u, sigma_q, sigma_u) containing the Stokes parameters and their uncertainties.

Return type:

tuple of (float, float, float, float)

Notes

  • Uses Kislat 2014 methodology, but applies per-event modulation factor. This function does not give the same errors as the IXPEObssim (Baldini+) PCUBE algorithm; it uses the formulas resulting from linear propagation of uncertainties.

leakagelib.ps_fit.spectral_weights module#

class leakagelib.ps_fit.spectral_weights.RMF#

Bases: object

Load an RMF from the RMF saved in leakagelib, which was made from the CALDB IXPE RMF 20240101_v013

convolve_spectrum(spectrum)#

Returns the spectrum convolved with the RMF.

Parameters:

spectrum (callable) – A function that takes energies in keV and returns the spectrum unit

Returns:

An interpolator for the spectrum convolved with the RMF

Return type:

scipy interp1d object

convolve_spectrum_mu(spectrum, use_nn)#

Returns the spectrum times the modulation factor convolved with the RMF.

Parameters:

spectrum (callable) – A function that takes energies in keV and returns the spectrum unit

Returns:

An interpolator for the spectrum times mu convolved with the RMF

Return type:

scipy interp1d object

delta()#

Module contents#

Use the PSF to fit for the Stokes coefficients of objects

Jack Dinsmore 2025

leakagelib.ps_fit.estimate_particle_flux(datas)#

Estimate the fraction of events which are particles based on the particle character