neuralib.locomotion.position.CircularPosition

class neuralib.locomotion.position.CircularPosition[source]

Bases: NamedTuple

Position information in circular environment.

Dimension parameters:

P = Number of position points (after interpolation)

T = Number of trial(lap)

__init__()

Methods

__init__()

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

interp_time(time[, fill_value])

Interpolate position data to new time points.

with_run_mask1d(**kwargs)

With only the running epoch.

with_time_range(t0, t1)

With specific time range

Attributes

d

1D displacement array in cm.

p

1D position array in cm.

t

1D time array in s.

trial_array

Trial number array as same shape as P

trial_time_index

1D time index for every trial.

v

1D velocity array in cm/s.

t: ndarray

1D time array in s. Array[float, P]

p: ndarray

1D position array in cm. Array[float, P]

d: ndarray

1D displacement array in cm. Array[float, P]

v: ndarray

1D velocity array in cm/s. Array[float, P]

trial_time_index: ndarray

1D time index for every trial. Array[int, T]

with_time_range(t0, t1)[source]

With specific time range

Parameters:
  • t0 (float) – time start

  • t1 (float) – time end

Returns:

A new instance of the class with updated subset of attributes (t, p, d, v) based on the time range.

Return type:

Self

with_run_mask1d(**kwargs)[source]

With only the running epoch. Note that shape will be changed (stationary epoch excluded)

Parameters:

kwargs – Additional keyword arguments to pass to running_mask1d function.

Returns:

A new instance of the class with updated subset of attributes (t, p, d, v) based on the mask generated.

Return type:

Self

interp_time(time, fill_value=0.0)[source]

Interpolate position data to new time points.

This method interpolates the position (p), displacement (d), and velocity (v) data to match the provided time array. Uses linear interpolation and fills out-of-bounds values with the specified fill_value.

Parameters:
  • time (ndarray) – Target time array to interpolate to. Array[float, N]

  • fill_value (float) – Value to use for out-of-bounds interpolation, defaults to 0.0.

Returns:

A new CircularPosition instance with interpolated data aligned to the new time array.

Return type:

Self

property trial_array: ndarray

Trial number array as same shape as P

Returns:

Array[int, P]

static __new__(_cls, t, p, d, v, trial_time_index)

Create new instance of CircularPosition(t, p, d, v, trial_time_index)

Parameters:
  • t (ndarray)

  • p (ndarray)

  • d (ndarray)

  • v (ndarray)

  • trial_time_index (ndarray)