Ground-Based Characterisation of a Compact Instrument for Gamma-ray Burst Detection on a CubeSat Platform

: Gamma-ray bursts (GRBs) are intense and short-lived cosmic explosions. Miniaturised CubeSat-compatible instruments for the study of GRBs are being developed to help bridge the gap in large missions and assist in achieving full sky coverage. CubeSats are small, compact satellites conforming to a design standard and have transformed the space industry. They are relatively low-cost and are developed on fast timescales, which has provided unparalleled access to space. This paper focuses on GMOD, the gamma-ray module, onboard the 2U CubeSat EIRSAT-1, launched on December 1st 2023. GMOD is a scintillation-based instrument with a cerium bromide crystal coupled to an array of sixteen silicon photomultipliers, designed for the detection of GRBs. The characterisation of GMOD in the spacecraft, along with the validation of an updated spacecraft MEGAlib model is presented and this approach can be followed by other CubeSats with similar science goals. The energy resolution of the flight model is 7.07% at 662 keV and the effective area peaks in the tens to hundreds of keV, making it a suitable instrument for the detection of GRBs. An investigation into the instrument’s angular response is also detailed. The results from this characterisation campaign are a benchmark for the instrument’s performance pre-launch and will be used to compare with the detector’s performance in orbit.


Introduction
Gamma-ray bursts (GRBs) are violent, bright and brief explosions in the universe resulting from the death of a massive star or the collision of two compact objects, such as neutron star-neutron star or neutron star-black hole mergers [1,2].The breakthrough coincident detection of electromagnetic signals (from radio to gamma rays) and gravitational waves in 2017 facilitated a new way to probe these complex events [3,4].A major challenge to the future of gamma-ray astronomy and the progression of GRB science is the lack of new missions.The legacy and current gamma-ray missions have excelled in advancing the understanding of these objects but the majority are operating beyond their nominal lifetimes [5][6][7][8].Additionally, current gamma-ray observatories cannot provide full-sky coverage in a single observation for these brief isotropic explosions, which is critical for future coincident detections.Obtaining a population of GRB/gravitational wave joint detections will be important in determining the characteristics of the different types of GRBs, confirming other theorised progenitors and the extracted properties can be used to search archival data (e.g., [9]) for similar candidates.Furthermore, increasing the number of joint detections could constrain the neutron star equation of state, advance the understanding of the origin of the heaviest elements in the universe and provide new insights into fundamental physics such as investigating the difference between the speed of gravity and the speed of light [3,10].
CubeSats are small-scale satellites, usually conforming to a design standardisation, defined by Cal Poly specifications [11].CubeSats have grown in popularity in recent years due to their science and technology demonstration capabilities [12][13][14][15].CubeSats were originally developed as an educational tool [16,17], resulting in the production of commercial-off-theshelf (COTS) components.COTS components can be used for the fundamental subsystems of the satellite, e.g., power, communications and onboard computer (OBC), allowing for more resources to be applied to the science objectives of the mission [18].CubeSats are relatively low-cost and have short launch timescales [19], making them ideal candidates to bridge the gap in gamma-ray missions during the multi-messenger era [20].In addition to the current large-scale gamma-ray missions, a fleet of GRB-detecting CubeSats could allow for the adequate detection and localization of GRBs, and increased sky coverage.SmallSats with GRB detection and localisation capabilities are in development, e.g., BurstCube [21,22], MoonBEAM [23], HERMES [24], GRBAlpha [25] and CAMELOT [26].
The Educational Irish Research Satellite (EIRSAT-1) is a 2U CubeSat with a primary payload, the gamma-ray module, GMOD, developed for the detection of GRBs [27,28] at energies 60 keV to ≈2 MeV, as presented in Figure 1.GMOD is a <1 U scintillation-based detector and consists of two main components: the detector assembly and the GMOD Motherboard (MB) [29][30][31].The detector assembly holds the CeBr 3 scintillation crystal (25 mm × 25 mm × 40 mm), which interacts with gamma-ray photons from GRBs to produce optical photons, which are collected by a tiled array of 16 silicon photomultipliers (SiPMs).The outputs from the SiPMs are read out and digitised by an application-specific integrated circuit (ASIC), produced by Integrated Detector Electronics AS (IDEAS), Oslo, Norway called SIPHRA (Silicon Photomultiplier Readout ASIC) [32].The GMOD motherboard was developed in-house [33,34] and supports the electronics for power and the readout of the detector assembly.The GMOD MB converts the channel data into timetagged events (TTEs).TTEs are generated for the 16 individual channels of SIPHRA and for the sum channel (sum of 16 channels).Both sum and 16 channel TTEs are sent in pages to OBC.GMOD is based on in-house instrument heritage and will be used to scale up to a 6U mission with detection and localisation capabilities, called Gamma-ray Investigation of the Full Transient Sky (GIFTS) [29,30,[35][36][37].
The characterisation of an instrument in the spacecraft is necessary to investigate its performance and ensure that it is capable of achieving the mission's science goals [38].Instrument characterisation as presented in this paper provides an in-depth understanding of the behaviour of the instrument that could not be achieved via functional testing.Performing the characterisation of the flight model of GMOD in EIRSAT-1 is essential for interpreting the downlinked science data throughout the mission and identifying intrinsic features in the data products.This characterisation campaign also provides a benchmark of the experiment's performance pre-launch.The results from this campaign can be used to compare with the detector's performance in-orbit, during commissioning and nominal operations.
Initially, the ground-based energy calibration of GMOD was performed to map the analog-to-digital (ADC) values to energy.Once the data were in energy space, the properties of the detector could be investigated, including the instrument's resolution.A calibration of the instrument will be performed post-launch using the signature of galactic positron annihilation at 511 keV to determine the shift in the energy spectrum [39].Additionally, lines from solar activity, e.g., the 2.2 MeV line from neutron capture on hydrogen [40], can be used for in-orbit calibration.In addition to the ground characterisation, in-orbit cross-calibration will be performed when GRBs are detected in coincidence with other missions (e.g., Ref. [41]).The aim of these tests was, first, to evaluate the effective area of the GMOD detector as a function of energy and source incident angle to correctly generate the detector response files [5].This gave an understanding of the response of the detector and allowed an interpretation of the mission's science data when analysing potential GRB triggers from different sky positions (on-and off-axis).Some triggers were also simulated by bringing a source close to the spacecraft for a short period of time.The aim of these tests was to further validate the correct operation of the trigger algorithm and data processing and protection in the onboard software (OBSW) v18.3; see Refs.[30,42] for more details.Simulations were performed in MEGAlib, a collection of programs to simulate gamma-ray instrumentation [43], to correlate with measurements in the lab and validate a Geomega EIRSAT-1 model, with the original model detailed in Ref. [29].
Section 2 presents the experimental set-up in the cleanroom, including the angular measurements on a motorised turntable, where all the characterisation tests were performed with the EIRSAT-1 flight model (FM).The methods for producing the calibration and energy resolution are outlined in Sections 3 and 4. The effective area of GMOD as a function of energy and the angular response of GMOD are presented in Section 5.The trigger data analysis is presented in Section 6.The simulations performed in MEGALib are discussed in Section 7 and compared to the experimental data to assess the accuracy of the model.

Energy Calibration Hardware Set-Up
Initially, the measurements to determine the channel-energy relation of GMOD were performed.The main goal of these measurements was to maximise the number of counts during the integration interval.The spacecraft was secured in a vertical support stand for the energy calibration source measurements.The EIRSAT-1 FM was connected to the power and data acquisition ground-support equipment (GSE) via the Umbilical Interface Unit (UIU), as labelled in Figure 2 (Panel B).The UIU interfaced with a bench power supply unit (PSU) to provide a battery voltage of 8.35 V for the spacecraft.The UIU also provided an interface between the spacecraft and the laptop used to command the satellite via the MCS v21.2 and Python v3.7 scripts and retrieve the experimental data stored on the OBC.On the laptop, a terminal was used to monitor the debug log from the spacecraft throughout the test activities.
In the first test, different radiative sources (enumerated 1-6, see Table 1) were placed close to GMOD.As in Figure 2, sources 1-5 were positioned on the cross-hairs, which identified the centre of GMOD's CeBr 3 crystal, on a cap on the +Z face of the spacecraft (Panels A and C of Figure 2).The distance from the end cap to the centre of the crystal (CoC) is 49.6 mm.The position of source 6 is centred on the X face of the crystal, 222 mm from the +Y face and 119 mm from the -Z face (see Panel D of Figure 2).It was found that, with some of the sources in this position, the OBC could not manage the rate at which GMOD was generating data for long durations.To determine the GMOD data rate that the OBC could successfully handle, the sources were placed at different distances from the CoC.
For each source position, the GMOD data production rate, in pages/min, was monitored via the MCS.The address of the GMOD sum page received by the OBC was determined at the same time as the address of the most recent page of generated summed data multiple times over a few minutes.If the difference between these was increasing as time progressed, the rate at which GMOD was producing data was greater than the rate at which the OBC was reading data.The source was moved until the difference between these two parameters remained the same over time, indicating that the OBC could manage the data rate produced by GMOD.This was found to be ∼ 250 pages/min.Each page contains 31 TTEs, so the TTE rate that the OBC can keep up with for long-duration experiments (∼ hours) is ∼ 130 TTEs/s or 130 counts/s.As GRBs are on much shorter timescales, this issue will not affect GMOD's ability to detect these events.Table 2 contains the exact sources used for the energy calibration measurements, their location with respect to the CoC in GMOD and the integration times.2, the source is centred on X of the crystal, 222 mm from the +Y face and 119 mm from the −Z face.

Table 1.
Radioactive sources used for GMOD characterisation.The peak energies and transition probabilities for sources marked with an * are from [38] and those marked with † are from [44].The source activity for sources 1, 2, 3 and 6 are in µCi and quoted as of 12:00 GMT on 1 December 1979.The activity of source 5 is quoted as of 15

Angular Measurements Hardware Set-Up
For the determination of the angular response of the FM, two sources with known activities, 241 Am and 137 Cs, were used.Due to the limited time with the FM, integrations with these sources at various angles were performed at the same time, with the two sources taped together.They were selected as the gamma-ray peaks from each were at sufficiently different energies so as to not interfere with each other.Figure 3 presents the hardware set-up used, where the spacecraft was mounted on a turntable with an attached moveable appendage.The turntable had a slip ring and interface printed circuit boards (PCBs), which facilitated powering and commanding the spacecraft via the UIU.The UIU provided an interface with a bench PSU to provide power for the spacecraft.It also provided the connection to the MCS on the laptop, which facilitated setting up the experiment and downlinking the data.This hardware was designed for attitude control and mission testing and utilised for GMOD characterisation.The FM was secured on a motorised turntable and the source was mounted on a moveable appendage, to vary the polar and azimuthal angles, respectively.
The sources were placed at a variety of different positions relative to the spacecraft, with some example orientations displayed in Figure 4.This was achieved by varying the polar and azimuthal angles.The polar angle was varied by mounting the source on a movable arm that could be rotated about an axis that went through the centre of the detector.The azimuthal angle was varied by securing the spacecraft on the controllable turntable, and moving it to the required positions.The turntable was also controlled via the Python test scripts, and a separate script was written for these measurements containing the set-up commands for GMOD and the commands for the turntable to move the spacecraft to a specified range of angles.
Table 3 shows the locations tested, in both polar and azimuthal angles with respect to the crystal centre and in Cartesian coordinates with respect to the centre of the spacecraft.These Cartesian coordinates are included, as they were required for the MEGAlib simulations discussed in Section 7. The final column of Table 3 shows the integration time (in seconds).During the test runs, all the scripts were run for 3.5 h; however, for locations where GMOD was most sensitive (e.g., +Y face, polar 90 • , Az 270 • ) the number of TTEs downlinked from the OBC was not representative of the number of TTEs generated by GMOD.This issue was due to the OBC being unable to manage the rate at which GMOD was producing data; this was accounted for in the data analysis.The analysis and results of these off-axis measurements are presented in Section 5. Table 3. Positions at which the source was placed for the angular response investigation for GMOD FM.These positions are provided in polar and azimuthal angles with respect to the crystal centre and in Cartesian coordinates with respect to the centre of the spacecraft.The integration time for each measurement is provided in the final column.

Data Acquisition and Scripting
Due to time constraints on the availability of the EIRSAT-1 FM, the ability to execute tests overnight and without an operator always present was paramount.Python scripts were composed to configure the ∼40 parameters to set up GMOD and then allow for the specified amount of time for spectral integration.The scripts interfaced with the mission control software (MCS v21.2) and commanded the experiment as if it were in flight.The main interface with the spacecraft was via Bright Ascension's MCS [45].The Python scripts performed the following tasks: turning on GMOD and experiment configuration including firmware version and operational mode.The script then synchronised the time on GMOD's microcontroller to the OBC time, and initiated GMOD generating data and streaming it to the OBC.The script recorded the storage location of each run on the OBC and, once a number of integrations had been completed, a second script could be used to downlink the data.The data were downlinked through the satellite telemetry interface using the MCS connected to the OBSW.This campaign provided the opportunity to test the robustness of the chain of data acquisition that will be followed during the actual mission.

Single-Source Spectra
The FM of GMOD was configured to take a 12 h measurement for each of the sources from 1 to 6 in Table 2.The summed channel TTEs stored on the OBC corresponding to each measurement were downlinked and analysed in Python.A 24 h background integration was also performed and downlinked.All of the data sets were divided by their respective integration times, and the background spectrum was subtracted from the raw source spectra.Figure 5 presents the raw spectrum (purple), background spectrum (grey) and background-subtracted spectrum (teal) for each source.

Channel-Energy Relation
All the source spectra produced with GMOD followed a primarily Gaussian shape, which varied depending on the underlying interaction with the CeBr 3 crystal.The photopeaks all fit with the following Gaussian function: where N is the height of the peak, σ is the standard deviation and µ is the position of the centre of the peak [46].In order to translate the ADC channels to energy values, a channel-energy relationship was first determined.Each photopeak from the sources listed in Table 2 was fitted with a Gaussian function, and the channel number for the centre of the photopeak, µ, was extracted.Figure 6 presents four examples of the functions fitted to energy peaks in the spectra to determine the channel number of the peak centre.2. In each panel, the background spectrum (grey) and the raw source spectrum (purple) are presented.

Counts/Hour
In the analysis, the gamma-ray photopeaks could not be fitted with a simple Gaussian, as there are other contributions in the photopeak such as from back-scattering off of nearby structures, background contributions and Compton distributions (as seen in the spectra in Figure 5).In general, the peaks were fitted with a combination of a Gaussian function and a polynomial function to account for other contributions to the photopeak.The final fit is plotted as a dashed line and the composite functions are plotted separately as solid lines in Figure 6.The ADC channel numbers associated with each peak centre, µ, were then plotted against the known energy of the photopeaks, as listed in Table 1, to map the channel numbers to energy.Figure 7

Energy Resolution
The energy resolution represents the broadening of a gamma-ray line due to photoelectron statistics and detector effects, it quantifies how well the detector can define a gamma-ray line for a specific energy.
The energy resolution, R, of a detector is defined as where the full-width at half-maximum (FWHM) of the energy pulse is divided by the location of the peak's centre, µ [38].The FWHM is calculated using the standard deviation, σ, of the Gaussian fit function, as follows: There are a number of contributing factors resulting in the increase of a detector's energy resolution such as the aforementioned photoelectron statistics, changes to the configuration of GMOD and non-uniformity of the scintillator's response or the SiPMs' performance.The sources used in this testing were only a sample of the full range of energies that could be emitted by astrophysical sources.The resolution of the detector for this larger energy range can be extrapolated by fitting the following function to the physical measurements [38]: ( The constant, a, is negligible because SiPMs are high-gain devices and the noise is not an issue for the measurement of gamma rays above 50 keV.The

√
b 2 E term accounts for the fluctuations in the number of scintillated photons and photoelectrons produced by the SiPMs.The final term,

√
c 2 E 2 , is attributed to the non-ideal transfer of the scintillated photon energy from their creation locations to the SiPMs.
The energy calibration was first applied to the spectra produced by GMOD for the sources listed in Table 2, such that the spectral counts/keV/hour were plotted against energy in keV, rather than channel number, as in Figure 8.   2.
The photopeaks were then re-fitted with a combination of a Gaussian(s) and a polynomial function to account for other contributions to the photopeak to determine σ and, using Equation (4), the FWHM in terms of energy.Figure 9 presents four examples of fitting the photopeaks of the sources in energy space.Figure 10 presents the σ values for the photopeaks as a function of energy.Equation ( 5) was then fitted to these points with coefficients b = 0.6761 and c = 8.9754 ×   The energy resolution of the photopeaks were determined using Equation ( 3).This energy resolution was plotted as a function of energy, as in Figure 11.Equation ( 5) can be expressed in terms of the FWHM (%), as follows: and can be fitted to the data in Figure 11 to determine the resolution of the GMOD FM over a wide range of energies.The obtained coefficients of the fit are b = 0.6294 and c = 6.8994 × 10 −3 .The energy resolution of GMOD FM improves for incoming photons with higher energies and was found to be 7.07% at 662 keV.

Effective Area
The effective area of a gamma-ray detector accounts for the detection efficiency of the instrument and the observable area.The full-energy peak effective area, A e f f (cm 2 ), for a detector is determined as [38] where C is the number of counts in the photopeak, i.e., the area under the Gaussian, P T is the transition probability, s is the distance (cm) between the source and the detector and a c is the activity of the radioactive source (1/s).The activity is given by where a o is the activity of the source (s −1 ) at a specified time, t is the time (s) between the determination of the activity and the performance of the test campaign and T1 2 is the half-life of the source (s).
As the source is emitting gamma rays in all directions but only a fraction is observable to the detector, the term 4πs 2 accounts for the fraction of photons emitted by the source that will actually come in contact with the detector.
Figure 12 presents the effective area of the flight model of GMOD as a function of energy, where all the sources were positioned above the +Z face of the spacecraft at the CoC.The source activity must be known for the determination of an absolute effective area, which limited the sources in Table 1 that could be used to determine GMOD's effective area.Sources 1-3, 5 and 6 were used to determine the effective area of GMOD as a function of energy.Table 2 provides the position of these sources relative to the crystal centre, the s term in Equation (7).In Figure 12, the previously simulated effective area (blue) from [29] is in good agreement with the physical measurements (see Section 7.2 for the updates made to the model to represent the FM including the addition of the GMOD top reinforcement bracket (GTRB), the structural bracket the detector assembly is mounted on).The instrument's sensitivity appears to peak in the range of tens to a few hundred keV, as is desired for the detection of the prompt emission of GRBs.The effective area is lower for smaller energies as a result of gamma-ray absorption by the detector housing and spacecraft.
The effective area of FM GMOD as a function of source incident angle was also investigated.As described in Section 2.2, due to time constraints, two sources, 137 Cs and 241 Am, were used together for the angular measurements.The effective area of GMOD was determined at 34 different incident angles, as listed in Table 3. Figure 13 presents the angular response of GMOD at 662 keV and Figure 14 at 59.4 keV.The angular response of GMOD at both these energies follows similar profiles.As shown in Figures 13 and 14, the calculated values of the effective area have an uncertainty of 6-7%, which is due to an uncertainty of the source activity (5% for the 241 Am source and 3.5% for the 137 Cs source) and errors in the source-to-crystal distance (about 5 mm).
The measurements at polar angle 90 • show the most diversity and the impact of the crystal geometry on the detector's performance.The area of the Y and Z faces of the GMOD crystal is 10 cm 2 , and the X faces are 6.25 cm 2 .The effective area of GMOD peaks at the −Y and +Y faces, which correspond to the longer faces of the crystal.The only obstacle between the source and crystal at these faces are the spacecraft panels with mounted solar arrays.At the −X face, the effective area drops by ∼ 0.2 cm 2 , as this face of the crystal is smaller.The effective area is at a minimum at the +X face as the gamma-ray photons are attenuated by the PCBs (SIPHRA and adapter boards) before reaching the crystal.For the other polar angles, the effective area tends to be at a minimum at azimuthal angle 0 • (+X face).The effect of the spacecraft is also evident by the difference in effective area between polar angles 0 • and 180 • .At 59.4 keV, the effective area at polar angle 0 • (+Z face) is similar to the −Y and +Y faces at > 5 cm 2 .The spacecraft components beneath GMOD attenuate the incoming photons as, at polar angle 180 • , the effective area is ∼0.05 cm 2 .As expected, at higher energies (662 keV), the photons are capable of reaching the crystal through the spacecraft and there is a smaller difference in the effective area between the −Z and +Z of ∼ 1 cm 2 .

Trigger Algorithm Testing
Additionally, the correct operation of the OBC-triggering algorithm and the processing and protection of the TTEs around the time of the trigger were tested during the characterisation campaign.GMOD was configured for experiment-running and the OBC's triggering algorithm was enabled.During these tests, the source was brought close to each face of the spacecraft (without touching the satellite) for a fixed amount of time, i.e., 10 s.GMOD triggered on the source at multiple positions, and it was confirmed that the trigger time and duration were correct, contributing to the verification of the functionality of the onboard triggering algorithm.The trigger data processing and protection in the OBSW around the time of the trigger were also validated as the data analysed from these triggers were downlinked from the protected trigger data storage channels on the OBC.The OBC successfully recorded 21 triggers.Figure 15 presents six triggers, where each trigger had the source located at a different face of the spacecraft (+X, −X, +Y, −Y, +Z, −Z) for ten seconds.Panel A of Figure 2 presents the EIRSAT-1 coordinate system.
In Figure 15, the sources were approximately the same distance from each face of the spacecraft for the same duration, so the intensity of the triggers reflects the impact of the crystal geometry and surrounding spacecraft on the performance of GMOD.The highest number of counts in a trigger (∼ 3500) was when the source was at the +Z face of the spacecraft; the only components between the source and GMOD are EMOD and the GTRB.As expected, the counts in the trigger are at a minimum when the source is at the −Z face of the spacecraft.The trigger only creates ∼ 230 counts, as the CubeSat stack of PCBs attenuates the gamma-ray photons before they arrive at the GMOD detector.Similarly, the +X trigger has relatively low counts, as the gamma-ray photons need to pass through the components in the detector assembly (SIPHRA, Interface PCB) before reaching the scintillator.The +Y trigger has ∼2000 counts, as the source is further away from the GMOD detector.The −Y and −X triggers have a similar number of ∼ 3000 counts in the trigger, as there was only a solar panel between them and the source.

Characterisation Simulations
In order to understand and predict the performance of GMOD as a GRB detector and ensure that the correct response is used if the event location is known, it is important to have an accurate spacecraft and detector model.The engineering qualification model (EQM) of EIRSAT-1, developed using MEGAlib, is described in [29].This model needed to be updated to reflect the changes to the configuration of GMOD in the flight model.The first hardware design change was in the mounting of GMOD in EIRSAT-1.In the EQM, GMOD was mounted to the GMOD motherboard.In the FM, GMOD is suspended above the motherboard, and mounted in the PCB stack via, on a structural bracket, the GTRB.The second hardware change was that ceramic capacitors were used on the GMOD EQM MB.The GMOD FM motherboard has metal framed capacitors, as these are more robust against PCB flexure.Simulations were then performed with this updated model to correlate with measurements in the lab and validate the updated EIRSAT-1 model.Section 7.1 provides an overview of the MEGAlib software v4.0 used to update the model and run the simulations.Section 7.2 outlines the updates made to the spacecraft geometry model.Section 7.3 presents the results of the simulations with a comparison to the physical measurements to confirm that the model was representative of the performance of the physical spacecraft.

MEGALib
The Medium-Energy Gamma-ray Astronomy library (MEGALib) v4.0 is a collection of programs for simulating gamma-ray instrumentation [43]).The software library was initially developed for the telescope MEGA [47]), which combined Compton scattering and pair production instrumentation; therefore, the higher-level data analysis tools concentrate on Compton telescope processes.However, the flexible design of the tools makes it applicable to many detector types, including scintillation-based instruments like GMOD on EIRSAT-1.
The geometry of the detector and the satellite were first defined using Geomega, as seen in Figure 16; then, the gamma-ray source(s) were defined and, using Cosima and Revan tools, the response of GMOD in EIRSAT-1 to the sources was simulated.The main input file of Geomega includes the list of materials, the volumes of all the components of the spacecraft, the characteristics of the detector and any trigger criteria.In MEGAlib, the lengths of all objects are defined in half lengths and, throughout the programme, all the units are in cm, keV, g and deg.The materials that comprise the different components of the detector and the satellite, their densities and chemical compositions are defined in a separate file in Geomega and included in the main input file.The volumes can be a variety of different shapes including boxes, spheres, tubes and trapezoids.
The gamma-ray detector also needs to be defined in the geometry file in MEGAlib.Various properties of the detector are defined in the geometry file including trigger thresholds, noise thresholds and energy resolution in the case of scintillation-based detectors.The definition of the detector identifies which volume(s) in the model in which the positions and energies of interactions should be recorded.
The second tool used in MEGAlib is Cosima.Cosima is a Geant-4-based [49] simulator of the detection of gamma rays in the keV to a few hundreds of GeV range via photo-electric absorption, Compton scattering and pair production by gamma-ray telescopes.The Cosima simulation is directed by an input "source" file.The first input into the source file is the Geomega geometry definition of the satellite and the detector, as shown in the sample code below.The second section of the source file describes the electromagnetic interactions package that will be used to describe the interactions in the simulation.The Livermore lowenergy EM package describes gamma-ray interactions in the 250 eV to 100 GeV range [50].The output format of the simulated data is then defined (e.g., storage of simulation history and ionisation information) and the final section describes a simulated run.One source file can define multiple simulation runs that will be performed in succession.Each run must have a defined output file name, stop criterion (time) , definition of the radioactive source including the particle type, beam type and position, source spectrum and the average total flux integrated over beam and spectrum.The flux (particles/s) is calculated by multiplying the activity of the source (Bq) by the transition probability.
The output of the Cosima simulation contains the interaction history of all the primary and secondary particles and all of the hits in the detector.Along with each hit, the associated position in world coordinates and energy are recorded.Revan is the final MEGAlib package used in this chapter, to combine the Cosima simulation results and the Geomega geometry together to generate a simulated detector response.Revan is used to generate the spectrum recorded by the simulated detector of the gamma-ray source.This spectrum can then be analysed and compared to the physical measurements to confirm that the simulated model of the spacecraft is in close agreement.

EIRSAT-1 MEGAlib Model
In order to determine the performance of GMOD in orbit, it is important to consider the impact of the remainder of the spacecraft on its ability to detect incoming gamma rays.The initial geometry of EIRSAT-1 in MEGAlib is described in detail in [29]; however, due to design changes, the model required an update.The major addition to the model was the creation and inclusion of the GMOD GTRB.
In Geomega, to create the GTRB, a plate of aluminium was defined.The structure of the GTRB was then modelled by making vacuum cut-outs in the shapes of cuboids and trapezoids.Figure 17 shows the GTRB model in Geomega, the shapes highlighted in green are all vacuum cut-outs.The GTRB is 5 mm thick at the edge and then there is a 1 mm indent, as shown by the dark blue sections which are large vacuum cut-outs.The GTRB was inserted above the GMOD detector assembly, as shown in the left panel of Figure 18, and the right panel shows the new GMOD assembly included in the full spacecraft.The position of the detector assembly also required modification as, in the FM, the aluminium housing was inverted and secured to the GTRB (in the EQM, the aluminium housing was mounted to the GMOD MB below).

Simulations and Comparison with Physical Measurements
Two groups of simulations were performed to compare with the GMOD FM physical measurements and investigate the accuracy of the EIRSAT-1 MEGAlib model.Initially, the 12 h integrations were simulated using MEGAlib.The activity of the source is required as a simulation input; therefore, the response of GMOD to the five sources with known activities from Table 1 were simulated, i.e., 241 Am, 137 Cs, 133 Ba, 60 Co and 22 Na.The measurement duration, source activity and position relative to the centre of the spacecraft were input into the Cosima source file.Cosima was run to generate all the particle interactions.Revan was then used to process the Cosima output file, along with the spacecraft and instrument geometry, to produce a spectrum recorded by the simulated detector.Figure 19 presents a comparison of the simulated spectra (teal) and the spectra produced by the physical FM (grey) for each source.Both spectra are displayed in counts/keV/hour.As expected, the number of counts in the simulated photopeaks does not exactly match that of the physical measurements; these differences can be accounted for with uncertainties in the activities and positions of the sources.
As most evident in the 137 Cs spectrum, the additional low energy counts in the region of ∼ 50 keV to 250 keV in the physical measurements can be attributed to scattering from the surrounding environment.The MEGAlib simulation assumes that the spacecraft is in a vacuum, so there are no testing mounts or walls to scatter the gamma rays.
The photopeak of the gamma-ray line at 59.4 keV in the measured 241 Am spectrum (grey spectrum in the last panel of Figure 19) has an unusual profile, as this peak is at the energy threshold of the physical flight model of GMOD.Prior to FM vibration, GMOD was capable of detecting the full peak at 59.4 keV.After FM vibration testing, a shift in energies down in the channel number was observed in the GMOD spectra due to a lower current being produced by the SiPMs.A lower current could be caused by a lower light collection or an electronic issue with the SiPM bias voltage.As the bias voltage has been measured and confirmed to be configured correctly, the issue is attributed to the lower light collection.An optical coupling issue would cause lower light collection, e.g., trapped air between the scintillator and SiPMs.However, as the spacecraft had been qualified after the FM environmental testing, it could not be disassembled to confirm this possible cause or rectify it.for the five sources with known activities in Table 1.In each panel, the spectra produced by the physical GMOD FM are plotted for comparison.
The peaks of the simulated spectra were fitted using the same method as followed for the measured spectra to determine the relationship between σ and energy, as shown in Figure 20.The relationship described by Equation ( 5) was fitted to the simulated data points (teal) with the fit coefficients b = 0.6810 and c = 9.6791 × 10 −3 .The model is in good agreement with the relationship fit to the measured spectra (grey solid line).
The energy resolution, in terms of FWHM (%), of the simulated detector was then determined using these σ values and Equation (3).The energy resolutions of the simulated spectra were fitted with the relationship described by Equation ( 6   The effective area as a function of energy of the simulated detector was determined, as seen in Figure 22.As expected, the effective area of the model is slightly higher across all energies, with the average difference between the measured and simulated energies being 0.5 cm 2 .This is due to the previously explained difference in photopeak counts of the simulated spectra in comparison to the measured spectra.The second set of simulations performed was to investigate the accuracy of the ME-GAlib GMOD model's angular effective area.Source files for the measurements at the 34 angles were run with Cosima.The spectra were processed using Revan and analysed to calculate the effective areas.Table 4 compares the calculated effective areas at polar angle 0 • and polar angle 180 • , which correspond to the source being 22.5 cm from the +Z and −Z of the spacecraft, respectively.Figures 23 and 24 compare the measured (grey) and simulated (teal) angular response of GMOD FM at 662 keV and 59.4 keV, respectively.The updated FM model produces the expected angular response from GMOD in agreement with the measured results.Across all angles, the simulated effective area is higher due to there being more counts in the simulated photopeaks.There is also a larger difference in values for the 59.4 keV peak due to the physical FM not fully detecting this peak in 241 Am.

Conclusions
The characterisation of the flight model instrument provides a comprehensive understanding of the instrument's behaviour pre-launch.Initially, an energy calibration was performed on GMOD to map the ADC channel values to energy.Then, the properties of the detector were determined, with the FM having an energy resolution of 7.07% at 662 keV.The effective area as a function of energy and incident angle was investigated, which is important for interpreting the downlinked science data during the mission.The effective area of GMOD peaks in the energy range of tens to a few hundred keV, as is required by the specifications of our scientific case for GRB detection.As expected, the detector is most sensitive on the faces with minimal obstruction and the least sensitive faces are those where gamma-ray photons must first pass through the CubeSat stack or the PCBs in the detector assembly.In addition to these measurements with the physical flight model, the EIRSAT-1 MEGAlib model was updated to reflect the new configuration of GMOD in the flight model.This updated model was validated by simulating the measurements made in the lab and confirming consistency between the simulated and physical results.This approach to characterising an instrument for GRB science can be followed by other CubeSats with similar science goals.The results from this characterisation campaign can be used for comparison with the detector's performance in orbit.In reference [29], simulations performed with the original MEGAlib model predicted that GMOD will detect 11-14 GRBs at a significance greater than 10σ during a nominal one-year mission.Future work would include performing these simulations with the updated MEGAlib model presented in this paper and producing the response files for spectral fitting.

Figure 1 .
Figure 1.The flight model of EIRSAT-1 including the location of major subsystems and the GMOD detector assembly and motherboard.The coordinate system of the spacecraft is also detailed.

Figure 2 .
Figure 2. (A) EIRSAT-1, including co-ordinate system, on vertical integration stand for energy calibration measurements with a source positioned on the +Z endcap.(B) GSE for measurements; on the left is the FM, in the centre is the UIU and on the right is the PSU powering the spacecraft.(C) Source positioned on the +Z endcap on cross-hairs marking the centre of the CeBr 3 crystal.(D) Position of source 6 in Table2, the source is centred on X of the crystal, 222 mm from the +Y face and 119 mm from the −Z face.

Figure 3 .
Figure 3.The test set-up for the measurements made to determine the angular response of GMOD.The FM was secured on a motorised turntable and the source was mounted on a moveable appendage, to vary the polar and azimuthal angles, respectively.

Figure 4 .
Figure 4. (A) EIRSAT-1 FM on vertical integration stand mounted to the turntable for polar 0 • measurement, i.e., the sources, circled in orange, mounted at the crystal centre in X, Y and 22.5 cm above the

Figure 5 .
Figure 5. GMOD FM background-subtracted spectra (teal) in counts/hour for the six sources in Table2.In each panel, the background spectrum (grey) and the raw source spectrum (purple) are presented.

Figure 6 .
Figure 6.A sample of four fits to GMOD spectra in terms of ADC channel number.Each panel shows the fit (dashed grey line) to the background-subtracted spectrum.The composite functions of the fit are plotted as solid lines.
presents the channel-energy relation for GMOD FM.The relationship between the ADC channel number and energy, E, was best fitted with a quadratic of the form E = a(Channel Number) 2 + b(Channel Number) + c (2) where a, b and c are the fit coefficients.The coefficients of the fit to the GMOD channel energy relation are a = 3.56 × 10 −5 , b = 0.42 and c = −17.30.

Figure 7 .
Figure 7. Energy-channel calibration relation for GMOD FM.The relationship was fit with a quadratic (dashed line) with the coefficients a = 3.56 × 10 −5 , b = 0.42 and c = −17.30.The teal points representing the mixed source were not used in the final fit due to the lab temperature being different for these measurements.Measurement errors for gamma-ray line centres are on the order of 0.3 ADC channel.

Figure 9 .
Figure 9.A sample of four fits to GMOD spectra in terms of energy (keV).Each panel shows the fit (dashed grey line) to the energy-calibrated spectrum.The composite functions of the fit are plotted as solid lines.

Figure 12 .
Figure 12.GMOD FM effective area as a function of energy, where all the sources were positioned above the +Z face of the spacecraft at the CoC.Simulated photopeak effective area from [29] plotted in teal for comparison to physical measurements.

Figure 13 .
Figure 13.Angular effective area of GMOD FM at 662 keV.

Figure 14 .
Figure 14.Angular effective area of GMOD FM at 59.4 keV.

Figure 15 .
Figure 15.Each panel shows the counts recorded in a GMOD trigger as a function of time.A 137 Cs source was used to trigger GMOD; the source was briefly positioned at each face of the spacecraft for ∼10 s.The protected trigger data was plotted.The maximum counts were recorded when the source was at the +Z face; each panel shows this max count value as a dashed green line to facilitate trigger comparison.

Figure 16 .
Figure 16.Updated EIRSAT-1 MEGAlib mass model including the GTRB with one solar panel cut out to view the internal components.

Figure 17 .
Figure 17.The left panel presents GMOD GTRB modelled in MEGAlib Geomega.The shapes highlighted in green are all vacuum cut-outs.The GTRB is 5 mm thick at the edge and then there is a 1 mm indent, as shown by the dark blue sections, which are large vacuum cut-outs.The right panel is the physical GMOD GTRB attached to the GMOD detector assembly.

Figure 18 .
Figure 18.The GMOD GTRB modelled in MEGAlib Geomega included above the detector assembly (LHS) and then within the full spacecraft model (RHS) where the position of the detector assembly has also been updated to reflect the flight model.

Figure 19 .
Figure 19.Spectra (counts/keV/hour) produced by the simulated MEGAlib GMOD detector (teal)for the five sources with known activities in Table1.In each panel, the spectra produced by the physical GMOD FM are plotted for comparison.
) and fit coefficients b = 0.6274 and c = 1.3940 × 10 −2 , as in Figure 21.The MEGAlib model results (teal) reflect the measured energy resolution of GMOD FM (grey solid line).

Figure 20 .
Figure 20.GMOD simulated σ as a function of energy, fitted with Equation (5) and coefficients a = 0, b = 0.6810 and c = 9.6791 × 10 −3 .The model is in good agreement with the relationship fit to the measured spectra (grey solid line).Relative statistical errors in the sigma values are under 4%.

Figure 21 .
Figure 21.Simulated energy resolution in terms of FWHM (%) fit with Equation (6) and coefficients a = 0, b = 0.6274 and c = 1.3940 × 10 −2 .The model is in good agreement with the relationship fit to the measured spectra (grey solid line).Relative statistical errors in the resolution values are under 4%.

Figure 22 .
Figure 22.GMOD FM simulated effective area as a function of energy, where all the simulated source positions were above the +Z face of the spacecraft at the CoC.

Figure 23 .
Figure 23.GMOD FM simulated angular response compared with the measured FM response at 662 keV.Errors in measured values are mainly due to systematic uncertainties.Errors for simulated values are purely statistical and under 1%.

Figure 24 .
Figure 24.GMOD FM simulated angular response compared with the measured FM response at 59.4 keV.Errors in measured values are mainly due to systematic uncertainties.Errors for simulated values are purely statistical and under 1%.

Table 2 .
May 2013.Energy calibration source positions and the duration of spectral integrations.Sources 1-5 were placed above the +Z endcap of the spacecraft at various distances from the centre of the GMOD crystal (CoC).Source 6 was aligned with the CoC in X, placed 222 mm from the +Y face and 119 mm from the −Z face on the table.

Table 4 .
Comparison of effective area for measured and simulated GMOD FM at 662 keV and 59.4 keV at +Z (polar angle 0 • ) and −Z (polar angle 180 • ).