XIMPOL: a new x-ray polarimetry observation-simulation and analysis framework

We present a new simulation framework, XIMPOL, based on the python programming language and the Scipy stack, specifically developed for X-ray polarimetric applications. XIMPOL is not tied to any specific mission or instrument design and is meant to produce fast and yet realistic observation-simulations, given as basic inputs: (i) an arbitrary source model including morphological, temporal, spectral and polarimetric information, and (ii) the response functions of the detector under study, i.e., the effective area, the energy dispersion, the point-spread function and the modulation factor. The format of the response files is OGIP compliant, and the framework has the capability of producing output files that can be directly fed into the standard visualization and analysis tools used by the X-ray community, including XSPEC which make it a useful tool not only for simulating physical systems, but also to develop and test end-to-end analysis chains.


-Introduction
XIMPOL is a new simulation framework specifically designed for X-ray polarimetry. It is based on the python programming language and the associated scientific ecosystem and it is publicly available under the GNU General Public License [1]. XIMPOL is able to produce realistic observation-simulations given as inputs a source model and the detector response functions. The generated output FITS files can be analyzed with standard analysis tools, such as XSPEC [2], and HEASARC ftools [3]. In addition, dedicated tools for the analysis of polarimetric informations are directly available within XIMPOL.
In this contribution we will give an overview of the basic architecture of the software and, although the framework is not tied to any specific mission or instrument design, we will present a few physically interesting case studies in the context of the the X-ray Imaging Polarimetry Explorer (XIPE ) mission [4], currently in phase study for the M4 ESA call.

-Architectural overview
The vast majority of the simulation and data preparation algorithms implemented in XIMPOL are available in four main executables, as illustrated in the block diagram of fig. 1. These consist in: • xpobssim: given a source model, a set of instrument response functions, and a given observation time, it produces a photon list corresponding to a given observation time in the form of a binary FITS table.
• chandra2ximpol : given a Chandra event list and a set of instrument response functions, it converts the Chandra observation into a XIMPOL observation-simulation.
• xpselect: it allows to select subsamples of photons in a given event file, based on the event energy, direction, time or phase, producing a new (smaller) event file.
• xpbin: it allows to bin the data using several different algorithms, producing counts maps and spectra, light curves, phasograms and modulation cubes (i.e., histograms of the measured azimuthal distributions in multiple energy layers).
Where applicable, the data formats are consistent with the common display and analysis tools used by the community, e.g., the binned count spectra can be fed into XSPEC, along with the corresponding response functions, for standard spectral analyses. All the simulation and analysis tools are fully configurable via command-line interface. Also, XIMPOL provides a "pipeline" facility to easy concatenate all the aforementioned functionalities in python scripts.

-Source model definition
The basic setup for a generic simulation is specified via a python configuration file. In order to define a source model, three functions are needed: 2) Polarization degree: P (E, t, ra, dec).
3) Polarization angle: φ(E, t, ra, dec). There is a great flexibility in defining these functions: they can be defined analytically (e.g., constants, power-laws,. . .), can be the result of interpolations built from a series of data points or, for the energy spectrum, can be a XSPEC spectral model. The source morphology can be defined as a variety of predefined structures: point sources, Gaussian or uniform disks, or an arbitrary extended sources (from FITS images). In addition, XIMPOL fully supports phase-dependent periodic sources and an arbitrary number of components can be easily overlaid in the same input model. For example, fig. 2 shows the Chandra image used to define the morphology of the source (Cas A, in this case) and the simple polarization pattern used in the simulation. Figure 3 shows the spectral model used. In this particular simulation, we have defined a thermal non-polarized spectral component overlaid with a polarized non-thermal component.

-Observation-simulation
The main purpose of the observation-simulation tool, called xpobssim, is to simulate a realistic observation of a source taking as inputs the source model and a set of suitable detector response functions. In the simulation work-flow, the first step consists in calculating the expected number of events. This is done convolving the provided source spectrum with the effective area of the instrument and integrating the curve in energy and in time. Then, using the count spectrum and the light curve as one-dimensional probability density functions, the event times (or phase) and the true energies are randomly sampled. The energies are also smeared with the energy dispersion. According to the source morphology and the instrument point spread function (PSF), the incoming photons direction in the sky is determined ( fig. 4, left panel). In the last step, the tool generates the angular distribution of the photoelectron emission angles based on the given polarization model ( fig. 4, right panel). The output of the simulation is a photon list that is saved in a FITS file containing all the information about the photons.

-Chandra2ximpol converter
The chandra2ximpol converter is a tool alternative to xpobssim, specifically designed to simulate a source starting from Chandra observations (for example, fig. 5, left panel). This technique has the advantage to preserve the full correlation between the source morphology and the spectrum, especially important for extended sources. The starting point of the conversion is the Chandra photon list, publicly available from the on-line database [5], which includes energies and spatial information of every event. The Chandra angular and energy resolutions are much better than those expected for the XIPE mission (angular resolution: ∼ 1 arcsec vs. ∼ 30 arcsec, energy resolution: 5% vs. ∼ 20% at 5.9 keV [7]), so that we can take the Chandra measured energies and positions as Monte Carlo truth. Based on the ratio of the effective areas and the given observation time, the events are down-or over-sampled and then smeared with the response functions (in this case XIPE : fig. 5, right panel). Finally, the emission angle is generated accordingly with the specified polarization model and the output event list is saved in a FITS file.

-Analysis tools
XIMPOL also comes with a basic set of command-line analysis tools. These allow the user to select subsamples of photons based on event energy, direction, time or phase (xpselect), or bin and fit the simulated data, producing count maps, spectra, phasograms, light and modulation curves (xpbin). The resulting spectra and the response functions are compatible with XSPEC, which can be therefore used to perform spectral analysis. All the tools, including XSPEC, can be seamlessly combined into analysis pipelines. As an illustrative example, fig. 6 shows the results of a 100 ks XIPE simulation of an observation of the Crab nebula (plus pulsar), based on [8], with superimposed the polarization model given as input. These figures show the result of the complete simulation-analysis pipeline. In each pulsar-phase bin, the data have been analyzed and the polarization degree and angle have been obtained. The comparison with the input model is also shown.

-Conclusions
In summary, XIMPOL is a newly developed observation-simulation and analysis framework that allows the user to easily produce fast and realistic simulation of astronomical sources as well as analyze and display the simulation results. The entire software package is not tied to any specific mission and the user simply provides the instrument response functions to use. Thanks to its capabilities and flexibility it can play a relevant role in a context of growing interest for the X-ray polarimetry.