PhaseX: an X-ray phase-contrast imaging simulation code for matter under extreme conditions

: We present PhaseX, a simulation code for X-ray phase-contrast imaging (XPCI), specially dedicated to the study of matter under extreme conditions (of pressure and density). Indeed, XPCI can greatly benefit the diagnosis of such states of matter. This is due to the noticeable contrast enhancement obtained thanks to the exploitation of both attenuation and phase-shift of the electromagnetic waves crossing the sample to be diagnosed. PhaseX generates synthetic images with and without phase contrast. Thanks to its modular design PhaseX can adapt to any imaging set-up and accept as inputs objects generated by hydrodynamic or particle-in-cell codes. We illustrate Phase-X capabilities by showing a few examples concerning laser-driven implosions and laser-driven shock waves.


Other Items to Check
• Please note that the original manuscript has been converted to XML prior to the creation of the PDF proof, as described above.The PDF proof was generated using LaTeX for typesetting.The placement of your figures and tables may not be identical to your original paper.• Please carefully check all key elements of the paper, particularly the equations and tabular data.• Author list: Please make sure all authors are presented, in the appropriate order, and that all names are spelled correctly.• If you need to supply new or replacement figures, please upload each figure as an individual PDF file at the desired final figure size.The figure must fit inside the margins of the manuscript, i.e., width no more than 5.3 inches (or 13.46 cm).Confirm the quality of the figures and upload the revised files when submitting proof corrections.

Introduction
In this paper, we present PhaseX, a code for X-ray phase contrast imaging, specifically designed for the generation of synthetic images of samples of matter under extreme conditions (of pressure and density).X-ray phase-contrast imaging (XPCI) is a powerful diagnostic tool that takes advantage of the phase-shift of the electromagnetic wave [1] as it crosses a sample to be imaged.When an object is irradiated with X-rays, the dominant interactions are attenuation, and for the transmitted part, phase-shift.In X-ray attenuation contrast imaging (XACI) the image results from the difference in attenuation among various parts of the sample.Instead XPCI also includes the contribution of the phase shift undergone by radiation as it crosses different parts of the sample.In other words, XACI is related to the imaginary part (β) of the refraction index of matter n = 1 − δ + iβ, while in XPCI the real part (1 − δ) of such an index also plays a role.A careful design of the imaging setup allows maximizing the phase-contrast in the measured image.
Wave interference on the image plane forms characteristic intensity fringes which surround the density variations encountered by the wave-front in the object plane.More in detail, a steep variation in the refractive index induces a perturbation on the wave front that can be converted into a sharp intensity variation on the detector plane [2].Depending on the detection scheme employed, the measured intensity can be proportional to the first or the second spatial derivative of the induced phase-shift.As we will show later in the text, δ, and consequently the phase-shift, is proportional to the electron density.As a result, the measured intensity is proportional to the first or the second spatial derivative of the electron density.
X-ray imaging has several applications in the field of matter under extreme conditions.It is used in experiments on the equation of state of materials [3], on laser driven shock-waves [4][5][6][7][8][9] and on the isochoric heating of metal targets [10].X-ray imaging allows observing the formation and the evolution of hydrodynamic instabilities occurring in "laboratory astrophysics" [11] and the response of lattices under extreme conditions [12].Another important application of X-ray imaging is to monitor the compression of spherical capsules in inertial confinement fusion (ICF) experiments [13][14][15][16][17].
Most of these works were performed with XACI.However, XPCI is attracting growing interest in the field.In contrast to XACI, XPCI can evidence density discontinuities in low-Z materials, which are practically transparent to X-rays [17,18].Moreover, if the measurement requires extremely hard X-rays, XPCI can compensate for the reduction of attenuation contrast [19,20].In particular, XPCI can be a valuable diagnostic tool [12,21] for experiments involving matter compressed by strong shock-waves, which generate sharp density profiles.In addition, using hard X-rays as back-lighter allows to filter the plasma target self-emission [22].
Generating high-quality XPCI images it is important to have small X-ray attenuation.However, this is not sufficient to produce a phase-contrast enhancement.Given an object and the spatial frequency of the feature to observe, we need to adjust the source-object distance, the objectdetector distance and source parameters (spectrum and size) consequently.In particular, the spatial coherence and the source-blurring are functions of these distances, as well as of the source size [23].
In this context, it is therefore crucial to develop a simulation code that can support researchers in the preparation of the experiments and related data analysis.The literature presents several XPCI simulation codes.Some of them are specifically suited for medical purposes [24,25], other codes are general purpose [26][27][28][29].References [26][27][28][29] employ a Monte Carlo method to describe photon interactions, and then use a wave-optics approach to generate the image.However, all these codes work for matter under standard conditions and are not designed to be coupled with hydrodynamic or particle-in-cell (PIC) codes.Kar et al. [9] present an imaging simulation code for plasma experiments entirely based on a geometrical optics approach.By contrast, PhaseX adopts a wave-optics approach.The results of this choice are a better definition of small features and a reduced computational power and time.
PhaseX can support researchers in all the contexts described above, by linking PIC and hydrodynamics codes (whose output quantities are not directly measurable) to the diagnosed quantities.
The code currently handles the propagation based imaging (PBI) scheme [1] and the relative options for spherical and planar wave.We are planning to add extra modules to handle Talbot-Lau and Analyzer-based imaging schemes [1].Thanks to the modular design, we can easily update PhaseX and improve its capability and performance responding to the requirements coming from different users.Access to the code is available on request to the authors.This paper is organized as follow: Sec. 2 describes the model implemented in the code; Sec. 3 describes the code implementation; Sec 4 shows the application of the code to cases of interest for ICF and high energy density physics (HED).The Supplement 1 contains the instructions file used to run one of the simulations shown in Sec.4.2.

Modelling
PhaseX produces a synthetic image which results from the application of the following expression: where the real image I R is the result of the convolution between the ideal image I I (which includes both the contribution of attenuation and phase-shift) and the point spread function of the imaging system (PSF).The latter is the convolution between the source spatial distribution σ S and the detector point spread function PSF D .
Fig. 1 shows the flow chart of the code with its various packages.The code is based on a modular design, where each package executes a set of instructions necessary to calculate one of the components of Eq. (1).Moreover, the same quantities can be calculated following different approximations and procedures which depend on the given experimental set-up.In this section, we will explain the models and their implementations in the different packages and modules.

Geometry
The light wave-front is assumed to be spherical, irradiating from a single point.The reason behind this choice is that the experiments for which this code have been created are based on a point-projection setup.In this configuration, a conical beam illuminates an object and creates an image on a detector at a certain distance.However, for a large source-object distance this model approximates the plane-wave description.
Fig. 2 shows the geometry used.The X-ray beam propagates along the Z-axis, which is common to the three reference systems: source, object, and image.The gray box represents the object and it is placed just in front of the object plane.The latter is placed at a distance R 0 from the source and it is identified with the axis X, Y.The image plane is placed at a distance R 1 from the object plane and it is identified with axis X 1 , Y 1 .⃗ r 0 is the vector connecting the source with a generic point (x, y, z) of the object.⃗ r 1 is the vector connecting the point (x, y, z) of the object with point (x 1 , y 1 , z) of the image plane.The object is illuminated by a spherical wave where k = 2π/λ is the modulus of the wave vector.

Transmission function
To describe the X-ray interaction with matter we use the projection approximation [30].The basic assumption is that the object induces a negligible perturbation on the path of the rays.This means that any deflection occurring to the beam when it propagates inside the object is negligible.This is justified by the fact that the refraction index of X-rays in matter is always very close to 1. Therefore, the amplitude and phase of the wave function on the object plane are determined by the attenuation and phase-shift accumulated along the unperturbed rays.The transmitted wave function is where T(x, y) is the object transmission function.The integral is performed over the volume of the object, δ( ⃗ r 0 , λ) and β( ⃗ r 0 , λ) are the real and imaginary parts of the object complex refractive index.
Eq. ( 3) can be rewritten as where the amplitude describes the attenuation of the X-ray beam intensity induced by the object.The phase term describes the phase-shift induced by the object on the X-ray beam.Wu et al. [31] report that the projection approximation is valid as long as the finest feature to be observed is larger than

√
Tλ, where T is the object thickness.As an example, for an inertial confinement fusion shell with a diameter of 2 mm and an X-ray back-lighter energy of 8.04 keV (copper Kα), the projection approximation holds as long as the finest observable feature is larger than 0.5 µm.This value is beyond the resolution limit imposed by the source size and detector resolution currently achievable in most of the facilities.To summarize, the projection approximation works in the field of application of PhaseX.

Refractive index
Multiple libraries and models are available for the refractive index, but all of them focus only on the extinction coefficient from which opacities are derived [32,33].Only recently, new models [34,35] have started to investigate the behavior of both attenuation and phase-shift.
To properly treat this problem we need to identify the working conditions.In general, the interaction of photons is influenced by the temperature of the material.If the material is cold, there is no interaction with free electrons, while, if the material is hot and ionized, the interaction with free electrons is dominant.
In case of cold matter, the decrement of the real part δ and the imaginary part β of the refractive index n can be written as: where Z j and A j are the atomic number and the mass number of the elements that compose the object, w j is their weight fraction, f ′ j is the real component of the atomic factor [36], N A is the Avogadro number and r e the classical electron radius.The parameter σ j (E) in Eq. (7b) is the cross section of the interaction process between a photon of energy E and the element Z j .It takes into account photoelectric absorption as well as Rayleigh and Compton scattering processes [37].
For fully ionized matter, the attenuation coefficient is usually obtained from tabulated opacities.As for the phase-shift in absence of magnetic field, we have [38] ( where n e is the electron density and n c is the plasma critical density (maximum electron density at which the light can propagate).If matter is partially ionized, the description of X-ray interaction in general requires more complex treatment [39].
The XPCI requirement that the photon energy range must be far from the absorption edges helps to extend the above models towards the subject of this work.Hu et al. [34,40] show that for low-Z materials and photon energy above the K-edge the opacity varies strongly with density but very weakly with temperature.The main effect of the temperature is the absorption edge shift [40].
With the same assumption (photon energy range far from the absorption edges), we can assume that the electrons inside the atoms are essentially free [30] and Eq.(7a) reduces to where c is the light speed, r 0 is the classical electron radius and h is the Planck's constant.
If we increase the photon energy until the electron density falls below the critical density, Eq. ( 9) reduces to Eq. ( 8) or, in a form more familiar to plasma physics (for n e ≪ n c ), Figure 3 shows the result of Eqs.(7a), ( 8) and (9).As test material we used polystyrene (density ρ = 1.05 g/cm 2 ).We can distinguish two different behaviors depending on the energy of the photons relative to the carbon K-edge (284 eV).At photon energies lower than the K-edge the discrepancy between the solid-cold and fully ionized or quasi-free models is >40%.At photon energy ≃ 1 keV the discrepancy is ∼ 5% and it falls below 3% at higher photon energy (≫ K-edge). Figure 3(d) (at constant density) shows that the three models have a different behavior below the K-edge while they overlap at higher photon energies.Figure 3(c) does not show significant differences between the fully ionized and the quasi-free model.Moreover, Kar et al. [9] found that above the absorption edge the phase-shift term for a solid CH-plastic at room temperature agrees with the first-principles opacity table [40] model of the same material at 5000 K.
To summarize, above the absorption edge the solid-cold model can reproduce the X-ray matter interaction at conditions typical of high energy density experiments.Several works [9,41,42] used these consideration to successfully reproduce XPCI experimental images of laser-driven shock-wave in plastic materials.
Regarding the photon energy range, we should notice that above 20 keV Compton scattering is the predominant mechanism.For this reason, the Compton scattering is included in PhaseX.The attenuation in the solid-cold model (Eq.(7b)) takes into account the photoionization, Compton and Rayleigh scattering cross-section.In general the opacity tables available for matter under extreme conditions include the scattering process.Nevertheless, we are aware that a wave-optics model cannot track the scattered photons, but it treats scattering simply as a reduction of the transmitted beam.However, several works in literature [24,43,44] showed that wave-optics can reproduce the experimental image of a plastic sample (low Z) at photon energy higher up to 20 keV.Wu et al. for X-rays energy in the range of 60-500 keV approximated the attenuation cross section by those of Compton scattering, with an error ranging from 0.16% up to 10% [45].The requirement is a finer sampling of the propagator and object transmission function to simulate properly the higher spatial frequency occurring at this energy.

Phase-contrast
The transmitted wave, evaluated on the object plane, propagates freely in vacuum up to the image plane.To describe the diffraction process which occurs in the free space we use a wave-optics formalism.The reason for this choice relies on the limitations imposed by a ray optics approach.Peterzol et al. [44] proved that the ray-optical approach is valid as log as ϵ ≪ 1, with ϵ the ratio between the quantity λπR 1 M (where M = (R 1 + R 0 )/R 0 is the magnification) and the square of the total resolution of the imaging setup, including also the effect of the finite source size.
In a typical experiment the parameters of the imaging setup are R 1 ≥ 1 m and M ≥ 10.If we consider the copper Kα as a probe, the ray-optical approach only works when the resolution of the imaging setup is worse than 70 µm.However, Peterzol et al. reported that already with ϵ = 0.26 the ray-optical approach showed a significant disagreement between the experimental data and simulations.This means that in our example, the ray-optical approach cannot simulate imaging setup with resolution better than 137 µm.
To describe the evolution of the transmitted wave, we use the Fresnel-Kirchoff integral [46]: To calculate the intensity on the detector plane I = |ψ 1 | 2 it is sufficient to substitute Eq. ( 4) into Eq.(11).
If the wave propagates along a distance longer than the transverse dimension of the sample, the second and the third terms inside quantities r 0,1 = {R 2 0,1 + (x 0,1 − x) 2 + (y 0,1 − y) 2 } 1/2 are smaller than R 0,1 .Under this assumption, Eq. ( 11) reduces to the convolution formulation of the Fresnel diffraction approximation [30].The Fresnel approximation transforms the Fresnel-Kirchoff integral into a convolution integral, in our case the convolution between the object's transmission function and the Fresnel propagator.At the end, by using the properties of the Fourier transform we can solve the Fresnel-Kirchoff in the Fourier space: where F and F −1 are the forward and backward Fourier transforms, and

PSF
Source dimension and detector resolution are introduced via a convolution product at the end of the simulation, as Eq. ( 1) shows.In particular, for point projection imaging, the source distribution σ S is rescaled [19] by the source magnification R 1 /R 0 .

Modules
Figure 4 shows the modules implemented in each package of PhaseX.The gray box gathers packages whose modules have different versions allowing to take into account the source spectrum and the object composition.Sec. 2 refers to a monochromatic source.However, for a broadband spectrum source Eq. ( 1) becomes [43]: where I I,λ is the ideal image computed for each wavelength channel, and w λ is the weight of the channel that takes into account the source emission intensity and the imaging system spectral response.In practice, Eq. ( 13) means that the code repeats the procedure described by the flowchart in Fig. 1 for each wavelength channel.At the end it sums all the images and it convolves the result with the system PSF.The main application of PhaseX is the the study of HED physics, so the object description is typically obtained from density maps obtained from hydrodynamic simulations.The density map has one, two, or three dimensions depending on the object symmetry, and this explains the 2D and 3D modules in the transmission function package (Fig. 4).We did not implement a 1D module because we treat it as a special case of the cylindrical symmetry case (2D).
In addition, hydrodynamic codes can either be Lagrangian or Eulerian.In the first case, PhaseX employs a routine to remap the code mesh on an equally spaced orthogonal mesh.In both cases, the hydrodynamic quantities needed on each PhaseX mesh point are density, electron temperature and material composition.
The "Refractive index" package implements three modules: "Solid" calculates the refractive index via Eq.( 7), "Free electron" calculates the refractive index via Eq.( 9) and the module "Warm" that calculates the refractive index for material at a temperature higher than the standard one.In particular, the quantities required in Eq. ( 7) are extracted from the external library xraylib [37].
Regarding the "Warm" module, it interpolates external opacity tables to obtain β, in this case function of temperature and density.To calculate δ, the module uses Eq. ( 9).Moreover, the module allows to use the solid-cold approximation to obtain the refractive index in regions of the object that fall outside the provided opacity table.In Sec. 4 we provide two examples generated with the "Warm" module.
The "Phase-contrast" package generates two outputs, one is the image which takes only the attenuation into account, and a second image that takes into account both attenuation and phase-shift.
The last package "PSF" contains the two modules that evaluate the source effect and the detector PSF.Both modules currently are based on Gaussian and Lorentz distribution functions.However, it is possible to add a user-defined function that better reproduces the PSF of the real imaging system.

Implementation
The modular architecture of PhaseX ensures an easy and fast update of the code.In this way, we can adapt the code to different objects and experimental setups.
Most of the code is written using Python (version 3) for it is open-source and has a user-friendly architecture.Moreover, Python allows using external libraries written in different languages.We used this capability to write the transmission function modules that calculate the transmission function using a ray-tracing algorithm.
The transmission function modules calculate the transmission function (Eqs.( 5) and 6).These are the line integral of δ and β along the X-ray path that connects the source to a point contained on an ideal plane located behind the object.To do so, the module uses a ray-tracing algorithm.To better accomplish this task, we wrote them in FORTRAN, implementing a multi-threading parallel construct with OpenMP.A ray-tracing algorithm requires multiple nested loops and conditional statements, all of them are computationally expensive and FORTRAN can run them much faster than Python.Moreover, Python (via its modules NumPy) can saturate the available memory when it performs vectorized calculation over arrays.The FORTRAN module is wrapped inside the main Python code.
All these features allow PhaseX to run on a small system like a laptop.The parameters and instructions necessary for simulation are given as a set of keywords contained in a text file.Supplement 1 shows the input file used for the example presented in Sec 4.2.

Applications
We used an earlier version of PhaseX (not including the treatment of warm matter) in the preparation and analysis of the experiments described in Refs.[41,42].The main use of PhaseX concerns dynamic situations.However, simulating the hydrodynamics occurring in laser-matter interaction is extremely difficult.Hydrodynamics has non-linear dependency on multiple parameters, and most of them cannot be measured properly in an experiment.Using these experiments as an initial benchmark for PhaseX could be risky.A discrepancy between simulated and measured images could be induced by an "error" in the hydrodynamic simulation used as input for PhaseX.To limit the source of "errors" only to PhaseX, we performed first tests using static objects.We tested the code on a nylon wire (see Fig. 2 of Ref. [41] ) and a solid cylinder (see Fig. 4 of Ref. [42]).Once we had validated the code in this static environment, we performed an experiment on a plastic cylinder compressed by a shock-wave Refs.[41,42].
In both cases we used the same backlighter and the same imaging setup to acquire images.
In the above tests we used the solid-cold model of the refractive index.Such an approximation could fail when the bulk temperature of the object is higher than the room temperature.To overcome this problem, we have implemented the module "Warm" (Sec.2.3).
To show the capabilities of this new module, we illustrate and discuss here three different cases.The first two cases concern spherical implosions, the third one reproduces the interaction of a shock-wave with an obstacle.The evolution of the objects in the three cases was simulated with the hydrodynamic code DUED [47].To generate the opacity tables used by PhaseX, we used the web interface [48] to the TOPS code [32].
In all cases the distance from the X-ray source to the object was 2.5 cm and the distance object-detector 150 cm.We assumed a monochromatic X-ray source at 8.04 keV (the copper Kα line) with a Gaussian spatial distribution.Regarding the full width half maximum of the distribution, we assumed 10 µm for the spherical implosion cases, and 5 µm for the shock-wave interaction.As detector, we used an imaging plate with intrinsic resolution of 100 µm.
We applied XPCI in dynamic situations.However, image blurring due to plasma motion is negligible in typical cases, even when matter velocities reach values as large as 500 km/s.During the backlighting pulse (with duration shorter than 10 ps), the plasma moves less than 5 µm.This value is below the achievable image resolution reported in the present examples.

Spherical implosions
We first show spherical implosions of two different objects, a plastic (CH) sphere and a plastic spherical shell filled with hydrogen gas driven by spherically symmetric laser pulses.Table 1 shows the specifications of the two objects.These objects are irradiated with a flat-top laser pulse (time = 0.9 ns energy = 14.5 kJ) and wavelength 354 nm.Figures 5 shows the images of the two objects generated 1 ns after the beginning of the laser ablation for the capsule and 1.3 ns for the shell respectively.The label solid indicates the image generated by using the solid-cold model (module "Solid" inside the code).The label warm R and warm P indicate the images generated with the module "Warm", where R and P indicate Rosseland and Planck mean opacity table respectively that we used to obtain β.Regarding the choice between the two frequency-averaged methods, generally Planck mean is used in calculating the emitted flux whereas Rosseland is used in studying transport in optically thick plasma [49].However, in the present work we did not see a significant difference between the intensity profiles generated with the two different opacities.For comparison we show also the XACI (pure attenuation image) of the same object obtained by using the solid-cold model.As we said above, the interfaces matter-vacuum and shockedunshocked matter are blurred.This is evident in the shell object (Fig. 5(b)), the difference in terms of X-ray transmission between the hydrogen gas and the plastic shell is ∼ 5%.The result is that XACI has a lower spatial resolution than XPCI.
Figure 6 shows the radial profiles of density and electron temperature of the hydrodynamic simulation (a) and the imaging simulation (b) for the sphere (Fig. 5(a)).Figure 6(a) shows that the core of the sphere is close to the initial conditions (solid density and room temperature).This combination of density and temperature falls off the tabulated opacity area, the minimum temperature value that we can get from TOPS is 0.5 eV.To avoid extrapolation errors, we inserted in the code a function to switch from opacity table to, as example for this case, solid-cold model for the cells which temperature is outside the given opacity table.shows the radial profiles of the XPC-images (solid lines) over imposed to the corresponding pure attenuation profiles (dotted lines).The phase-contrast effect enhances the contrast at interfaces, so that it is easy to recognize the shocked region.
Figure 7 show simulations results for the plastic shell filled with hydrogen gas (Fig. 5).The temperature and the density profiles are different from the previous test object.In particular, the hydrogen temperature (Fig. 7(a)) oscillates between 50 eV and 400 eV.The solid-cold model will over estimate the attenuation, so we used the opacity tables (for hydrogen and CH-plastic) for the entire object volume.Fig. 7(b) shows the resulting simulated intensity profiles.Besides a reduction of the attenuation over the entire radius, we clearly see how the solid-cold model overestimates the attenuation not only for the hydrogen core, but also for the corona.
We should notice that, in both cases, the difference between a full solid-cold approach and the warm options results in an average increase of the relative intensity of ∼ 1% only.

Shock-wave interaction
The third case concerns the interaction of a nearly planar shock-wave with a dense object embedded in a low density foam.The shock is driven by a laser pulse irradiating one of the bases of a cylinder consisting of an outer CH plastic layer (ρ = 1.05 g/cm 3 ) filled with a foam (ρ = 0.10 g/cm 3 ).A smaller plastic cylinder (ρ = 1.05 g/cm 3 ), coaxial with the main cylinder is embedded in the foam as shown in Fig. 8(a).More in details, the cylinder has a diameter of 1.1 mm and a length of 0.5 mm.The plastic layer has inner diameter of 1.0 mm and thickness of 0.05 mm.The smaller cylinder (acting as obstacle for the shock-wave) has diameter of 0.2 mm and length of 0.1 mm.The plastic layer on the right hand side is irradiated by a laser pulse with energy of 1.25 kJ, time duration 1 ns and wavelength 532 nm.The laser intensity profile is supergaussian ∼ exp[−(r/r 0 ) m ] with index m = 8 and r 0 = 0.375 mm.The peak intensity is 3×10 14 W/cm 2 .The PhaseX input file for this case is presented in Supplement 1.
Figure 8(b) shows the density map at 7.0 ns after the beginning of the laser pulse.We see that when the shock impacts against the inner cylinder and crosses it the central part of the shock-front slows down forcing the main shock-front (inside the foam) to collapse towards the axis of the cylinder (Fig. 8 label 1).Moreover, the flow along the foam-solid plastic interface (Fig. 8 labels 1 and 2) is highly sheared.
For the imaging simulation we used the option "warm" with Rosseland opacity.Figure 8(c) shows the XACI image while Fig. 8(d) shows the XPCI image.Also in this case XPCI enhances the contrast at the interfaces, allowing to visualize the surface of the plastic cylinder facing the laser (Fig. 8 label 3), acting like a piston compressing the foam.Moreover the contrast enhancement allows to visualize the two shock-fronts, the main one inside the foam (Fig. 8 label  4) and the second one inside the inner cylinder (∼ 150 µm behind the main shock-front).Close to the cylinder axis we see the main shock collapsing and closing behind the inner cylinder (Fig. 8 label 1).XPCI makes visible the sheared flow along the interface plastic-foam (Fig. 8 labels 1 and 2).In the XACI image (Fig. 8(c)), the contrast is lower; consequently some interfaces are faint and the sheared flow is not visible.The plastic-foam interface (Fig. 8 label 3) and matter-vaccum (Fig. 8 label 5) are faint.The last one for example is important to evaluate the position and consequently the velocity of the shock.

Conclusion
In this work, we presented PhaseX, a code for X-ray imaging simulation.The code generates synthetic images with and without phase-contrast.Its modular design allows adapting the code to the imaging setup.This feature is crucial during the experiment design and later to analyze the acquired data.
Thanks to the different models implemented, PhaseX can handle simulations of warm materials, which is essential to study matter under extreme conditions.We have shown three applications of PhaseX to cases of interest for ICF and HED.In the three simulations, we modelled the imaging setup on the parameters available at large-scale facilities.For all cases, we have shown that XPCI achieves a higher definition and contrast than XACI, with a consequent increase in spatial resolution.In the first two cases, the solid-cold model overestimates the attenuation for temperature values above the room temperature.The result is a reduction of the contrast at the interface compared to the contrast obtained with the warm models.
PhaseX is a powerful tool that could help researchers to design experiments that employ radiography diagnostics.To accomplish this task we will keep updating the code by implementing in future release modules that handle different detection schemes (Talbot-Lau and diffraction enhanced imaging) and X-ray optics (crystal and refractive optics).As we said at the beginning of this work, the object emits light (also in the X-ray spectrum) that can cover up the diagnostic signal.We are working on a module that calculates the intensity map of the target self-emission.

Fig. 1 .
Fig. 1.Flow chart of the code, the colored boxes indicate the different packages that compose the code.Symbols are defined in the main text.

Fig. 2 .
Fig.2.Geometry display of the diffraction process.The object (dark gray box) is placed at a distance R 0 from the source S and R 1 from the image plane (X 1 , Y 1 ).The X-ray beam propagates along the Z-axis, which is perpendicular to the object and image plane.

Fig. 3 .
Fig. 3. Comparison between the models described in the text to calculate δ, test material polystyrene ρ = 1.05 g/cm 3 .The color maps show the discrepancy ∆ r = (δ 1 (E, ρ) − δ 2 (E, ρ))/δ 1 (E, ρ) between the models as a function of the photon energy and the mass density expressed in unit of the solid density.a) solid-cold vs fully ionized, b) solid-cold vs quasi-free, c) fully ionized vs quasi-free; the vertical dot-dash line indicates the carbon K-edge energy.d) zoom of δ(E) around the C K-edge at solid density.

Fig. 4 .
Fig. 4. Packages and modules of the code.

Fig. 5 .
Fig. 5. Spherical implosion: XACI and XPCI images for the plastic sphere (a) and the shell (b).For each image: Abs is the pure attenuation image, warm R XPCI using Rosseland opacity, warm P XPCI using Planck opacity, solid XPCI using solid-cold model.

Figure 6 (
Figure 6(b)  shows the radial profiles of the XPC-images (solid lines) over imposed to the corresponding pure attenuation profiles (dotted lines).The phase-contrast effect enhances the contrast at interfaces, so that it is easy to recognize the shocked region.Figure7show simulations results for the plastic shell filled with hydrogen gas (Fig.5).The temperature and the density profiles are different from the previous test object.In particular, the hydrogen temperature (Fig.7(a)) oscillates between 50 eV and 400 eV.The solid-cold model will over estimate the attenuation, so we used the opacity tables (for hydrogen and CH-plastic) for the entire object volume.Fig.7(b) shows the resulting simulated intensity profiles.Besides a reduction of the attenuation over the entire radius, we clearly see how the solid-cold model overestimates the attenuation not only for the hydrogen core, but also for the corona.We should notice that, in both cases, the difference between a full solid-cold approach and the warm options results in an average increase of the relative intensity of ∼ 1% only.

Fig. 7 .
Fig. 7. Laser-irradiated plastic shell filled with H 2 gas at 1.3 ns.The vertical dotted line shows the interface H-CH; a) temperature and density radial profiles; b) XPI (solid) and XACI (dotted) radial intensity profiles.

Fig. 8 .
Fig. 8. Shock interaction: a) density map in the plane ZR at time 0; b) density map 7 ns after the beginning of the laser ablation; c) XACI image of the object showed in b); c) XPCI image of the same object.Labels: 1) collapsed shock; 2) sheared flow; 3) interface plastic-foam; 4) main shock; 5) interface matter-vacuum.