osl_dynamics.simulation.HMM_OscillatoryMVN#
- class osl_dynamics.simulation.HMM_OscillatoryMVN(n_samples, trans_prob, frequencies, sampling_frequency, covariances, means='zero', peak_width=2.0, n_channels=None, n_covariances_act=1, stay_prob=None, observation_error=0.0, aperiodic_covariance=None, aperiodic_exponent=1.0, aperiodic_knee=1.0)#
Bases:
osl_dynamics.simulation.base.SimulationHMM with an oscillatory multivariate normal observation model.
Each state has a covariance and a spectral peak at its own frequency. See
OscillatoryMVN.- Parameters:
- n_samplesint
Number of samples to draw from the model.
- trans_probnp.ndarray or str
Transition probability matrix as a numpy array or a
str('sequence'or'uniform') to generate a transition probability matrix.- frequenciesnp.ndarray or list
Peak frequency (Hz) of each state, shape (n_states,), or of each state and channel, shape (n_states, n_channels).
- sampling_frequencyfloat
Sampling frequency in Hz.
- covariancesnp.ndarray or str
Covariance matrix for each state, shape should be (n_states, n_channels, n_channels). Either a numpy array or
'random'.- meansnp.ndarray or str, optional
Mean vector for each state, shape should be (n_states, n_channels). Either a numpy array or
'zero'or'random'.- peak_widthfloat or np.ndarray, optional
Width (Hz) of the spectral peaks. A float, or one value per state.
- n_channelsint, optional
Number of channels.
- n_covariances_actint, optional
Number of iterations to add activations to covariance matrices.
- stay_probfloat, optional
Used to generate the transition probability matrix if
trans_probis astr. Must be between 0 and 1.- observation_errorfloat, optional
Standard deviation of the white noise added to the generated data.
- aperiodic_covariancenp.ndarray, optional
Covariance of the aperiodic (\(1/f\)) background activity, shape (n_channels, n_channels).
Nonefor no background.- aperiodic_exponentfloat, optional
Exponent of the aperiodic power spectrum.
- aperiodic_kneefloat, optional
Knee frequency (Hz) of the aperiodic power spectrum.
- hmm#
- state_model#
- obs_model#
- n_samples#
- n_sessions = None#
- property n_states: int#
Number of states (simulations of mutually exclusive states only).
- property n_modes: int#
Number of modes (simulations of modes only).
- property state_time_course: numpy.ndarray#
State time course (simulations of mutually exclusive states only).
- property mode_time_course: numpy.ndarray#
Mode time course (simulations of modes only).
- standardize()#
Standardize the data and update the ground truth parameters.
Each channel is standardized over time. With session-specific parameters each session is standardized separately, otherwise the sessions are standardized together.
- get_instantaneous_covariances()#
Get the ground truth covariance at each time point.
- Returns:
- inst_covsnp.ndarray
Instantaneous covariances. Shape is (n_samples, n_channels, n_channels), with a leading session dimension if there are multiple sessions.