Represents a single spectrum of a gamma ray spectrometry measurement.
Slots
hashA
characterstring giving the 32-byte MD5 hash of the imported file.nameA
characterstring the measurement reference.dateA
POSIXctelement giving the measurement date and time.instrumentA
characterstring giving the instrument name.file_formatA
characterstring giving the format of the imported file.live_timeA
numericvalue.real_timeA
numericvalue.channelA
integervector giving the channel number. Numeric values are coerced to integer as byas.integer()(and hence truncated towards zero).energyA
numericvector giving the gamma ray's energy (in keV).countA
numericvector giving the counts number for each channel. Numeric values are coerced to integer as byas.integer()(and hence truncated towards zero).rateA
numericvector the count rate (\(1/s\)) for each channel.calibrationA linear model used for energy scale calibration (see
energy_calibrate()).
Access
In the code snippets below, x is a GammaSpectrum object.
length(x)Get number of channel in
x.get_hash(x)Get the MD5 hash of the raw data file.
get_names(x),set_names(x) <- valueRetrieves or sets the name of
xaccording tovalue.get_channels(x)Get the number of channels in
x.get_counts(x)Get the counts of
x.get_energy(x)Get the energy range of
x.get_rates(x)Get the count rates of
x.
Coerce
In the code snippets below, x is a GammaSpectrum object.
as.matrix(x)Coerces
xto amatrix.as.data.frame(x)Coerces
xto adata.frame.
Subset
In the code snippets below, x is a GammaSpectrum object.
x[[i]]Extracts information from a slot selected by subscript
i.iis acharactervector of length one and will be matched to the name of the slots.
See also
Other class:
Baseline-class,
CalibrationCurve-class,
GammaSpectra-class,
PeakPosition-class,
coerce()
Examples
## Import a Canberra CNF file
spc_file <- system.file("extdata/LaBr.CNF", package = "gamma")
(spc <- read(spc_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
## Access
get_hash(spc)
#> [1] "e0a2c67173cf7f407db7148ae0058bbf"
get_names(spc)
#> [1] "LaBr"
get_livetime(spc)
#> [1] 3385.54
get_realtime(spc)
#> [1] 3403.67
length(spc)
#> [1] 1024
range_energy(spc)
#> [1] -7.004032 3124.914528
## Subset
spc[["date"]]
#> [1] "2019-02-07 11:48:18 UTC"
spc[["instrument"]]
#> [1] "InSpector 1000"
spc[["file_format"]]
#> [1] "CNF"
