Information for prodrate.m calibrating reference 10Be and 26Al production rates.
The calculator is fixed by Jakob Heyman (jakob.heyman@gu.se) 2015-2019 mainly based on the CRONUS
calculator (Balco et al. 2008) and the LSD production rate scaling (Lifton et al. 2014).


TO USE THE CALCULATOR:
1. Fix the input.txt file (see below).
2. Adjust Pmin10/Pmin26 and Pmax10/Pmax26 in rows 17-20 in prodrate.m.
   Pmin and Pmax defines the range of reference production rates that is tested and all individual
   samples in input.txt must yield reference production rates falling between these values for the
   code to work.
2. Run prodrate.m in Octave or Matlab.
3. Reference 10Be and/or 26Al production rates (atoms/g/yr) are saved in out-prodrate.txt.


The calculator is based on the CRONUS calculator (Balco et al. 2008) with some modifications:
* Nuclide-specific time-dependent LSD spallation production rate scaling based on simulated cosmic
  ray fluxes (Lifton et al. 2014).
* Time-constant muon production rate parameterization, including depth dependence for samples with
  an assumed erosion rate, based on Antarctica depth profile data (Borchers et al. 2016; Marrero et
  al. 2016; Phillips et al. 2016; Balco 2017) with fstar and sigma0 calibrated using muclib.m.
* Adjustment of the time-dependent production rate to the year of sampling (assuming a constant
  production since 2010).
* Atmospheric pressure based on sample elevation and ERA-40 re-analysis dataset ('std'), Antarctica
  best-fit interpolation ('ant') (Balco et al. 2008), or given directly ('pre') in hPa.
* Attenuation length for calculating the spallation production rate adjustments for sample thickness
  and erosion rate interpolated from atmospheric pressure and cutoff rigidity (Marrero et al. 2016).
* Sample group reference production rate calibration based on chi-square minimization, adjusting the
  reference production rate to derive the best match with the calibration age for the full set of
  samples.
* Sample group reference production rate uncertainty calculated using an unbiased estimator of the
  weighted production rate uncertainty.
* The calibration age uncertainty, which is not an independent variable for each sample of a
  calibration site, is added in quadrature to the sample group reference production rate (and to
  each sample reference production rate uncertainty).
* If Pcluster = 1 (line 24), outliers are removed in an attempt to achieve a well-clustered
  reference production rate. Parameters for this (lines 27-29) are minimum number of well-clustered
  samples, maximum outlier ratio of full group size, and p-value limit for clustering test.


INPUT INSTRUCTIONS:
The input is similar to the input for the CRONUS exposure age calcuator version 2, with changed unit
for erosion rate and the addition of sampling year, calibration age, and calibration age
uncertainty. Each row in input.txt is one sample. The file input.txt should contain 18 columns with
the following information:
1. Sample name - (strange characters may cause problems).
2. Latitude [DD (WGS84)] - North latitudes are positive. South latitudes are negative.
3. Longitude [DD (WGS84)] - East longitudes are positive. West longitudes are negative.
4. Elevation/pressure [m a.s.l. / hPa].
5. Elevation/pressure flag - std/ant/pre (ERA40 elev interpol/Antarctica elev/atmospheric pressure).
6. Sample thickness [cm].
7. Sample density [g/cm3].
8. Correction factor - Unitless factor used for topo/geom shielding correction (no shielding -> 1).
9. Erosion rate [mm/ka]. NOTE: different unit than in the CRONUS calculator.
10. 10Be concentration [atoms/g] - (if no 10Be measurement: use 0).
11. 10Be concentration uncertainty [atoms/g] - (if no 10Be measurement: use 0).
12. 10Be standardization - See make_consts_expage.m lines 34-38 for acceptable names and values.
13. 26Al concentration [atoms/g] - (if no 26Al measurement: use 0).
14. 26Al concentration uncertainty [atoms/g] - (if no 26Al measurement: use 0).
15. 26Al standardization - See make_consts_expage.m lines 41-42 for acceptable names and values.
16. Sampling year [CE].
17. Calibration age [yr before sampling] - Independently known exposure age.
18. Calibration age uncertainty [yr].


OUTPUT INFORMATION:
The calculator saves reference 10Be/26Al production rates in the file out-prodrate.txt. The
reference production rate (atoms/g/yr) with uncertainty (including calibration age uncertainty) is
saved for each sample. In the second last row the combined sample group 10Be/26Al reference
production rate (atoms/g/yr) is saved. In the last row the reduced chi-square value and chi-square
statistics p-value for the group 10Be/26Al reference production rate is saved.

If there is only one 10Be or 26Al measurement the output will only contain the individual sample
production rate (no group production rate and statistics).

Samples with 0/0 concentration/uncertainty yield '-' in the output.
If all input 10Be concentration/uncertainty are 0/0 no 10Be data is saved.
If all input 26Al concentration/uncertainty are 0/0 no 26Al data is saved.

The calculator plots (line 23) individual sample proabability density curves (red lines), a summed
probability density curve (black line) for the reference production rates, individual outlier
density curves (blue lines), and the group reference production rate (vertical black line) and
uncertainty (grey area). Note that the probability density curves do not include the calibration age
uncertainty but the group production rate uncertainty (grey area) does include the calibration age
uncertainty.
