Gamma-ray Templates Help Written 26-Sep-2021, Gerry Share and Kim Tolbert Modified 11-Feb-2024, Gerry Share and Kim Tolbert Modified 14-Feb-2024, Kim Tolbert The fitted amplitudes of the nuclear-line templates used in OSPEX fits to gamma-ray data provide the fluxes (gamma/cm^2-s) in those lines at energies >200 keV. Templates are provided for different sets of parameters. For example, there are three sets of templates when we combine lines for different elemental compositions, such as photospheric, coronal (the composition found in gradual SEP events), and rea (the composition found in impulsive SEP events). The three templates are 1) the alpha-4He fusion lines, 2) narrow nuclear de-excitation lines, and 3) broad nuclear de-excitation lines. The are templates for 5 ambient/accelerated compositions: pho/pho, pho/cor, pho/rea, cor/cor, and cor/rea. The templates are all calculated assuming the accelerated particle distribution is produced in magnetic loop with magnetic convergence having a value of delta=0.2 and for saturated pitch angle scattering. Templates are provided for 6 heliocentric angles. Once these parameters are defined the three sets of templates, alpha, narrow, and broad are provided for accelerated alpha/proton ratios from 0.01 to 0.7 and for accelerated ion power-law indices from 1.6 to 6. The gamma-ray templates are stored at https://hesperia.gsfc.nasa.gov/rhessi_extras/gamma_ray_templates/ under four directories: 3comp abun pions 22scat The templates used for fitting are stored in the .sav files in those directories. The yields*.dat files in each directory are used manually by the user to convert the flux to number of protons (see 'CONVERTING THE FLUX TO INFERRED NUMBER OF PROTONS > 30 MeV' section below). The 3comp (including 3He) and abun templates are produced by particles transported in a magnetic loop with intense turbulence producing saturated pitch angle scattering. The abundance templates provide the spectra produced by proton and alpha (direct) interactions on C, N, O, Ne, Mg, Si, S, and Fe and by C, N, O, Ne, Mg, Si, S, and Fe heavy nuclei (inverse) interactions on ambient H and He where the H/He ratio is 0.085 for photospheric abundance and is 0.036 for coronal abundance. These templates are based on Murphy, Kozlovsky, Kiener, and Share (2009). Such abundance fits include several parameters and are best used only for intense flares with instruments with good spectral resolution. In many cases it is best to use 3comp templates that combine the spectra of the elements based on the assumed compositions of the ambient medium (Pho or Cor) and of the accelerated ions (Pho, Cor, or Rea). 3He templates in the 3comp directory provide spectra for 3He interactions on photospheric or coronal ambient compositions. The pions directory contains templates with spectra from isotropic proton and particle interactions on H and He (He/H = 0.1) based on Murphy, Dermer, and Ramaty (1987) for a magnetic field of 500G and density of 1.e^15/cm^3 with effects due to solar atmospheric attenuation taken into account. NB, the expected distribution of accelerated particles is expected to be anisotropic and downward directed (as discussed above). Thus, the templates are only accurate near the solar limb. The 22scat directory contains templates of the calculated spectra of solar atmospheric scattered radiation from the 2.223 MeV neutron capture line produced deep in the solar atmosphere (Murphy and Share [2018] and Murphy and Share [2021 in preparation]). Note: the 2223_neutr_cap directory contains no templates. The 2.223 MeV neutron capture line should be fitted with a Gaussian. DETAILED DESCRIPTION: 3COMP includes subdirectories pho-cor, pho-pho, pho-rea, cor-cor, cor-pho, cor-rea where the first name is the ambient abundance and the second is the accelerated particle abundance and: Pho - an elemental composition similar to that found in the solar photosphere. Cor - an elemental composition similar to that found in gradual solar energetic particle events or in the corona. Rea - an elemental composition found in impulsive solar energetic particle events defined by Don Reames (rea). (So pho-cor are templates for a photospheric ambient abundance and a gradual or coronal accelerated particle abundance) 3he_cor - 3He interactions on coronal compositions. No explicit dependence on alpha/p ratio 3he_pho - 3He interactions on photospheric compositions. No explicit dependence on alpha/p ratio nar_pho_none - described below nar_cor_none - described below The theta subdirectories provide templates for the heliocentric angle of the flare site from Sun center (0-90 degrees) or the angle between the magnetic field lines on which the particles travel and the vector from Sun center to Earth. Each theta directory contains files named xx_yy_apzzz_snnn_thtt.sav where xx - cc=cor_cor, cp=cor_pho, cr=cor_rea, pc=pho_cor, pp=pho_pho, pr=pho_rea yy - aa (alpha particles interactions with ambient 4He) nar (adds together all the direct interaction templates) brd (adds together all the inverse interaction templates apzzz - accelerated alpha particle/proton number ratio. In the solar atmosphere the 4He/H ratio is 0.085. Alphas are accelerated 4He and protons are accelerated H. snnn - the power law index of the accelerated particles producing the gamma rays. (s160 means plindex=1.6) thtt - the heliocentric angle from disk center (0-90 degrees) of the flare 3COMP also includes directories nar_pho_none and nar_cor_none which provide provide narrow (direct interactions) on the atmosphere with Ne removed from the ambient material. This allows the Ne abundance to be determined independently as described in Share, Murphy, et al [2021 in preparation]. Included are templates for photospheric and coronal compositions with Ne removed; these are to be used in place of the narrow templates. Also included are templates for proton and alpha interactions on Ne for all the same parameters. ABUN contains normalized gamma-ray line templates for each ambient element that is excited by protons and alpha particles (direct interactions) and templates for each accelerated element that interacts with hydrogen and helium in the solar atmosphere (inverse interactions). ABUN includes directories for six theta values (heliocentric angle from disk center to flare in degrees). Each theta directory contains files named a_on_b_snnn_thtt.sav where a_on_b - accelerated a on b (e.g. c_on_hhe means accelerated carbon and ambient H and He) snnn - the power law index of the accelerated particles producing the gamma rays thtt - the heliocentric angle from disk center (0-90 degrees) of the flare PIONS includes three theta subdirectories (heliocentric angle from disk center to flare in degrees) for three ranges, which contain narrower theta directories (the name now contains 10*angle in degrees) containing templates in those narrower ranges of theta dependent only on the index of the accelerated particles. Note that there is no explicit dependence on alpha/p ratio in the templates. Each theta directory contains files named pi_snn_thttt.sav where snn - the power law index of the accelerated particles producing the gamma rays thttt - the heliocentric angle*10 (so th012 means 1.2 degrees) of the flare from disk center 22SCAT includes ten theta subdirectories (heliocentric angle from disk center to flare in degrees) each of which have just one template of the scattered photons spectrum of the 2.223 MeV line produced by particles with a power-law index of 4. Each theta directory contains files named 22scat_thtt.sav where thtt - the heliocentric angle from disk center (0-90 degrees) of the flare CONVERTING THE FLUX TO INFERRED NUMBER OF PROTONS > 30 MeV The output parameters for all of the templates fit to flux spectra (cts/cm^2 s keV) are in units photons/(cm^2 - s). In each subdirectory there is an ASCII file (called yields*.dat). The numbers in the yield files for the specific composition and heliocentric angle for which there are templates provide the means to estimate the number of >30 MeV flare-accelerated protons per sec from the gamma-ray flux determined by fitting the associated template (e.g. narrow deexcitation lines for pho-cor [ambient-accelerated] at a heliocentric angle of 60 deg for an alpha/proton ratio of 0.1 and a spectral index of 4). This provides independent estimates of the number of accelerated protons. The yields*.dat files contain tables to facilitate converting the flux to number of protons > 30 MeV (Np>30 MeV) for the different templates. 3COMP - The .dat files give the calculated number of photons produced for unit number of protons above 30 MeV (Np>30 MeV = 1) at the Sun. To convert a given flux into inferred Np> 30 MeV for that interaction, divide the flux by the calculated number for the composition, theta, ap, and s, and then multiply by 4 pi R^2 (2.8 X 10-^27). ABUN: The .dat files give the calculated number of photons produced for unit number of protons above 30 MeV (Np>30 MeV = 1) at the Sun, assuming that the ambient or accelerated abundance of a given element (X) relative to H is one; i.e. [X}/[H]=1. To convert a given flux into inferred Np> 30 MeV for that interaction, divide the flux by the calculated number for theta, ap, and s and by a value of the relative abundance [X]/[]H] (either assumed or determined independently), and then multiply by 4 pi R^2 (2.8 X 10-^27). PIONS: The .dat files give the calculated number of pion-decay photons >200 keV produced for unit number of protons above 30 MeV (Np>30 MeV = 1) at the Sun. To convert a given flux into inferred Np> 30 MeV for that interaction, divide the flux by the calculated number for the theta and s, and then multiply by 4 pi R^2 (2.8 X 10-^27). 22SCAT: This does not apply to the 22scat templates. This component is a free parameter and is used to account for the visible continuum from scattering of 2.223 MeV gamma-rays produced deep in the solar atmosphere. It has no direct relationship to the accelerated particles producing the gamma-ray lines. 2223_NEUTR_CAP: The solar flux in the 2.223 MeV neutron capture line line is obtained by fitting a Gaussian to the line feature. The .dat files give the calculated number of photons in the 2.223 MeV line produced for unit number of protons above 30 MeV (Np>30 MeV = 1) at the Sun. These take into account attenuation in the line due to its depth of production. To convert a given flux into inferred Np> 30 MeV for that interaction, divide the flux by the calculated number for the theta and s, and then multiply by 4 pi R^2 (2.8 X 10-^27). There are two sets of .dat files with the yields for an assumed photospheric ambient abundance (0.85) and coronal abundance (0.36). RETRIEVING THE .SAV TEMPLATE FILES AND ACCOMPANYING .DAT FILES The spex_remote_template_widget.pro routine retrieves directory listings from the server, and allows users to choose the template file to copy to the local TEMP directory (whatever IDL get_temp_dir() returns) for use as a template for fitting spectra in OSPEX. Spex_remote_template_widget can be run standalone via the command file = spex_remote_template_widget() or called from within the OSPEX GUI when selecting a template in the Fit Components widget. Or users can go directly to https://hesperia.gsfc.nasa.gov/rhessi_extras/gamma_ray_templates/ and copy files manually to their local directory. Or in an IDL script, once the full path to a file has been specified, users can copy the file via the command sock_copy, remote_fullname, out_dir=get_temp_dir(), local_file=local_name The local name of the copied file will be returned in the local_name variable. For example: sock_copy, $ 'https://hesperia.gsfc.nasa.gov/rhessi_extras/gamma_ray_templates/22scat/22scat_theta31/22scat_th31.sav', $ out_dir=get_temp_dir(), local_file=local_name print,local_name C:\Users\atolbert\AppData\Local\Temp\22scat_th31.sav