# BetaShape
The BetaShape program calculates **beta and electron capture decays**, and provides for each transition:
* Energy spectra of the emitted &beta; and &nu; particles, of the internal bremsstrahlung (IB) photons and of the recoiling nucleus.
* Capture probabilities and capture-to-positron ratios for all subshells.
* Average energies and a detailed energy balance.
* log-_ft_ values.
* In case of multiple branches, total decay spectra are also generated for each type of particles.

All results are provided as formatted text files, including updated ENSDF (or ENSDF-JSON) files and CSV files. A graphical interface is also provided.

BetaShape is part of the [ENSDF Analysis and Utility Programs](https://nds.iaea.org/public/ensdf_pgm/).
It is also made available on [LNHB website](http://www.lnhb.fr/rd-activities/spectrum-processing-software/) as part of the Utility Programs of the [Decay Data Evaluation Project (DDEP)](http://www.lnhb.fr/nuclear-data/nuclear-data-table/).
Any question can be addressed to Xavier Mougeot: xavier.mougeot@cea.fr

## Downloads
Ready-to-use packages (command-line programs and graphical interface) can be downloaded from the [latest release](https://github.com/IAEA-NSDDNetwork/BetaShape/releases/latest), for:
* **Windows 11** (64-bit).
* **Ubuntu 26.04 LTS** (x86_64) and later.
* **macOS 15** and later, on Apple silicon (M1 or later). The programs are not signed with an Apple Developer ID: after unzipping, run once `xattr -dr com.apple.quarantine ~/BetaShape-3.0` in the Terminal (see `README_macOS.txt` in the package).

Each archive comes with a `.sha256` checksum file. The user manual (PDF) and the description of the CSV format (Excel file) are available in this repository.

## Quick start
Define the `BSINSTALL` environment variable and add it to your `PATH` (Section 1 of `README.txt` in the package; `update_bsinstall_*` scripts are provided). Running the benchmark calculations is recommended at first use:
```
mybench          (Windows: mybench.bat)
```
The program takes as input a formatted ENSDF file, for example [Ni63.txt](http://www.lnhb.fr/nuclides/Ni-63.txt) for <sup>63</sup>Ni decay, or an NNDC ENSDF-JSON file (`.json`, beta version). With default options, it is simply run by typing:
```
betashape Ni63.txt
```
Various options are available (`betashape -help`). In the previous example, one can ask in addition for an update of the Q-value (from AME2020), spectra with a constant energy step of 0.5 keV and a CSV file:
```
betashape Ni63.txt -qval myEstep=0.5 -csv
```
**Graphical interface**: double-click `BetaShapeGUI` (`.exe` on Windows, `.app` on macOS) in the BetaShape folder. Load an ENSDF or JSON file, or enter a single transition, set the options and run; results, spectra (with figure and CSV export), energy balances and updated files are then displayed. Interface in English or French.

More information can be found in the `README.txt` file within the package.

## Citations
**Beta decays**: [2023MO21] [X. Mougeot, Applied Radiation and Isotopes 201, 111018 (2023)](https://doi.org/10.1016/j.apradiso.2023.111018)

**Electron captures**: [2019MO35] [X. Mougeot, Applied Radiation and Isotopes 154, 108884 (2019)](https://doi.org/10.1016/j.apradiso.2019.108884)

## Change history
#### Version 3.0 (2026/10)
* New **graphical interface** (English/French) for Windows, Linux and macOS.
* **Nuclear recoil**: &beta;, &nu; and recoil spectra from three-body kinematics for beta transitions (`recoil=1`, default); two-body recoil energy per subshell for electron capture.
* **Internal bremsstrahlung** photon spectra (with `rd=1`): Ivanov et al. (`ibmodel=1`, default) or Knipp-Uhlenbeck-Bloch (`ibmodel=0`) for beta transitions; Morrison-Schiff for electron capture.
* **Energy balance** of each transition (&beta;, &nu;, recoil, IB, atomic relaxation, shaking), also given in CSV files (CSV format 3.0).
* **Neutrino mass** (`mnu=`) and **sterile neutrino** (`mst=`, `Pst=`).
* Charge radius models from Angeli (`rmsmodel=`); revised atomic overlap correction; physical constants from CODATA 2022.
* Total spectra: recoil and IB added for beta transitions; new total file for electron capture (`capt_[Element][A]_tot.bs`: &nu; lines and continuum, IB, energy balance); revised uncertainties of total spectra and mean energies.
* Intensities: absolute or relative treatment from `BR`&times;`NB` (`brnb=`, `brnb_lim=`).
* **ENSDF-JSON input** (NNDC format, beta version), with updated JSON output.
* All programs in `bin/`, found through `BSINSTALL`: BetaShape runs from any directory. New options `-version`, `-help` and `-silent`.

#### Version 2.4 (2024/06)
* Acceleration of electron capture calculations by a factor of 50.
* An environment variable (`BSINSTALL`) can be defined to run from any directory.
* Validation of the code on the entire ENSDF database, archive version of January 2024.

#### Version 2.3.1 (2023/12)
* A few bugs fixed in generated CSV files.
* Insertion of a comment line with the code version in updated ENSDF files.
* Description of CSV format in a separate Microsoft Office Excel file.

#### Version 2.3 (2023/09)
Following the [24<sup>th</sup> NSDD meeting](https://conferences.iaea.org/event/323/) held at the Australian National University in Canberra (24-28 October 2022) and further discussions, the changes below have been implemented.
* Provision of:
  - __*f*-values__ in CSV files.
  - __mean energy of the emitted neutrinos__ in CSV files.
  - __experimental shape factors__ in updated ENSDF files.
* **Rounding limit** can be changed via the option `unc_digit=X` with `X` from 1 to 99 (50 by default).
* Treatment of __non-numeric uncertainties__ (`LT`, `GT`, `LE`, `GE`, `AP`, `CA`, `SY`), and __asymmetric uncertainties__ (with the `-asym` option) via the Min-Max method.
* Modification of __forbidenness assignment__
  * Initial and final J<sup>&pi;</sup> unambiguously defined: single J, single &pi; for each level, `()` and `[]` accepted.

    &rarr; Allowed or forbidden unique transition treated correctly.

    &rarr; Forbidden non-unique transition treated as transition of same &Delta;J ignoring spin change (also known as &xi;-approximation)
    * 1<sup>st</sup> forbidden non-unique as allowed.
    * 2<sup>nd</sup> forbidden non-unique as <sup>st</sup> forbidden unique.
    * 3<sup>rd</sup> forbidden non-unique as 2<sup>nd</sup> forbidden unique.
    * etc.
  * Initial and final J defined but at least one parity undefined

    &rarr; Transition treated according to the &xi;-approximation.
  * Otherwise, transition treated as allowed: initial and final J undefined; unplaced transitions; several J or &pi; in at least one level.
* Treatment of __branching ratios__
`BR` and `NB` from N and PN records are taken into account to determine the normalization factor, and their uncertainties are propagated.

_Nota Bene_: For an EC/B+ transition, the splitting of the branch is calculated and the EC and B+ intensities are updated. Their uncertainties do include the uncertainty on the normalization factor. There is a risk of inconsistency because of multiple counting:
  * If the uncertainty on the normalization factor includes the uncertainties on the intensities, and vice-versa.
  * If the code is run several times on the updated dataset.

## Disclaimer
Neither the author nor anybody else makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness or usefulness of any information disclosed, or represents that its use would not infringe privately owned rights.
