def read_epocharray(self,lazy = False, cascade = True, 
                        channel_index = 0,
                        t_start = 0.,
                        segment_duration = 0.):
        """function to read digital timestamps. this function reads the event
        onset and offset and outputs onset and duration. to get only onsets use
        the event array function"""
        if lazy:
            epa = EpochArray(file_origin = self.filename,
                             times=None, durations=None, labels=None)
        else:
            #create temporary empty lists to store data
            tempNames = list()
            tempTimeStamp = list()
            durations = list()
            #get entity from file
            digEntity = self.fd.get_entity(channel_index)
            #transform t_start into index (reading will start from this index) 
            startat = digEntity.get_index_by_time(t_start,0)#zero means closest index to value
            #get the last index to read, using segment duration and t_start
            endat = digEntity.get_index_by_time(float(segment_duration+t_start),-1)#-1 means last index before time       
            
            #run through entity using only odd "i"s 
            for i in range(startat,endat+1,1):
                if i % 2 == 1:
                    #get in which digital bit was the trigger detected
                    tempNames.append(digEntity.label[-8:])
                    #get the time stamps of even events
                    tempData, onOrOff = digEntity.get_data(i-1)
                    #if this was an onset event, save it to the list
                    #on triggered recordings it seems that only onset events are
                    #recorded. On continuous recordings both onset(==1) 
                    #and offset(==255) seem to be recorded
                    #if onOrOff == 1:
                    #append the time stamp to them empty list
                    tempTimeStamp.append(tempData)
                
                    #get time stamps of odd events
                    tempData1, onOrOff = digEntity.get_data(i)
                    #if onOrOff == 255:
                    #pass
                    durations.append(tempData1-tempData)
            epa = EpochArray(file_origin = self.filename,
                                 times = np.array(tempTimeStamp)*pq.s, 
                                 durations = np.array(durations)*pq.s, 
                                 labels = np.array(tempNames,dtype = "S"),
                                 description = "digital events with duration")
            return epa
dataset/ETHPy150Open NeuralEnsemble/python-neo/neo/io/neuroshareapiio.py/NeuroshareapiIO.read_epocharray/original