Locust: C++ software for simulation of RF detection

The Locust simulation package is a new C++ software tool developed to simulate the measurement of time-varying electromagnetic fields using RF detection techniques. Modularity and flexibility allow for arbitrary input signals, while concurrently supporting tight integration with physics-based simulations as input. External signals driven by the Kassiopeia particle tracking package are discussed, demonstrating conditional feedback between Locust and Kassiopeia during software execution. An application of the simulation to the Project 8 experiment is described. Locust is publicly available at https://github.com/project8/locust_mc.


Introduction
The Locust software package [1] is a simulation tool developed to model the response of an antenna and receiver to time-varying electromagnetic fields. Its purpose is to generate data files formatted identically to those measured with an RF receiver and digitizer in the laboratory, thereby allowing for detailed calibration and simulation of physical measurements relying on RF detection techniques. Written in C++, the software is modular and extensible to allow for algorithmic implementation of various RF receiver configurations. The sensitive frequency range of Locust's detection is arbitrarily flexible. The simulation accepts a calculated electromagnetic signal as input, the form of which can be a sinusoidal waveform or an arbitrary externally-defined signal, and places it into a software object named "LMCSignal". A collection of flexible classes called generators are available to the user for sequential configuration; these generators are named with the prefix "LMCGenerator" and represent components of an RF receiver. Figure 1 shows a flow diagram with the classes that comprise the central function of Locust. Locust presently has two main modes of operation available through appropriate selection of "LMCGenerator 1" in Figure 1: It can independently generate an ideal signal to use as input to its receiver, or it can instead wait periodically for an external electromagnetic signal from another software package. Both modes of operation are represented in Figure 1, with the functionality of the first generator block to be expanded to accommodate external signals in Section 3. Section 2 will discuss the first running mode using an internally generated signal. Within the context of the Locust framework, the characteristics of the signal will be observed as it traverses the components of a simulated receiver, is digitized, and is then processed after Locust with the Katydid [2] analysis software. Section 3 will refer to the second running mode in which Locust is integrated with another numerical model, an electron cyclotron orbit simulation performed with the Kassiopeia [3] software package.
When considering how to model RF/microwave measurements, a question likely arises as to why a new simulation tool is needed. The general reasons are for control and adaptability. While there are presently several nonlinear time-domain RF circuit simulation tools that are commercially available (e.g. [4][5][6]), as well as EM field solvers (e.g. [7][8][9][10]), co-simulation frameworks that are driven by both tasks in cooperation are not as widely developed. Additionally many commercial simulation packages are at least partially closed-source, which limits their use as modular components in multistep calculations. Further constraining the available options is the need for a straightforward, open-source interface allowing for arbitrary input from detailed physics models, as well as for data acquisition libraries that generate output with modifiable format. The above criteria, along with a scarcity of suitable solutions, have motivated the development of Locust. Locust supports highly adaptable computations in both the time and frequency domains, which allows for RF spectral interpretation of stochastic processes. Of note is its initial application to the Project 8 experiment, an endeavor to constrain the effective electron neutrino mass by way of cyclotron radiation emission spectroscopy (CRES) [11][12][13].
In the Project 8 experiment, decay electrons emit cyclotron radiation in a 1 T magnetic field. Of particular interest is the region in the tritium beta spectrum near the 18.6 keV endpoint where the modification of the decay phase space by a non-zero effective neutrino mass becomes most significant. Electrons emit radiation at frequency where e is the charge of the electron, B is the magnetic field strength, m e is the mass of the electron, the Lorentz factor is γ = (1 + K/m e c 2 ), K is the kinetic energy of the electron, and c is the speed of light in vacuum. As such, the experiment is sensitive to a range of electron energies that includes monoenergetic conversion electrons near 30 keV from 83m Kr. As many of the first commissioning runs in Project 8 were tuned for detection of 30 keV electrons [12], Section 3 shows a working Locust example comparing signals from 30 keV electrons in simulation and laboratory data.

Software flow
The simplest type of input to Locust is an electric field sinusoidal in time. The sinusoid can be defined as an arbitrary test signal by the user, or it can be configured to represent the properties of a theoretical model. Non-sinusoids are also compatible with the simulation approach. Referring to the diagram of classes in Figure 1, the flow of the software begins in the top of the left column where the simulation properties are defined. Properties include sampling frequency, record size, number of channels, and paths to output files. Within these constraints the LMCSignal object is initialized as an array of complex voltages. Following initialization, the LMCSignal object is passed through generator blocks "LMCGenerator 1" through "LMCGenerator N". Generators 1 through N are ordered to allow initial population of the LMCSignal object in Generator 1, analogous to sampling a signal in the laboratory, followed by additional operations such as anti-alias filtering and downsampling in Generators 2 through N. Certain generators, such as that for Gaussian noise as in Section 2.2.2, can be configured without the need for filtering or downsampling and may be implemented either last in the sequence or alone. In fact, Generators 1 through N are not required by the software at all; if these blocks were removed from Figure 1, the remaining simulation would output a time series of voltages all equal to 0. Digitization and subsequent writing to disk occurs in the two blocks in the far right column. The remainder of Section 2 will describe the steps in the generation, filtering, digitization, and processing of a simulated laboratory signal in more detail.

Simulation of signal generation
With a sinusoidal electric field as input, Locust first calculates the response of the antenna and stores the voltages in LMCSignal. Voltage amplitude and phase are computed from the incident fields. The voltage amplitude V 0 is derived from the incident electric field amplitude |E inc | by where the antenna factor A F , in units of 1/m, represents the gain of the antenna in converting from an incident electric field to an induced voltage across the antenna terminals. If the input signal is known in units of power P instead of V/m, then the conversion goes as where R is the antenna load impedance and is typically 50 Ω. The simulated voltage phase φ advances monotonically and discretely as with f ′ as the time-dependent frequency calculated at the location of the antenna, and ∆t the time between voltage samples. If there are n >1 propagating fields or noise fields incident at the antenna at time t, then the induced complex voltageṼ RF (t) is where the jth propagating or noise field induces a voltage with magnitude V 0,j (t) and phase φ j (t).
The phase-sensitive voltages are represented by the in-phase V I and quadrature V Q components V Q (t) = V 0 sin(φ(t)).
While this definition of the voltages at the antenna terminals is useful for concrete discussion, in the simulation they are typically not calculated in the RF frequency band. Instead, as will be explained in Section 2.2.1, the voltages are first sampled in the intermediate frequency (IF) band in terms of their mixing product in LMCGenerator 1 in Figure 1. This improves efficiency by avoiding the need for sampling in the RF frequency band, which requires more intensive computing resources.
2.2.1. Receiver A minimal receiver in Locust can in principle be a single generator in which voltages are sampled and then immediately digitized. However, depending on experiment design and computing resource availability, more complexity may often be appropriate. A realistic Locust receiver chain typically consists of a mixer with local oscillator at frequency f LO , a low-pass filter, and a downsampling stage as shown in Figure 2. The downsampling reduces the sampling frequency by a factor of M by discarding every M-1 out of M samples (e.g. [14]). The signal voltages are sampled as the mixing product where V RF (t) is the real part of the incident RF signal and φ LO (t) is the phase of the local oscillator signal. If V RF (t) is a sinusoidal waveform with phase φ RF (t), then V RF (t) = V 0 cos(φ RF (t)) and Equation 8 can be written as The voltages in Equation 9 can optionally be sampled without the upper sideband at phase φ RF (t) + φ LO (t) as This omission of the upper sideband is analogous to attenuation by an ideal low-pass filter in the receiver chain. Both φ RF (t) and φ LO (t) are typically calculated with Equation 4, using f ′ (t) and f LO to advance φ RF (t) and φ LO (t) in time, respectively. Depending on experiment design, φ RF (t) can accumulate at varying rates. To accommodate any modulation, voltages are typically sampled at a rate 10× higher than the desired sampling frequency f S . This allows for accurate representation of unwanted high-frequency spurious signals between f S /2 and 10f S /2, making the signals suppressible using a low-pass filter with a threshold near the Nyquist frequency f S /2 [15,16]. Without the fast sampling rate the spurs can alias to frequencies below ∼ f S /2, where they will not be removed by the low-pass filter [15,16]. Following the low-pass filter is the downsampling stage, which reduces the fast sampling frequency back down to f S .
A receiver chain such as the example above can be replicated in the simulation to accommodate multiple digitizer channels. The number of channels is specified in Locust by way of an externally-defined parameter.
where V Imag and V Qmag follow a normal distribution with standard deviation √ k B T f S where k B is the Boltzman constant, T is the noise temperature, and f S is the sampling rate after downsampling.

Digitization and Signal
Processing Before signals are written to disk they are digitized using parameters that can be matched to the data acquisition hardware being simulated (e.g. bit depth, and the voltage range and offset). The I and Q components are digitized separately and stored as complex integer values. The default file type is the "Egg" file, a file standard that was developed by the Project 8 collaboration based on the Hierarchical Data Format, version 5 [17]. Egg files are designed for storing time-series data from one or more data sources such as digitizer channels. They are created by Locust using the Monarch library [18], a C++ library that includes an interface for writing and reading Egg files, as well as the documentation of the Egg file standard. Analysis of the digitized data is performed using the Katydid analysis software framework [2]. From the data, Katydid can generate two-dimensional spectrograms of power in frequency and time that are useful for examination of Locust results. Figure 3 shows an example of a spectrogram containing a Locust signal processed with Katydid using two different variations of the software receiver chain in Figure 2, as well as a typical example of a signal measured in the Project 8 experiment. Katydid is also used for more complex analyses to allow other direct comparisons between simulation and laboratory measurements. An instance of this type of work will be shown below. , showing chirped tone signals generated either with Locust (left and middle panels) or measured in the Project 8 experiment [12] (right panel). The Locust spectra are simulated using two variations of the generators shown in Figure 2. The left panel shows an internal signal after downmixing and downsampling only, and the middle panel shows the same internal signal after downmixing, low-pass filtering, downsampling, and adding noise. In the middle panel the upper edge of the low-pass filter is set to 185 MHz, above which the signal power is attenuated. The right panel depicts a randomly chosen signal from a 30.23 keV electron measured in the first phase of the Project 8 experiment. The scale of the power and frequency in the measured data differ from the simulation by a factor of receiver gain and by an offset in local oscillator frequency, respectively.

Summary
In this section the main purpose of Locust has been described as a simulation accurately representing a physical detector for RF signals. Steps have been outlined in calculating voltages expected to be measured in response to an incident electromagnetic signal. The above work provides a starting point for the discussion in the next section.

Integrated radiation source simulation
Directly comparable to the running mode discussed above in which internal signals are defined and their detection is simulated, Locust can accept signals constructed with external software. When running in this mode, a specialized generator serves as "LMCGenerator 1" in Figure 1. In the generator, the Locust C++ thread pauses and waits for information from the external software before populating each element of the LMCSignal time series as in Equation 10. Next, just as in Section 2, the LMCSignal array is processed through an applicable receiver chain and is digitized. To illustrate, Figure 4 shows a flow diagram in which the functionality of the block corresponding to "LMCGenerator 1" is expanded to interact with the external Kassiopeia software Figure 4: Block diagram showing the flow of information between "LMCGenerator 1" in Figure 1 and the Kassiopeia software package. The "KSStepModifier" class in Kassiopeia drives and accepts feedback from the Locust "LMCFieldCalculator" class, as described in the text.
package [3]. The next section will describe this interface in more detail.

Kassiopeia
One example of software that can be used to define external signals is the Kassiopeia simulation software package [3], compiled as a submodule within Locust. First developed for the KATRIN experiment [19], Kassiopeia is a software tool designed to compute electromagnetic fields in complex geometries, simultaneous with timedependent solutions of particle states in position and momentum (x,p). More specifically, it calculates particle trajectories stochastically in the presence of surface and gas interactions, while allowing for elastic and inelastic collisions. Of the available particle interaction models in Kassiopeia, the focus of this work relies on the state (x,p) calculations of electrons with energies 18-30 keV in a 1 T magnetic field. This energy range is of interest to Project 8 because it is near the 18.6 keV endpoint of tritium beta decay, and near the 30 keV conversion electrons from 83m Kr. The calculated electron trajectory x(t) is derived using the adiabatic approximation, which relies on conservation of the magnetic moment of the electron (e.g. [3]). The approximation is valid when variations in the electric and magnetic fields are minimal over each cyclotron orbit. Kinematic constraints on the use of the approximation within Kassiopeia are discussed in [20]. An eighth order Runge-Kutta integrator is used to solve the ordinary differential equation describing the trajectory. Power P lost by the electron to synchrotron radiation is then computed in Kassiopeia as [3] P = µ 0 6πc where F = dp/dt is the radiation reaction force, F || and F ⊥ are the components of F parallel and perpendicular to the magnetic field, µ 0 is the permeability of free space, q and m are the charge and mass of the electron, and B(r c , t) is the magnetic field at the guiding center of the motion r c . In the adiabatic approximation F || =0, implying that the cyclotron motion is responsible for the energy loss by the electron to radiation. Together Equations 13 and 14 define the electron's energy loss and trajectory, computed numerically, as it moves through the calculated magnetic field. The cyclotron frequencies reported for 18-30 keV electrons in a 1 T field are near 26 GHz. As Locust has been developed for the Project 8 collaboration, one of its initial applications has been to employ Kassiopeia's machinery to generate signals similar to those measured in the first phase of the Project 8 experiment [12]. The laboratory signals were measured at one end of a hermetic waveguide cell filled with gaseous 83m Kr, which emits conversion electrons at 17.8243 keV, 30.4196 keV, 30.4723 keV, and 31.9370 keV [21], among others. Emitted electrons were trapped magnetically in a 0.9583 T background magnetic field, and their cyclotron radiation was detected with an antenna and receiver.
In Locust and Kassiopeia the experiment is implemented with a magnetic trap having a longitudinal field map as in Figure 5, and a 83m Kr radioactive source contained within a rectangular WR42 (10.7 mm×4.3 mm) waveguide cell of length 10 cm. The Locust receiver is located at one end of the waveguide cell, and a reflecting waveguide short sits at the opposite end. Electrons emitted with energies >30 keV are tracked in time through the calculated magnetic field, while electrons with lower energies are terminated in the software. This selection, in addition to a one degree wide restriction on pitch angle θ relative to the magnetic field, reduces overall computation time while allowing for reasonable agreement between measured data and simulation. For comparison, pitch angles of electrons expected to be trapped with appreciable signal power in the context of CRES experiments are discussed in detail in [13], and are consistent with the range of pitch angles selected in Locust.

Waveguide modes
The first step in the communication between Kassiopeia and Locust is to calculate how much energy is transferred from the Kassiopeia electron to the Locust receiver in the form of an external signal. This computation happens iteratively between Kassiopeia and Locust, both at and between the times when voltages are sampled in Locust. First, Kassiopeia reports the total power lost by the electron to cyclotron radiation in Equation 13. Next, Locust calculates the fraction of that total power deposited into the propagating mode or modes. A mode that is able to propagate to the receiver is treated as an external signal; its detection in Locust occurs identically to that for the internally generated signals in Section 2. The calculation proceeds as follows. The time-averaged power P ± radiated by the electron, given by Kassiopeia, is distributed into the sum of propagating and nonpropagating waveguide modes [22]. Power propagating in both longitudinal directions is represented by "±". In general notation similar to the discussion in [23], the total time-averaged power is where Z µ is the characteristic impedance of mode µ and A ± µ is the time-averaged excitation amplitude of mode µ propagating into both longitudinal directions in the waveguide. The fraction η µ of the total power deposited into mode µ is then The amplitudes of the propagating modes are derived from the Poynting theorem [24] where J is the electron current, and V is the volume enclosed by the waveguide walls and two surfaces enclosing the current distribution [24]. The transverse mode fields E µ are normalized at excitation as in [24] a E µ · E λ da = δ µλ (18) where δ µλ is the Kronecker delta function and da is an element of the cross-sectional area of the waveguide. While the time-averaged power is always distributed between propagating and nonpropagating modes, the instantaneous fraction of power deposited into the propagating modes is assumed to have a maximum near unity. This approximation is applicable for this work given that amplitudes of non-propagating modes are decreased by propagation constants that are perturbed upward due to finite conductivity of the waveguide walls [22], and because non-propagating modes do not induce a direct response in the receiver electronics. Indirectly they are present, as the energy deposited into non-propagating modes is contained implicitly in the calculation of trajectory and radiated power in Kassiopeia. A statement similar to the latter is made in [22] in that a change to the total power radiated into all waveguide modes by an electron should be accompanied by a change in the trajectory of the electron.
As relevant to the first two phases of the Project 8 experiment, two waveguide geometries have presently been implemented in Locust. Figure 6 shows the timeaveraged fraction of power contained in the propagating modes for a 10.7 mm×4.3 mm rectangular WR42 waveguide cell and 5.0 mm radius circular waveguide cell at 26 GHz. The circular waveguide in the right panel of Figure 6 supports two propagating modes, of which the TM01 power fraction is suppressed according to its wavenumber relative to that in the TE11 mode [22]. Each of the calculations in Figure 6 are presently implemented in Locust, selectable by a parameter, and are referenced while the simulation is running.

Mode propagation
After the mode excitation, the propagating modes carry the appropriate fraction η µ of the source energy in both longitudinal directions [24]. Mode fields that propagate to the Locust receiver are processed as an external signal. Any mode field that does not propagate to the receiver does not induce a voltage. Finally, a mode µ field that propagates away from the electron, and then reflects back to the location of the electron, sums with the ongoing field excitation by the electron. The outcome of the latter case, described in the next section, has been uniquely suited within the Locust framework to explain a subset of measurements in the Project 8 experiment [11].

Waveguide back-reaction
In the simulation, the mode configuration in the waveguide at the location of the electron affects the amount of power radiated in Equation 15. This back-reaction by the field on the electron behaves as stimulated emission (e.g. [25][26][27][28]) that is self-induced by the electron in the waveguide. A similar back force between a radiating electron and its induced mode fields has been observed in resonant cavities [29][30][31]; this type of effect has also been widely employed in lasers with resonant cavities. In [30] the back force is described quantitatively in terms of image charges that constrain the induced cavity mode fields. And, in [31] spontaneous emission by a radiating electron is observed to be inhibited by self-induced fields in a resonant cavity.
In the Locust simulation the effect due to the waveguide back-reaction is computed by way of time-dependent energy conservation in Equations 17 and 18. As time advances in the simulation, energy is exchanged iteratively between the electron and the waveguide mode field that it induced previously. First, in Equation 18 the mode fields are normalized at their initial excitation, but are not normalized again if they return to the electron by way of a reflection. The reflected field is instead added everywhere to the existing normalized mode E µ , giving E ′ µ . The time-dependent sum at the electron is |E ′ µ (t)| = cos(0) + cos(ξ(t)), where cos(0) represents the normalized field induced at the electron and cos(ξ(t)) is the reflected field with phase ξ(t). Neglecting propagation times for small geometries, ξ(t) advances from zero at the electron's position to ξ(t) > 0 according to propagation distance and wavelength. If the reflector is a conductor, as in the calculation to be discussed in Section 4, ξ(t) is calculated as Otherwise it is typically In the expression for ξ(t), z(t) is the longitudinal position of the electron, D is the distance from the center of the magnetic trap to the reflector, and λ ′ is the Dopplershifted wavelength calculated at the reflector using the group velocity of the propagating mode. Longitudinal symmetry is enforced with |z(t)|, as needed for agreement with the data, and is consistent with the indication that A + µ = A − µ in [22,24]. In Locust, Equations 19-21 are calculated in the "LMCFieldCalculator" block shown in Figure 4.
With the reflected fields Equation 17 becomes which induces a correction to the total power P ± radiated by the electron in Equation 15. Specifically, P ± µ is adjusted from its nominal value without reflections in Section 3.2 to its new value Adjusting the total power P ± by replacing P ± µ with P ±′ µ , where the last two terms each represent the fraction of power η µ radiated into mode µ as in Equation 16. In Locust Equation 24 is applied in the loop spanning the "KSStepModifier" and "LMCFieldCalculator" classes shown in Figure 4.
Equation 24 probably appears unstable in that the power P ± depends on its own history. Likewise in [30] the problematic outcome of an infinity from the calculated interaction of an electron with its self-energy in a resonant cavity is identified, and is subsequently renormalized by carefully subtracting the field contribution from selected image charges. While the experiment detailed in [30] differs from that described here, the computational difficulties arising from the back force can be analogous. Fortunately, in Locust the relevant mode fields in Equation 24 are separated in time, which makes their effect finite when calculated iteratively.
Another implication of Equation 24 is that the electron radiates more (less) than it does in free space if E ′ µ (t) / |E µ (t)| is more (less) than unity. Thus the power radiated by the electron, initially reported in Kassiopeia and represented in Equation 15, is altered at each trajectory step according to the time-dependent sum at the electron's location of both the normalized and the reflected propagating mode fields. The resulting trajectory of the electron computed in Kassiopeia changes in response to this adjusted energy loss. As a related consequence, the amplitude of the propagating mode fields also scale iteratively with the total radiated power as in Section 3.2. Each of the two critical quantities (radiated power and propagating power) are calculated repeatedly while the simulation is running; the electron's energy loss is adjusted according to the mode configuration after every tracking step in Kassiopeia, while the propagating mode amplitude is calculated only at the relatively infrequent times when voltages are sampled at the receiver.

Results
Simulated and experimental results are compared using identical analysis chains with the Katydid [2] software. Signals from electron "tracks" of power in frequency and time, similar to those in the spectrograms of Figure 3, are identified and their characteristics recorded. The sampling rate f S in each data set is 200 MHz. The receivers are both tuned to measure the 30.420 keV and 30.472 keV conversion electrons from a 83m Kr source. In the simulation the local oscillator frequency is set to 25.3106 GHz. The simulated magnetic field map is shown in Figure 5 and is consistent with that used in the experiment.
The intermediate steps in the analysis are: (i) Perform a Fast Fourier Transform of each 8192-sample-long time series; (ii) To compensate for frequency-dependent variations in gain, integrate the spectrogram over the full acquisition in time to obtain the average power spectrum and approximate it with a spline fit; (iii) Impose a cut on signal-to-noise ratio by selecting high-power bins above a threshold set by spline fit to the background; (iv) High-power bins with too few neighboring points are removed and the surviving bins are clustered together using the Density-Based Spatial Clustering of Applications with Noise (DBSCAN) algorithm [32]; (v) Clusters of points are analyzed for linear structure using a Hough Transform [33], resulting in track objects.
Characteristics of the analyzed electron tracks are shown in Figure 7. The track slope corresponds to the track's rate of change of frequency in time, and the track power is derived from the summed amplitudes in the track as plotted in the spectrogram. The starting frequency of each track is derived from the frequency of the first bin in the track. The agreement between data and simulation is reasonable. There is an apparent excess of points with slope near 600 MHz/s in both data and simulation. This behavior is a binning effect in the 2D spectrograms in frequency and time that is more pronounced for events with shorter duration. Small deviations of the simulation from the data are expected due to substantial sensitivity to the mode configuration in Section 3.2.2 as well as to the magnetic field map. Accordingly, changing the longitudinal position of the reflector by 0.5 mm is enough to detune the agreement noticeably by eye, as is altering the magnetic trap coil currents by 0.02 A. The noise temperature applied in Figure 7, inferred in the simulation from the data, is 15 K.
Although there is qualitative agreement in Figure 7, the simulation result deviates from the laboratory data in several places. The differences are more pronounced in regions where the track power is low. For example, the upstroke of the black "V"shaped feature in the simulated points in panel (a) is absent from the measured data. Additionally, the tilted band in panel (c) appears less intense in the simulation than it does in the measured data, and the range of slopes in the data in panel (c) extends slightly lower than that in the simulation.
Given the extent of the differences between data and simulation, some discussion is needed on what kind of additional work could improve the agreement. Because the magnetic field and trap dimensions have already been carefully tuned to simulate this result, effort toward improving the agreement should begin with several other concrete steps. First, the restriction on pitch angles in the simulation, presently applied with   Figure 7: Comparison between data and simulation for 30.420 keV and 30.472 keV conversion electrons emitted from a 83m Kr source. Electron track characteristics extracted from simulation (black) and measurement (green) are plotted. The top two panels (a) and (b) show track slope plotted against track starting frequency for the data and simulation. The lower two panels (c) and (d) show the track power, with that in the data scaled downward by a factor of the inferred laboratory receiver gain, plotted against the track slope. Receiver gain is extracted at 93 dB, but is probably lower due to differences in track duration between data and simulation that are driven by computation time. Resolution bandwidth is 24 kHz. arbitrary uniformity from 89°to 90°, can be adjusted after straightforward development in software and computing to allow numerically-calculated intensities that vary across the same range. Second, propagation times that are presently neglected in Equations 20 and 21 could be built into the calculation. Third, after implementing the latter improvements, higher statistics in the simulation would likely increase the broadband noise points in the simulated result as is depicted in the measured spectra in panels (a) and (b). Finally, the range of slopes in the simulation might be extensible to lower values through a closer examination of the power correction in Equation 24. Presently it is derived instantaneously from time-averaged amplitudes. If possible, it would be worthwhile to check whether the range of simulated slopes could be extended lower with a more precise representation of the time dependence in the mode configuration.
While the present simulation is probably too discrepant from the data to allow detailed quantitative analysis, it provides important information on modeling time-dependent behaviors in CRES experiments. In particular, as stated above, the interaction between the electron and its reflected mode field in Section 3.2.2 is treated here with approximate time dependence. If further stochastic particle-driven computations are of interest, a reasonable goal would be refinement of the temporal interpretation of this and other related effects. At the same time, the simulation can be used to evaluate the impact of systematic effects on the experiment, and to optimize the granularity of time-dependent calculations that are needed to model it.

Conclusion
The Locust software package simulates the detection of RF signals comparable to signals measured in the laboratory. Its range of applications extends from user-defined standalone test signals to field excitations computed from simulated particles. It is useful both as a framework for investigating the feasibility of experiments in the laboratory, and as a tool for offline data analysis. Additional work with Locust is underway to study and optimize future, larger-scale experiments in support of the Project 8 collaboration. The source code along with examples and instructions for installation is available for download from https://github.com/project8/locust_mc.