GammaSpectrum-class {gamma} | R Documentation |
An S4 Class to Represent a Gamma Sectrum
Description
Represents a single spectrum of a gamma ray spectrometry measurement.
Slots
hash
A
character
string giving the 32-byte MD5 hash of the imported file.name
A
character
string the measurement reference.date
A
POSIXct
element giving the measurement date and time.instrument
A
character
string giving the instrument name.file_format
A
character
string giving the format of the imported file.live_time
A
numeric
value.real_time
A
numeric
value.channel
A
integer
vector giving the channel number. Numeric values are coerced to integer as byas.integer()
(and hence truncated towards zero).energy
A
numeric
vector giving the gamma ray's energy (in keV).count
A
numeric
vector giving the counts number for each channel. Numeric values are coerced to integer as byas.integer()
(and hence truncated towards zero).rate
A
numeric
vector the count rate (1/s
) for each channel.calibration
A 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) <- value
Retrieves or sets the name of
x
according 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
x
to amatrix
.as.data.frame(x)
Coerces
x
to adata.frame
.
Subset
In the code snippets below, x
is a GammaSpectrum
object.
x[[i]]
Extracts information from a slot selected by subscript
i
.i
is acharacter
vector of length one and will be matched to the name of the slots.
Note
This class retains copy construction.
Author(s)
N. Frerebeau
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))
## Access
get_hash(spc)
get_names(spc)
get_livetime(spc)
get_realtime(spc)
length(spc)
range_energy(spc)
## Subset
spc[["date"]]
spc[["instrument"]]
spc[["file_format"]]