Helper function to populate the base rate
777906
def get_baserate(self):
        """"""
        rateslist = self.rates['list']['resources']
        for rate in rateslist:
            rateobj = rate['resource']['fields']
            if rateobj['symbol'].partition('=')[0] == rateobj['name']:
                return rateobj['name']
        raise RuntimeError("%s: baserate not found" % self.name)
446413
private static float calcLearningRate(float initLearningRate, int epochs, long totalProcessed, long vocabWordCount) {
    float rate = initLearningRate * (1 - totalProcessed / (float) (epochs * vocabWordCount + 1));
    if (rate < initLearningRate * LEARNING_RATE_MIN_FACTOR) rate = initLearningRate * LEARNING_RATE_MIN_FACTOR;
    return rate;
  }
1136466
def str_rate(self):
        """"""
        # Handle special cases.
        if not self._eta.started or self._eta.stalled or not self.rate:
            return '--- KiB/s'

        unit_rate, unit = UnitByte(self.rate).auto_no_thousands
        if unit_rate >= 10:
            formatter = '%d'
        else:
            formatter = '%0.1f'
        return '{0} {1}/s'.format(locale.format(formatter, unit_rate, grouping=False), unit)
1343938
def _modify_raw_val(val, is_basepairs):
    
    return float(val) * (config.base_count_multiplier if is_basepairs else config.read_count_multiplier)
904440
def compute_amount(self):
        """"""
        self.amount = self.base_amount * self.aliquot / 100
        return self.amount
622801
function populateLabels(axis, config, labelTemplateString, labels, numberOfSteps, graphMin, graphMax, stepValue) {
		var logarithmic;
		if (axis == 2) {
			logarithmic = config.logarithmic2;
			fmtYLabel = config.fmtYLabel2;
		} else {
			logarithmic = config.logarithmic;
			fmtYLabel = config.fmtYLabel;
		}
		if (labelTemplateString) {
			//Fix floating point errors by setting to fixed the on the same decimal as the stepValue.
			if (!logarithmic) { // no logarithmic scale
				for (var i = 0; i < numberOfSteps + 1; i++) {
					labels.push(tmpl(labelTemplateString, {
						value: fmtChartJS(config, 1 * ((graphMin + (stepValue * i)).toFixed(getDecimalPlaces(stepValue))), fmtYLabel)
					}));
				}
			} else { // logarithmic scale 10,100,1000,...
				var value = graphMin;
				for (var i = 0; i < numberOfSteps + 1; i++) {
					labels.push(tmpl(labelTemplateString, {
						value: fmtChartJS(config, 1 * value.toFixed(getDecimalPlaces(value)), fmtYLabel)
					}));
					value *= 10;
				}
			}
		}
	}
554403
def populate(self):
        
        from django.conf import settings
        from django.core import urlresolvers

        self.append(("", ""))
        urlconf = settings.ROOT_URLCONF
        resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
        # Collect base level views
        for key, value in resolver.reverse_dict.items():
            if isinstance(key, basestring):
                args = value[0][0][1]
                url = "/" + value[0][0][0]
                self.append((key, " ".join(key.split("_"))))
        # Collect namespaces (TODO: merge these two sections into one)
        for namespace, url in resolver.namespace_dict.items():
            for key, value in url[1].reverse_dict.items():
                if isinstance(key, basestring):
                    args = value[0][0][1]
                    full_key = '%s:%s' % (namespace, key)
                    self.append((full_key, "%s: %s" % (namespace, " ".join(key.split("_")))))
        self.sort()
1093864
def get_singlerate(self, base, code):
        """"""
        try:
            url = self.onerate_url % (base, code)
            resp = get(url)
            resp.raise_for_status()
        except exceptions.HTTPError as e:
            self.log(logging.ERROR, "%s: problem with %s:\n%s", self.name, url, e)
            return None
        rate = resp.text.rstrip()

        if rate == 'N/A':
            raise RuntimeError("%s: %s not found" % (self.name, code))
        else:
            return Decimal(rate)
678063
private function convert($input) : Rates
    {
        $rates = new Rates();
        $rates->timestamp = time();
        $rates->date = $this->date;
        $rates->base = 'EUR';
        $rates->rates = [];
        $rates->url = $this->url;

        $data = json_decode($input, true);

        if (!empty($data)) {
            if (!empty($data['rates'])) {
                $rates->extra['fixer_date'] = $data['date'] ?? null;
                foreach ($data['rates'] as $key => $row) {
                    $rates->rates[$key] = $row;
                }
                //add 1:1 conversion rate from base for testing
                $rates->rates[$data['base']] = 1;
            }
        }
        else {
            $rates->error = "No data in response from Fixer.io";
        }

        return $rates;
    }
1296150
def calculate_rates(base_currency, counter_currency, forward_rate=None, fwd_points=None, spot_reference=None):
    """"""
    if base_currency not in DIVISOR_TABLE:
        divisor = DIVISOR_TABLE.get(counter_currency, DEFAULT_DIVISOR)
        if forward_rate is None and fwd_points is not None and spot_reference is not None:
            forward_rate = spot_reference + fwd_points / divisor
        elif forward_rate is not None and fwd_points is None and spot_reference is not None:
            fwd_points = (forward_rate - spot_reference) * divisor
        elif forward_rate is not None and fwd_points is not None and spot_reference is None:
            spot_reference = forward_rate - fwd_points / divisor

    rates = {}
    if forward_rate is not None:
        rates['forward_rate'] = forward_rate

    if fwd_points is not None:
        rates['fwd_points'] = fwd_points

    if spot_reference is not None:
        rates['spot_reference'] = spot_reference

    return rates
128703
def create_population(self):
        ""
        base = self._base
        if base._share_inputs:
            used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
            used_inputs_naive = used_inputs_var
        if base._pr_variable == 0:
            used_inputs_var = SelectNumbers([])
            used_inputs_naive = SelectNumbers([x for x in range(base.nvar)])
        elif base._pr_variable == 1:
            used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
            used_inputs_naive = SelectNumbers([])
        else:
            used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
            used_inputs_naive = SelectNumbers([x for x in range(base.nvar)])
        nb_input = Inputs(base, used_inputs_naive, functions=base._input_functions)
        while ((base._all_inputs and not base.stopping_criteria_tl()) or
               (self.popsize < base.popsize and
                not base.stopping_criteria())):
            if base._all_inputs and used_inputs_var.empty() and used_inputs_naive.empty():
                base._init_popsize = self.popsize
                break
            if nb_input.use_all_variables():
                v = nb_input.all_variables()
                if v is None:
                    continue
            elif not used_inputs_var.empty() and np.random.random() < base._pr_variable:
                v = self.variable_input(used_inputs_var)
                if v is None:
                    used_inputs_var.pos = used_inputs_var.size
                    continue
            elif not used_inputs_naive.empty():
                v = nb_input.input()
                if not used_inputs_var.empty() and used_inputs_naive.empty():
                    base._pr_variable = 1
                if v is None:
                    used_inputs_naive.pos = used_inputs_naive.size
                    if not used_inputs_var.empty():
                        base._pr_variable = 1
                    continue
            else:
                gen = self.generation
                self.generation = 0
                v = base.random_offspring()
                self.generation = gen
            self.add(v)
179246
def _populate_inputs(self, total):
        
        total = total + 1
        for input_number in range(1, total):
            self.query('ISN'+str(input_number).zfill(2))
458408
def suggest_accumulation_rate(chron):
    
    # Follow's Bacon's method @ Bacon.R ln 30 - 44
    # Suggested round vals.
    sugg = np.tile([1, 2, 5], (4, 1)) * np.reshape(np.repeat([0.1, 1.0, 10, 100], 3), (4, 3))
    # Get ballpark accumulation rates, uncalibrated dates.
    ballpacc = stats.linregress(x=chron.depth, y=chron.age * 1.1).slope
    ballpacc = np.abs(sugg - ballpacc)
    sugg = sugg.flat[ballpacc.argmin()]  # Suggest rounded acc.rate with lowest abs diff.
    return sugg
480671
def get_rate_for(self, currency: str, to: str, reverse: bool=False) -> Number:
        """"""

        # Return 1 when currencies match
        if currency.upper() == to.upper():
            return self._format_number('1.0')

        # Set base and quote currencies
        base, quote = currency, to
        if reverse:
            base, quote = to, currency

        try:  # Get rate from source
            rate = self._get_rate(base, quote)
        except Exception as e:
            raise ConverterRateError(self.name) from e

        # Convert rate to number
        rate = self._format_number(rate)

        try:  # Validate rate value
            assert isinstance(rate, (float, Decimal))
            assert rate > 0
        except AssertionError as e:
            raise ConverterValidationError(self.name, rate) from e

        # Return market rate
        if reverse:
            return self._format_number('1.0') / rate
        return rate
307583
def populate(amount, options = {}, &block)
      self.class.remember_depth do
        build_records(Populator.interpret_value(amount), options[:per_query] || DEFAULT_RECORDS_PER_QUERY, &block)
      end
    end
532790
def transformer_base_range(rhp):
  """"""
  # After starting from base, set intervals for some parameters.
  rhp.set_float("learning_rate", 0.3, 3.0, scale=rhp.LOG_SCALE)
  rhp.set_discrete("learning_rate_warmup_steps",
                   [1000, 2000, 4000, 8000, 16000])
  rhp.set_float("initializer_gain", 0.5, 2.0)
  rhp.set_float("optimizer_adam_beta1", 0.85, 0.95)
  rhp.set_float("optimizer_adam_beta2", 0.97, 0.99)
  rhp.set_float("weight_decay", 0.0, 1e-4)
603103
def convert_currency(self, base_fiat, base_amount, target_fiat):
        
        url = "http://api.fixer.io/latest?base=%s" % base_fiat
        data = self.get_url(url).json()
        try:
            return data['rates'][target_fiat.upper()] * base_amount
        except KeyError:
            raise Exception("Can not convert %s to %s" % (base_fiat, target_fiat))