The denoise_spectrum()
function uses quadratic trend
filtering to optimally denoise each of the \(IQU\) Stokes parameters of
a polarized spectrum, in turn also leading to denoised estimates for the
normalized Stokes parameters
\(Q/I\) and \(U/I\). Setting compute_uncertainties = TRUE
generates a bootstrap ensemble of denoised spectra for each Stokes parameter,
which allows variability bands to be computed for each denoised spectrum by
then calling bands()
on the denoise_spectrum()
output.
denoise_spectrum( wavelength, flux, variance, mask, lambda = c("lambda_min", "lambda_1se"), compute_uncertainties = FALSE, break_at = 10L, min_pix_segment = 10L, mc_cores = parallel::detectCores() - 4, ... )
wavelength | Vector of wavelength measurements. |
---|---|
flux | Spectropolarimetric measurements, passed as a 3-column tibble, data frame, or matrix, with the columns corresponding to the \(IQU\) Stokes parameters, respectively. |
mask | Pixel masks, in a tibble, data frame, or matrix with dimensions
matching those of |
compute_uncertainties | (Boolean) If |
break_at | The minimum number of consecutively-masked spectral pixels
that will trigger a break in the spectrum. Defaults to |
min_pix_segment | After the segmentation procedure is complete, the
resulting segments are examined to ensure that each is sufficiently long for
a non-trivial/well-defined denoising analysis. In particular, any segment
that has fewer than |
mc_cores | Multi-core computing using the
|
... | (Optional) Named arguments to be passed to
|
variances | Measurement variances, in a tibble, data frame, or matrix
with dimensions matching those of |
An object of class 'polarized_spectrum'
. This is a list with the
following elements:
Number of segments the spectrum was broken into by
break_spectrum()
.
The original data set, as a list of n_segments
tibbles. Each
tibble contains the observed wavelengths (with the union set of masked
wavelengths removed), the Stokes \(IQU\) flux measurements, and the
measurement variances.
The set of denoised spectra, as a list of
n_segments
tibbles. Each tibble contains the wavelength evaluation grid for
its respective segment and all of the denoised signal estimates:
\(I\), \(Q\), \(U\), \(Q/I\), \(U/I\).
If compute_uncertainties = TRUE
, a list of bootstrap
ensembles for the denoised \(I\), \(Q\), \(U\) parameters,
respectively. Each ensemble is returned as an \(n \times B\) matrix.
If compute_uncertainties = FALSE
, this will return NULL
.
Technical summary of the denoising analysis of the \(I\) Stokes parameter.
Same as above, but for the \(Q\) Stokes parameter.
Same as above, but for the \(U\) Stokes parameter.
Politsch et al. (2020a).
Trend filtering – I. A modern statistical tool for time-domain astronomy and
astronomical spectroscopy. MNRAS, 492(3), p. 4005-4018.
Politsch et al. (2020b). Trend Filtering – II. Denoising astronomical signals with varying degrees of smoothness. MNRAS, 492(3), p. 4019-4032.
# Any SALT Observatory spectrum can be read into R from its FITS file # using the "FITSio" R package, as below. In the example below, we will # analyze the polarized spectrum of a SALT Wolf-Rayet star. For convenience, # here we've stored the header and data units (HDU) from the FITS file into # three variables (`sci`, `var`, and `bpm`) that are stored in an R data file # within this package, so we can source them using a simple call to `data()`. if (FALSE) { install.packages("FITSio") path_to_FITS_file <- "<your_local_path_to_FITS_file>" file.name <- "WR006_c1_12345678_stokes.fits" sci <- FITSio::readFITS(paste0(path_to_FITS_file, file.name), hdu = 1) var <- FITSio::readFITS(paste0(path_to_FITS_file, file.name), hdu = 2) bpm <- FITSio::readFITS(paste0(path_to_FITS_file, file.name), hdu = 4) } #### library(dplyr) data(polarized_spectrum_WR_star) wavelength <- seq( from = sci$axDat$crval[1], by = sci$axDat$cdelt[1], length = sci$axDat$len[1] ) flux <- as_tibble(sci$imDat) variance <- as_tibble(var$imDat) %>% select(1:3) mask <- as_tibble(bpm$imDat) spec_denoised <- denoise_spectrum( wavelength, flux, variance, mask, compute_uncertainties = TRUE )