Learn R Programming

psd (version 0.4-1)

psd-environment: 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 enviroment 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.

new_adapt_history initializes a nested-list object to store the data from each iteration.

update_adapt_history updates the adaptive estimation history list.

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)

new_adapt_history(adapt_stages)

get_adapt_history()

update_adapt_history(stage, ntap, PSD, freq = NULL)

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
adapt_stages
scalar; The number of adaptive iterations to save (excluding pilot spectrum).
stage
scalar; the current stage of the adaptive estimation procedure
ntap
vector; the tapers
PSD
vector; the power spectral densities
freq
vector; the frequencies

Value

  • psd_envRefresh returns (invisibly) the result of psd_envStatus().

    the object represented by variable in the psd environment.

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 Retieving

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{} }

subsection

  • Setter
  • Getter and Setter

itemize

  • psd_envAssignGet

item

  • psd_envAssign
  • psd_envClear
  • psd_envRefresh
  • update_adapt_history

See Also

psd-utilities, pspectrum

Examples

Run this code
#RDEX#\dontrun{
require(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
get_adapt_history()
#RDEX#}

Run the code above in your browser using DataLab