used for building set of traces
974132
def _init_trace(self, n,  color, style,
                    linewidth=2.5, zorder=None, marker=None, markersize=6):
        
        while n >= len(self.traces):
            self.traces.append(LineProperties())
        line = self.traces[n]
        label = "trace %i" % (n+1)
        line.label = label
        line.drawstyle = 'default'
        if zorder     is None:
            zorder = 5 * (n+1)
        line.zorder = zorder
        if color      is not None: line.color = color
        if style      is not None: line.style = style
        if linewidth  is not None: line.linewidth = linewidth
        if marker     is not None: line.marker = marker
        if markersize is not None: line.markersize = markersize
        self.traces[n] = line
1167443
def batchsd(trace, batches=5):
    

    if len(np.shape(trace)) > 1:

        dims = np.shape(trace)
        # ttrace = np.transpose(np.reshape(trace, (dims[0], sum(dims[1:]))))
        ttrace = np.transpose([t.ravel() for t in trace])

        return np.reshape([batchsd(t, batches) for t in ttrace], dims[1:])

    else:
        if batches == 1:
            return np.std(trace) / np.sqrt(len(trace))

        try:
            batched_traces = np.resize(trace, (batches, int(len(trace) / batches)))
        except ValueError:
            # If batches do not divide evenly, trim excess samples
            resid = len(trace) % batches
            batched_traces = np.resize(trace[:-resid], 
                (batches, len(trace[:-resid]) / batches))

        means = np.mean(batched_traces, 1)

        return np.std(means) / np.sqrt(batches)
1270212
function() {
    var chains = this.chains();
    var traces = [];
    for (var i = 0; i < chains.length; ++i) {
      Array.prototype.push.apply(traces, chains[i].backboneTraces());
    }
    return traces;
  }
1261192
void applyActiveTrace()
                    throws java.io.IOException {
        String[] names = activeNames.split(":");

        // Loop over existing Components.
        for (java.util.Iterator traceIterator = activeTrace.values().iterator(); traceIterator.hasNext();) {
            AbstractTrace abstractTrace = (AbstractTrace) traceIterator.next();

            int traceLevelToSet = Trace.Level_None;
            // Loop over active Components, testing to see if any of them is a match.
            for (int i = 0; i < names.length; i++) {
                String name = names[i];
                if (name.equals("*"))
                    name = ".*";
                if (java.util.regex.Pattern.matches(name, abstractTrace.getSourceClass().getName()))
                    traceLevelToSet = traceLevel;
            } // for names...
            abstractTrace.setLevel(traceLevelToSet);
        } // for ... activeTrace Map.

    }
158590
def autocorrplot(trace, vars=None, fontmap = None, max_lag=100):
    """"""

    try:
        # MultiTrace
        traces = trace.traces

    except AttributeError:

        # NpTrace
        traces = [trace]

    if fontmap is None: fontmap = {1:10, 2:8, 3:6, 4:5, 5:4}

    if vars is None:
        vars = traces[0].varnames

    # Extract sample data
    samples = [{v:trace[v] for v in vars} for trace in traces]

    chains = len(traces)

    n = len(samples[0])
    f, ax = subplots(n, chains, squeeze=False)

    max_lag = min(len(samples[0][vars[0]])-1, max_lag)

    for i, v in enumerate(vars):

        for j in xrange(chains):

            d = np.squeeze(samples[j][v])

            ax[i,j].acorr(d, detrend=mlab.detrend_mean, maxlags=max_lag)

            if not j:
                ax[i, j].set_ylabel("correlation")
            ax[i, j].set_xlabel("lag")

            if chains > 1:
                ax[i, j].set_title("chain {0}".format(j+1))

    # Smaller tick labels
    tlabels = gca().get_xticklabels()
    setp(tlabels, 'fontsize', fontmap[1])

    tlabels = gca().get_yticklabels()
    setp(tlabels, 'fontsize', fontmap[1])
948320
private int getStackOffset(@NonNull StackTraceElement[] trace) {
    checkNotNull(trace);

    for (int i = MIN_STACK_OFFSET; i < trace.length; i++) {
      StackTraceElement e = trace[i];
      String name = e.getClassName();
      if (!name.equals(LoggerPrinter.class.getName()) && !name.equals(Logger.class.getName())) {
        return --i;
      }
    }
    return -1;
  }
1136189
function(){
        while(this.numPairs>0){
            var pair=this.pairs[--this.numPairs];
            pair.shape1=null;
            pair.shape2=null;
        }
        this.numPairChecks=0;
        this.collectPairs();
    }
282425
public static int[] setSteps(Last[][][] traceback, boolean local, int[] xyMax, Last last, List<Step> sx,
			List<Step> sy) {
		int x = xyMax[0], y = xyMax[1];
		boolean linear = (traceback[x][y].length == 1);
		while (local ? (linear ? last : traceback[x][y][last.ordinal()]) != null : x > 0 || y > 0) {
			switch (last) {
			case DELETION:
				sx.add(Step.COMPOUND);
				sy.add(Step.GAP);
				last = linear ? traceback[--x][y][0] : traceback[x--][y][1];
				break;
			case SUBSTITUTION:
				sx.add(Step.COMPOUND);
				sy.add(Step.COMPOUND);
				last = linear ? traceback[--x][--y][0] : traceback[x--][y--][0];
				break;
			case INSERTION:
				sx.add(Step.GAP);
				sy.add(Step.COMPOUND);
				last = linear ? traceback[x][--y][0] : traceback[x][y--][2];
			}
		}
		Collections.reverse(sx);
		Collections.reverse(sy);
		return new int[] {x, y};
	}
892051
def set_trace(frame=None, skip=0, server=None, port=None):
    """"""
    frame = frame or sys._getframe().f_back
    for i in range(skip):
        if not frame.f_back:
            break
        frame = frame.f_back
    wdb = Wdb.get(server=server, port=port)
    wdb.set_trace(frame)
    return wdb
875822
def trace_generator(trace, start=0, stop=None, step=1):
    
    i = start
    stop = stop or np.inf
    size = min(trace.length(), stop)
    while i < size:
        index = slice(i, i + 1)
        yield trace.gettrace(slicing=index)[0]
        i += step
1359435
private void getSubArray(byte[] b, int traceDataOffset) {
		for (int x = 0; x <= b.length - 1; x++) {
			b[x] = traceData[traceDataOffset + x];
		}
	}
182341
def MakeExpandedTrace(frame_records):
  """"""
  dump = []
  for (frame_obj, filename, line_num, fun_name, context_lines,
       context_index) in frame_records:
    dump.append('File "%s", line %d, in %s\n' % (filename, line_num,
                                                 fun_name))
    if context_lines:
      for (i, line) in enumerate(context_lines):
        if i == context_index:
          dump.append(' --> %s' % line)
        else:
          dump.append('     %s' % line)
    for local_name, local_val in frame_obj.f_locals.items():
      try:
        local_type_name = type(local_val).__name__
      except Exception as e:
        local_type_name = '    Exception in type({}).__name__: {}'.format(local_name, e)
      try:
        truncated_val = repr(local_val)[0:500]
      except Exception as e:
        dump.append('    Exception in repr({}): {}\n'.format(local_name, e))
      else:
        if len(truncated_val) >= 500:
          truncated_val = '%s...' % truncated_val[0:499]
        dump.append('    {} = {} ({})\n'.format(local_name, truncated_val, local_type_name))
    dump.append('\n')
  return dump
1248896
function () {
		var series = this,
			graphPath = [],
			segmentPath,
			singlePoints = []; // used in drawTracker

		// Divide into segments and build graph and area paths
		each(series.segments, function (segment) {
			
			segmentPath = series.getSegmentPath(segment);
			
			// add the segment to the graph, or a single point for tracking
			if (segment.length > 1) {
				graphPath = graphPath.concat(segmentPath);
			} else {
				singlePoints.push(segment[0]);
			}
		});

		// Record it for use in drawGraph and drawTracker, and return graphPath
		series.singlePoints = singlePoints;
		series.graphPath = graphPath;
		
		return graphPath;
		
	}
223469
def trace(self):
        """"""
        if self._trace is None:
            self._trace = self.load_trace(self.mname)
        return self._trace
1170671
public static void setupTracingConfig() {
    TracingUtilities.setupTracingConfig();
    List<String> descriptors = Arrays.asList(
      "BigtableTable.getTableDescriptor",
      "BigtableTable.exists",
      "BigtableTable.existsAll",
      "BigtableTable.batch",
      "BigtableTable.batchCallback",
      "BigtableTable.get",
      "BigtableTable.put",
      "BigtableTable.checkAndPut",
      "BigtableTable.delete",
      "BigtableTable.checkAndDelete",
      "BigtableTable.checkAndMutate",
      "BigtableTable.mutateRow",
      "BigtableTable.append",
      "BigtableTable.increment",
      "BigtableTable.incrementColumnValue"
    );

    Tracing.getExportComponent().getSampledSpanStore().registerSpanNamesForCollection(descriptors);
  }
819076
@Override public void showTraces(List<Trace> traces, int removedTraces) {
    if (lastScrollPosition == 0) {
      lastScrollPosition = lv_traces.getFirstVisiblePosition();
    }
    adapter.clear();
    adapter.addAll(traces);
    adapter.notifyDataSetChanged();
    updateScrollPosition(removedTraces);
  }
1033586
function () {
		var series = this;

		// cache attributes for shapes
		//series.getAttribs();

		this.drawPoints();

		// draw the mouse tracking area
		if (series.options.enableMouseTracking !== false) {
			series.drawTracker();
		}
        
        // PATCH by Simon Fishel
        //
        // execute beforeLabelRender hook to allow re-formatting of data labels
        //
        // + if(series.options.hooks && series.options.hooks.beforeLabelRender) {
        // +    series.options.hooks.beforeLabelRender(series)
        // + }
        
        if(series.options.hooks && series.options.hooks.beforeLabelRender) {
            series.options.hooks.beforeLabelRender(series)
        }

		this.drawDataLabels();

		if (series.options.animation && series.animate) {
			series.animate();
		}

		series.isDirty = false; // means data is in accordance with what you see
	}