Display the traces and spikes in a given interval.
6699
def set_interval(self, interval=None, change_status=True,
                     force_update=False):
        """"""
        if interval is None:
            interval = self._interval
        interval = self._restrict_interval(interval)
        if not force_update and interval == self._interval:
            return
        self._interval = interval
        start, end = interval
        self.clear()

        # Set the status message.
        if change_status:
            self.set_status('Interval: {:.3f} s - {:.3f} s'.format(start, end))

        # Load the traces.
        traces = self.traces(interval)

        # Find the data bounds.
        ymin, ymax = traces.data.min(), traces.data.max()
        data_bounds = (start, ymin, end, ymax)

        # Used for spike click.
        self._data_bounds = data_bounds
        self._waveform_times = []

        # Plot the traces.
        self._plot_traces(traces.data,
                          color=traces.get('color', None),
                          data_bounds=data_bounds,
                          )

        # Plot the spikes.
        waveforms = traces.waveforms
        assert isinstance(waveforms, list)
        for w in waveforms:
            self._plot_waveforms(waveforms=w.data,
                                 color=w.color,
                                 channel_ids=w.get('channel_ids', None),
                                 start_time=w.start_time,
                                 data_bounds=data_bounds,
                                 )
            self._waveform_times.append((w.start_time,
                                         w.spike_id,
                                         w.spike_cluster,
                                         w.get('channel_ids', None),
                                         ))

        # Plot the labels.
        if self.do_show_labels:
            self._plot_labels(traces.data, data_bounds=data_bounds)

        self.build()
        self.update()
605029
def display(self) -> typing.Union[None, report.Report]:
        """"""
        return (
            self._project.current_step.report
            if self._project and self._project.current_step else
            None
        )
1212146
def traceplot(trace: sample_types, labels: List[Union[str, Tuple[str, str]]] = None, ax: Any = None,
              x0: int = 0) -> Any:
    

    if labels is None:
        labels = list(trace.keys())

    if ax is None:
        _, ax = plt.subplots(len(labels), 1, squeeze=False)

    for index, label in enumerate(labels):
        data = [sample for sample in trace[label]]

        ax[index][0].set_title(label)
        ax[index][0].plot(__integer_xaxis(ax[index][0], x0, len(data)), data)

    __pause_for_crude_animation()

    return ax
597556
def plot(self):
		'''
		
		'''
		pl.plot(self.x, self.y, '.')
		pl.plot(self.x_int, self.y_int)
		pl.grid(True)
		pl.show()
797275
def num_spikes(self):
        
        self.cursor.execute('SELECT Count(*) from spikes')
        rows = self.cursor.fetchall()[0]
        # Check against 'wc -l *ex*.gdf'
        if self.debug: print('DB has %d spikes' % rows)
        return rows
800378
def add_traces(self):
        """"""
        y_distance = self.parent.value('y_distance')
        self.chan = []
        self.chan_pos = []
        self.chan_scale = []

        row = 0
        for one_grp in self.parent.channels.groups:
            for one_chan in one_grp['chan_to_plot']:

                # channel name
                chan_name = one_chan + ' (' + one_grp['name'] + ')'

                # trace
                dat = (self.data(trial=0, chan=chan_name) *
                       self.parent.value('y_scale'))
                dat *= -1  # flip data, upside down
                path = self.scene.addPath(Path(self.data.axis['time'][0],
                                               dat))
                path.setPen(QPen(QColor(one_grp['color']), LINE_WIDTH))

                # adjust position
                chan_pos = y_distance * row + y_distance / 2
                path.setPos(0, chan_pos)
                row += 1

                self.chan.append(chan_name)
                self.chan_scale.append(one_grp['scale'])
                self.chan_pos.append(chan_pos)
1050260
def intervals(start, end, interval):
    
    interval = _seconds_or_timedelta(interval)
    current_timestamp = start
    while current_timestamp.epoch < end.epoch:
        yield current_timestamp

        current_timestamp = current_timestamp.add(
            seconds=interval.total_seconds()
        )
212743
def print_intervals(intervals):
        
        res = []
        for i in intervals:
            res.append(repr(i))
        print("".join(res))
62002
public synchronized void printStatistics() {
        // quickly memoize and update counters, get the time, record update time, etc...
        long nowSuccesses = incrementCount.get();
        long nowFailures = failureCount.get();
        long prevSuccesss = lastPeriod.getAndSet(nowSuccesses);
        long endTime = System.currentTimeMillis();
        long startTime = lastStatsReportTS;
        lastStatsReportTS = endTime;

        // do math with as much safety as possible
        long invocationsCompleted = Math.max(nowSuccesses - prevSuccesss, 0);
        long periodDurationMs = Math.max(endTime - startTime, 1);
        long cumulativeDurationMs = Math.max(endTime - benchmarkStartTS, 1);
        long periodThroughput = (long) (invocationsCompleted / (periodDurationMs / 1000.0));
        long cumulativeThroughput = (long) (nowSuccesses / (cumulativeDurationMs / 1000.0));
        long time = (long) (Math.round(endTime - benchmarkStartTS) / 1000.0);

        // print out periodic report
        System.out.printf("%02d:%02d:%02d ", time / 3600, (time / 60) % 60, time % 60);
        System.out.printf("Period Throughput %10d/s, ", periodThroughput);
        System.out.printf("Cumulative Throughput %10d/s, ", cumulativeThroughput);
        System.out.printf("Total Failures %10d", nowFailures);
        System.out.printf("\n");
    }
359421
def display(level='DEBUG'):
    """"""
    logger = get_logger()
    sh = logging.StreamHandler()
    sh.setLevel(getattr(logging, level))
    sh.setFormatter(DEFAULT_LOG_FORMAT)
    logger.addHandler(sh)
1184483
def display(self):
        """"""
        size = list(range(len(self.layers)))
        size.reverse()
        for i in size:
            layer = self.layers[i]
            if layer.active:
                print('%s layer (size %d)' % (layer.name, layer.size))
                tlabel, olabel = '', ''
                if (layer.type == 'Output'):
                    if self.countWrong:
                        tlabel = ' (%s)' % self.classify(layer.target.tolist())
                        olabel = ' (%s)' % self.classify(layer.activation.tolist())
                        if olabel == tlabel:
                            self.numRight += 1
                        else:
                            olabel += '  *** WRONG ***'
                            self.numWrong += 1
                            if self.actDisplay is not None:
                                self.actDisplay.showWrong()
                    print('Target    : %s%s' % (pretty(layer.target, max=15), tlabel))
                print('Activation: %s%s' % (pretty(layer.activation, max=15), olabel))
                if self.patterned and layer.type != 'Hidden':
                    targetWord, diff = self.getWord( layer.target, returnDiff = 1)
                    if layer.kind == 'Output':
                        if targetWord == None:
                            print("Target Pattern   = %s" % "No match")
                        else:
                            if diff == 0.0:
                                print("Target Pattern   = '%s'" % targetWord)
                            else:
                                print("Target Pattern   = '%s'; difference = %f)" % (targetWord, diff))
                    actWord, diff = self.getWord( layer.activation, returnDiff = 1 )
                    if (layer.kind == 'Input' or layer.kind == 'Output'):
                        if actWord == None:
                            print("Matching Pattern = %s" % "No match")
                        else:
                            if diff == 0.0:
                                print("Matching Pattern = '%s'" % actWord)
                            else:
                                print("Matching Pattern = '%s'; difference = %f" % (actWord, diff))
                print("------------------------------------")
271992
def display_progress(cls, operations):
        
        start_crea = datetime.utcnow()

        # count number of operations, 3 steps per operation
        if not isinstance(operations, (list, tuple)):
            operations = [operations]
        count_operations = len(operations) * 3
        updating_done = False
        while not updating_done:
            op_score = 0
            for oper in operations:
                op_ret = cls.call('operation.info', oper['id'])
                op_step = op_ret['step']
                if op_step in cls._op_scores:
                    op_score += cls._op_scores[op_step]
                else:
                    cls.echo('')
                    msg = 'step %s unknown, exiting' % op_step
                    if op_step == 'ERROR':
                        msg = ('An error has occured during operation '
                               'processing: %s' % op_ret['last_error'])
                    elif op_step == 'SUPPORT':
                        msg = ('An error has occured during operation '
                               'processing, you must contact Gandi support.')
                    cls.echo(msg)
                    sys.exit(1)

            cls.update_progress(float(op_score) / count_operations,
                                start_crea)

            if op_score == count_operations:
                updating_done = True

            time.sleep(cls._poll_freq)

        cls.echo('\r')
988807
def show_progress(self, message=None):
        """'"""
        if self.in_progress_hanging:
            if message is None:
                sys.stdout.write('.')
                sys.stdout.flush()
            else:
                if self.last_message:
                    padding = ' ' * max(0, len(self.last_message)-len(message))
                else:
                    padding = ''
                sys.stdout.write('\r%s%s%s%s' % (' '*self.indent, self.in_progress, message, padding))
                sys.stdout.flush()
                self.last_message = message
764276
def _print_result_info(traces, events):
    
    print_v('Returning %i traces:'%len(traces))
    for r in sorted(traces.keys()):
        x = traces[r]
        print_v('  %s (%s): %s -> %s (min: %s, max: %s, len: %i)'%(r, type(x), x[0],x[-1],min(x),max(x),len(x)))
    print_v('Returning %i events:'%len(events))
    for r in sorted(events.keys()):
        x = events[r]
        print_v('  %s: %s -> %s (len: %i)'%(r, x[0] if len(x)>0 else '-',x[-1] if len(x)>0 else '-',len(x)))
1366966
def tail(conn, stack_name, log_func=_tail_print, sleep_time=5,
         include_initial=True):
    """"""
    # First dump the full list of events in chronological order and keep
    # track of the events we've seen already
    seen = set()
    initial_events = get_events(conn, stack_name)
    for e in initial_events:
        if include_initial:
            log_func(e)
        seen.add(e.event_id)

    # Now keep looping through and dump the new events
    while 1:
        events = get_events(conn, stack_name)
        for e in events:
            if e.event_id not in seen:
                log_func(e)
                seen.add(e.event_id)
        time.sleep(sleep_time)
618844
def display_view(self):
        """"""
        self.idx_start.setText(str(self.parent.value('window_start')))
        self.idx_length.setText(str(self.parent.value('window_length')))
        self.idx_scaling.setText(str(self.parent.value('y_scale')))
        self.idx_distance.setText(str(self.parent.value('y_distance')))
160695
def busy_display():
    """"""
    sys.stdout.write("\033[?25l")  # cursor off
    sys.stdout.flush()
    for x in range(1800):
        symb = ['\\', '|', '/', '-']
        sys.stdout.write("\033[D{}".format(symb[x % 4]))
        sys.stdout.flush()
        gevent.sleep(0.1)