wonambi.utils.simulate module

wonambi.utils.simulate.create_channels(chan_name=None, n_chan=None)[source]

Create instance of Channels with random xyz coordinates

Parameters:
  • chan_name (list of str) – names of the channels

  • n_chan (int) – if chan_name is not specified, this defines the number of channels

Returns:

instance of Channels – where the location of the channels is random

wonambi.utils.simulate.create_data(datatype='ChanTime', n_trial=1, s_freq=256, chan_name=None, n_chan=8, time=None, freq=None, start_time=None, signal='random', amplitude=1, color=0, sine_freq=10, attr=None)[source]

Create data of different datatype from scratch.

Parameters:
  • datatype (str) – one of ‘ChanTime’, ‘ChanFreq’, ‘ChanTimeFreq’

  • n_trial (int) – number of trials

  • s_freq (int) – sampling frequency

  • chan_name (list of str) – names of the channels

  • n_chan (int) – if chan_name is not specified, this defines the number of channels

  • time (numpy.ndarray or tuple of two numbers) – if tuple, the first and second numbers indicate beginning and end

  • freq (numpy.ndarray or tuple of two numbers) – if tuple, the first and second numbers indicate beginning and end

  • start_time (datetime.datetime, optional) – starting time of the recordings

  • attr (list of str) – list of possible attributes (currently only ‘channels’)

  • 'ChanTime' (Only for datatype ==) –

  • signal (str) – ‘random’, ‘sine’

  • amplitude (float) – amplitude (peak-to-peak) of the signal

  • color (float) – noise color to generate (white noise is 0, pink is 1, brown is 2). This is only appropriate if signal == ‘random’

  • sine_freq (float) – frequency of the sine wave (only if signal == ‘sine’), where phase is random for each channel

Returns:

data (instance of specified datatype)

Notes

ChanTime uses randn (to have normally distributed noise), while when you have freq, it uses random (which gives always positive values). You can only color noise for ChanTime, not for the other datatypes.

wonambi.utils.simulate.f(x, coef)[source]

Create an almost-linear function to apply to the power spectrum.

Parameters:
  • x (ndarray) – vector with the frequency values

  • coef (float) –

    coefficient to apply (0 -> white noise, 1 -> pink, 2 -> brown,

    -1 -> blue)

Returns:

ndarray – vector to multiply with the other frequencies

Notes

No activity in the frequencies below .1, to avoid huge distorsions.