Skip to contents

Update field bad.pixs of the instrument descriptor embedded in raw_spct and raw_mspct objects.

Usage

update_bad_pixs(x, bad.pixs = NULL, action = "replace")

Arguments

x

raw_spct or raw_mspct object with attribute instr.desc set.

bad.pixs

numeric New vector of indexes to bad pixels in the detector array. If NULL, bad pixels are retrieved from calibration data in the current version of 'ooacquire'.

action

character One of "replace" or "add".

Value

a copy of x with an updated instr.desc attribute embedded.

Details

Spectral objects, including those with raw counts data can contain an instrument descriptor. One member of this attribute is a vector of indexes to bad pixels. New bad pixels can be identified in some cases after data are acquired. Recomputing of physical quantities from raw counts normally reuses the embedded calibration data. Function update_bad_pixs() makes it possible to update the embedded bad pixels information before recomputing derived quantities. This function can be applied only to raw_spct objects created with functions from package 'ooacquire'.

With defaults arguments for formal parameters bad.pixs and action, the bad.pixs field of the descriptor is updated to match that in the matching calibration data in the version of 'ooacquire' currently loaded. However, if a numeric vector to positions in the detector array is passed as argument, depending on the argument passed to action, this vector will be used either to replace the existing one, or the indexes in the vector "added" to those already stored, using union().

Note

Only objects of class raw_spct, individually or as members of a raw_mspct object, are supported as the update must precede any conversion into physical units, and will propagate to returned values when computations are applied to the updated raw_spct objects.