Skip to contents

Reads a gamma ray spectrum file.

Usage

read(file, ...)

# S4 method for character
read(file, extensions = c("cnf", "tka"), ...)

Arguments

file

A character string giving the path of files to be imported.

...

Extra parameters to be passed to rxylib::read_xyData().

extensions

A character vector specifying the possible file extensions. It must be one or more of "cnf", "tka".

Value

A GammaSpectra object if more than one spectrum are imported at once, else a GammaSpectrum object.

Note

Only supports Canberra CNF and TKA files.

See also

Author

N. Frerebeau

Examples

## Import a Canberra CNF file
cnf_file <- system.file("extdata/LaBr.CNF", package = "gamma")
(cnf_spc <- read(cnf_file))
#> Gamma spectrum:
#> *  name: LaBr
#> *  date: 2019-02-07 11:48:18
#> *  live_time: 3385.54
#> *  real_time: 3403.67
#> *  channels: 1024
#> *  energy_min: -7
#> *  energy_max: 3124.91

## Import a TKA file
tka_file <- system.file("extdata/LaBr.TKA", package = "gamma")
(tka_spc <- read(tka_file))
#> Gamma spectrum:
#> *  name: LaBr
#> *  date: 2024-04-09 09:33:37.903032
#> *  live_time: 3385.54
#> *  real_time: 3403.67
#> *  channels: 1024
#> *  energy_min: NA
#> *  energy_max: NA

## Import all files in a given directory
spc_dir <- system.file("extdata/BDX_LaBr_1/calibration", package = "gamma")
(spc <- read(spc_dir))
#> A collection of 7 gamma spectra: BRIQUE, C341, C347, GOU, LMP, MAZ, PEP