X-PSI: A Python package for neutron star X-ray pulse simulation and inference

The X-ray Pulse Simulation and Inference (X-PSI) package is a software package designed to simulate rotationally-modulated surface X-ray emission from neutron stars and to perform Bayesian statistical inference on real or simulated pulse profile data sets. Model parameters of interest include neutron star mass and radius and the system geometry and properties of the hot emitting surface regions

such as stellar mass and radius, and properties of the surface radiation field such as a map of temperature.The mass and radius of a neutron star are a function of the equation of state of internal matter, especially the dense matter in the core, and the formation history of the star, which determines the central energy density and the spin frequency.The state of the surface radiation field is the product of a potentially long and complex stellar evolutionary history, especially that of the stellar magnetosphere.Such parameter estimation requires relativistic tracing of radiation as it propagates from surface to a distant telescope.Pulse-profile modelling to infer neutron star parameters is a major science goal for both current X-ray telescopes such as the Neutron Star Interior Composition ExploreR (NICER, Gendreau et al., 2016) and proposed future telescopes such as eXTP and STROBE-X (Ray et al., 2019;Watts et al., 2019).
While there are some open-source libraries for simulating the X-ray signals from rapidly spinning neutron stars and more generally from the vicinity of general relativistic compact objects including black holes (Nättilä & Pihajoki, 2018;Pihajoki et al., 2018) the scope of these projects does not include statistical modeling, which necessitates tractable parametrised models and a modular framework for constructing those models.X-PSI addresses this need, coupling code for likelihood functionality (simulation) with existing open-source software for posterior sampling (inference).

The X-PSI package and science use
X-PSI is an open-source Python package for Bayesian modeling of time-and energy-resolved X-ray pulsations.X-PSI provides a framework for the implementation of custom models, including likelihood and prior functions, and for feeding those models to open-source statistical sampling software for use on high-performance computing systems.X-PSI supplies modules for post-processing posterior sample sets, and supplies tools for visualisation.For example, one can generate time-and energy-resolved images and animations of model X-ray pulsars by tracing radiation from the stellar surface to a distant observer, such as a space telescope, as it propagates through spacetime; a snapshot of such an animation may be found in Figure 1.Posterior summaries can be plotted of the time-and energy-domain signals that a model pulsar is inferred to generate, conditioned on observational data.X-PSI is being used by the NICER collaboration for pulse-profile modeling of X-ray emission from rotation-powered millisecond pulsars (Riley et al., 2021b(Riley et al., , 2019a)).Many more papers have used the accompanying open-source analysis pipeline and products published on Zenodo (Riley et al., 2021a(Riley et al., , 2019b)).The first were Raaijmakers et al. (2019) and Bilous et al. (2019), respectively on the topics of dense matter inference and multipolar magnetic fields.
The numerical likelihood routines native to X-PSI are written in Cython (Behnel et al., 2011), and are dependent on the GNU Scientific Library (GSL, Gough, 2009).High-level objectoriented model construction is performed by a user in the Python language, as is the interfacing with sampling software.Low-level customisation is encouraged in the extensions, either directly in Cython or via calls to external C libraries.X-PSI is Unix source code compatible, and release versions are freely available on GitHub under the GNU General Public License.Extensive documentation, step-by-step tutorials, and reproduction code for existing data analyses, are available via the GitHub repository, along with a growing suite of unit tests.Future plans include migration to Python 3, further improvements to post-processing software, and the implementation of an expanded suite of atmosphere models.

Figure 1 :
Figure 1: A snapshot from a time-and energy-resolved animation of a toy neutron star that generates X-ray pulsations.The top three panels are sky maps of photon specific intensity at three representative photon energies, and the bottom panels show instantaneous integrals over the sky maps, together with sky map integrals at past times normalized to the maximum at each photon energy (bottom-left panel) and additional photon energies (bottom-right panel).