# Path: python/pipeline/exceptions.py
# class PipelineException(Exception):
#     """Base pipeline exception. Prints the message plus any specific info."""
#     def __init__(self, message, info=None):
#         info_message = '\nError info: ' + repr(info) if info else ''
#         super().__init__(message + info_message)
#         self.info = info
# 
# Path: python/pipeline/utils/eye_tracking.py
# ANALOG_PACKET_LEN = 2000


import h5py
import numpy as np
from ..exceptions import PipelineException
from .eye_tracking import ANALOG_PACKET_LEN
from .signal import mirrconv, spaced_max

        ## Specific to version '1.0'
        cam1_ts: 1-d vector. Timestamps for each video frame of camera 1 in master clock time.
        cam2_ts: 1-d vector. Timestamps for each video frame of camera 2 in master clock time.

        ## Specific to versions '2.x'
        framenum_ts: np.array (2 x num_scanimage_slices / 30)
            framenum_ts[0]: Counter starting at 1 and records every 30.
            framenum_ts[1]: Timestamps in master clock time.
        trialnum_ts: np.array (2 x num_stimulus_trials)
            trialnum_ts[0]: Counter starting at 1 for first run of session.
            trialnum_ts[1]: Timestamps in master clock time.
        eyecam_ts: np.array (2 x num_video_frames)
            eyecam_ts[0]: Timestamps in master clock time.
            eyecam_ts[1]: Timestamps in seconds since some reference time.
        ### Optional:
        posture_ts: np.array (2 x num_video_frames)
            posture_ts[0]: Timestamps in master clock time.
            posture_ts[1]: Timestamps in seconds since some reference time.
        temperature: np.array (num_samples). Temperature in Fahrenheit degrees / 100 at 10
            KHz.

    ..note:: Master clock time is an integer counter that increases every 0.1 usecs and
        wraps around at 2 ** 32 - 1.
    """
    with h5py.File(filename, 'r', driver='family', memb_size=0) as f:
        file_version = str(f.attrs['Version'][0])

        data = {'version': file_version}
        if file_version == '1.0':

# Path: python/pipeline/exceptions.py
# class PipelineException(Exception):
#     """Base pipeline exception. Prints the message plus any specific info."""
#     def __init__(self, message, info=None):
#         info_message = '\nError info: ' + repr(info) if info else ''
#         super().__init__(message + info_message)
#         self.info = info
# 
# Path: python/pipeline/utils/eye_tracking.py
# ANALOG_PACKET_LEN = 2000


# Path: python/pipeline/utils/h5.py
import h5py
import numpy as np
from ..exceptions import PipelineException
from .eye_tracking import ANALOG_PACKET_LEN
from .signal import mirrconv, spaced_max


        ## Specific to version '1.0'
        cam1_ts: 1-d vector. Timestamps for each video frame of camera 1 in master clock time.
        cam2_ts: 1-d vector. Timestamps for each video frame of camera 2 in master clock time.

        ## Specific to versions '2.x'
        framenum_ts: np.array (2 x num_scanimage_slices / 30)
            framenum_ts[0]: Counter starting at 1 and records every 30.
            framenum_ts[1]: Timestamps in master clock time.
        trialnum_ts: np.array (2 x num_stimulus_trials)
            trialnum_ts[0]: Counter starting at 1 for first run of session.
            trialnum_ts[1]: Timestamps in master clock time.
        eyecam_ts: np.array (2 x num_video_frames)
            eyecam_ts[0]: Timestamps in master clock time.
            eyecam_ts[1]: Timestamps in seconds since some reference time.
        ### Optional:
        posture_ts: np.array (2 x num_video_frames)
            posture_ts[0]: Timestamps in master clock time.
            posture_ts[1]: Timestamps in seconds since some reference time.
        temperature: np.array (num_samples). Temperature in Fahrenheit degrees / 100 at 10
            KHz.

    ..note:: Master clock time is an integer counter that increases every 0.1 usecs and
        wraps around at 2 ** 32 - 1.
    """
    with h5py.File(filename, 'r', driver='family', memb_size=0) as f:
        file_version = str(f.attrs['Version'][0])

        data = {'version': file_version}
        if file_version == '1.0':

            data['analogPacketLen'] = ANALOG_PACKET_LEN