neuromancer.psl.perturb module

Base Control Profiles for System excitation # TODO: All signals should be nsim X nx np.arrays of type np.float64. # TODO: Any signals bounded by xmin and xmax should be tested to ensure this. # TODO: No camel case functions # TODO: No random seed setting # TODO: Only variables with upper case should be arrays which are matrices (this is discouraged but acceptable)

neuromancer.psl.perturb.Periodic(nx=1, nsim=100, numPeriods=1, xmax=1, xmin=0, form='sin', rseed=1)[source]

periodic signals, sine, cosine :param nx: (int) Number signals :param nsim: (int) Number time steps :param numPeriods: (int) Number of periods :param xmax: (int/list/ndarray) signal maximum value :param xmin: (int/list/ndarray) signal minimum value :param form: (str) form of the periodic signal ‘sin’ or ‘cos’ :param rseed: (int) Set random seed

neuromancer.psl.perturb.RandomWalk(nx=1, nsim=100, xmax=1, xmin=0, sigma=0.05, rseed=1)[source]
Parameters:
  • nx – (int) State space dimension

  • nsim – (int) Number of simulation steps

  • xmax – (float) Upper bound on state values

  • xmin – (float) Lower bound on state values

  • sigma – (float) Variance of normal distribution

  • rseed – (int) Set random seed

Returns:

neuromancer.psl.perturb.Sawtooth(nx=1, nsim=100, numPeriods=1, xmax=1, xmin=0, rseed=1)[source]

ramp change :param nx: (int) Number signals :param nsim: (int) Number time steps :param numPeriods: (int) Number of periods :param xmax: (int/list/ndarray) signal maximum value :param xmin: (int/list/ndarray) signal minimum value :param rseed: (int) Set random seed

neuromancer.psl.perturb.SplineSignal(nsim=500, values=None, xmin=0, xmax=1, rseed=1)[source]

Generates a smooth cubic spline trajectory by interpolating between data points

Parameters:
  • nsim – (int) Number of simulation steps

  • values – (np.array) values to interpolate

  • xmin – (float) Minimum value of time series

  • xmax – (float) Maximum value of time series

  • rseed – (int) Set random seed.

Returns:

neuromancer.psl.perturb.Step(nx=1, nsim=100, tstep=50, xmax=1, xmin=0, rseed=1)[source]

step change :param nx: (int) Number signals :param nsim: (int) Number time steps :param tstep: (int) time of the step :param xmax: (int/list/ndarray) signal maximum value :param xmin: (int/list/ndarray) signal minimum value :param rseed: (int) Set random seed

neuromancer.psl.perturb.Steps(nx=1, nsim=100, values=None, randsteps=5, xmax=1, xmin=0, rseed=1)[source]
Parameters:
  • nx – (int) Number signals

  • nsim – (int) Number time steps

  • values – (list/ndarray) sequence of step changes, e.g., [0.4, 0.8, 1, 0.7, 0.3, 0.0]

  • randsteps – (int) number of random step changes if values is None

  • xmax – (int/ndarray) signal maximum value

  • xmin – (int/ndarray) signal minimum value

  • rseed – (int) Set random seed

Returns:

neuromancer.psl.perturb.WhiteNoise(nx=1, nsim=100, xmax=1, xmin=0, rseed=1)[source]

White Noise :param nx: (int) Number signals :param nsim: (int) Number time steps :param xmax: (int/list/ndarray) signal maximum value :param xmin: (int/list/ndarray) signal minimum value :param rsee: (int) Set random seed

neuromancer.psl.perturb.random_walk(nsim, d, min=0.0, max=1.0, sigma=0.05)[source]

Gaussian random walk for arbitrary number of dimensions scaled between min/max bounds TODO: Test within min and max. Test nsim, d, edge case d = 1. :param nsim: (int) Number of simulation steps :param d: (int) Number of dimensions for the random walk :param min: (float or 1-d array) Lower bound on values :param max: (float or 1-d array) Upper bound on values :param sigma: (float or 1-d array) Variance of normal distribution :return: (np.array shape=(nsim, d)) Random walk time series of dimension nx and length nsim

neuromancer.psl.perturb.white_noise(nsim, d, min=0.0, max=1.0, sigma=0.05)[source]

Gaussian random walk for arbitrary number of dimensions scaled between min/max bounds :param nsim: (int) Number of simulation steps :param d: (int) Number of dimensions for the random walk :param min: (float or 1-d array) Lower bound on values :param max: (float or 1-d array) Upper bound on values :param sigma: (float or 1-d array) Variance of normal distribution :return: (np.array shape=(nsim, d)) Random walk time series of dimension nx and length nsim