Skip to content

rxu17/snsa-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

snsa-tools

Simple Nuclear Spectra Analysis (SNSA) Tools. This repository containing basic tools to analyze nuclear spectra (mainly spe files of a specific format from Maestro)

Setup

Python virtual env

  1. Clone the repository
  2. Setup a python virtual env
python -m venv <your_env_name>
source <your_env_name>/bin/activate
  1. Run the following to install all dependencies
pip install .

Use this to install in development mode

pip install -e .

Docker

  1. Pull latest docker image
docker pull ghcr.io/rxu17/snsa-tools:main
  1. Run docker image in interactive mode
docker run -it ghcr.io/rxu17/snsa-tools:latest /bin/bash

How to Use

Here is a sample workflow to run the simple spectra analysis which reads in your input SPE file and generates a PNG image of the plot of counts vs channel number from the data retrieved from your SPE files.

python3 run_spe_analysis.py 
    -input <input_filepath>
    -title <title_of_plot>
    -output <output_filepath>

Otherwise, you can import specific functions from spe_analysis_functions for use in your own analysis and create your own SPEData objects from spe_core.

SPEData class

read

The format that the read method in the SPEData class expects is something like the following:

$SPEC_ID:
No sample description was entered.
$SPEC_REM:
DET# 1
DETDESC# DESKTOP-XXXXXX Easy-MCA-XXX SN 12471827
AP# Maestro Version 7.01
$DATE_MEA:
04/05/2023 20:07:54
$MEAS_TIM:
360 361
$DATA:
0 8191
       0
       0
       0
       0
       0
       0
       0
       0
       0
       0
       0
       0
$ROI:
3
1196 1200
2797 2825
3179 3207
$PRESETS:
Live Time
360
0
$ENER_FIT:
0.000000 1.00000
$MCA_CAL:
3
0.000000E+000 1.000000E+000 0.000000E+000 keV
$SHAPE_CAL:
3
0.000001E+000 0.000000E+000 0.000000E+000

plot

Plots will be outputted like the following of Channel vs Counts:

Background Spectra

spe_analysis_functions

These contain helpful functions for analysis

Running tests

  1. Install pytest (an optional dependency) in your local python env
pip install ".[pytest]"
  1. Run tests
python3 -m pytest tests

About

Repository containing basic tools to analyze nuclear spectra (mainly spe files of a specific format from Maestro)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors