prefs#

Preferences and configuration shared throughout the program.

Saves and loads to a prefs file (default is ~/.perceptivo/prefs.json )

Each runtime has its own set of preferences. When first run, if there is not prefs file detected it populates with defaults (though defaults can be populated at any time by instantiating the object with no arguments and using save, eg.:

prefs = Patient_Prefs()
prefs.save()
class perceptivo.prefs.Runtimes(value)#

Bases: enum.Enum

An enumeration.

patient = 'patient'#
clinician = 'clinician'#
stimuli = 'stimuli'#
perceptivo.prefs.json_dumps_pretty(v, *, default)#
class perceptivo.prefs.Prefs(*, loglevel: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] = 'DEBUG')#

Bases: pydantic.main.BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

loglevel: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR']#
class Config#

Bases: object

json_dumps(*, default)#
save(file: pathlib.Path = PosixPath('/home/docs/.perceptivo/prefs.json'))#
classmethod load(file: pathlib.Path = PosixPath('/home/docs/.perceptivo/prefs.json')) perceptivo.prefs.Prefs#
classmethod get_runtime_prefs(runtime: perceptivo.prefs.Runtimes) perceptivo.prefs.Patient_Prefs#
class perceptivo.prefs.Patient_Prefs(*, loglevel: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] = 'DEBUG', runtime: perceptivo.prefs.Runtimes = 'patient', Audio_Config: perceptivo.types.sound.Audio_Config = Audio_Config(fs=44100), Audiogram_Model: perceptivo.types.psychophys.Psychoacoustic_Model = Psychoacoustic_Model(model_type='Gaussian_Process', args=[], kwargs={'kernel': Kernel(length_scale=(100.0, 200.0), length_scale_bounds=(1, 100000.0))}), Picamera_Params: perceptivo.types.video.Picamera_Params = Picamera_Params(sensor_mode=0, resolution=(1280, 720), fps=30, format='grayscale', output_file=None), picamera_process: bool = True, picam_queue_size: int = 1024, pupil_extractor: str = 'simple', pupil_extractor_params: perceptivo.video.pupil.EllipseExtractor_Params = EllipseExtractor_Params(footprint_size=5, search_scale=1.5), collection_params: perceptivo.types.patient.Collection_Params = Collection_Params(collection_wait=5), networking: perceptivo.types.networking.Patient_Networking = Patient_Networking(ip='', clinician_ip='', eyecam=Socket(id='patient:eyecam', socket_type='PUSH', protocol='tcp', mode='connect', port=5500, ip='', to=None), control=Socket(id='patient:control', socket_type='DEALER', protocol='tcp', mode='connect', port=5600, ip='', to='clinician:control')))#

Bases: perceptivo.prefs.Prefs

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

runtime: perceptivo.prefs.Runtimes#
Audio_Config: perceptivo.types.sound.Audio_Config#
Audiogram_Model: perceptivo.types.psychophys.Psychoacoustic_Model#
Picamera_Params: perceptivo.types.video.Picamera_Params#
picamera_process: bool#

Run the picamera in a separate Process (using cameras.Picamera_Process . Only True supported for now!

picam_queue_size: int#
pupil_extractor: str#
pupil_extractor_params: perceptivo.video.pupil.EllipseExtractor_Params#
collection_params: perceptivo.types.patient.Collection_Params#
networking: perceptivo.types.networking.Patient_Networking#
class Config#

Bases: object

use_enum_values = True#
class perceptivo.prefs.Clinician_Prefs(*, loglevel: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] = 'DEBUG', networking: perceptivo.types.networking.Clinician_Networking = Clinician_Networking(ip='', patient_ip='', eyecam=Socket(id='clinician:eyecam', socket_type='PULL', protocol='tcp', mode='bind', port=5500, ip='*', to=None), control=Socket(id='clinician:control', socket_type='ROUTER', protocol='tcp', mode='bind', port=5600, ip='*', to=None)), gui: perceptivo.types.gui.GUI_Params = GUI_Params(control_panel=Control_Panel_Params(amplitude_range=GUI_Param(key='amplitude_range', name='Amplitude Range (dBSPL)', widget_type='range', default=GUI_Range(min=0.0, max=80.0, n=8), args=[], kwargs={'limits': (0, 100)}), frequency_range=GUI_Param(key='frequency_range', name='Frequency Range (Hz)', widget_type='range', default=GUI_Range(min=0.0, max=8000.0, n=17), args=[], kwargs={'limits': (0, 20000)}), iti=GUI_Param(key='iti', name='Inter-Trial Interval (s)', widget_type='float', default=5.0, args=[], kwargs={}), iti_jitter=GUI_Param(key='iti_jitter', name='Inter-Trial Jitter (proportion of ITI)', widget_type='float', default=0.1, args=[], kwargs={}))), update_period: float = 0.05)#

Bases: perceptivo.prefs.Prefs

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

networking: perceptivo.types.networking.Clinician_Networking#
gui: perceptivo.types.gui.GUI_Params#
update_period: float#
perceptivo.prefs.get(field: str, file: pathlib.Path = PosixPath('/home/docs/.perceptivo/prefs.json'))#
perceptivo.prefs.set_global(prefs: perceptivo.prefs.Prefs)#
perceptivo.prefs.get_global() perceptivo.prefs.Prefs#