stytra.experiments package¶
Submodules¶
stytra.experiments.camera_recording_experiment module¶
-
class
stytra.experiments.camera_recording_experiment.
VideoRecordingExperiment
(*args, **kwargs)[source]¶ Bases:
stytra.experiments.tracking_experiments.CameraVisualExperiment
-
start_protocol
()[source]¶ Start the protocol from the ProtocolRunner. Before that, send a a notification and if required communicate with the microscope to synchronize and read configuration.
-
stytra.experiments.fish_pipelines module¶
stytra.experiments.tracking_experiments module¶
-
class
stytra.experiments.tracking_experiments.
CameraVisualExperiment
(*args, camera, camera_queue_mb=100, **kwargs)[source]¶ Bases:
stytra.experiments.VisualExperiment
General class for Experiment that need to handle a camera. It implements a view of frames from the camera in the control GUI, and the respective parameters. For debugging it can be used with a video read from file with the VideoFileSource class.
-
class
stytra.experiments.tracking_experiments.
TrackingExperiment
(*args, tracking, recording=None, **kwargs)[source]¶ Bases:
stytra.experiments.tracking_experiments.CameraVisualExperiment
Abstract class for an experiment which contains tracking.
This class is the base for any experiment that tracks behavior (being it eyes, tail, or anything else). The general purpose of the class is handle a frame dispatcher, the relative parameters queue and the output queue.
The frame dispatcher take two input queues:
frame queue from the camera;
parameters queue from parameter window.
and it puts data in three queues:
subset of frames are dispatched to the GUI, for displaying;
all the frames, together with the parameters, are dispatched to perform tracking;
the result of the tracking function, is dispatched to a data accumulator for saving or other purposes (e.g. VR control).
- Parameters
tracking (dict) –
- containing fields: tracking_method
- estimator: can be vigor for embedded fish, position
for freely-swimming, or a custom subclass of Estimator
-
send_gui_parameters
()[source]¶ Called upon gui timeout, put tracking parameters in the relative queue.
-
start_protocol
()[source]¶ Start the protocol from the ProtocolRunner. Before that, send a a notification and if required communicate with the microscope to synchronize and read configuration.
-
end_protocol
(save=True)[source]¶ Function called at Protocol end. Reset Protocol and save data_log.
- Parameters
save (bool) – Specify whether to save experiment data (Default value = True).
Module contents¶
-
class
stytra.experiments.
Experiment
(app=None, protocol=None, dir_save=None, dir_assets='', instance_number=-1, database=None, metadata_general=None, metadata_animal=None, loop_protocol=False, log_format='csv', scope_triggering=None, offline=False, **kwargs)[source]¶ Bases:
PyQt5.QtCore.QObject
General class that runs an experiment.
- Parameters
app (QApplication()) – Application to run the Experiment QObject.
protocol (object of
Protocol
) – list of protocols that can be run in this experiment session.directory (str) – (optional) Directory where metadata will be saved. If None, nothing will be saved (default: None).
metadata_general (
GeneralMetadata
object) – (optional) Class for saving general metadata about the experiment. I If not passed, a default GeneralMetadata object will be set.metadata_animal (
AnimalMetadata
object) – (optional) Class for saving animal metadata about the experiment. If not passed, a default AnimalMetadata object will be set.calibrator (
Calibrator
object) – (optional) Calibrator object to calibrate the stimulus display. If not set, a CrossCalibrator will be used.asset_directory (str) – (optional) Path where asset files such as movies or images to be displayed can be found.
display (dict) – (optional) Dictionary with specifications for the display. Possible key values are full_screen: bool (False) window_size: Tuple(Int, Int) framerate: target framerate, if 0, it is the highest possilbe gl_display : bool (False)
rec_stim_framerate (int) – (optional) Set to record a movie of the displayed visual stimulus. It specifies every how many frames one will be saved (set to 1 to record) all displayed frames. The final movie will be saved in the directory in an .h5 file.
trigger (
Trigger
object) – (optional) Trigger class to control the beginning of the stimulation.offline (bool) – if stytra is used in offline analysis, stimulus is not displayed
log_format (str) – one of “csv”, “feather”, “hdf5” (pytables-based) or “json”
-
sig_data_saved
¶
-
folder_name
¶
-
start_protocol
()[source]¶ Start the protocol from the ProtocolRunner. Before that, send a a notification and if required communicate with the microscope to synchronize and read configuration.
-
end_protocol
(save=True)[source]¶ Function called at Protocol end. Reset Protocol and save data_log.
- Parameters
save (bool) – Specify whether to save experiment data (Default value = True).
-
class
stytra.experiments.
VisualExperiment
(*args, calibrator=None, stim_plot=False, stim_movie_format='h5', record_stim_framerate=None, display=None, **kwargs)[source]¶ Bases:
stytra.experiments.Experiment
General class that runs an experiment.
- Parameters
calibrator (
Calibrator
object) – (optional) Calibrator object to calibrate the stimulus display. If not set, a CrossCalibrator will be used.display_config (dict) – (optional) Dictionary with specifications for the display. Possible key values are “full_screen” and “window_size”. gl_display : bool (False)
rec_stim_framerate (int) – (optional) Set to record a movie of the displayed visual stimulus. It specifies every how many frames one will be saved (set to 1 to record) all displayed frames. The final movie will be saved in the directory in an .h5 file.
offline (bool) – if stytra is used in offline analysis, stimulus is not displayed
-
sig_data_saved
¶