retinotopic_mapping.DisplayLogAnalysis

This module contains the class(es) and methods that perform offline analysis of the log file (the .pkl file) saved by the DisplayStimulus.DisplaySequence.

DisplayLogAnalyzer

class retinotopic_mapping.DisplayLogAnalysis.DisplayLogAnalyzer(log_path)

class to take display_log (.pkl) file, check its integrity and extract stimuli and display organize into stim_dict dictionary, which is a intermediate step to put visual display information into nwb files.

Attributes:
num_frame_tot

Methods

analyze_photodiode_onsets_combined(self, …)
Parameters:
analyze_photodiode_onsets_sequential(self, …) Analyze photodiode onsets in a sequential way
get_stim_dict(self)
Returns:
check_integrity  
analyze_photodiode_onsets_combined(self, pd_onsets_seq, is_dgc_blocked=True)
Parameters:
pd_onsets_seq: list

product of self.analyze_photodiode_onsets_sequential()

dgc_onset_type : str

type of onset “block” or “cycle”

Returns:
pd_onsets_combined : dict
analyze_photodiode_onsets_sequential(self, stim_dict, pd_thr=-0.5)

Analyze photodiode onsets in a sequential way

Parameters:
stim_dict: dictionary

should be the output of self.get_stim_dict()

pd_thr : float

the threshold to detect photodiode onset, the photodiode color was saved in each displayed frame (the last item of frame tuple) as float with range [-1., 1.]. pd_onset is defined as up crossing the pd_thr. retinotopic_mapping.tools.GenericTools.up_crossing() function is used to detect the up crossing. It detects the frame meeting the following criteria: 1) the current frame has photodiode color larger than pd_thr; 2) the previous frame has photodiode color no larger than pd_thr

Returns:
pd_onsets: list

list of photodiode onsets in sequential manner (in time). Each element in the list is a dictionary representing one photodiode onset. The dictionary has 3 fields:

  1. stim_name: str, the name of the stimulus the onset belongs to
  2. global_frame_ind: the index of this frame in the total frame displayed
  3. global_pd_onset_ind: the index of this photodiode onset in the total photodiode onsets series
    of the stimuli display
  4. str(s)_stim: string that represents the properties of the onset frame. For most frame it is just a
    string, for LocallySparseNoise, it is a set of strings with each string representing one probe on the onset frame.
get_stim_dict(self)
Returns:
stim_dict: dictionary

the structure of this dictionary should look like this:

{
‘000_UniformContrastRetinotopicMapping’: {

… ‘stim_name’ : ‘000_UniformContrastRetinotopicMapping’, ‘index_to_display’: <index referencing ‘frames_unique’ field> ‘timestamps’: <index referencing entire display sequence,

should match hardware vsync signal>

‘frames_unique’: list of tuple representing unique frames … },

‘001_StimulusSeparatorRetinotopicMapping: {

… ‘stim_name’ : ‘000_UniformContrastRetinotopicMapping’, ‘index_to_display’: <index referencing ‘frames_unique’ field> ‘timestamps’: <index referencing entire display sequence,

should match hardware vsync signal>

‘frames_unique’: list of tuple representing unique frames … },

… }