The Athena X-IFU Instrument Simulator xifusim

We present the instrument simulator xifusim developed for the X-ray Integral Field Unit X-IFU aboard the planned Athena mission. xifusim aims to be an accurate representation of the entire instrument, starting from a full simulation of the Transition-Edge Sensor (TES) array receiving impact photons unconstrained by the small signal limit. Its output current is then propagated through the entire readout chain, including multiplexing, amplification and the digital readout. The final output consists of triggered records, which can be post-processed to reconstruct the photon energies. The readout chain itself is separated into individual, modular blocks with several possible models for each, allowing the simulation of different readout schemes or models of varying physical accuracy at the expense of run time. New models are implemented as necessary to enable studies of the overall readout chain. Such studies are also facilitated by fine-grained control of the simulation output, including the internal state of intermediate simulation blocks. In addition to its modularity, xifusim also allows the manipulation of certain internal parameters during a run, enabling the simulation of readout chain characterization measurements, environmental drifts or various kinds of crosstalk.


Introduction
The Advanced Telescope for High-Energy Astrophysics (Athena) is an ESA mission planned to launch in the early 2030s [1]. To investigate its science theme of 'The Hot and Energetic Universe', Athena will utilize a high effective area X-ray telescope with two focal plane instruments-the Wide Field Imager WFI [2], a large field of view DEPFET detector, and the X-ray Integral Field Unit [3], a TES-based Journal of Low Temperature Physics (2022) 209:988-997 microcalorimeter array with around 3000 individual pixels and an energy resolution of 2.5 eV up to 7 keV.
An important part of the mission is the development of end-to-end simulators which are used to study the impact of instrumental design decisions on the science performance of Athena. For this, both instruments use the SIXTE environment [4], which simulates the entire detection process and produces standard event files compatible with existing astrophysics analysis software.
For the X-IFU, SIXTE also contains a dedicated TES simulator tessim [5], which focuses on the simulation of TES microphysics. However, as instrumental studies of the X-IFU became more complex after phase A, tessim became insufficient and was extensively redesigned to accommodate the full X-IFU readout chain. This resulted in the development of xifusim, an instrument simulator fully dedicated to the X-IFU, whose design and capabilities are described in this paper.

Software Design
The general concept of xifusim is that it simulates the X-IFU readout chain as a sequence of data processing blocks, starting from photon impacts. This chain is shown in Fig. 1. Similar to tessim [5], the TES signal is generated by solving a differential equation system in the time domain, with the effect of photons introduced via an external energy term in the TES thermal equation. The output of the TES block is a continuous current stream per simulated pixel.
Deviating from tessim, which continues by digitizing the simulated current and then triggering, xifusim simulates more components of the readout chain. The first block after the TES array is the SQUID block, primarily used as an amplifier and in the case of Time-Division Multiplexing (TDM) a separate multiplexing stage. Next, the WFEE block simulates the Warm Front End Electronics of the X-IFU, most importantly the low noise amplifier (LNA). The LNA output is then digitized Fig. 1 Diagram of the simulated readout chain. The instrument is simulated as a sequence of functional blocks (rounded corners) starting from a TES array, which receives photon impacts and outputs a current stream that is further amplified and processed by the SQUID array, Warm Front end Electronics (WFEE) and Digital Readout Electronics (DRE). Cable labels represent connections with possible bandwidth limitations. The standard output of xifusim are triggered pulse records (Color figure online) and processed by the DRE DEMUX block. This block simulates the digital readout electronics of the X-IFU, its most important function being the demultiplexing of the signal and providing a feedback current to operate the SQUID at its setpoint. The demultiplexed output of the DRE is then processed by the Trigger block, which cuts out sections of the data stream before and after a triggering condition is met.
An important part of xifusim is that the individual blocks in Fig. 1 can each be represented by different models, which are summarized in Sect. 3. The models of each block have the same input and output data types and can be replaced independently from each other, making xifusim a modular code. This is handled in xifusim, which is written in C++, by generating individual objects from object templates. Note that while xifusim is written in standard C++, running on CPUs, some of its components, most importantly the TES array, have also been implemented in CUDA, enabling the use of GPUs [6]. This is especially useful when running simulations on the scale of the whole TES array.

Models
An important feature of xifusim is the on-the-fly selection of different models representing the readout chain blocks. The main benefit of this feature is the ability to continuously add models to the software as needed by internal studies to quickly judge the impact of changes to the readout chain. This section will briefly describe the models that have been added to xifusim thus far.
For the TES block, xifusim supports two main models. The first is the same model used by tessim, consisting of the standard TES differential equations [7] with a linear resistance R(T, I). This model is able to produce representative TES pulses for pixels with standard lab characterizations (thermal conductances, circuit parameters and TES transition parameters and ). As opposed to the small signal model, the detector response is nonlinear in energy [5,6]. A more advanced model, described in [8], simulates AC-biased TES pixels using a resistively shunted junction model. This model was mostly utilized during the study of Frequency-Division Multiplexing (FDM) readout, being able to simulate, e.g., the frequency response of the non-linear TES devices.
The SQUID block consists of two categories of models. The first models the SQUID as a simple amplifier, using either simple linear and sinusoidal transfer functions or user-provided tables of input flux vs output signal. These models also support row-switching needed by Time-Division Multiplexing (TDM). A more complex SQUID model was implemented specifically for TDM simulations. This model simulates the SQUID via a V( , I) interpolation table embedded in a circuit differential equation system which includes flux actuated row-switches. By including bandwidth limited control signals, this model can simulate switching transients and their effect on TES readout in detail [9].
The modeling of the Warm Front End Electronics for the X-IFU is described in [10]. xifusim currently contains models for a low noise amplifier with voltage saturation, with other models such as the temperature dependency to be implemented. For the digital readout electronics, xifusim supports the operation of the readout chain both with and without multiplexing. Non-multiplexing schemes are either a flux-locked loop (FLL) configuration controlling the first SQUID stage or a simple model with no SQUID feedback at all. For multiplexing, xifusim supports both FDM and TDM, with the main focus of the current development being the simulation of TDM as the X-IFU switched to this multiplexing scheme as a baseline.
For its final block, xifusim implements several triggering models, which can be used as in a real instrument to only output data of scientific interest. The standard triggering algorithm of xifusim is the differential trigger described in [5], based on a low pass filtered one-sided derivative of the signal. Additionally, xifusim includes a 'noise' trigger (continuous triggering regardless of input signal, used to extract noise samples) as well as a 'perfect' trigger, which bypasses triggering on the DRE output and instead triggers whenever a photon is processed by the simulator. The latter is mostly used in studies to avoid systematics introduced by an actual triggering algorithm based on the input data stream.
In application, a user can select from any sensible combination of the above models (mostly restricted by needing to use the same multiplexing scheme) whenever the program is called. This is achieved by supplying the desired models and parameter sets via an XML file containing references to a FITS database with the corresponding model parameters.

Further Features
The standard operation of xifusim is oriented on the data flow of the real instrument, meaning it only simulates photons impacting on the TES array and outputs triggered records of the data stream. While this is sufficient for most end-to-end simulations of the instrument, more detailed instrumental studies require both further introspection of the individual readout chain segments as well as greater control over the simulation itself.
To enable detailed analysis of a given simulation, xifusim is able to write both the intermediate output and internal data of the blocks shown in Fig. 1 as requested by the user. An example for the intermediate output would be the TES output current or the LNA output before digitization. The internal data which xifusim can output strongly depends on the particular model for a given block-examples include the TES temperature or resistance, the magnetic flux of a given SQUID or internal counter values of the digital readout electronics.
In terms of simulation control, xifusim allows for the manipulation of selected parameters during the simulation. These parameters include the TES bath temperature and bias voltage, an additional TES load power, additional SQUID input fluxes and multiplicative terms for the gain of the direct and feedback line.
Variation of these parameters enables the simulation of multiple processes, such as calibration measurements (e.g., IV-curves, by varying the TES voltage), external drifts (TES bath temperature, cable gains) or crosstalk (SQUID input fluxes or TES parameters). xifusim supports the simulation of both simple linear and sinusoidal drifts as well as parameter drifts read in by a user-provided FITS file giving the relevant parameters as a function of time.
A simple example of a xifusim simulation utilizing these features is that of electrical crosstalk due to mutual inductance coupling. This type of crosstalk occurs when a current pulse in a given signal pixel is picked up by an inductively coupled pixel circuit, resulting in a voltage transient in the latter pixel proportional to the derivative of the original pulse.
This effect can be simulated in xifusim using a two-stage approach, displayed in Fig. 2. First, we acquire the current response of a TES pixel to a photon via a normal, single photon simulation in which we read out the TES current. We then convert this current signal to a voltage transient by multiplying its derivative with a mutual inductance M in , here 0.85 nH. Using the parameter variation feature, we can then simulate a 'victim' pixel receiving the crosstalk by varying its bias voltage by the calculated voltage transient. This causes a very weak current response in the pixel, with the peak signal in the 'victim' around a factor of 2000 weaker than the 'perpetrator' current pulse. Nonetheless, this type of crosstalk can cause a measurable shift in the reconstructed energy of a photon impacting on the 'victim' victim, as will be shown in Sect. 5.

Applications
One of the primary uses of xifusim is in providing input for the development of event processing software for the X-IFU. Here, both tessim [11,12] and later xifusim [13] were used to generate synthetic data streams used to test different triggering and energy reconstruction algorithms. xifusim was also used to study the effect of cosmic ray impacts on the X-IFU energy resolution [14]. This study used xifusim to simulate photon impacts during thermal bath temperature fluctuations due to cosmic rays impacting the detector wafer, with the wafer thermal response calculated externally.
Another use of xifusim is the creation of input for the SIXTE simulation environment [4], specifically for the X-IFU end-to-end simulator xifupipeline. Unlike xifusim, this simulator does not directly simulate the TES array and readout chain. Instead, it determines the detected photon energy based on a redistribution matrix file in addition to simulating energy offsets due to crosstalk. Here, crosstalk energy shifts are calculated from precomputed tables, generated either from laboratory data or xifusim simulations.
An example of such a xifusim simulation is the mutual inductance crosstalk shown in Sect. 4. To determine the effect of crosstalk on a photon's measured energy, we repeat this simulation with an additional signal photon in the pixel receiving the crosstalk voltage shift. We then apply an optimal filter to the output pulse record produced by xifusim. The difference between this reconstructed energy and the energy reconstructed from a pulse record without the crosstalk signal corresponds to the crosstalk energy shift. Figure 3 shows this crosstalk energy shift as a function of the delay of the perpetrator photon with respect to the victim photon, showing a complex structure as a function of delay caused by the shape of the crosstalk pulse and the optimal filter itself.
In particular, the "bump" in the crosstalk energy shift around a 50 ms delay can be explained as follows: The structure of an optimal filter is such that in the time domain, its weights are largely constant in the time period long after the main pulse signal, which samples the detector noise. As such, any additional signal polluting this time period causes a shift in reconstructed energy roughly proportional to the integral over the signal. Figure 4 shows the crosstalk signal and its cumulative sum as a function of time. Notably, the cumulative sum reaches values of around -130 ADU around 1 ms but is reduced back to roughly 20 ADU for the full record, explaining the small crosstalk shifts for the period from 10 to 40 ms in Fig. 3. However, if the perpetrator photon arrives towards the end of the victim record, only part of the crosstalk signal will contribute to this energy shift. This is equivalent to the cumulative sum in Fig. 4 being aborted at an earlier time. In particular, a crosstalk photon arriving 1 ms before the end of the victim record will cause significantly more crosstalk than a perpetrator arriving 10 ms before the end of the victim record, causing the "bump" in Fig. 3.
By repeating these simulations for a set of perpetrator and victim energies covering the whole X-IFU energy band, we can then generate a 3D interpolation table of the crosstalk shift as a function of time lag as well as perpetrator and victim energy. This table is used by xifupipeline to simulate crosstalk in kilosecond-scale observations of the X-IFU in reasonable timescales [15].
Such model data may also eventually be used to correct the effect of crosstalk on real data, should its representativeness prove sufficient. The reader may refer to [16] for a first attempt at a comparison between laboratory crosstalk data and an older implementation of our models.

Conclusions
Since the original development of tessim, the X-IFU development effort, and as such the scope and detail of the required simulations, has progressed rapidly. As such, the extended scope and depth provided by xifusim has become an essential tool in the instrument's development.
One of the most important features of xifusim has been its modularity, allowing for the rapid implementation of new models as required by instrumental studies. One example of such a development was the switch of the X-IFU multiplexing scheme from FDM to TDM, which required only a new model for the SQUID multiplexer and digital readout electronics, with the rest of the models remaining applicable. The integration of new models in xifusim will continue as necessary-one such example being more detailed modeling of radiative transfer in the X-IFU 's photon absorbers [17]. The granular output and parameter variation features described in Sect. 4 are also an important part of xifusim, with extensive use both during development as a testing and debugging tool as well as for studies focused on individual readout chain components.
As a consequence of its modular design, it is also in principle possible to use xifusim to simulate individual readout chain blocks (such as only a TES) or even other instruments. An example would be the X-IFU 's cryogenic anticoincidence detector [18], which is also based on transition edge sensors-a simulator for this instrument using the xifusim code base is currently under development.
Lastly, while the xifusim source code has so far only been accessible to members of the X-IFU consortium, we also plan a future open source release enabling the use of the simulator or parts of its code in other software for the general community.