Usage
This section introduces the basic usage of GenML. GenML provides several interfaces for efficiently generating M-L noise sequences in batches and computing actual and theoretical autocorrelation functions. The following are detailed explanations:
Parameters
N[typeint]: Number of noise sequences to generate.T[typeint]: Length of the noise sequences to generate.C[typefloat]: Amplitude coefficient.lamda[typefloat]: Mittag-Leffler exponent, range (0, 2).tau[typeint]: Characteristic memory time, range (0, 10000).seed[default=None]: Random seed for generating noise.Set to
Nonefor different noise sequences each time; set to a specific value for identical noise sequences each time.
xi[typendarray]: Generated noise sequences, shape (N, T).tmax[typeint]: Maximum value for computing autocorrelation functions, range (0, T).dt[typeint]: Interval for computing autocorrelation functions, range (0, tmax).nc[default=1]: Number of cores to use for parallel computation of autocorrelation functions.
Note: When
lamdaapproaches 2 andtauis large, generating noise sequences may take a long time and consume a significant amount of memory. It is recommended to use caution in such cases.
Calculating Autocorrelation Function
To calculate the autocorrelation function (ACF) values of the generated noise sequences, you can use the acf function for actual ACF values and the acft function for theoretical ACF values. Usage: genml.acf(xi, tmax, dt, nc) and genml.acft(tmax, dt, C, lamda, tau).
Example usage:
tmax = 100 # Max lag for ACF calculation
dt = 1 # Step size between lags
nc = 4 # Number of CPU cores for parallel processing
# Calculate actual ACF values
acfv = genml.acf(xi, tmax, dt, nc)
# Calculate theoretical ACF values
acftv = genml.acft(tmax, dt, C, lamda, tau)