stimpyp.session.SessionInfo#

class stimpyp.session.SessionInfo#

Bases: NamedTuple

session name and the corresponding time start-end

__init__()#

Methods

__init__()

count(value, /)

Return number of occurrences of value.

in_range(time[, value, error])

Get the range (the first and last value) of value array in this session.

in_slice(time, value[, error])

Get the slice of value in this session

index(value[, start, stop])

Return first index of value.

time_mask_of(t)

create a mask for time array t.

Attributes

name

name of this session

time

time start/end of this session

name: str#

name of this session

time: tuple[float, float]#

time start/end of this session

time_mask_of(t)#

create a mask for time array t.

Parameters:

t (ndarray) – 1d time array

Returns:

mask for this session

Return type:

ndarray

static __new__(_cls, name, time)#

Create new instance of SessionInfo(name, time)

Parameters:
  • name (Session)

  • time (tuple[float, float])

count(value, /)#

Return number of occurrences of value.

in_range(time, value=None, error=True)#

Get the range (the first and last value) of value array in this session.

Parameters:
  • time (ndarray) – 1d time array (T,)

  • value (ndarray | None) – 1d value array. Shape should as same as time (T,)

  • error (bool) – raise an error when empty.

Returns:

tuple of first and last value or time.

Return type:

tuple[Any, Any]

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

in_slice(time, value, error=True)#

Get the slice of value in this session

Parameters:
  • time (ndarray) – 1d time array (T,)

  • value (ndarray) – 1d value array. Shape should as same as time (T,)

  • error (bool) – raise an error when empty.

Returns:

slice of value

Return type:

slice