Exemplo n.º 1
0
    def decode_data(self, chdata, tsdata, sync_offset):
        """
        The qutau data has two arrays: one channel array containing the channel numbers 
        where clicks were observed. The other one contains the time stamps. 
        Here I assign to each event a third and fourth array. The third array contains
        the sync number, and a fourth array replaces the second array with timestamps. It 
        contains the times with respect to the last sync. Finally we reshape the data 
        in the well known HydraHarp format.
        """
        chdata = chdata.astype(np.uint8)
        tsdata = tsdata.astype(np.uintc)

        sync_mask = chdata != self.sync_chan
        special = np.logical_or(chdata == self.marker1_chan,
                                chdata == self.marker2_chan)
        sync_number = hhopt.get_sync_number(chdata, self.sync_chan,
                                            sync_offset)
        timings_wrt_sync = hhopt.get_dt_wrt_sync(chdata, tsdata,
                                                 self.sync_chan)

        datastack = hhopt.stack(sync_number.astype(np.uintc),
                                timings_wrt_sync.astype(np.uintc),
                                chdata.astype(np.uintc),
                                special.astype(np.uintc))

        #adjust the sync number offset to the last sync number
        sync_offset = datastack[-1, 0]

        #delete syncs from the arrays
        decoded_data = hhopt.apply_filter_to_2darray(
            datastack, sync_mask.astype(np.uintc))

        return decoded_data, sync_offset
    def decode_data(self, chdata, tsdata, sync_offset):
        """
        The qutau data has two arrays: one channel array containing the channel numbers 
        where clicks were observed. The other one contains the time stamps. 
        Here I assign to each event a third and fourth array. The third array contains
        the sync number, and a fourth array replaces the second array with timestamps. It 
        contains the times with respect to the last sync. Finally we reshape the data 
        in the well known HydraHarp format.
        """
        chdata = chdata.astype(np.uint8)
        tsdata = tsdata.astype(np.uintc)
        
        sync_mask = chdata != self.sync_chan
        special = np.logical_or(chdata == self.marker1_chan, chdata == self.marker2_chan)
        sync_number = hhopt.get_sync_number(chdata, self.sync_chan, sync_offset)
        timings_wrt_sync = hhopt.get_dt_wrt_sync(chdata, tsdata, self.sync_chan)

        datastack = hhopt.stack(sync_number.astype(np.uintc), 
                                      timings_wrt_sync.astype(np.uintc), 
                                      chdata.astype(np.uintc),
                                      special.astype(np.uintc))

        #adjust the sync number offset to the last sync number
        sync_offset = datastack[-1,0]

        #delete syncs from the arrays
        decoded_data = hhopt.apply_filter_to_2darray(datastack, sync_mask.astype(np.uintc))

        return decoded_data, sync_offset
Exemplo n.º 3
0
def decode(data):
    nsync = np.bitwise_and(data, 2**10 - 1)
    event_time = np.bitwise_and(np.right_shift(data, 10), 2**15 - 1)
    channel = np.bitwise_and(np.right_shift(data, 25), 2**6 - 1)
    special = np.bitwise_and(np.right_shift(data, 31), 1)
    return hhopt.stack(nsync, event_time, channel, special)
Exemplo n.º 4
0
def decode(data):
    nsync = np.bitwise_and(data, 2**10-1)
    event_time = np.bitwise_and(np.right_shift(data, 10), 2**15-1)
    channel = np.bitwise_and(np.right_shift(data, 25), 2**6 - 1)
    special = np.bitwise_and(np.right_shift(data, 31), 1)
    return hhopt.stack(nsync, event_time, channel, special)