stimpyp.stimpy_core.StimpyProtocol#

class stimpyp.stimpy_core.StimpyProtocol#

Bases: AbstractStimProtocol

class for handle the protocol file for stimpy bitbucket/github version (mainly tested in the commits derived from master branch)

Dimension parameters:

N = numbers of visual stimulation (on-off pairs) = (T * S)

T = number of trials

S = number of Stim Type

C = number of Cycle

__init__(name, options, visual_stimuli, version)#
Parameters:
  • name (str)

  • options (dict[str, Any])

  • visual_stimuli (DataFrame)

  • version (Literal['pyvstim', 'stimpy-bit', 'stimpy-git', 'debug'])

Methods

__init__(name, options, visual_stimuli, version)

evolve_param_headers()

Get parameter header which set in the 'evolveParams, i.g., 'phase'

load(file)

Load *.prot file

loads(content[, name])

load string

Attributes

background

background for non-stimulation epoch.

blank_duration

blank duration between each visual stimulus (in sec)

controller

protocol controller name

end_blank_duration

blank duration after the visual stimulation epoch

evolve_params

Get value from 'evolveParams'.

is_shuffle

if shuffle stimulation

mask

todo check in stimpy

n_stimuli

number of stimuli (S)

n_trials

(T,)

reward_duration

reward zone duration use in the vr branch

start_blank_duration

blank duration before starting the visual stimulation epoch (in sec)

stim_params

stimulus_type

stimulus type

texture

stimulus texture, {circle, sqr.

tf

total_duration

total protocol duration

trial_blank_duration

blank duration between trials (in sec) TODO check stimpy source code

trial_duration

trial duration

visual_duration

total visual duration

name

protocol name.

options

protocol options

visual_stimuli_dataframe

visual stimuli dataframe.

version

date of major changes

classmethod load(file)#

Load *.prot file

Parameters:

file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – file path

Return type:

Self

classmethod loads(content, name='<string>')#

load string

Parameters:
  • content (str)

  • name (str)

Return type:

Self

property controller: str#

protocol controller name

property is_shuffle: bool#

if shuffle stimulation

property background: float#

background for non-stimulation epoch. Note the default value need to check in user-specific stimpy version

property start_blank_duration: int#

blank duration before starting the visual stimulation epoch (in sec)

property blank_duration: int#

blank duration between each visual stimulus (in sec)

property trial_blank_duration: int#

blank duration between trials (in sec) TODO check stimpy source code

property end_blank_duration: int#

blank duration after the visual stimulation epoch

property reward_duration: float#

reward zone duration use in the vr branch

property trial_duration: int#

trial duration

property visual_duration: int#

total visual duration

property total_duration: int#

total protocol duration

property texture: str#

stimulus texture, {circle, sqr… todo check in stimpy}

__init__(name, options, visual_stimuli, version)#
Parameters:
  • name (str)

  • options (dict[str, Any])

  • visual_stimuli (DataFrame)

  • version (Literal['pyvstim', 'stimpy-bit', 'stimpy-git', 'debug'])

property mask: str#

todo check in stimpy

property n_stimuli: int#

number of stimuli (S)

property n_trials: int#

(T,)

property stim_params: tuple[str, ...]#
property stimulus_type: str#

stimulus type

name: str#

protocol name. related to filename

options: dict[str, Any]#

protocol options

visual_stimuli_dataframe: pl.DataFrame#

visual stimuli dataframe. row number: S

version: STIMPY_SOURCE_VERSION#

date of major changes

class EvoledParameter#

Bases: dict[str, Any]

handle the evolveParams header in the protocol file only available in stimpy-bit version

__new__(**kwargs)#
clear() None.  Remove all items from D.#
copy() a shallow copy of D#
fromkeys(value=None, /)#

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)#

Return the value for key if key is in the dictionary, else default.

items() a set-like object providing a view on D's items#
pop(k[, d]) v, remove specified key and return the corresponding value.#

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()#

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)#

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from dict/iterable E and F.#

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() an object providing a view on D's values#
__init__(keys, data)#
Parameters:
  • keys (list[str])

  • data (ndarray)

keys() a set-like object providing a view on D's keys#
evolve_param_headers()#

Get parameter header which set in the ‘evolveParams, i.g., ‘phase’

Returns:

header list.

Return type:

list[str]

property evolve_params: EvoledParameter#

Get value from ‘evolveParams’.

Examples:

>>> log: StimpyProtocol

How many parameters in evolveParams

>>> len(log.evolve_params)

List parameter in ‘evolveParams’

>>> log.evolve_params.keys()

Dose parameter ‘phase’ in ‘evolveParams’?

>>> 'phase' in log.evolve_params

Get phase value from ‘evolveParams’.

>>> log.evolve_params['phase']
Returns:

property tf: ndarray#