psd-environment {psd} | R Documentation |
Various environment manipulation functions.
Description
The computation of adaptive power spectral density estimates
requires bookkeeping and non-destructive manipulation of variables.
The functions here are mainly convenience wrappers
designed to maintain variable separation from the
.GlobalEnv
environment so that no innocent variable is destroyed in
the process of iteratively computing spectra.
The user should generally not be using the setters even though
all functions exist in the namespace.
get_psd_env_pointer
is a convenience wrapper to get the environment pointer.
get_psd_env_name
is a convenience wrapper to get the environment name.
psd_envRefresh
will clear any variables in the environment and reset the initialization stamp.
psd_envClear
clears the contents of the environment.
psd_envStatus
returns a list of some information regarding
the status of the environment.
psd_envList
returns a listing of any assignments.
psd_envGet
returns the value of variable
.
psd_envAssign
assigns value
to variable
, but does not return it.
psd_envAssignGet
both assigns and returns a value.
update_adapt_history
updates the adaptive estimation history list.
new_adapt_history
initializes a nested-list object to store the
data from each iteration.
Usage
get_psd_env_pointer()
get_psd_env_name()
psd_envRefresh(verbose = TRUE)
psd_envClear()
psd_envStatus()
psd_envList()
psd_envGet(variable)
psd_envAssign(variable, value)
psd_envAssignGet(variable, value)
get_adapt_history()
last_psd()
update_adapt_history(PSD, stage, ...)
## S3 method for class 'spec'
update_adapt_history(PSD, stage, ...)
## Default S3 method:
update_adapt_history(PSD, stage, ntap = NA, freq = NULL, ...)
new_adapt_history(adapt_stages)
Arguments
verbose |
logical; should messages be given? |
variable |
character; the name of the variable to get or assign |
value |
character; the name of the variable to assign |
PSD |
vector or object with class |
stage |
scalar; the current stage of the adaptive estimation procedure |
... |
additional arguments |
ntap |
vector; the tapers |
freq |
vector; the frequencies |
adapt_stages |
scalar; The number of adaptive iterations to save (excluding pilot spectrum). |
Defaults and Initialization
One can use get_psd_env_pointer()
and get_psd_env_name()
to access the
pointer and name of the environment, if
needed.
psd_envRefresh
should be used when
a fresh environment is desired: typically only if, for example, psdcore
is
used rather than pspectrum
.
Assigning and Retrieving
psd_envAssign
and psd_envGet
perform the assignments and retrieval
of objects in the environment. A convenience function, psd_envAssignGet
,
is included so that both assignment and retrieval may be performed at the same
time. This ensures the assignment has succeeded, and the returned value is
not from some other frame.
Getters and Setters
The functions here can be classified whether the get, or set variables in the environment; some do both. Others make no modifications to the environment.
Getter
get_adapt_history
get_psd_env_name
get_psd_env_pointer
psd_envGet
psd_envList
psd_envStatus
Setter
new_adapt_history
psd_envAssign
Getter and Setter
psd_envAssignGet
psd_envClear
psd_envRefresh
update_adapt_history
Adaptive History
The list object for historical adapt-data may be accessed with get_adapt_history
.
The top names of the returned list are
stg_kopt
Sequential taper vectors.
stg_psd
Sequential power spectral density vectors.
freq
The frequencies for each set of
stg_kopt
andstg_psd
.
Note
psd_envClear
does not remove the environment–simply the assignments within it.
See Also
Examples
## Not run: #REX
library(psd)
##
## psd working environment
##
# Get some status information about the psd working environment
psd_envStatus()
# Get a list of all variables
psd_envList()
# Pull the variable "init" into .GlobalEnv
print(x <- psd_envGet("init"))
# Pull the adaptive history into .GlobalEnv
set.seed(1234)
X <- rnorm(1e3)
pspectrum(X)
get_adapt_history()
## End(Not run)#REX