interpolate_Npts

nrv.optim.optim_utils.interpolate_Npts(position, t_sim: float = 100, dt: float = 0.005, amp_start: float = 0, amp_stop: float = 1, intertype: str = 'Spline', bounds: tuple[float] = (0, 0), fixed_order: bool = False, t_end: float = None, t_shift: float = None, save: bool = False, fname: str = 'interpolate_2pts.dat', plot: bool = False, save_scale: bool = False, generatefigure: bool = True, strict_bounds: bool = True, kwargs_interp: dict = {}, **kwargs)[source]

genarte a waveform from a particle position using interpolate where the position values are the coordonnate of N points which should be reached by the output waveform

Note

If \(t_{i}\) and \(I_{i}\) are the time and amplitude of the \(ith\) point the position vector \(\mathcal{X}\) should be:

\[\mathcal{X} = \begin{pmatrix} t_{1} & I_{1} & t_{2} & I_{2} & ... & t_{N} & I_{N} \end{pmatrix}\]
Parameters:
  • position (np.ndarray) – particle position in 2N dimensions with the coordonnate of the N points to interpolate.

  • t_sim (float) – simulation time (ms), by default 100

  • dt (float) – time step of the simulation (ms), by default 0.005

  • amp_start (float) – amplitude at the beginning of the interpolation

  • amp_stop (float) – amplitude at the end of the interpolation

  • intertype (str) –

    type of interpolation perform, by default ‘Spline’ type possibly:

    • ’Spline’ : Cubic spline interpolation

    • ’linear’

  • bounds (tupple) – limit range of the interpolation, if both equal no limit, by default (0,0)

  • fixed_order (bool) – fix the order of the points to interpolate

  • t_end (float) – optionnal, if not None, time of the stimulation at which the interpollation should reach amp_stop

  • t_shift (float) – optionnal, if not None, interpolation will be shifted of this time

  • save (bool) – save or not the output in a .dat file, by default False

  • fname (str) – name of the file on wich the output should be saved, by default ‘interpolate_2pts.dat’

  • strict_bounds (bool) – if True values out of bound will be set to closer bound

  • kwargs_interp (dict) – kwargs to add to the interpollation

Returns:

waveform – waveform generated from position

Return type:

np.ndarray