Split data into multiple timesteps.
772479
def split_timesteps(data, consistent_abmn=False):
    """"""
    if has_multiple_timesteps(data):
        grouped = data.groupby("timestep")
        return [group[1] for group in grouped]
    else:
        return data
215660
def _combine_ranges_on_length(self, data_len, first, second):
        '''
        
        '''
        first = get_true_slice(first, data_len)
        second = get_true_slice(second, data_len)
        final_start, final_step, final_stop = (None, None, None)

        # Get our start
        if first.start == None and second.start == None:
            final_start = None
        else:
            final_start = (first.start if first.start else 0)+(second.start if second.start else 0)

        # Get our stop
        if second.stop == None:
            final_stop = first.stop
        elif first.stop == None:
            final_stop = (first.start if first.start else 0) + second.stop
        else:
            final_stop = min(first.stop, (first.start if first.start else 0) + second.stop)

        # Get our step
        if first.step == None and second.step == None:
            final_step = None
        else:
            final_step = (first.step if first.step else 1)*(second.step if second.step else 1)

        # If we have a start above our stop, set them to be equal
        if final_start > final_stop:
            final_start = final_stop

        return slice(final_start, final_stop, final_step)
152112
private float[] generateParticleTimeStamps(float totalTime)
    {
        float timeStamps[] = new float[mEmitRate * 2];

        if ( burstMode ) {
            for (int i = 0; i < mEmitRate * 2; i += 2) {
                timeStamps[i] = totalTime;
                timeStamps[i + 1] = 0;
            }
        }
        else {
            for (int i = 0; i < mEmitRate * 2; i += 2) {
                timeStamps[i] = totalTime + mRandom.nextFloat();
                timeStamps[i + 1] = 0;
            }
        }
        return timeStamps;

    }
1312643
def split(cls, dataset, start, end, datatype, **kwargs):
        
        objs = []
        if datatype is None:
            for d in dataset.data[start: end]:
                objs.append(dataset.clone(d, datatype=cls.subtypes))
            return objs
        elif not dataset.data:
            return objs
        ds = cls._inner_dataset_template(dataset)
        for d in dataset.data:
            ds.data = d
            if datatype == 'array':
                obj = ds.array(**kwargs)
            elif datatype == 'dataframe':
                obj = ds.dframe(**kwargs)
            elif datatype == 'columns':
                if ds.interface.datatype == 'dictionary':
                    obj = dict(ds.data)
                else:
                    obj = ds.columns(**kwargs)
            else:
                raise ValueError("%s datatype not support" % datatype)
            objs.append(obj)
        return objs
390153
def merge(data,skip=50,fraction=1.0):
    """"""

    w,s,d = data.chains.shape
    
    start = int((1.0 - fraction) * s)
    total = int((s - start) / skip)
        
    return data.chains[:,start::skip,:].reshape((w*total,d))
826175
def split32(data):
    
    all_pieces = []

    for position in range(0, len(data), 32):
        piece = data[position:position + 32]
        all_pieces.append(piece)

    return all_pieces
722377
def truncate_data(offset)
      for t in ALL_COLUMNS
        times = @times[t]
        @times[t] = @times[t][offset, times.size]
        @repeat = @times[t].size
      end
      @analysis = nil
      self
    end
1006810
def process_formdata(self, valuelist):
        """"""
        if valuelist:
            time_str = u' '.join(valuelist)
            try:
                timetuple = time.strptime(time_str, self.format)
                self.data = datetime.time(*timetuple[3:6])
            except ValueError:
                self.data = None
                raise
612559
def timestep_text(self):
        """"""
        if self.header.analysis_period.timestep == 1:
            return 'Hourly'
        else:
            return '{} Minute'.format(int(60 / self.header.analysis_period.timestep))
244780
def cull_to_timestep(self, timestep=1):
        """"""
        valid_s = self.header.analysis_period.VALIDTIMESTEPS.keys()
        assert timestep in valid_s, \
            'timestep {} is not valid. Choose from: {}'.format(timestep, valid_s)

        new_ap, new_values, new_datetimes = self._timestep_cull(timestep)
        new_header = self.header.duplicate()
        new_header._analysis_period = new_ap
        new_coll = HourlyDiscontinuousCollection(
            new_header, new_values, new_datetimes)
        new_coll._validated_a_period = True
        return new_coll
371089
def timeslice_generator(self):
        """"""
        slice_id = 0
        while slice_id < self.n_timeslices:
            blob = self.get_blob(slice_id)
            yield blob
            slice_id += 1
1235509
def _steps_to_slices():
    """"""
    if not (conf.core.timesteps or conf.core.snapshots):
        # default to the last snap
        conf.core.timesteps = None
        conf.core.snapshots = slice(-1, None, None)
        return
    elif conf.core.snapshots:
        # snapshots take precedence over timesteps
        # if both are defined
        conf.core.timesteps = None
        steps = conf.core.snapshots
    else:
        conf.core.snapshots = None
        steps = conf.core.timesteps
    steps = steps.split(':')
    steps[0] = int(steps[0]) if steps[0] else None
    if len(steps) == 1:
        steps.append(steps[0] + 1)
    steps[1] = int(steps[1]) if steps[1] else None
    if len(steps) != 3:
        steps = steps[0:2] + [1]
    steps[2] = int(steps[2]) if steps[2] else None
    steps = slice(*steps)
    if conf.core.snapshots is not None:
        conf.core.snapshots = steps
    else:
        conf.core.timesteps = steps
710583
def fromseconds(cls, seconds):
        """"""
        try:
            seconds = int(seconds)
        except TypeError:
            seconds = int(seconds.flatten()[0])
        return cls(datetime.timedelta(0, int(seconds)))
751603
def _split_batches(self, data, batch_size):
        """"""
        for i in range(0, len(data), batch_size):
            yield data[i : i + batch_size]
1185734
def explode(self):
        
        for t_id in self.items:
            timeperiod = self.items[t_id]
            timeperiod.explode()
746901
def _load_at(self, time, channels=None):
        """"""
        if channels is None:
            channels = slice(None, None, None)
        time = int(time)
        time_o = time
        ns = self.n_samples_trace
        if not (0 <= time_o < ns):
            raise ValueError("Invalid time {0:d}/{1:d}.".format(time_o, ns))
        slice_extract = _slice(time_o,
                               self.n_samples_before_after,
                               self._filter_margin)
        extract = self._traces[slice_extract][:, channels].astype(np.float32)

        # Pad the extracted chunk if needed.
        if slice_extract.start <= 0:
            extract = _pad(extract, self._n_samples_extract, 'left')
        elif slice_extract.stop >= ns - 1:
            extract = _pad(extract, self._n_samples_extract, 'right')

        assert extract.shape[0] == self._n_samples_extract
        return extract
127563
def split(self, start=None, end=None, datatype=None, **kwargs):
        
        if not self.interface.multi:
            if datatype == 'array':
                obj = self.array(**kwargs)
            elif datatype == 'dataframe':
                obj = self.dframe(**kwargs)
            elif datatype == 'columns':
                obj = self.columns(**kwargs)
            elif datatype is None:
                obj = self
            else:
                raise ValueError("%s datatype not support" % datatype)
            return [obj]
        return self.interface.split(self, start, end, datatype, **kwargs)