Returns the frequency statistics for this CPU;
the returned object contains the frequencies as keys,
and the duration at this frequency in milliseconds as the value,
for the range that was specified.
186614
function(range) {
      var stats = {};

      function addStatsForFreq(freqSample, index) {
        // Counters don't have an explicit end or duration;
        // calculate the end by looking at the starting point
        // of the next value in the series, or if that doesn't
        // exist, assume this frequency is held until the end.
        var freqEnd = (index < freqSample.series_.length - 1) ?
            freqSample.series_.samples_[index + 1].timestamp : range.max;

        var freqRange = tr.b.Range.fromExplicitRange(freqSample.timestamp,
            freqEnd);
        var intersection = freqRange.findIntersection(range);
        if (!(freqSample.value in stats))
          stats[freqSample.value] = 0;
        stats[freqSample.value] += intersection.duration;
      }

      var freqCounter = this.getCounter('', 'Clock Frequency');
      if (freqCounter !== undefined) {
        var freqSeries = freqCounter.getSeries(0);
        if (!freqSeries)
          return;

        tr.b.iterateOverIntersectingIntervals(freqSeries.samples_,
            function(x) { return x.timestamp; },
            function(x, index) { return index < freqSeries.length - 1 ?
                                     freqSeries.samples_[index + 1].timestamp :
                                     range.max; },
            range.min,
            range.max,
            addStatsForFreq);
      }

      return stats;
    }
1305665
def timefreq(x,fs=200):
    
    from numpy import size, shape, arange, append
    
    maxfreq=float(fs)/2.0 # Maximum frequency
    minfreq=float(fs)/float(size(x,0)) # Minimum and delta frequency -- simply the inverse of the length of the recording in seconds
    F=arange(minfreq,maxfreq+minfreq,minfreq) # Create frequencies evenly spaced from 0:minfreq:maxfreq
    F=append(0,F) # Add zero-frequency component
    
    return F
974201
def frequency_bins(header):
  '''
   
  '''

  center_frequency = 1.0e6*header['rf_center_frequency']
  if header["number_of_subbands"] > 1:
    center_frequency += header["subband_spacing_hz"]*(header["number_of_subbands"]/2.0 - 0.5)

  return np.fft.fftshift(\
    np.fft.fftfreq( int(header["number_of_subbands"] * constants.bins_per_half_frame*(1.0 - header['over_sampling'])), \
      1.0/(header["number_of_subbands"]*header["subband_spacing_hz"])) + center_frequency
    )
1058674
def frequencies_iter(self):
        
        df = self.to_dataframe()
        n = float(len(self))
        for var, sign in it.product(df.columns, [-1, 1]):
            f = len(df[df[var] == sign]) / n
            if f > 0:
                yield Literal(var, sign), f
800107
def _read_truth_freqs(in_file):
    
    out = {}
    with VariantFile(in_file) as bcf_in:
        for rec in bcf_in:
            freq = float(rec.info.get("VAF", 1.0))
            out[_get_key(rec)] = freq
    return out
855530
def values(self):
        
        if self.ui.hzBtn.isChecked():
            fscale = SmartSpinBox.Hz
        else:
            fscale = SmartSpinBox.kHz

        if self.ui.msBtn.isChecked():
            tscale = SmartSpinBox.MilliSeconds
        else:
            tscale = SmartSpinBox.Seconds

        return fscale, tscale
810956
def get_statistics(self):
        
        return {
            'cumulative_elapsed_time': self.get_cumulative_elapsed_time(),
            'percentage': self.get_percentage(),
            'n_splits': self.get_n_splits(),
            'mean_per_split': self.get_mean_per_split(),
        }
1222327
def rc_stats(stats):
    
    rc_nucs = {'A':'T', 'T':'A', 'G':'C', 'C':'G', 'N':'N'}
    rcs = []
    for pos in reversed(stats):
        rc = {}
        rc['reference frequencey'] = pos['reference frequency']
        rc['consensus frequencey'] = pos['consensus frequency']
        rc['In'] = pos['In']
        rc['Del'] = pos['Del']
        rc['ref'] = rc_nucs[pos['ref']]
        rc['consensus'] = (rc_nucs[pos['consensus'][0]], pos['consensus'][1])
        for base, stat in list(pos.items()):
            if base in rc_nucs:
                rc[rc_nucs[base]] = stat
        rcs.append(rc)
    return rcs
62486
def get_phonon_frequencies(self):
        """"""
        # TODO: the following is most likely not correct or suboptimal
        # hence for demonstration purposes only
        frequencies = []
        for k, v0 in self.data.iteritems():
            for v1 in v0.itervalues():
                vec = map(abs, v1['dynmat'][k - 1])
                frequency = math.sqrt(sum(vec)) * 2. * \
                            math.pi * 15.633302  # THz
                frequencies.append(frequency)
        return frequencies
1229535
public int getMaximalFrequency()
    {
        int maxfreq = 0;
        for (Map.Entry<T, Integer> entry : styles.entrySet())
        {
            if (entry.getValue() > maxfreq)
                maxfreq = entry.getValue();
        }
        return maxfreq;
    }
154956
def frequency

      return brute_frequency unless @seconds && @seconds.length > 1

      delta = 60
      prev = @seconds[0]

      @seconds[1..-1].each do |sec|
        d = sec - prev
        delta = d if d < delta
      end

      delta
    end
583871
def get_cpu_timings(self):
        
        timings = {}
        with open('/proc/stat', 'r') as file_obj:
            for line in file_obj:
                if 'cpu' in line:
                    line = line.strip().split()
                    timings[line[0]] = [int(x) for x in line[1:]]

        return timings
694568
def lm_ffinal(freqs, damping_times, modes):
    

    f_max = {}
    for lmn in modes:
        l, m, nmodes = int(lmn[0]), int(lmn[1]), int(lmn[2])
        for n in range(nmodes):
            f_max['%d%d%d' %(l,m,n)] = qnm_freq_decay(freqs['%d%d%d' %(l,m,n)],
                                      damping_times['%d%d%d' %(l,m,n)], 1./1000)

    f_final = max(f_max.values())
    if f_final > max_freq:
        f_final = max_freq

    return f_final
232615
function getStats() {
  var procMem = process.memoryUsage();
  var stats = {
    mem: {
      total: os.totalmem(),
      free: os.freemem(),
      heap: procMem.rss
    },
    cpu: os.loadavg()
  };
  for(var i=0; i < stats.cpu.length; i++) {
    stats.cpu[i] = stats.cpu[i].toFixed(3);
  }
  stats.cpu = stats.cpu.join(",");
  // We convert from bytes to mb
  stats.mem.total = Math.ceil(stats.mem.total / 1000000) + "MB";
  stats.mem.free = Math.ceil(stats.mem.free / 1000000) + "MB";
  stats.mem.heap = (stats.mem.heap / 1000000).toFixed(3) + "MB";
  return stats;
}
265785
def frequency(self, context):
        
        channels = self._manager.spectral_window_table.getcol(MS.CHAN_FREQ)
        return channels.reshape(context.shape).astype(context.dtype)
830472
public T getMostFrequent()
    {
        T ret = null;
        int freq = 0;
        for (Map.Entry<T, Integer> entry : styles.entrySet())
        {
            if (entry.getValue() > freq)
            {
                ret = entry.getKey();
                freq = entry.getValue();
            }
        }
        return ret;
    }
1028611
def get_data_indices(self):
        
        return numpy.round(self._get_indices() + 1 +
                           self.frequency * self.duration).astype(int)