psd-environment: Various environment manipulation functions.

Description Usage Arguments Defaults and Initialization Assigning and Retrieving Getters and Setters Adaptive History Note See Also Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 'spec'; the power spectral density estimates

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

Setter

Getter and Setter

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 and stg_psd.

Note

psd_envClear does not remove the environment–simply the assignments within it.

See Also

psd-utilities, pspectrum

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## 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

psd documentation built on Feb. 1, 2022, 1:06 a.m.