def __new__(cls, data, unit=None, t0=None, dt=None, sample_rate=None,
                times=None, channel=None, name=None, **kwargs):
        """Generate a new `TimeSeriesBase`.
        """
        # parse t0 or epoch
        epoch = kwargs.pop('epoch', None)
        if epoch is not None and t0 is not None:
            raise ValueError("give only one of epoch or t0")
        if epoch is None and t0 is not None:
            kwargs['x0'] = _format_time(t0)
        elif epoch is not None:
            kwargs['x0'] = _format_time(epoch)
        # parse sample_rate or dt
        if sample_rate is not None and dt is not None:
            raise ValueError("give only one of sample_rate or dt")
        if sample_rate is None and dt is not None:
            kwargs['dx'] = dt
        # parse times
        if times is not None:
            kwargs['xindex'] = times

        # generate TimeSeries
        new = super(TimeSeriesBase, cls).__new__(cls, data, name=name,
                                                 unit=unit, channel=channel,
                                                 **kwargs)

        # manually set sample_rate if given
        if sample_rate is not None:
            new.sample_rate = sample_rate

        return new
def __new__ ( cls , data , unit = None , t0 = None , dt = None , sample_rate = None , times = None , channel = None , name = None , ** kwargs ) : epoch = kwargs . pop ( 'epoch' , None ) if epoch is not None and t0 is not None : raise ValueError ( "give only one of epoch or t0" ) if epoch is None and t0 is not None : kwargs [ 'x0' ] = _format_time ( t0 ) elif epoch is not None : kwargs [ 'x0' ] = _format_time ( epoch ) if sample_rate is not None and dt is not None : raise ValueError ( "give only one of sample_rate or dt" ) if sample_rate is None and dt is not None : kwargs [ 'dx' ] = dt if times is not None : kwargs [ 'xindex' ] = times new = super ( TimeSeriesBase , cls ) . __new__ ( cls , data , name = name , unit = unit , channel = channel , ** kwargs ) if sample_rate is not None : new . sample_rate = sample_rate return new
Generate a new `TimeSeriesBase`.