Skip to content

Commit

Permalink
Merge pull request #9 from SiLab-Bonn/development
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
leloup314 authored Feb 9, 2022
2 parents e081fcf + 307a134 commit 975ab97
Show file tree
Hide file tree
Showing 36 changed files with 153 additions and 60 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
- master
- development
pull_request:
branches:
- master

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
tests:
name: Testing on Python ${{matrix.python-version}} | ${{matrix.sim}}
runs-on: ubuntu-20.04

strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-latest]
python-version: [3.7, 3.8, 3.9]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Anaconda ${{matrix.python-version}} setup
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{matrix.python-version}}

- name: Dependency installation
shell: bash -l {0}
run: |
conda info -a
conda install numpy scipy pyyaml matplotlib nose jupyter pandas
pip install -r requirements.txt
- name: Package installation
shell: bash -l {0}
run: |
python setup.py develop
- name: Testing
shell: bash -l {0}
run: nosetests
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# example checkpoints
irrad_spectroscopy/examples/.ipynb_checkpoints/
examples/.ipynb_checkpoints/
# example output folder
irrad_spectroscopy/examples/output/
examples/output/
# pyc
*.pyc
# pycharm
Expand Down
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

95 changes: 86 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
==================================
Irrad_Spectroscopy |travis-status|
Irrad_Spectroscopy |test-status|
==================================

Introduction
============

``irrad_spectroscopy`` is a package intended to do gammma spectroscopy of (proton) irradiated samples such as chips, sensors,
PCBs, etc. but can be also used for general gamma spectroscopy e.g. of radioactive sources. It consits of few independent
methods which togehter allow for a complete spectroscopic analysis of radioactive gamma-spectra. A step-by-step full spectroscopy
of an example spectrum can be found in the ``examples`` folder.
``ìrrad_spectroscopy`` is a package which provides functions for gamma and X-ray spectroscopy, including isotope identification, activity determination and spectral dose calculations.
Furthermore, it offers functions for calculating the gamma equivalent dose for given isotopes as a function of their initial activity.

The package was developed for spectroscopic analysis or proton-irradiated semiconductor devices but can be used to analyze various samples,
from radioactive sources to activated machine parts. It consits of few independent methods which togehter allow for a complete spectroscopic analysis, including plotting, of
radioactive gamma-spectra. A step-by-step full spectroscopy of an example spectrum can be found in the ``examples`` folder.

Installation
============

You have to have Python 2/3 with the following packages installed:
You have to have Python 3 with the following packages installed:

- numpy
- scipy
Expand All @@ -37,6 +39,9 @@ To finally install ``irrad_spectroscopy`` run the setup file
Example usage
=============

Full spectroscopy
-----------------

Check the ``examples`` folder for several measured data sets of different sources for calibration and analysis. A `Jupyter Notebook <http://jupyter.org/>`_
with a step-by-step analysis of an example spectrum of an irradiated chip is provided. Install jupyter and run

Expand All @@ -46,14 +51,86 @@ with a step-by-step analysis of an example spectrum of an irradiated chip is pro
in order to open the web interface.

Equivalent dose calculation
--------------------------

The package implements dose rate calculations for individual gamma lines as well as full gamma spectra of isotopes
for various materials (search materials in `this table <https://github.com/SiLab-Bonn/irrad_spectroscopy/blob/development/irrad_spectroscopy/tables/xray_coefficient_table.yaml>`_)
Dose rate calculations are implemented, assuming a point-like source!

Calculating dose rate of an individual gamma line in air:

.. code-block:: python
# Import
from irrad_spectroscopy.physics import gamma_dose_rate
# Get dose rate of single gamma line in uSv/h
# Zn65 line at 1115.564 keV, prob 50.60%, activity of 20 kBq at a distance of 100 cm in air
res = gamma_dose_rate(energy=1115.546,
probability=0.506,
activity=20e3,
distance=100,
material='air')
print(res) # Prints 1.515e-3 # uSv/h
Calculating the (integrated) gamma dose rate of an isotope in air:

.. code-block:: python
# Import
from irrad_spectroscopy.physics import isotope_dose_rate
# Zn65 with activity of 20 kBq at a distance of 100 cm in air
res = isotope_dose_rate(isotope='65_Zn',
activity=20e3,
distance=100,
material='air')
print(res) # Prints {'65_Zn': 1.515e-3} # uSv/h
# Zn65 with activity of 20 kBq at a distance of 100 cm in air
# integrated over 2000 hours
res = isotope_dose_rate(isotope='65_Zn',
activity=20e3,
distance=100,
material='air',
time=2000)
print(res) # Prints {'65_Zn': 2.66} # uSv
Calculating the gamma dose rate of multiple isotopes in air:

.. code-block:: python
# Import
from irrad_spectroscopy.physics import isotope_dose_rate
# Multiple isotopes (Zn65 and Be7) with different activities
# (20 kBq, 100kBq) at a distance of 100 cm in air
res = isotope_dose_rate(isotope=('65_Zn', '7_Be'),
activity=(20e3, 100e3),
distance=100,
material='air')
print(res) # Prints {'65_Zn': 1.515e-3, '7_Be': 0.73e-3} # uSv/h
Testing
=======

The code in this package has unit-tests. These tests contain a benchmark with actual gamma-spectroscopy data of
two calibrated, radioactive sources, namely 22-Na and 133-Ba. The activity reconstruction efficiencies for the
tested data sets are tested to be above 90%.


.. |travis-status| image:: https://api.travis-ci.com/SiLab-Bonn/irrad_spectroscopy.svg?branch=master
:target: https://travis-ci.com/SiLab-Bonn/irrad_spectroscopy
.. |test-status| image:: https://github.com/Silab-Bonn/irrad_spectroscopy/actions/workflows/main.yml/badge.svg?branch=development
:target: https://github.com/SiLab-Bonn/irrad_spectroscopy/actions
:alt: Build status

Example spectrum
================

Generated spectrum, including background and identified peaks, of a radioactive sample after proton irradiation.
Multiple isotopes can be assigned to one peak due to the uncertaiunty of the energy calibration.

.. image:: static/figs/sample_spectrum.png
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@
"# name\n",
"SAMPLE_NAME = 'example_sample'\n",
"\n",
"# paths\n",
"package_path = isp.package_path\n",
"\n",
"example_path = os.path.join(package_path, 'examples')\n",
"example_path = os.getcwd()\n",
"\n",
"data_path = os.path.join(example_path, 'example_data')\n",
"\n",
Expand Down Expand Up @@ -276,21 +273,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.15"
"pygments_lexer": "ipython3",
"version": "3.8.12"
}
},
"nbformat": 4,
Expand Down
9 changes: 1 addition & 8 deletions irrad_spectroscopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
import yaml


# paths
package_path = os.path.dirname(__file__)

examples_path = os.path.join(package_path, 'examples')

testing_path = os.path.join(package_path, 'testing')

tables_path = os.path.join(package_path, 'tables')
tables_path = os.path.join(os.path.dirname(__file__), 'tables')

# table files paths
gamma_table_file = os.path.join(tables_path, 'gamma_table.yaml')
Expand Down
Empty file.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from setuptools import setup, find_packages # This setup relies on setuptools since distutils is insufficient and badly hacked code

version = '0.1.0'
version = '1.0.0'
author = 'Pascal Wolf'
author_email = '[email protected]'

Expand All @@ -11,7 +11,7 @@
setup(
name='irrad_spectroscopy',
version=version,
description='Gamma spectroscopy of irradiated sensors, chips and PCBs.',
description='Gamma and X-ray spectroscopy as well as dose rate calculations of radioactive samples.',
url='https://github.com/SiLab-Bonn/irrad_spectroscopy',
license='MIT License',
long_description='',
Expand Down
Binary file added static/figs/efficiency_calib_eu152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/figs/energy_calib_eu152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/figs/sample_spectrum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import irrad_spectroscopy.spectroscopy as sp
from irrad_spectroscopy.spec_utils import get_measurement_time, source_to_dict, select_peaks
from irrad_spectroscopy.physics import decay_law
from irrad_spectroscopy import testing_path, gamma_table
from irrad_spectroscopy import gamma_table


test_data_path = os.path.join(testing_path, 'test_data')
test_data_path = os.path.join(os.path.dirname(__file__), 'test_data')


class TestSpectroscopy(unittest.TestCase):
Expand Down

0 comments on commit 975ab97

Please sign in to comment.