Merge timeseries into a new :class:`~.TimeSeries` instance.

    :parameter series: an iterable over :class:`~.TimeSeries`.
517427
def ts_merge(series):
    '''
    '''
    series = iter(series)
    ts = next(series)
    return ts.merge(series)
390359
def union(*sets, **kwargs):
    
    sets = _set_preprocess(sets, **kwargs)
    return as_index( _set_concatenate(sets), axis=0, base=True).unique
429143
def merge(self, frame):
        
        for column, values in frame.iteritems():
            # Temporary hack, fix later
            counter = self._counters.get(column)
            for value in values:
                if counter is not None:
                    counter.merge(value)
440178
function mergeData(timeserieses, range) {
  const reference = {revisions: {}};
  let cell;
  for (const timeseries of timeserieses) {
    for (const datum of timeseries) {
      if (datum.revision < range.min) {
        if (!reference.revision ||
            datum.revision < reference.revision) {
          reference.revision = datum.revision;
          // This might overwrite some or all of reference.revisions.
          Object.assign(reference.revisions, datum.revisions);
        }
        continue;
      }

      if (!cell) {
        cell = {...datum};
        cell.timestampRange = new tr.b.math.Range();
        if (cell.timestamp) {
          cell.timestampRange.addValue(cell.timestamp.getTime());
        }
        if (!cell.revisions) cell.revisions = {};
        continue;
      }

      TimeseriesMerger.mergeStatistics(cell, datum);
      if (datum.timestamp) {
        cell.timestampRange.addValue(datum.timestamp.getTime());
      }

      // TODO Uncomment when Histograms are displayed.
      // mergeHistograms(cell, datum);

      if (datum.revision > cell.revision) {
        cell.revision = datum.revision;
        Object.assign(cell.revisions, datum.revisions);
      }

      // TODO merge annotations
    }
  }
  return {reference, cell};
}
857139
def union(self, *iterables):
        
        return self.__class__(chain(iter(self), *iterables), key=self._key)
389948
def combine_argtype(observations):
    
    assert len(observations) > 0
    assert is_Tuple(observations[0])
    if len(observations) > 1:
        prms = [get_Tuple_params(observations[0])]
        ln = len(prms[0])
        for obs in observations[1:]:
            assert is_Tuple(obs)
            prms.append(get_Tuple_params(obs))
            assert len(prms[-1]) == ln
        if simplify:
            prms = map(list, zip(*prms))
            if not isinstance(prms, list):
                # special care for Python 3
                prms = list(prms)
            for type_list in prms:
                simplify_for_Union(type_list)
            prms = map(tuple, prms)
        else:
            prms = map(tuple, zip(*prms))
        prms = map(Union.__getitem__, prms)
        return Tuple[tuple(prms)]
    else:
        return observations[0]
730629
def _ts_slice(self, Xt, y):
        '''  '''
        Ns = len(Xt)
        Xt_new = []
        for i in range(self.n_splits):
            for j in range(Ns):
                Njs = int(len(Xt[j]) / self.n_splits)
                Xt_new.append(Xt[j][(Njs * i):(Njs * (i + 1))])
        Xt_new = np.array(Xt_new)

        if len(np.atleast_1d(y[0])) == len(Xt[0]):
            # y is a time series
            y_new = []
            for i in range(self.n_splits):
                for j in range(Ns):
                    Njs = int(len(y[j]) / self.n_splits)
                    y_new.append(y[j][(Njs * i):(Njs * (i + 1))])
            y_new = np.array(y_new)
        else:
            # y is contextual to each series
            y_new = np.concatenate([y for i in range(self.n_splits)])

        return Xt_new, y_new
970981
def _load(self, metrix):
    
    if isinstance(metrix, TimeSeries):
      return metrix
    if isinstance(metrix, dict):
      return TimeSeries(metrix)
    return TimeSeries(utils.read_csv(metrix))
663657
def from_series(cls, series, offset=0):
        
        return cls(data=series.data, index=series.index, data_name=series.data_name, index_name=series.index_name,
                   sort=series.sort, offset=offset)
61050
def align(time, time2, magnitude, magnitude2, error, error2):
    

    error = np.zeros(time.shape) if error is None else error
    error2 = np.zeros(time2.shape) if error2 is None else error2

    # this asume that the first series is the short one
    sserie = pd.DataFrame({"mag": magnitude, "error": error}, index=time)
    lserie = pd.DataFrame({"mag": magnitude2, "error": error2}, index=time2)

    # if the second serie is logest then revert
    if len(time) > len(time2):
        sserie, lserie = lserie, sserie

    # make the merge
    merged = sserie.join(lserie, how="inner", rsuffix='2')

    # recreate columns
    new_time = merged.index.values
    new_mag, new_mag2 = merged.mag.values, merged.mag2.values
    new_error, new_error2 = merged.error.values, merged.error2.values

    if len(time) > len(time2):
        new_mag, new_mag2 = new_mag2, new_mag
        new_error, new_error2 = new_error2, new_error

    return new_time, new_mag, new_mag2, new_error, new_error2
385558
def add_series(series)
      raise ArgumentError, "Invalid argument 'series' Expected ImageSeries or DoseVolume, got #{series.class}." unless [ImageSeries, DoseVolume].include?(series.class)
      @image_series << series
      @associated_series[series.uid] = series
    end
962177
def update(self, iterable={}, **kwargs):
        
        def _merge(a, *args):
            for key, value in itertools.chain(*args):
                if key in a and isinstance(value, (dict, Conf)):
                    value = _merge(a[key], value.items())
                a[key] = value
            return a

        # adopt iterable sequence to unified interface: (key, value)
        if isinstance(iterable, (dict, Conf)):
            iterable = iterable.items()

        # iterate and update values
        _merge(self._data, iterable, kwargs.items())
969999
def map(self, fn):
        """"""
        return TimeSeries([(x, fn(y)) for x, y in self.points])
999697
def merge(self, other):
        
        ignore = self.ignore
        extra = self.extras
        if isinstance(other, Dict):
            other_keys = other.keys
            ignore += other.ignore
            extra += other.extras
        elif isinstance(other, (list, tuple)):
            other_keys = list(other)
        elif isinstance(other, dict):
            return self.__class__(other, *self.keys)
        else:
            raise TypeError('You must merge Dict only with Dict'
                            ' or list of Keys')
        return self.__class__(*(self.keys + other_keys), ignore_extra=ignore,
                              allow_extra=extra)
424283
def merge(self, other):
        
        newstart = min(self._start, other.start)
        newend = max(self._end, other.end)
        return Range(newstart, newend)
1214287
def add_series(self, name, number_format=None):
        
        series_data = XySeriesData(self, name, number_format)
        self.append(series_data)
        return series_data
442476
def copy(self):
        
        df = super(Ensemble,self).copy()
        pe = ParameterEnsemble.from_dataframe(df=df,pst=self.pst.get())
        pe.__istransformed = self.istransformed
        return pe