Giter Club home page Giter Club logo

gamma's Introduction

gamma

R-CMD-check codecov

r-universe CRAN Version CRAN checks CRAN Downloads

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

DOI SWH

Overview

gamma is intended to process in-situ gamma-ray spectrometry measurements for luminescence dating. This package allows to import, inspect and (automatically) correct the energy scale of the spectrum. It provides methods for estimating the gamma dose rate by the use of a calibration curve. This package only supports Canberra CNF and TKA files.

The gammaShiny package provides an enhanced graphical user interface for the main applications of gamma.

To cite gamma in publications use:

  Lebrun B, Frerebeau N, Paradol G, Guérin G, Mercier N, Tribolo C,
  Lahaye C, Rizza M (2020). "gamma: An R Package for Dose Rate
  Estimation from In-Situ Gamma-Ray Spectrometry Measurements."
  _Ancient TL_, *38*(2), 1-5.

  Frerebeau N, Lebrun B, Paradol G (2024). _gamma: Dose Rate Estimation
  from in-Situ Gamma-Ray Spectrometry_. Université Bordeaux Montaigne,
  Pessac, France. doi:10.5281/zenodo.2652393
  <https://doi.org/10.5281/zenodo.2652393>, R package version 1.0.5.

Installation

You can install the released version of gamma from CRAN with:

install.packages("gamma")

And the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("crp2a/gamma")

Usage

## A minimal example
library(gamma)

## Find the full path to the spectrum file
spc_file <- system.file("extdata/LaBr.CNF", package = "gamma")
## Import the spectrum
spectrum <- read(spc_file)

## Set the expected channel/energy peaks for the energy scale calibration
## Spectrum pre-processing and peak detection
peaks <- spectrum |>
  signal_slice() |>
  signal_stabilize(f = sqrt) |>
  signal_smooth(method = "savitzky", m = 21) |>
  signal_correct(method = "SNIP", n = 100) |>
  peaks_find()

## Set the energy values (in keV)
set_energy(peaks) <- c(238, NA, NA, NA, 1461, NA, NA, 2615)

## Calibrate the energy scale
calib <- energy_calibrate(spectrum, peaks)

## Inspect peaks
plot(calib, peaks)

## Estimate the gamma dose rate of a set of spectra
## You may want to give extra attention to the energy calibration step
spc_file <- system.file("extdata/BDX_LaBr_1/test", package = "gamma")
spectra <- read(spc_file)

## Load the calibration curve for the dose rate estimation
## As this curve is instrument specific, you will have to build your own
## See help(fit_dose)
data("BDX_LaBr_1", package = "gamma")
plot(BDX_LaBr_1)

## Estimate the gamma dose rate
(doses <- dose_predict(BDX_LaBr_1, spectra))
#>            names   dose_Ni  error_Ni dose_NiEi error_NiEi
#> 1 20110523204008  252.2866  378.6325  220.6747   331.0412
#> 2 20110523210008  257.3316  386.1409  219.1303   328.7243
#> 3 20110527205316  247.5890  371.4762  203.0288   304.5699
#> 4 20130809172451  892.1003 1338.3368  849.8817  1274.9341
#> 5 20130813181639 1065.0899 1597.8515 1024.9325  1537.5334
#> 6 20160717175757  565.6418  848.6886  496.7518   745.1931
#> 7 20160717181052  480.1928  720.4625  421.8396   632.8149
#> 8 20160717182601  497.7403  746.7658  436.2712   654.4642

Contributing

Please note that the gamma project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Acknowledgements

This work received a state financial support managed by the Agence Nationale de la Recherche (France) through the program Investissements d’avenir (ref. 10-LABX-0052 and 11-IDEX-0001).

gamma's People

Contributors

blebrun avatar nfrerebeau avatar rlumsk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gamma's Issues

Enhancement of the import section

In order to improve the user experience here are some feature request for this section :

  • change tab section to : " 1 - file import"
  • allow user to display one or more spectra on the plot (tick box ?)

Export graph in "energy calibration tab"

Is your feature request related to a problem? Please describe.
It is not possible to export graph on the "energy calibration" tab

Describe the solution you'd like
A button to be able to export the graph.

Describe alternatives you've considered
A screenshot is a terrible alternative ^^

Add zoom ability to plot of the import tab

Is your feature request related to a problem? Please describe.
There is no possibility to zoomon the plot of the import tab

Describe the solution you'd like
Add the same zoom function on this tab as in the energy calibration tab

"Select a calibration curve" improvement

To prevent users from forgetting to select the relevant calibration curve, it would be desirable that no calibration curve be selected by default.
This would force the user to knowingly select the correct curve so that the dose rate table does not remain empty.

"geom_pointrange" function not found

Describe the bug
No plot is produced in the dose rate estimation tab. Instead, thie message is displayed : "Error: impossible to find the function "geom_pointrange"

Screenshots
Capture d’écran 2019-11-14 à 16 43 26

Enhancement of the export plot option

It would be really cool to have a "publication-ready" plot export option. I mean by that a standardized export of plot with the following pre-defined settings :

  1. A more exploitable (and fixed) plot size.
  2. A relevant font size (8pt ?).

Enhancement of the Dose rate section

In order to improve the user experience here are some feature request for this section :

  • Change tab name to : "3 - Dose rate calculation"
  • add measurement time value in the table
  • add the ability display only selected samples in the table
  • add the ability to control the number of significant digits displayed
  • add the ability to export the results as .xls

plot not produced

Describe the bug
When exporting a plot from the "import" tab, the folowing error message is displayed, with no plot produced

Warning: Error in ggsave: impossible de trouver la fonction "ggsave"
  [No stack trace available]

Possibility to energy-calibrate more than one spectrum at a time

At the moment, when trying to energy-calibrate multiple spectra at a time (formal class "GammaSpetra") using the function energy_calibrate(), one receives the following error message:

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘energy_calibrate’ for signature ‘"GammaSpectra", "PeakPosition"

Is it possible to enable this functionality?
Thank you!

Export table

Is your feature request related to a problem? Please describe.
A table is displayed in the Shiny interface, tab "import", but it is not possible to export it

Describe the solution you'd like
A button allowing us to export this table as a .csv file

Enhancement of the zoom function

Is your feature request related to a problem? Please describe.
There is actually no way to know that we can perform zoom on the plot of the energy calibration tab, moreover, once we have zoomed, there is no way to go back to the full view (or it is so unnatural that I was not able to find how to do it).

Describe the solution you'd like
Change the cursor to a magnifying glass when hoovering the plot, and put a "reset zoom" button

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.