isCountRate: Method or IRInputObject used to indicate if the
        science data is in units of counts or count rate.  This method
        assumes that the keyword 'BUNIT' is in the header of the input
        FITS file.
546079
def isCountRate(self):
        
        has_bunit = False
        if 'BUNIT' in self._image['sci',1].header :
            has_bunit = True

        countrate = False
        if (self._image[0].header['UNITCORR'].strip() == 'PERFORM') or \
            (has_bunit and self._image['sci',1].header['bunit'].find('/') != -1) :
            countrate = True

        return countrate
683035
public void stats(String name, float value) {
		for (ICounters counter : _counters)
			counter.stats(name, value);
	}

	/**
	 * Records the last calculated measurement value.
	 * 
	 * Usually this method is used by metrics calculated externally.
	 * 
	 * @param name  a counter name of Last type.
	 * @param value a last value to record.
	 */
	public void last(String name, float value) {
		for (ICounters counter : _counters)
			counter.last(name, value);
	}

	/**
	 * Records the current time as a timestamp.
	 * 
	 * @param name a counter name of Timestamp type.
	 */
	public void timestampNow(String name) {
		timestamp(name, ZonedDateTime.now());
	}

	/**
	 * Records the given timestamp.
	 * 
	 * @param name  a counter name of Timestamp type.
	 * @param value a timestamp to record.
	 */
	public void timestamp(String name, ZonedDateTime value) {
		for (ICounters counter : _counters)
			counter.timestamp(name, value);
	}

	/**
	 * Increments counter by 1.
	 * 
	 * @param name a counter name of Increment type.
	 */
	public void incrementOne(String name) {
		increment(name, 1);
	}

	/**
	 * Increments counter by given value.
	 * 
	 * @param name  a counter name of Increment type.
	 * @param value a value to add to the counter.
	 */
	public void increment(String name, int value) {
		for (ICounters counter : _counters)
			counter.increment(name, value);
	}

}
136610
def init_counts(self, counts_len):
        '''
        '''
        assert self._data and counts_len and self.counts_len == 0
        self.counts_len = counts_len
        self._init_counts()

        results = decode(self._data, payload_header_size, addressof(self.counts),
                         counts_len, self.word_size)
        # no longer needed
        self._data = None
        return results
410864
private final void init(int nbuckets, int initBucketSize) {
    buckets = new Element[nbuckets][];
    counts = new int[nbuckets];
    this.initBucketSize = initBucketSize;
  }
623452
int countTag(long i1, long i2, long tag) {
		int tagCount = 0;
		for (int posInBucket = 0; posInBucket < CuckooFilter.BUCKET_SIZE; posInBucket++) {
			if (checkTag(i1, posInBucket, tag))
				tagCount++;
			if (checkTag(i2, posInBucket, tag))
				tagCount++;
		}
		return tagCount;
	}
1331065
def _checkObjectToInfer(self, sensationList):
    
    for sensations in sensationList:
      if set(sensations.keys()) != set(range(self.numColumns)):
        raise ValueError(
          "Invalid number of cortical column sensations sent to experiment"
        )
      for pair in sensations.values():
        if not isinstance(pair, tuple) or len(pair) != 2 or \
                not isinstance(pair[0], set) or \
                not isinstance(pair[1], set):
          raise ValueError("Invalid SDR's sent to experiment")
96142
function (partStatistics) {
        this.count += partStatistics.count;
        this.tested += partStatistics.tested;
        this.ignored += partStatistics.ignored;
    }
848134
def count_features_type(features):
        
    counter={k.name: v for k, v in features.columns.to_series().groupby(features.dtypes)}
    binary=0
    if ('int64' in counter):
        binary=len(set(features.loc[:, (features<=1).all(axis=0)].columns.values) 
                & set(features.loc[:, (features>=0).all(axis=0)].columns.values) 
                & set(counter['int64']))    
    return (binary,len(counter['int64'])-binary if 'int64' in counter else 0,len(counter['float64']) if 'float64' in counter else 0)
111336
public boolean checkBestAttrib(double n,
			AutoExpandVector<AttributeClassObserver> observerss, DoubleVector observedClassDistribution){
		double h0 = entropy(observedClassDistribution);
		boolean  isTheBest = false;
		double[] entropyValues = getBestSecondBestEntropy(this.saveBestGlobalEntropy);
		double bestEntropy = entropyValues[0];
		double secondBestEntropy = entropyValues[1];
	    double range = Utils.log2(this.numClass);
		double hoeffdingBound = ComputeHoeffdingBound(range, this.splitConfidenceOption.getValue(), n);
		if ((h0 > bestEntropy) && ((secondBestEntropy - bestEntropy > hoeffdingBound)
				|| (hoeffdingBound < this.tieThresholdOption.getValue()))) {
			for (int i = 0; i < this.saveBestValGlobalEntropy.size(); i++) {
				if (bestEntropy ==(this.saveBestValGlobalEntropy.get(i).get(1))) {
					this.saveTheBest.add(this.saveBestValGlobalEntropy.get(i).get(0)); 
					this.saveTheBest.add(this.saveBestValGlobalEntropy.get(i).get(1));
					this.saveTheBest.add(this.saveBestValGlobalEntropy.get(i).get(2)); 
					this.saveTheBest.add((double)i);
					if (this.saveTheBest.get(2) != 0.0) {
						this.saveTheBest.add(this.saveBestValGlobalEntropy.get(i).get(3)); 
						}
					break;
					}
				}
			isTheBest = true;
			} else {
				isTheBest = false;
				}
		return isTheBest;
		}
192180
def count(self, value):
        

        if value is not None:
            assert type(value) is int, "'{0}' attribute: '{1}' type is not 'int'!".format(
                "count", value)
            assert value > 0, "'{0}' attribute: '{1}' need to be exactly positive!".format("count", value)
        self.__count = value
36288
public void setBitCount(int count) {
        bitCount = count;
        discretes = new BitVector(count);
        //set correct length, without counting unitid and fc
        setDataLength(discretes.byteSize() + 1);
    }
1028098
@VisibleForTesting
  void countersToMetrics(GobblinMetrics metrics) throws IOException {
    Optional<Counters> counters = Optional.fromNullable(this.job.getCounters());

    if (counters.isPresent()) {
      // Write job-level counters
      CounterGroup jobCounterGroup = counters.get().getGroup(MetricGroup.JOB.name());
      for (Counter jobCounter : jobCounterGroup) {
        metrics.getCounter(jobCounter.getName()).inc(jobCounter.getValue());
      }

      // Write task-level counters
      CounterGroup taskCounterGroup = counters.get().getGroup(MetricGroup.TASK.name());
      for (Counter taskCounter : taskCounterGroup) {
        metrics.getCounter(taskCounter.getName()).inc(taskCounter.getValue());
      }
    }
  }
1161268
def h(count=0, **kwargs):
    '''
    
    '''
    with Reflect.context(**kwargs) as r:
        kwargs["count"] = count
        instance = H_CLASS(r, stream, **kwargs)
        instance()
1357861
def _int_check(self, attribute_array, value, irow, key):
        ''''''
        value = value.strip(' ')
        try:
            if value:
                attribute_array = np.hstack([attribute_array, int(value)])
            else:
                attribute_array = np.hstack([attribute_array, np.nan])
        except:
            msg = 'Input file format error at line: %d' % (irow + 2)
            msg += ' key: %s' % (key)
            raise ValueError(msg)
        return attribute_array
342786
def setup_multiifo_interval_coinc_inj(workflow, hdfbank, full_data_trig_files, inj_trig_files,
                                      stat_files, background_file, veto_file, veto_name,
                                      out_dir, pivot_ifo, fixed_ifo, tags=None):
    
    if tags is None:
        tags = []
    make_analysis_dir(out_dir)
    logging.info('Setting up coincidence for injections')

    if len(hdfbank) != 1:
        raise ValueError('Must use exactly 1 bank file for this coincidence '
                         'method, I got %i !' % len(hdfbank))
    hdfbank = hdfbank[0]

    # Wall time knob and memory knob
    factor = int(workflow.cp.get_opt_tags('workflow-coincidence', 'parallelization-factor', tags))

    ffiles = {}
    ifiles = {}
    for ifo, ffi in zip(*full_data_trig_files.categorize_by_attr('ifo')):
        ffiles[ifo] = ffi[0]
    for ifo, ifi in zip(*inj_trig_files.categorize_by_attr('ifo')):
        ifiles[ifo] = ifi[0]

    injinj_files = FileList()
    injfull_files = FileList()
    fullinj_files = FileList()
    # For the injfull and fullinj separation we take the pivot_ifo on one side,
    # and the rest that are attached to the fixed_ifo on the other side
    for ifo in ifiles:  # ifiles is keyed on ifo
        if ifo == pivot_ifo:
            injinj_files.append(ifiles[ifo])
            injfull_files.append(ifiles[ifo])
            fullinj_files.append(ffiles[ifo])
        else:
            injinj_files.append(ifiles[ifo])
            injfull_files.append(ffiles[ifo])
            fullinj_files.append(ifiles[ifo])

    combo = [(injinj_files, "injinj"),
             (injfull_files, "injfull"),
             (fullinj_files, "fullinj"),
            ]
    bg_files = {'injinj':[], 'injfull':[], 'fullinj':[]}

    for trig_files, ctag in combo:
        findcoinc_exe = PyCBCFindMultiifoCoincExecutable(workflow.cp,
                                                         'multiifo_coinc',
                                                         ifos=ifiles.keys(),
                                                         tags=tags + [ctag],
                                                         out_dir=out_dir)
        for i in range(factor):
            group_str = '%s/%s' % (i, factor)
            coinc_node = findcoinc_exe.create_node(trig_files, hdfbank,
                                                   stat_files,
                                                   veto_file, veto_name,
                                                   group_str,
                                                   pivot_ifo,
                                                   fixed_ifo,
                                                   tags=[veto_name, str(i)])

            bg_files[ctag] += coinc_node.output_files
            workflow.add_node(coinc_node)

    logging.info('...leaving coincidence for injections')

    return setup_multiifo_statmap_inj(workflow, ifiles.keys(), bg_files, background_file, out_dir, tags=tags + [veto_name])
965021
@Deprecated
  public Counter<L> scoresOf(RVFDatum<L, F> example) {
    Counter<L> scores = new ClassicCounter<L>();
    for (L l : labels()) {
      scores.setCount(l, scoreOf(example, l));
    }
    //System.out.println("Scores are: " + scores + "   (gold: " + example.label() + ")");
    return scores;
  }
628914
private Metric collectCounter(String dropwizardName, Counter counter) {
    String metricName = DropWizardUtils.generateFullMetricName(dropwizardName, "counter");
    String metricDescription =
        DropWizardUtils.generateFullMetricDescription(dropwizardName, counter);

    MetricDescriptor metricDescriptor =
        MetricDescriptor.create(
            metricName,
            metricDescription,
            DEFAULT_UNIT,
            Type.GAUGE_INT64,
            Collections.<LabelKey>emptyList());
    TimeSeries timeSeries =
        TimeSeries.createWithOnePoint(
            Collections.<LabelValue>emptyList(),
            Point.create(Value.longValue(counter.getCount()), clock.now()),
            null);
    return Metric.createWithOneTimeSeries(metricDescriptor, timeSeries);
  }