It takes a value of seebeck and adjusts the analytic seebeck until it's equal
        Returns: eta where the two seebeck coefficients are equal 
        (reduced chemical potential)
160567
def eta_from_seebeck(seeb,Lambda):
    
    from scipy.optimize import fsolve
    out = fsolve(lambda x: (seebeck_spb(x,Lambda) - abs(seeb)) ** 2, 1.,full_output=True)
    return out[0][0]
449105
def _compensate_pressure(self, adc_p):
        
        var_1 = (self._temp_fine / 2.0) - 64000.0
        var_2 = ((var_1 / 4.0) * (var_1 / 4.0)) / 2048
        var_2 *= self._calibration_p[5]
        var_2 += ((var_1 * self._calibration_p[4]) * 2.0)
        var_2 = (var_2 / 4.0) + (self._calibration_p[3] * 65536.0)
        var_1 = (((self._calibration_p[2]
                   * (((var_1 / 4.0) * (var_1 / 4.0)) / 8192)) / 8)
                 + ((self._calibration_p[1] * var_1) / 2.0))
        var_1 /= 262144
        var_1 = ((32768 + var_1) * self._calibration_p[0]) / 32768

        if var_1 == 0:
            return 0

        pressure = ((1048576 - adc_p) - (var_2 / 4096)) * 3125
        if pressure < 0x80000000:
            pressure = (pressure * 2.0) / var_1
        else:
            pressure = (pressure / var_1) * 2

        var_1 = (self._calibration_p[8]
                 * (((pressure / 8.0) * (pressure / 8.0)) / 8192.0)) / 4096
        var_2 = ((pressure / 4.0) * self._calibration_p[7]) / 8192.0
        pressure += ((var_1 + var_2 + self._calibration_p[6]) / 16.0)

        return pressure / 100
754983
def rhochange(self):
        """"""

        if self.opt['HighMemSolve'] and self.cri.Cd == 1:
            self.c = sl.solvedbd_sm_c(
                self.Df, np.conj(self.Df),
                (self.mu / self.rho) * self.GHGf + 1.0, self.cri.axisM)
92430
def _fix_uncontracted(basis):
    '''
    
    '''

    for el in basis['elements'].values():
        if 'electron_shells' not in el:
            continue

        for sh in el['electron_shells']:
            if len(sh['coefficients']) == 1 and len(sh['coefficients'][0]) == 1:
                sh['coefficients'][0][0] = '1.0000000'

            # Some uncontracted shells don't have a coefficient
            if len(sh['coefficients']) == 0:
                sh['coefficients'].append(['1.0000000'])

    return basis
376277
def mass2_from_tau0_tau3(tau0, tau3, f_lower):
    """
    mtotal = mtotal_from_tau0_tau3(tau0, tau3, f_lower)
    eta = eta_from_tau0_tau3(tau0, tau3, f_lower)
    return mass2_from_mtotal_eta(mtotal, eta)
1035759
def correct(self, temp, we_t):
        
        if not PIDTempComp.in_range(temp):
            return None

        n_t = self.cf_t(temp)

        if n_t is None:
            return None

        we_c = we_t * n_t

        return we_c
570764
protected static void adjustUpLeft(byte[][] matrix, byte[][] tempMatrix, int maxX, int maxY) {
		int currentMinX = Integer.MAX_VALUE, currentMinY = Integer.MAX_VALUE;
		for(int i = 0; i < maxX; i++) {
			for(int j = 0; j < maxY; j++) {
				if(matrix[i][j] == 1) {
					if(i < currentMinX) {
						currentMinX = i;
					}
					if(j < currentMinY) {
						currentMinY = j;
					}
				}
			}
		}
		for(int i = currentMinX; i < maxX; i++) {
			for(int j = currentMinY; j < maxY; j++) {
				tempMatrix[i - currentMinX][j - currentMinY] = matrix[i][j];
			}
		}
		for(int i = 0; i < maxX; i++) {
			for(int j = 0; j < maxY; j++) {
				matrix[i][j] = tempMatrix[i][j];
			}
		}
	}
487715
def Δk(self):
        
        Δc, Δv = self.Δc, self.Δv
        cos = self._energy.trig('cos θ')
        return lambda e: (1 / 2) * ((Δc + Δv) + (Δc - Δv) * cos(e))
177536
private static void adjustCalibrated(DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
										 DMatrixRMaj rectifyK,
										 RectangleLength2D_F64 bound, double scale) {
		// translation
		double deltaX = -bound.x0*scale;
		double deltaY = -bound.y0*scale;

		// adjustment matrix
		SimpleMatrix A = new SimpleMatrix(3,3,true,new double[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
		SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
		SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
		SimpleMatrix K = SimpleMatrix.wrap(rectifyK);

		// remove previous calibration matrix
		SimpleMatrix K_inv = K.invert();
		rL = K_inv.mult(rL);
		rR = K_inv.mult(rR);

		// compute new calibration matrix and apply it
		K = A.mult(K);

		rectifyK.set(K.getDDRM());
		rectifyLeft.set(K.mult(rL).getDDRM());
		rectifyRight.set(K.mult(rR).getDDRM());
	}
993369
private static void adjustCalibrated(FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight,
										 FMatrixRMaj rectifyK,
										 RectangleLength2D_F32 bound, float scale) {
		// translation
		float deltaX = -bound.x0*scale;
		float deltaY = -bound.y0*scale;

		// adjustment matrix
		SimpleMatrix A = new SimpleMatrix(3,3,true,new float[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
		SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
		SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
		SimpleMatrix K = SimpleMatrix.wrap(rectifyK);

		// remove previous calibration matrix
		SimpleMatrix K_inv = K.invert();
		rL = K_inv.mult(rL);
		rR = K_inv.mult(rR);

		// compute new calibration matrix and apply it
		K = A.mult(K);

		rectifyK.set(K.getFDRM());
		rectifyLeft.set(K.mult(rL).getFDRM());
		rectifyRight.set(K.mult(rR).getFDRM());
	}
1157418
private static void adjustQuality(Map<String, Float> pFormatQuality, String pFormat, float pFactor) {
        Float oldValue = pFormatQuality.get(pFormat);
        if (oldValue != null) {
            pFormatQuality.put(pFormat, oldValue * pFactor);
            //System.out.println("New vallue after multiplying with " + pFactor + " is " + pFormatQuality.get(pFormat));
        }
    }
1357727
def bhp2pascal(bhp, cfm, fan_tot_eff):
    """"""
    inh2o = bhp * 6356.0 * fan_tot_eff / cfm
    pascal = inh2o2pascal(inh2o)        
    m3s = cfm2m3s(cfm)
    return pascal, m3s
927223
function(signal1, signal2, options){
    options = options || {};
    options = _.defaults(options, defaultOptions);
    
    // ensure signal2 is not longer than signal2
    if(signal1.length < signal2.length){
      var tmp = signal1;
      signal1 = signal2;
      signal2 = tmp;
    }
    
    if(options.method == "cauchy"){
      return cauchy(signal1,signal2,options);
    } else {
      return specConvolution(signal1, signal2,options);
    }
  }
871930
function _computeReflectionCoefficients(absorptionCoefficients) {
  let reflectionCoefficients = [];
  for (let property in Utils.DEFAULT_REFLECTION_COEFFICIENTS) {
    if (Utils.DEFAULT_REFLECTION_COEFFICIENTS
        .hasOwnProperty(property)) {
      // Compute average absorption coefficient (per wall).
      reflectionCoefficients[property] = 0;
      for (let j = 0; j < Utils.NUMBER_REFLECTION_AVERAGING_BANDS; j++) {
        let bandIndex = j + Utils.ROOM_STARTING_AVERAGING_BAND;
        reflectionCoefficients[property] +=
          absorptionCoefficients[property][bandIndex];
      }
      reflectionCoefficients[property] /=
        Utils.NUMBER_REFLECTION_AVERAGING_BANDS;

      // Convert absorption coefficient to reflection coefficient.
      reflectionCoefficients[property] =
        Math.sqrt(1 - reflectionCoefficients[property]);
    }
  }
  return reflectionCoefficients;
}
429257
private boolean processStepResults(double fx_candidate, double actualReduction, double predictedReduction) {
		double ratio = actualReduction/predictedReduction;
		boolean accepted;

		// Accept the new state if the score improved
		if( fx_candidate < fx ) {
			// reduce the amount of dampening.  Magic equation from [1].  My attempts to improve
			// upon it have failed.  It is truly magical.
			lambda = lambda* max(1.0/3.0, 1.0-Math.pow(2.0*ratio-1.0,3.0));
			nu=NU_INITIAL;
			accepted = true;
		} else {
			lambda *= nu;
			nu *= 2;
			accepted = false;
		}

		if( UtilEjml.isUncountable(lambda) || UtilEjml.isUncountable(nu) )
			throw new OptimizationException("BUG! lambda="+lambda+"  nu="+nu);

		if( accepted ) {
			boolean converged = checkConvergenceFTest(fx_candidate,fx);
			if( verbose != null ) {
				double length_p = NormOps_DDRM.normF(p); // TODO compute elsewhere ?
				verbose.printf("%-4d  %9.3E  %10.3E  %9.3E  %9.3E  %9.3E  %6.3f   %6.2E\n",
						totalSelectSteps, fx_candidate, fx_candidate - fx,length_p,ftest_val,gtest_val, ratio, lambda);
				if( converged ) {
					verbose.println("Converged f-test");
				}
			}

			acceptNewState(fx_candidate);
			return maximumLambdaNu() || converged;
		} else
			return false;
	}
452358
private void calcRadiation( int i, int j, WritableRaster demWR, WritableRaster sOmbraWR, WritableRaster insolationWR,
            double[] sunVector, WritableRaster gradientWR, double mr ) {
        double z = demWR.getSampleDouble(i, j, 0);
        double pressure = ATM * Math.exp(-0.0001184 * z);
        double ma = mr * pressure / ATM;
        double temp = 273 + pLapse * (z - 4000);
        double vap_psat = Math.exp(26.23 - 5416.0 / temp);
        double wPrec = 0.493 * pRH * vap_psat / temp;
        double taur = Math.exp((-.09030 * Math.pow(ma, 0.84)) * (1.0 + ma - Math.pow(ma, 1.01)));
        double d = pCmO3 * mr;
        double tauo = 1 - (0.1611 * d * Math.pow(1.0 + 139.48 * d, -0.3035) - 0.002715 * d)
                / (1.0 + 0.044 * d + 0.0003 * Math.pow(d, 2));
        double taug = Math.exp(-0.0127 * Math.pow(ma, 0.26));
        double tauw = 1 - 2.4959 * (wPrec * mr) / (1.0 + 79.034 * (wPrec * mr) * 0.6828 + 6.385 * (wPrec * mr));
        double taua = Math.pow((0.97 - 1.265 * Math.pow(pVisibility, (-0.66))), Math.pow(ma, 0.9));

        double In = 0.9751 * SOLARCTE * taur * tauo * taug * tauw * taua;

        double cosinc = scalarProduct(sunVector, gradientWR.getPixel(i, j, new double[3]));

        if (cosinc < 0) {
            cosinc = 0;
        }
        double tmp = insolationWR.getSampleDouble(i, j, 0);
        insolationWR.setSample(i, j, 0, In * cosinc * sOmbraWR.getSampleDouble(i, j, 0) / 1000 + tmp);
    }
971852
private static UnitValue temperature(UnitValue value, Unit target) {
    BigDecimal n = value.amount();
    if (target == Unit.TEMPERATURE_GENERIC) {
      return new UnitValue(n, Unit.TEMPERATURE_GENERIC);
    }

    switch (value.unit()) {
      case FAHRENHEIT:
        if (target == Unit.CELSIUS) {
            n = n.subtract(THIRTY_TWO);
            n = new Rational(n, BigDecimal.ONE).multiply(FIVE_NINTHS).compute(RoundingMode.HALF_EVEN);
        } else if (target == Unit.KELVIN) {
            n = n.add(KELVIN_FAHRENHEIT);
            n = new Rational(n, BigDecimal.ONE).multiply(FIVE_NINTHS).compute(RoundingMode.HALF_EVEN);
        }
        break;
        
      case CELSIUS:
        if (target == Unit.FAHRENHEIT) {
          Rational r = new Rational(n, BigDecimal.ONE);
          n = r.multiply(NINE_FIFTHS).compute(RoundingMode.HALF_EVEN).add(THIRTY_TWO);
        } else if (target == Unit.KELVIN) {
          n = n.add(KELVIN_CELSIUS);
        }
        break;
        
      case KELVIN:
        if (target == Unit.CELSIUS) {
          n = n.subtract(KELVIN_CELSIUS);
        } else if (target == Unit.FAHRENHEIT) {
          Rational r = new Rational(n, BigDecimal.ONE).multiply(NINE_FIFTHS);
          n = r.compute(RoundingMode.HALF_EVEN).subtract(KELVIN_FAHRENHEIT);
        }
        break;
        
      default:
        return new UnitValue(n, Unit.TEMPERATURE_GENERIC);
    }

    return new UnitValue(n.stripTrailingZeros(), target);
  }