Abstract
| - Context. Neural networks are being extensively used for modeling data, especially in the case where no likelihood can be formulated. Aims. Although in the case of X-ray spectral fitting the likelihood is known, we aim to investigate the ability of neural networks to recover the model parameters and their associated uncertainties and to compare their performances with standard X-ray spectral fitting, whether following a frequentist or Bayesian approach. Methods. We applied a simulation-based inference with neural posterior estimation (SBI-NPE) to X-ray spectra. We trained a network with simulated spectra generated from a multiparameter source emission model folded through an instrument response, so that it learns the mapping between the simulated spectra and their parameters and returns the posterior distribution. The model parameters are sampled from a predefined prior distribution. To maximize the efficiency of the training of the neural network, while limiting the size of the training sample to speed up the inference, we introduce a way to reduce the range of the priors, either through a classifier or a coarse and quick inference of one or multiple observations. For the sake of demonstrating working principles, we applied the technique to data generated from and recorded by the NICER X-ray instrument, which is a medium-resolution X-ray spectrometer covering the 0.2-12 keV band. We consider here simple X-ray emission models with up to five parameters. Results. SBI-NPE is demonstrated to work equally well as standard X-ray spectral fitting, both in the Gaussian and Poisson regimes, on simulated and real data, yielding fully consistent results in terms of best-fit parameters and posterior distributions. The inference time is comparable to or smaller than the one needed for Bayesian inference when involving the computation of large Markov chain Monte Carlo chains to derive the posterior distributions. On the other hand, once properly trained, an amortized SBI-NPE network generates the posterior distributions in no time (less than 1 second per spectrum on a 6-core laptop). We show that SBI-NPE is less sensitive to local minima trapping than standard fit statistic minimization techniques. With a simple model, we find that the neural network can be trained equally well on dimension-reduced spectra via a principal component decomposition, leading to a faster inference time with no significant degradation of the posteriors. Conclusions. We show that simulation-based inference with neural posterior estimation is a complementary tool for X-ray spectral analysis. The technique is robust and produces well-calibrated posterior distributions. It holds great potential for its integration in pipelines developed for processing large data sets. The code developed to demonstrate the first working principles of the technique introduced here is released through a Python package called SIXSA (Simulation-based Inference for X-ray Spectral Analysis), which is available from GitHub.
|