This is used internally for :ref:`pysynphot-formula-effstim`
        calculations.
199002
def unitResponse(self,band):
        """"""
        #sumfilt(wave,1,band)
        # SUMFILT = Sum [ FILT(I) * WAVE(I) ** NPOW * DWAVE(I) ]
        wave=band.wave
        total = band.trapezoidIntegration(wave,band.throughput*wave)
        modtot = total/(H*C)
        return 2.5*math.log10(modtot) + STZERO
940048
private void calculate() {
        if (niceScale) {
            this.niceRange = calcNiceNumber(maxValue - minValue, false);
            this.majorTickSpacing = calcNiceNumber(niceRange / (maxNoOfMajorTicks - 1), true);
            this.niceMinValue = Math.floor(minValue / majorTickSpacing) * majorTickSpacing;
            this.niceMaxValue = Math.ceil(maxValue / majorTickSpacing) * majorTickSpacing;
            this.minorTickSpacing = calcNiceNumber(majorTickSpacing / (maxNoOfMinorTicks - 1), true);
            this.range = niceMaxValue - niceMinValue;
        } else {
            this.niceRange = (maxValue - minValue);
            this.niceMinValue = minValue;
            this.niceMaxValue = maxValue;
            this.range = this.niceRange;
        }
    }
1004158
def _add_numeric_operations(cls):
        

        axis_descr, name, name2 = _doc_parms(cls)

        cls.any = _make_logical_function(
            cls, 'any', name, name2, axis_descr, _any_desc, nanops.nanany,
            _any_see_also, _any_examples, empty_value=False)
        cls.all = _make_logical_function(
            cls, 'all', name, name2, axis_descr, _all_desc, nanops.nanall,
            _all_see_also, _all_examples, empty_value=True)

        @Substitution(desc="Return the mean absolute deviation of the values "
                           "for the requested axis.",
                      name1=name, name2=name2, axis_descr=axis_descr,
                      min_count='', see_also='', examples='')
        @Appender(_num_doc)
        def mad(self, axis=None, skipna=None, level=None):
            if skipna is None:
                skipna = True
            if axis is None:
                axis = self._stat_axis_number
            if level is not None:
                return self._agg_by_level('mad', axis=axis, level=level,
                                          skipna=skipna)

            data = self._get_numeric_data()
            if axis == 0:
                demeaned = data - data.mean(axis=0)
            else:
                demeaned = data.sub(data.mean(axis=1), axis=0)
            return np.abs(demeaned).mean(axis=axis, skipna=skipna)

        cls.mad = mad

        cls.sem = _make_stat_function_ddof(
            cls, 'sem', name, name2, axis_descr,
            "Return unbiased standard error of the mean over requested "
            "axis.\n\nNormalized by N-1 by default. This can be changed "
            "using the ddof argument",
            nanops.nansem)
        cls.var = _make_stat_function_ddof(
            cls, 'var', name, name2, axis_descr,
            "Return unbiased variance over requested axis.\n\nNormalized by "
            "N-1 by default. This can be changed using the ddof argument",
            nanops.nanvar)
        cls.std = _make_stat_function_ddof(
            cls, 'std', name, name2, axis_descr,
            "Return sample standard deviation over requested axis."
            "\n\nNormalized by N-1 by default. This can be changed using the "
            "ddof argument",
            nanops.nanstd)

        @Substitution(desc="Return the compound percentage of the values for "
                      "the requested axis.", name1=name, name2=name2,
                      axis_descr=axis_descr,
                      min_count='', see_also='', examples='')
        @Appender(_num_doc)
        def compound(self, axis=None, skipna=None, level=None):
            if skipna is None:
                skipna = True
            return (1 + self).prod(axis=axis, skipna=skipna, level=level) - 1

        cls.compound = compound

        cls.cummin = _make_cum_function(
            cls, 'cummin', name, name2, axis_descr, "minimum",
            lambda y, axis: np.minimum.accumulate(y, axis), "min",
            np.inf, np.nan, _cummin_examples)
        cls.cumsum = _make_cum_function(
            cls, 'cumsum', name, name2, axis_descr, "sum",
            lambda y, axis: y.cumsum(axis), "sum", 0.,
            np.nan, _cumsum_examples)
        cls.cumprod = _make_cum_function(
            cls, 'cumprod', name, name2, axis_descr, "product",
            lambda y, axis: y.cumprod(axis), "prod", 1.,
            np.nan, _cumprod_examples)
        cls.cummax = _make_cum_function(
            cls, 'cummax', name, name2, axis_descr, "maximum",
            lambda y, axis: np.maximum.accumulate(y, axis), "max",
            -np.inf, np.nan, _cummax_examples)

        cls.sum = _make_min_count_stat_function(
            cls, 'sum', name, name2, axis_descr,
            """Return the sum of the values for the requested axis.\n
            This is equivalent to the method ``numpy.sum``.""",
            nanops.nansum, _stat_func_see_also, _sum_examples)
        cls.mean = _make_stat_function(
            cls, 'mean', name, name2, axis_descr,
            'Return the mean of the values for the requested axis.',
            nanops.nanmean)
        cls.skew = _make_stat_function(
            cls, 'skew', name, name2, axis_descr,
            'Return unbiased skew over requested axis\nNormalized by N-1.',
            nanops.nanskew)
        cls.kurt = _make_stat_function(
            cls, 'kurt', name, name2, axis_descr,
            "Return unbiased kurtosis over requested axis using Fisher's "
            "definition of\nkurtosis (kurtosis of normal == 0.0). Normalized "
            "by N-1.",
            nanops.nankurt)
        cls.kurtosis = cls.kurt
        cls.prod = _make_min_count_stat_function(
            cls, 'prod', name, name2, axis_descr,
            'Return the product of the values for the requested axis.',
            nanops.nanprod, examples=_prod_examples)
        cls.product = cls.prod
        cls.median = _make_stat_function(
            cls, 'median', name, name2, axis_descr,
            'Return the median of the values for the requested axis.',
            nanops.nanmedian)
        cls.max = _make_stat_function(
            cls, 'max', name, name2, axis_descr,
            """Return the maximum of the values for the requested axis.\n
            If you want the *index* of the maximum, use ``idxmax``. This is
            the equivalent of the ``numpy.ndarray`` method ``argmax``.""",
            nanops.nanmax, _stat_func_see_also, _max_examples)
        cls.min = _make_stat_function(
            cls, 'min', name, name2, axis_descr,
            """Return the minimum of the values for the requested axis.\n
            If you want the *index* of the minimum, use ``idxmin``. This is
            the equivalent of the ``numpy.ndarray`` method ``argmin``.""",
            nanops.nanmin, _stat_func_see_also, _min_examples)
565849
private void calcAutoWidth(int i) {

        int w = 10;

        w = Math.max(w, fMetrics.stringWidth(sColHead[i]));

        for (int j = 0; j < iRowCount; j++) {
            String[] s = (String[]) (vData.elementAt(j));

            w = Math.max(w, fMetrics.stringWidth(s[i]));
        }

        iColWidth[i] = w + 6;
    }
557112
def function_application(func):
    
    if func not in NUMEXPR_MATH_FUNCS:
        raise ValueError("Unsupported mathematical function '%s'" % func)

    @with_doc(func)
    @with_name(func)
    def mathfunc(self):
        if isinstance(self, NumericalExpression):
            return NumExprFactor(
                "{func}({expr})".format(func=func, expr=self._expr),
                self.inputs,
                dtype=float64_dtype,
            )
        else:
            return NumExprFactor(
                "{func}(x_0)".format(func=func),
                (self,),
                dtype=float64_dtype,
            )
    return mathfunc
1304890
def main():
    
    t, kf, t0, major, minor, prod, beta = sympy.symbols(
        't k_f t0 Y Z X beta', negative=False)
    for f in funcs:
        args = [t, kf, prod, major, minor]
        if f in (pseudo_rev, binary_rev):
            args.insert(2, kf/beta)
        expr = f(*args, backend='sympy')
        with open(f.__name__ + '.png', 'wb') as ofh:
            sympy.printing.preview(expr, output='png', filename='out.png',
                                   viewer='BytesIO', outputbuffer=ofh)
        with open(f.__name__ + '_diff.png', 'wb') as ofh:
            sympy.printing.preview(expr.diff(t).subs({t0: 0}).simplify(),
                                   output='png', filename='out.png',
                                   viewer='BytesIO', outputbuffer=ofh)
703224
def _sumSeries(a: float, b: float, steps: int) -> float:
        
        return a * (exp(b * steps) - 1) / (exp(b) - 1)
166331
private void precompute() {
        sinTheta = Math.sin(theta);
        cosTheta = Math.cos(theta);
        sinPhi = Math.sin(phi);
        cosPhi = Math.cos(phi);
    }
791755
def _paramf(ins):
    
    output = _float_oper(ins.quad[1])
    output.extend(_fpush())
    return output
423619
def y_values_ref(self, series):
        
        top_row = self.series_table_row_offset(series) + 2
        bottom_row = top_row + len(series) - 1
        return "Sheet1!$B$%d:$B$%d" % (top_row, bottom_row)
82264
int getRowByY(int y) {
        checkForInit();
        int sum = 0;
        // header offset
        int tempY = y - mHeaderColumnHeight;
        if (tempY <= sum) {
            return 0;
        }
        for (int count = mRowHeights.length, i = 0; i < count; i++) {
            int nextSum = sum + mRowHeights[i];

            if (tempY > sum && tempY < nextSum) {
                return i;
            } else if (tempY < nextSum) {
                return i - 1;
            }
            sum = nextSum;
        }
        return mRowHeights.length - 1;
    }
437619
def adjust_internal_tacking_values(self,
                                       min_non_zero_index,
                                       max_index,
                                       total_added):
        '''
        '''
        if max_index >= 0:
            max_value = self.get_highest_equivalent_value(self.get_value_from_index(max_index))
            self.max_value = max(self.max_value, max_value)
        if min_non_zero_index >= 0:
            min_value = self.get_value_from_index(min_non_zero_index)
            self.min_value = min(self.min_value, min_value)
        self.total_count += total_added
922425
private void calculateOutside(int spanStart, int spanEnd, CfgParseChart chart, double[] newValues) {
    Factor parentOutside = chart.getOutsideEntries(spanStart, spanEnd);
    Tensor parentWeights = parentOutside.coerceToDiscrete().getWeights();

    Tensor binaryDistributionWeights = binaryDistribution.coerceToDiscrete().getWeights();
    int parentIndex = Ints.indexOf(binaryDistributionWeights.getDimensionNumbers(), parentVar.getOnlyVariableNum());
    int leftIndex = Ints.indexOf(binaryDistributionWeights.getDimensionNumbers(), leftVar.getOnlyVariableNum());
    int rightIndex = Ints.indexOf(binaryDistributionWeights.getDimensionNumbers(), rightVar.getOnlyVariableNum());

    int length = newValues.length;
    double[] binaryDistributionValues = binaryDistributionWeights.getValues();
    for (int i = 0; i < spanEnd - spanStart; i++) {
      double[] leftInside = chart.getInsideEntriesArray(spanStart, spanStart + i);
      double[] rightInside = chart.getInsideEntriesArray(spanStart + i + 1, spanEnd);

      for (int j = 0; j < length; j++) {
        newValues[j] = binaryDistributionValues[j] * parentWeights.get(binaryDistributionWeights.indexToPartialDimKey(j, parentIndex));
        newValues[j] *= rightInside[binaryDistributionWeights.indexToPartialDimKey(j, rightIndex)];
      }
      chart.updateOutsideEntry(spanStart, spanStart + i, newValues, binaryDistribution, leftVar);
      
      for (int j = 0; j < length; j++) {
        newValues[j] *= leftInside[binaryDistributionWeights.indexToPartialDimKey(j, leftIndex)];
      }
      chart.updateBinaryRuleExpectations(newValues);

      for (int j = 0; j < length; j++) {
        if (newValues[j] != 0.0) {
          newValues[j] = newValues[j] / rightInside[binaryDistributionWeights.indexToPartialDimKey(j, rightIndex)];
        }
      }
      chart.updateOutsideEntry(spanStart + i + 1, spanEnd, newValues, binaryDistribution, rightVar);
    }
  }
1097008
def _ttm_me_compute(self, V, edims, sdims, transp):
        
        shapeY = np.copy(self.shape)

        # Determine size of Y
        for n in np.union1d(edims, sdims):
            shapeY[n] = V[n].shape[1] if transp else V[n].shape[0]

        # Allocate Y (final result) and v (vectors for elementwise computations)
        Y = zeros(shapeY)
        shapeY = array(shapeY)
        v = [None for _ in range(len(edims))]

        for i in range(np.prod(shapeY[edims])):
            rsubs = unravel_index(shapeY[edims], i)
886541
def metric_calculator(tpf, fpf, P, N, metric_list, anal=True):
    

    metrics = {}

    # build dictionary to store performance metrics
    for vs_metric in [float(x) for x in metric_list if '.' in x]:
        if N >= 1 / vs_metric:
            # enrichment factor (ef) dictionary {#_of_req_decoys : [FPF,EF]}
            metrics[round(vs_metric * N)] = [vs_metric, 0]

    # non enrichment factor dictionary {'name' : ['name',value]}
    for vs_metric in [x for x in metric_list if '.' not in x]:
        metrics[vs_metric] = [vs_metric, 0, 0, 0]

    # calculate enrichment factors & auc
    metrics['AUC'][1] = 0

    for index in range(len(tpf)):
        # calculate and assign enrichment factors
        if N * fpf[index] in metrics.keys() and N * fpf[index] > 0:
            ef = tpf[index] / fpf[index]
            metrics[N * fpf[index]][1] = ef

        # calculate auc
        if fpf[index] != fpf[index - 1]:
            metrics['AUC'][1] = tpf[index] + metrics['AUC'][1]

    metrics['AUC'][1] = metrics['AUC'][1] / N

    # reshape metrics dictionary, discarding the #_of_req_decoys, i.e: {'fpf',[value,low,high]}
    reshaped = {}
    for k,v in metrics.iteritems():
            if type(v) is float or type(v) is int:
                reshaped[k] = v
            else:
                reshaped[v[0]] = v[1:]

    return reshaped
809123
def computeA(self, j, timeSeries):
        
        seasonLength = self.get_parameter("seasonLength")
        A_j = 0
        for i in range(seasonLength):
            A_j += timeSeries[(seasonLength * (j)) + i][1]
        return A_j / seasonLength
1143423
private void _nonsymetricOrthes ()
  {
    // This is derived from the Algol procedures orthes and ortran,
    // by Martin and Wilkinson, Handbook for Auto. Comp.,
    // Vol.ii-Linear Algebra, and the corresponding
    // Fortran subroutines in EISPACK.

    final int low = 0;
    final int high = m_nDim - 1;

    for (int m = low + 1; m <= high - 1; m++)
    {
      // Scale column.
      double scale = 0.0;
      for (int i = m; i <= high; i++)
        scale += MathHelper.abs (m_aHessenBerg[i][m - 1]);
      if (scale != 0.0)
      {
        // Compute Householder transformation.
        double h = 0.0;
        for (int i = high; i >= m; i--)
        {
          m_aOrt[i] = m_aHessenBerg[i][m - 1] / scale;
          h += m_aOrt[i] * m_aOrt[i];
        }
        double g = Math.sqrt (h);
        if (m_aOrt[m] > 0)
        {
          g = -g;
        }
        h -= m_aOrt[m] * g;
        m_aOrt[m] = m_aOrt[m] - g;

        // Apply Householder similarity transformation
        // H = (I-u*u'/h)*H*(I-u*u')/h)

        for (int j = m; j < m_nDim; j++)
        {
          double f = 0.0;
          for (int i = high; i >= m; i--)
          {
            f += m_aOrt[i] * m_aHessenBerg[i][j];
          }
          f /= h;
          for (int i = m; i <= high; i++)
          {
            m_aHessenBerg[i][j] -= f * m_aOrt[i];
          }
        }

        for (int i = 0; i <= high; i++)
        {
          double f = 0.0;
          for (int j = high; j >= m; j--)
          {
            f += m_aOrt[j] * m_aHessenBerg[i][j];
          }
          f /= h;
          for (int j = m; j <= high; j++)
          {
            m_aHessenBerg[i][j] -= f * m_aOrt[j];
          }
        }
        m_aOrt[m] = scale * m_aOrt[m];
        m_aHessenBerg[m][m - 1] = scale * g;
      }
    }

    // Accumulate transformations (Algol's ortran).
    for (int i = 0; i < m_nDim; i++)
    {
      final double [] aRow = m_aEigenVector[i];
      for (int j = 0; j < m_nDim; j++)
      {
        aRow[j] = (i == j ? 1d : 0d);
      }
    }

    for (int m = high - 1; m >= low + 1; m--)
    {
      if (m_aHessenBerg[m][m - 1] != 0.0)
      {
        for (int i = m + 1; i <= high; i++)
        {
          m_aOrt[i] = m_aHessenBerg[i][m - 1];
        }
        for (int j = m; j <= high; j++)
        {
          double g = 0.0;
          for (int i = m; i <= high; i++)
          {
            g += m_aOrt[i] * m_aEigenVector[i][j];
          }
          // Double division avoids possible underflow
          g = (g / m_aOrt[m]) / m_aHessenBerg[m][m - 1];
          for (int i = m; i <= high; i++)
          {
            m_aEigenVector[i][j] += g * m_aOrt[i];
          }
        }
      }
    }
  }