An interactive web-based tool to guide the preparation of neutron imaging experiments at oak ridge national laboratory

An interactive web-based tool has been developed at Oak Ridge National Laboratory (ORNL) to guide the end-user sample preparation for neutron imaging experiments. The tool is capable of estimating transmission through the sample using the cold neutron spectrum at the High Flux Isotope (HFIR) CG-1D imaging beamline. It can also predict the position and height of the resonance peaks at the Spallation Neutron Source (SNS) SNAP beamline when performing neutron resonance imaging with neutron energies higher than 1 eV. This tool provides robust and user-friendly sample input and utilizes measured/simulated beam spectrum at corresponding beamlines for accurate transmission/attenuation calculations. By using this tool, users who are interested in neutron imaging can test their ideas promptly and can better prepare samples for their experiments.


Introduction
For the past several decades, neutron radiography and neutron computed tomography (CT) have been proven to be powerful techniques that provide unique insights in many research fields [1][2][3][4][5][6][7], including biology [8][9][10], archeology [11][12][13], additive manufacturing [14][15][16][17][18], energy storage [19][20][21][22][23][24][25][26][27][28], geology [29][30][31][32][33][34], etc. As a result, the neutron imaging community has grown rapidly and is attracting an increasing number of researchers who may not necessarily have neutron expertise. Thus, one challenge is to ensure the feasibility of a proposed experiment for neutron imaging. This process typically involves the calculation of expected neutron transmission and the evaluation of contrast between the features of interest within the bulk material. There are a few online tools developed by research facilities, such as those available from the National Institute of Standards and Technology (https://www.ncnr.nist.gov/resources/activation/), the Jülich Centre for Neutron Science (http://apps.jcns.fz-juelich.de/toolbox/nXsection.php) and Technical University of Munich (https:// webapps.frm2.tum.de/intranet/neutroncalc/), for example, that can be used to assist this process for a reactorbased neutron source. However, there are some limitations in each of them in terms of robust estimation for neutron imaging measurement, such as steep learning curve for proper sample input, lack of the specific beam line spectrum for accurate transmission calculation, limited capability to vary the isotopic ratio to increase contrast between different sections of a sample. Additionally, with the development in time-of-flight techniques, one can access epithermal neutrons (neutrons with energies >1 eV) and extract energy/wavelength-dependent information such as elemental and isotopic contents using neutron resonance imaging [35][36][37][38][39][40][41][42][43]. A few online nuclear databases, such as the Java-based Nuclear Data Information System (JANIS), the Nuclear Data Service and National Nuclear Data Center, are available, but a user-friendly tool is missing in this community.
A Python library called ImagingReso [44], has been previously developed by our team to enable easy access to energy-dependent neutron cross-sections. This library aimed at developing the necessary infrastructure for the future web-based interface that is discussed in this manuscript.
Dash (https://plot.ly/dash/) is a Python framework developed by Plotly (https://plot.ly/python/) to assist in building web applications. It is written 'on top of' Flask (one of the most popular Python web application frameworks), Plotly.js [45], and React.js [46]. It simplifies the interactions with the technologies and protocols that are required to build an interactive web-based application. So, a modern user interface (UI) can be easily Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI. constructed using a piece of Python code. Additionally, Dash renders the UI in a browser, which makes it crossplatform and mobile friendly. In this work, we took the advantages that Dash provides and developed an interactive web-based application, called Neutron Imaging Toolbox (NEUIT, recently renamed as interactive NEUIT or iNEUIT), to accelerate neutron imaging experiment planning for both neutron resonance and white beam imaging at our facilities, the Spallation Neutron Source (SNS) SNAP (BL3) and the High Flux Isotope Reactor (HFIR) CG-1D Imaging beamline, respectively. The SNS provides access to energy-resolved data while the HFIR offers a time-average cold neutron flux (white-beam) data. The code is open source and is accessible at the following url: https://github.com/ornlneutronimaging/NEUIT.

Usage and functions
This web application currently provides three main functions, (i) white-beam signal simulation available at CG-1D, (ii) resonance signal simulation available at SNAP, and (iii) composition converter.

Neutron white-beam signal simulation
This web application focuses on the estimate of neutron transmission/attenuation. Figure 1(a) displays a screenshot of the input section. The first element in this section is a dropdown menu to select the beamline where the measurement will be carried out. Then the corresponding beam spectrum (neutron flux versus wavelength) is loaded behind the scene for subsequent calculations. In figure 1(a), the CG-1D imaging beamline or 'IMAGING (CG-1D), HFIR' is selected as an example. It's worth noting that this dropdown menu can also accommodate spectra of other neutron imaging beamlines if implemented in future updates. The second element in this application is the sample input table which takes the effective chemical formula, thickness of the sample in the beam path and the sample density. Such sample input logic is universally utilized in other web applications, because complex sample input can be easily defined by simply adding another layer of material using the '+' button. The third part is an interactive table that can be activated by checking the box labelled 'Modify isotopic ratios', to modify isotopic ratios of specific elements and thus allow optimization of the contrast between different sections of the sample. After hitting the 'SUBMIT' button, the transmission calculation is performed using Beer-Lambert law [47]: where N i is the number of atoms per unit volume of element i, d i is the effective thickness along the neutron path of element i, σ ij (E) is the energy-dependent neutron total cross-section for the isotope j of element i, A ij is the abundance of the isotope j of element i. N i can be calculated using: where N A is Avogadro's number, C i is the molar concentration of element i, ρ i is the density of element i, m ij is the molar mass of the isotope j of element i. Then the beam spectrum of the pre-selected beamline is used to populate the transmission and/or attenuation as shown in figure 1(b). A 'sample stack' section is automatically generated at the end to summarize the different material layers entered by the user.
In figure 1, water is entered as a sample. The neutron transmission through 2 mm of water is estimated to be ∼54.975%.

Neutron resonance signal simulation
The second application focuses on plotting energy-dependent neutron absorption in the epithermal range (i.e. for neutrons of energies >1 eV). In this range, many nuclides show drastic changes in cross-sections at certain neutron energies. This phenomenon is called a resonance, is essentially a unique response of a nuclide and can then be used to identify and quantify elements/isotopes. Since neutron resonance imaging is energy specific, the first element of this app is used to set the plotting energy range, such as minimum and maximum neutron energies and energy step/increment, as illustrated in figure 2(a). An interactive table is used here to take either energy in eV or wavelength in Å. After selecting the energy range, the remaining values will update automatically to show energy related characteristics such as the speed of neutron, time-of-flight (i.e. the time it takes neutrons to travel from the source to the detector), and the neutron classification. Next, the sample input table is used to gather the sample information similarly as the white-beam application. After pressing the 'SUBMIT' button, ImagingReso functions are called to retrieve energy/wavelength dependent neutron cross-sections from the ENDF nuclear database [48,49], and an interactive plot is generated in the result section, as seen in figure 2(b). Radio buttons, above the attenuation versus energy plot, are available to change the x and y axes plotting parameters, based on user preference. Using the Plotly library, the resonance plot of individual isotopes or elements (different colors in the legend, see figure 2(b)) in the sample can be shown or hidden individually.
In figure 2, silver and iodine are entered as a bilayer sample, energy-dependent attenuation for each isotope of silver and iodine, respectively, is computed to assist with the optimization of the transmission through the sample and the neutron energy range that needs to be selected for these measurements.

Composition converter
This web interface performs conversions between atomic and weight percentage. Most importantly, an effective chemical formula of a complex sample can be generated to facilitate the interactions with the previously described web applications. Since most materials are defined in weight %, one can easily calculate the corresponding chemical formula that is needed for the transmission calculation tools. In figure 3, a mixture of B 4 C and SiC is used as an example. Once the chemical formulae and weight (in g) are entered, isotopic content can be changed ( figure 3(a)). The output provides the equivalent formula in atomic % ( figure 3(b)). The reverse calculation is also possible if 'Atoms (mol)' are selected before entering the sample composition (see figure 3(a)).
In figure 3, a homogeneous mixture of B 4 C and SiC is entered as input. The code calculates the equivalent atomic percentage of the mixture. A mixture of 50 g B 4 C and 50 g SiC contains 42.051 at% B 4 C and 57.949 at% SiC. These later values can be readily used to calculate cold or epithermal neutron transmission using the previously described tools.

Conclusions
To better serve the growing neutron imaging community, we developed an easy-to-use web-based tool to guide sample preparation and experiment planning for both white-beam and energy-dependent neutron imaging measurements at ORNL. A sample of complex composition, such as concrete, solutions, multiphase samples, etc, can be easily entered as layers of the different components. Modification of isotopic ratios can be easily realized. Users can simply and intuitively interact with the web applications to evaluate the feasibility of their experiment as far as transmission is concerned. This tool greatly reduces the experimental planning effort/time required for both the instrument team and users.