DOESN'T work with OVERLAPPING labels

        :param timestamps:
        :param data:
        :param lbls:
        :return:
770035
def get_annotated_data_x_y(timestamps, data, lbls):
        

        timestamps = np.array(timestamps)

        timestamp_step = timestamps[3]-timestamps[2]
        current_new_timestamp = 0.0
        new_timestamps = []

        X = None
        Y = []
        classes = []

        for i in range(0, len(timestamps)):

            for lbl in lbls:
                if lbl.start_seconds <= timestamps[i] < lbl.end_seconds:
                    if X is None:
                        X = data[i, :]
                    else:
                        X = np.vstack((X, data[i, :]))
                    Y.append(lbl.label)
                    new_timestamps.append(current_new_timestamp)
                    current_new_timestamp += timestamp_step

                    if lbl.label not in classes:
                        classes.append(lbl.label)

        return X, Y, classes, new_timestamps
877572
def collide(cls, data, params):
        
        xminmax = ['xmin', 'xmax']
        data, width = cls._collide_setup(data, params)
        if params.get('width', None) is None:
            params['width'] = width

        # Reorder by x position then on group, relying on stable sort to
        # preserve existing ordering. The default stacking order reverses
        # the group in order to match the legend order.
        if params and 'reverse' in params and params['reverse']:
            idx = data.sort_values(
                ['xmin', 'group'], kind='mergesort').index
        else:
            data['-group'] = -data['group']
            idx = data.sort_values(
                ['xmin', '-group'], kind='mergesort').index
            del data['-group']

        data = data.loc[idx, :]

        # Check for overlap
        intervals = data[xminmax].drop_duplicates().values.flatten()
        intervals = intervals[~np.isnan(intervals)]

        if (len(np.unique(intervals)) > 1 and
                any(np.diff(intervals - intervals.mean()) < -1e-6)):
            msg = "{} requires non-overlapping x intervals"
            warn(msg.format(cls.__name__), PlotnineWarning)

        if 'ymax' in data:
            data = groupby_apply(data, 'xmin', cls.strategy, params)
        elif 'y' in data:
            data['ymax'] = data['y']
            data = groupby_apply(data, 'xmin', cls.strategy, params)
            data['y'] = data['ymax']
        else:
            raise PlotnineError('Neither y nor ymax defined')

        return data
571335
public void addSplit(long timestampInMs, long durationInNs) {
		last = durationInNs;
		total += durationInNs;
		squareTotal += durationInNs * durationInNs;
		if (durationInNs > max) {
			max = durationInNs;
		}
		if (durationInNs < min) {
			min = durationInNs;
		}
		counter++;
		lastTimestamp = timestampInMs;
	}
579784
def QA_util_stamp2datetime(timestamp):
    
    try:
        return datetime.datetime.fromtimestamp(timestamp)
    except Exception as e:
        # it won't work ??
        try:
            return datetime.datetime.fromtimestamp(timestamp / 1000)
        except:
            try:
                return datetime.datetime.fromtimestamp(timestamp / 1000000)
            except:
                return datetime.datetime.fromtimestamp(timestamp / 1000000000)
944481
void removeOutVertexLabel(VertexLabel lbl, boolean preserveData) {
        this.uncommittedRemovedOutVertexLabels.add(lbl);
        if (!preserveData) {
            deleteColumn(lbl.getFullName() + Topology.OUT_VERTEX_COLUMN_END);
        }
    }
940778
private static boolean areAttachmentLabelsUnique(List<String> labels) {
    Map<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    for (int i = 0; i < labels.size(); i++) {
      map.put(labels.get(i), labels.get(i));
    }
    if (labels.size() == map.size()) {
      return true;
    } else {
      return false;
    }
  }
734844
def _absolute_spike_times_from_labels(self,time_dimension=0,*args,**kwargs):
        
        x = self[time_dimension].copy()
        #x = self.spike_times.get_converted(time_dimension,kwargs.get('units',None))
        factor = self.len(time_dimension,units=kwargs.get('units',None),resolution=kwargs.get('resolution',1.0))
        for a in args:
            if a in self:
                x += factor * self[a]
                factor *= self.len(a)
        for k in kwargs.keys():
            if k in self:
                x += factor * self[k]
                if kwargs[k] is not None:
                    factor *= kwargs[k]
                else:
                    factor *= self.len(k)
        return x,factor
1209038
def _label_desc(self, label, desc, label_color=''):
        '''  '''
        return self.BRIGHT +  label_color + label + self.RESET + desc
1192739
def set_text(self, text):
        '''

        '''
        self.traj_controls.timelabel.setText(self.traj_controls._label_tmp.format(text))
576105
def _label_from_list(self, labels:Iterator, label_cls:Callable=None, from_item_lists:bool=False, **kwargs)->'LabelList':
        ""
        if not from_item_lists:
            raise Exception("Your data isn't split, if you don't want a validation set, please use `split_none`.")
        labels = array(labels, dtype=object)
        label_cls = self.get_label_cls(labels, label_cls=label_cls, **kwargs)
        y = label_cls(labels, path=self.path, **kwargs)
        res = self._label_list(x=self, y=y)
        return res
693022
def display_rows(self,
                     rows,
                     labels,
                     indent):

        ''''''

        out = []

        if not rows:
            return out

        first_row_type = type(rows[0])
        # all rows must have the same datatype
        consistent = True
        for row in rows[1:]:
            if type(row) != first_row_type:
                consistent = False

        if not consistent:
            return out

        if isinstance(labels, dict):
            labels_temp = []
            for key in sorted(labels):
                labels_temp.append(labels[key])
            labels = labels_temp

        if first_row_type is dict:  # and all the others
            temp_rows = []
            if not labels:
                labels = [six.text_type(label).replace('_', ' ').title() for label in sorted(rows[0])]
            for row in rows:
                temp_row = []
                for key in sorted(row):
                    temp_row.append(six.text_type(row[key]))
                temp_rows.append(temp_row)
            rows = temp_rows
        elif isinstance(rows[0], six.string_types):
            rows = [[row] for row in rows]  # encapsulate each row in a single-element list

        labels_and_rows = [labels] + rows if labels else rows
        has_header = self.has_header and labels

        return self.prepare_rows(labels_and_rows, indent + 4, has_header)
226218
def add_timestamps(self):
        """"""
        transform, _ = self.transform().inverted()

        stamps = _make_timestamps(self.start_time, self.minimum, self.maximum,
                                  self.parent.value('timestamp_steps'))

        for stamp, xpos in zip(*stamps):
            text = self.scene.addSimpleText(stamp)
            text.setFlag(QGraphicsItem.ItemIgnoresTransformations)

            # set xpos and adjust for text width
            text_width = text.boundingRect().width() * transform.m11()
            text.setPos(xpos - text_width / 2, TIME_HEIGHT)
588211
def add_time_labels(self):
        """"""
        for text, pos in zip(self.idx_time, self.time_pos):
            self.scene.addItem(text)
            text.setPos(pos)
483232
def accept_default_labels(self, other):
        

        self.units_label = other.units_label
        self.name_label = other.name_label
        self.notes_label = other.notes_label
        self.desc_label = other.desc_label
        self.plot_label = other.plot_label
        self.axis_label = other.axis_label
        self.scale_label = other.scale_label
        self.min_label = other.min_label
        self.max_label = other.max_label
        self.fill_label = other.fill_label
        return
1212164
def labels(self, labels):
        
        allowed_values = ["raw data", "documentation", "visualization", "clean data", "script", "report"]
        if not set(labels).issubset(set(allowed_values)):
            raise ValueError(
                "Invalid values for `labels` [{0}], must be a subset of [{1}]"
                .format(", ".join(map(str, set(labels)-set(allowed_values))),
                        ", ".join(map(str, allowed_values)))
            )

        self._labels = labels
1172043
def yticktext(self, labels, index=1):
        
        self.layout['yaxis' + str(index)]['ticktext'] = labels
        return self
637323
def labels(self, values):
        """"""
        if isinstance(values, dict):
            if self.__data is not None and len(self.__data) != len(values):
                raise ValueError(
                    'number of samples do not match the previously assigned data')
            elif set(self.keys) != set(list(values)):
                raise ValueError('sample ids do not match the previously assigned ids.')
            else:
                self.__labels = values
        else:
            raise ValueError('labels input must be a dictionary!')