neuralib.rastermap.plot.Covariant
- class neuralib.rastermap.plot.Covariant[source]
Bases:
NamedTupleCovariant variable that can be plotted alongside rastermap results.
Supports two types:
'continuous': time-series data (e.g., velocity, position)'event': discrete time segments (e.g., trial periods, behavioral events)
- Parameters:
name – name of the covariant variable
dtype – type of the covariant variable (
'event'or'continuous')time – time array.
Array[float, T]for continuous dtype orArray[float, [E, 2]]for on/off event dtypevalue – value array (only for continuous dtype).
Array[float, T]
- __init__()
Methods
__init__()count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
interp_activity(act_time)Interpolate data to match another activity time array (continuous dtype only).
masking_time(t)Mask data to a specific time range (continuous dtype only).
Attributes
Alias for field number 1
Alias for field number 0
Alias for field number 2
Alias for field number 3
- name: str
Alias for field number 0
- dtype: Literal['event', 'continuous']
Alias for field number 1
- time: ndarray
Alias for field number 2
- value: ndarray | None
Alias for field number 3
- masking_time(t)[source]
Mask data to a specific time range (continuous dtype only).
- Parameters:
t (tuple[float, float]) – (START,END) time range
- Returns:
new Covariant with data filtered to the time range
- Raises:
ValueError – if called on event dtype
- Return type:
Self
- static __new__(_cls, name, dtype, time, value=None)
Create new instance of Covariant(name, dtype, time, value)
- Parameters:
name (str)
dtype (Literal['event', 'continuous'])
time (np.ndarray)
value (np.ndarray | None)
- interp_activity(act_time)[source]
Interpolate data to match another activity time array (continuous dtype only).
- Parameters:
act_time (ndarray) – activity time array to interpolate to. Array[float, T’]
- Returns:
new Covariant with interpolated values matching act_time
- Raises:
ValueError – if called on event dtype
- Return type:
Self