parsers/MultiData.py
def tagIntervals(self, chData:object, startFrom:object, block:str, ignoreEmpty:bool=True) -> DataFrame:
        """Tags given data by intervals, then returns a single dataframe.
        
        :param chData: data to stack intervals from, usually after getChannelById method.
        :param startFrom: zeroTime to start from.
        :param block: which type of block to tag by.
        :param ignoreEmpty: Whether to cut off the empty and utility intervals.
        :return: DataFrame object ready to group by intervals.
        """
        data = []
        ints = self.settingsReader.getIntervals(block=block, ignoreEmpty=ignoreEmpty)
        for interval in ints:
            intData = self.getDataInterval(chData, startFrom, interval.get('id'), block=block)
            intData.insert(4, block, interval.get('id'))
            intData.insert(5, '{0} duration'.format(block), interval.get('duration'))
            data.append(intData)

        #case when there is no interval block in settings at all - nothing to tag
        if len(ints)==0:
            return chData
        if len(ints)==1:
            data = data[0]
        else:
            data = data[0].append(data[1:])


        zeroBased=[]
        zeroTime = data.iloc[0, 0]
        for timestamp in data.iloc[:, 0]:
            zeroBased.append(timestamp - zeroTime)
        #FIXME should be no duplicates
        data.insert(1, 'TimestampZeroBased', zeroBased, allow_duplicates=True)

        #inheriting metadata
        try:
            data.metadata = chData.metadata
        except AttributeError:
            pass


        return data
Tags given data by intervals, then returns a single dataframe.
        
        :param chData: data to stack intervals from, usually after getChannelById method.
        :param startFrom: zeroTime to start from.
        :param block: which type of block to tag by.
        :param ignoreEmpty: Whether to cut off the empty and utility intervals.
        :return: DataFrame object ready to group by intervals.
        
Tags given data by intervals, then returns a single dataframe.
Tags given data by intervals then returns a single dataframe .
def tagIntervals(self, chData:object, startFrom:object, block:str, ignoreEmpty:bool=True) -> DataFrame:
        data = []
        ints = self.settingsReader.getIntervals(block=block, ignoreEmpty=ignoreEmpty)
        for interval in ints:
            intData = self.getDataInterval(chData, startFrom, interval.get('id'), block=block)
            intData.insert(4, block, interval.get('id'))
            intData.insert(5, '{0} duration'.format(block), interval.get('duration'))
            data.append(intData)
        if len(ints)==0:
            return chData
        if len(ints)==1:
            data = data[0]
        else:
            data = data[0].append(data[1:])
        zeroBased=[]
        zeroTime = data.iloc[0, 0]
        for timestamp in data.iloc[:, 0]:
            zeroBased.append(timestamp - zeroTime)
        data.insert(1, 'TimestampZeroBased', zeroBased, allow_duplicates=True)
        try:
            data.metadata = chData.metadata
        except AttributeError:
            pass
        return data
def tagIntervals ( self , chData : object , startFrom : object , block : str , ignoreEmpty : bool = True ) -> DataFrame : data = [ ] ints = self . settingsReader . getIntervals ( block = block , ignoreEmpty = ignoreEmpty ) for interval in ints : intData = self . getDataInterval ( chData , startFrom , interval . get ( 'id' ) , block = block ) intData . insert ( 4 , block , interval . get ( 'id' ) ) intData . insert ( 5 , '{0} duration' . format ( block ) , interval . get ( 'duration' ) ) data . append ( intData ) if len ( ints ) == 0 : return chData if len ( ints ) == 1 : data = data [ 0 ] else : data = data [ 0 ] . append ( data [ 1 : ] ) zeroBased = [ ] zeroTime = data . iloc [ 0 , 0 ] for timestamp in data . iloc [ : , 0 ] : zeroBased . append ( timestamp - zeroTime ) data . insert ( 1 , 'TimestampZeroBased' , zeroBased , allow_duplicates = True ) try : data . metadata = chData . metadata except AttributeError : pass return data
Tags given data by intervals, then returns a single dataframe.
Tags given data by intervals then returns a single dataframe .
"""Tags given data by intervals, then returns a single dataframe.
        
        :param chData: data to stack intervals from, usually after getChannelById method.
        :param startFrom: zeroTime to start from.
        :param block: which type of block to tag by.
        :param ignoreEmpty: Whether to cut off the empty and utility intervals.
        :return: DataFrame object ready to group by intervals.
        """ #case when there is no interval block in settings at all - nothing to tag #FIXME should be no duplicates #inheriting metadata
DataFrame object ready to group by intervals.
DataFrame object ready to group by intervals .
self
chData
object
data to stack intervals from, usually after getChannelById method.
data to stack intervals from usually after getChannelById method .
startFrom
object
zeroTime to start from.
zeroTime to start from .
block
str
which type of block to tag by.
which type of block to tag by .
ignoreEmpty
bool
Whether to cut off the empty and utility intervals.
Whether to cut off the empty and utility intervals .