OPTIMAS/classical_ephy.py
def load_json_timing_data(path_output, experiment):
    """
    This function allows to load the json file where the timings of the laser, dlp, camera
    and ephys are stored.
    Input: path of the json file and the experiment folder number as input.
    Output: timings, each in their own variable
    """
    with open(f'{path_output}experiment_{experiment}_timings.json') as file:
        timings_data = dict(json.load(file))
    timings_dlp_on = timings_data['dlp']['on']
    timings_dlp_off = timings_data['dlp']['off']
    timings_laser_on = timings_data['laser']['on']
    timings_laser_off = timings_data['laser']['off']
    timings_ephy_on = timings_data['ephy']['on']
    timings_ephy_off = timings_data['ephy']['off']
    timings_ephy_stim_on = timings_data['ephy_stim']['on']
    timings_ephy_stim_off = timings_data['ephy_stim']['off']
    timings_camera_images = []  ## timings of the images as per the dcam api
    for images_timings in timings_data['camera']:
        for image_timing in images_timings:
            timings_camera_images.append(image_timing)

    timings_camera_images_bis = timings_data['camera_bis'] ## timing of the first frame as per manual clock
    print(f'timing difference between first image metadata and manual log is \
            {(timings_camera_images[0] - timings_camera_images_bis[0]) * 1000}')   ## ms difference

    return timings_dlp_on, timings_dlp_off, timings_camera_images, timings_laser_on, timings_laser_off, timings_camera_images_bis

    This function allows to load the json file where the timings of the laser, dlp, camera
    and ephys are stored.
    Input: path of the json file and the experiment folder number as input.
    Output: timings, each in their own variable
    
This function allows to load the json file where the timings of the laser, dlp, camera
and ephys are stored.
Input: path of the json file and the experiment folder number as input.
Output: timings, each in their own variable
This function allows to load the json file where the timings of the laser dlp camera and ephys are stored . Input : path of the json file and the experiment folder number as input . Output : timings each in their own variable
def load_json_timing_data(path_output, experiment):
    with open(f'{path_output}experiment_{experiment}_timings.json') as file:
        timings_data = dict(json.load(file))
    timings_dlp_on = timings_data['dlp']['on']
    timings_dlp_off = timings_data['dlp']['off']
    timings_laser_on = timings_data['laser']['on']
    timings_laser_off = timings_data['laser']['off']
    timings_ephy_on = timings_data['ephy']['on']
    timings_ephy_off = timings_data['ephy']['off']
    timings_ephy_stim_on = timings_data['ephy_stim']['on']
    timings_ephy_stim_off = timings_data['ephy_stim']['off']
    timings_camera_images = []  
    for images_timings in timings_data['camera']:
        for image_timing in images_timings:
            timings_camera_images.append(image_timing)
    timings_camera_images_bis = timings_data['camera_bis'] 
    print(f'timing difference between first image metadata and manual log is \
            {(timings_camera_images[0] - timings_camera_images_bis[0]) * 1000}')   
    return timings_dlp_on, timings_dlp_off, timings_camera_images, timings_laser_on, timings_laser_off, timings_camera_images_bis
def load_json_timing_data ( path_output , experiment ) : with open ( f'{path_output}experiment_{experiment}_timings.json' ) as file : timings_data = dict ( json . load ( file ) ) timings_dlp_on = timings_data [ 'dlp' ] [ 'on' ] timings_dlp_off = timings_data [ 'dlp' ] [ 'off' ] timings_laser_on = timings_data [ 'laser' ] [ 'on' ] timings_laser_off = timings_data [ 'laser' ] [ 'off' ] timings_ephy_on = timings_data [ 'ephy' ] [ 'on' ] timings_ephy_off = timings_data [ 'ephy' ] [ 'off' ] timings_ephy_stim_on = timings_data [ 'ephy_stim' ] [ 'on' ] timings_ephy_stim_off = timings_data [ 'ephy_stim' ] [ 'off' ] timings_camera_images = [ ] for images_timings in timings_data [ 'camera' ] : for image_timing in images_timings : timings_camera_images . append ( image_timing ) timings_camera_images_bis = timings_data [ 'camera_bis' ] print ( f'timing difference between first image metadata and manual log is \
            {(timings_camera_images[0] - timings_camera_images_bis[0]) * 1000}' ) return timings_dlp_on , timings_dlp_off , timings_camera_images , timings_laser_on , timings_laser_off , timings_camera_images_bis
This function allows to load the json file where the timings of the laser, dlp, camera
and ephys are stored.
This function allows to load the json file where the timings of the laser dlp camera and ephys are stored .
"""
    This function allows to load the json file where the timings of the laser, dlp, camera
    and ephys are stored.
    Input: path of the json file and the experiment folder number as input.
    Output: timings, each in their own variable
    """ ## timings of the images as per the dcam api ## timing of the first frame as per manual clock ## ms difference
path_output
experiment