Returns limb-darkening coefficients in Kepler band.
484172
def ldcoeffs(teff,logg=4.5,feh=0):
    
    teffs = np.atleast_1d(teff)
    loggs = np.atleast_1d(logg)

    Tmin,Tmax = (LDPOINTS[:,0].min(),LDPOINTS[:,0].max())
    gmin,gmax = (LDPOINTS[:,1].min(),LDPOINTS[:,1].max())

    teffs[(teffs < Tmin)] = Tmin + 1
    teffs[(teffs > Tmax)] = Tmax - 1
    loggs[(loggs < gmin)] = gmin + 0.01
    loggs[(loggs > gmax)] = gmax - 0.01

    u1,u2 = (U1FN(teffs,loggs),U2FN(teffs,loggs))
    return u1,u2
1276475
private void calchillshade( WritableRaster pitWR, WritableRaster hillshadeWR, WritableRaster gradientWR, double dx ) {

        pAzimuth = Math.toRadians(pAzimuth);
        pElev = Math.toRadians(pElev);

        double[] sunVector = calcSunVector();
        double[] normalSunVector = calcNormalSunVector(sunVector);
        double[] inverseSunVector = calcInverseSunVector(sunVector);
        int rows = pitWR.getHeight();
        int cols = pitWR.getWidth();
        WritableRaster sOmbraWR = calculateFactor(rows, cols, sunVector, inverseSunVector, normalSunVector, pitWR, dx);
        pm.beginTask(msg.message("hillshade.calculating"), rows * cols);
        for( int j = 1; j < rows - 1; j++ ) {
            for( int i = 1; i < cols - 1; i++ ) {

                double[] ng = gradientWR.getPixel(i, j, new double[3]);
                double cosinc = scalarProduct(sunVector, ng);
                if (cosinc < 0) {
                    sOmbraWR.setSample(i, j, 0, 0);
                }
                hillshadeWR.setSample(i, j, 0, (int) (212.5 * (cosinc * sOmbraWR.getSample(i, j, 0) + pMinDiffuse)));
                pm.worked(1);
            }
        }
        pm.done();
    }
70694
def obtain_band_edges(self):
        '''
        
        '''
        orbitals = self.aos_as_list()
        electrons = Composition(self.composition).total_electrons
        partial_filled = []
        for orbital in orbitals:
            if electrons <= 0:
                break
            if 's' in orbital[1]:
                electrons += -2
            elif 'p' in orbital[1]:
                electrons += -6
            elif 'd' in orbital[1]:
                electrons += -10
            elif 'f' in orbital[1]:
                electrons += -14
            partial_filled.append(orbital)

        if electrons != 0:
            homo = partial_filled[-1]
            lumo = partial_filled[-1]
        else:
            homo = partial_filled[-1]
            try:
                lumo = orbitals[len(partial_filled)]
            except:
                lumo = None

        if homo == lumo:
            metal = True
        else:
            metal = False

        return {'HOMO': homo, 'LUMO': lumo, 'metal': metal}
406880
def calcSMAfromT(self, epsilon=0.7):
        

        return eq.MeanPlanetTemp(self.albedo(), self.star.T, self.star.R, epsilon, self.T).a
666667
def get_band_structure(self):
        """"""

        kpath = HighSymmKpath(self.data.structure)
        kpt_line = [Kpoint(k, self.data.structure.lattice) for k
                    in
                    kpath.get_kpoints(coords_are_cartesian=False)[
                        0]]
        kpoints = np.array(
            [kp.frac_coords for kp in kpt_line])

        labels_dict = {l: k for k, l in zip(
            *kpath.get_kpoints(coords_are_cartesian=False)) if l}

        lattvec = self.data.get_lattvec()
        egrid, vgrid = fite.getBands(kpoints, self.equivalences, lattvec, self.coeffs)

        bands_dict = {Spin.up: (egrid / units.eV)}

        sbs = BandStructureSymmLine(kpoints, bands_dict,
                                    self.data.structure.lattice.reciprocal_lattice,
                                    self.efermi / units.eV,
                                    labels_dict=labels_dict)
        return sbs
480082
def params(self):
        
        params = dict(format=RESPONSE_FORMAT,
                      verbose=self.verbose,
                      epoch1=str(self.search_start_date),
                      epoch2=str(self.search_end_date),
                      search=self.orbit_method,
                      eunits=self.error_units,
                      eellipse=self.error_ellipse,
                      extres=self.resolve_extension,
                      xyres=self.resolve_position,
                      telinst=self.telescope_instrument)

        if self.orbit_method == 'bynameHorizons':
            params['object'] = NEW_LINE.join((str(target_name) for target_name in self.observations))
        else:
            params['obs'] = NEW_LINE.join((str(observation) for observation in self.observations))
        return params
204153
def _keplerian_to_keplerian_mean(cls, coord, center):
        

        a, e, i, Ω, ω, ν = coord
        if e < 1:
            # Elliptic case
            cos_E = (e + cos(ν)) / (1 + e * cos(ν))
            sin_E = (sin(ν) * sqrt(1 - e ** 2)) / (1 + e * cos(ν))
            E = arctan2(sin_E, cos_E) % (2 * np.pi)
            M = E - e * sin(E)  # Mean anomaly
        else:
            # Hyperbolic case
            H = arccosh((e + cos(ν)) / (1 + e * cos(ν)))
            M = e * sinh(H) - H

        return np.array([a, e, i, Ω, ω, M], dtype=float)
955811
def calcSMA(self):
        
        try:
            return eq.KeplersThirdLaw(None, self.star.M, self.P).a
        except HierarchyError:
            return np.nan
1252209
def get_uv_tan(c):
    
    l = c.spherical.lon
    b = c.spherical.lat

    p = np.array([-np.sin(l), np.cos(l), np.zeros_like(l.value)]).T
    q = np.array([-np.cos(l)*np.sin(b), -np.sin(l)*np.sin(b), np.cos(b)]).T

    return np.stack((p, q), axis=-1)
1010334
def calcTemperature(self):
        
        try:
            return eq.MeanPlanetTemp(self.albedo, self.star.T, self.star.R, self.a).T_p
        except (ValueError, HierarchyError):  # ie missing value (.a) returning nan
            return np.nan
274594
def get_irradiance_value(self, month, day, hour):
        """"""
        dt = DateTime(month, day, hour, leap_year=self.is_leap_year)
        count = int(dt.hoy * self.timestep)
        return self.direct_normal_irradiance[count], \
            self.diffuse_horizontal_irradiance[count]
430886
private void computePixelFeatures() {
		for (int y = 0; y < derivX.height; y++) {
			int pixelIndex = y*derivX.width;
			int endIndex = pixelIndex+derivX.width;
			for (; pixelIndex < endIndex; pixelIndex++ ) {
				float dx = derivX.data[pixelIndex];
				float dy = derivY.data[pixelIndex];

				// angle from 0 to pi radians
				orientation.data[pixelIndex] = UtilAngle.atanSafe(dy,dx) + GrlConstants.F_PId2;
				// gradient magnitude
				magnitude.data[pixelIndex] = Math.sqrt(dx*dx + dy*dy);
			}
		}
	}
269346
def _offset_setup(self,sigangle,leading,deltaAngleTrack):
        """"""
        #From the progenitor orbit, determine the sigmas in J and angle
        self._sigjr= (self._progenitor.rap()-self._progenitor.rperi())/numpy.pi*self._sigv
        self._siglz= self._progenitor.rperi()*self._sigv
        self._sigjz= 2.*self._progenitor.zmax()/numpy.pi*self._sigv
        #Estimate the frequency covariance matrix from a diagonal J matrix x dOdJ
        self._sigjmatrix= numpy.diag([self._sigjr**2.,
                                      self._siglz**2.,
                                      self._sigjz**2.])
        self._sigomatrix= numpy.dot(self._dOdJp,
                                    numpy.dot(self._sigjmatrix,self._dOdJp.T))
        #Estimate angle spread as the ratio of the largest to the middle eigenvalue
        self._sigomatrixEig= numpy.linalg.eig(self._sigomatrix)
        self._sigomatrixEigsortIndx= numpy.argsort(self._sigomatrixEig[0])
        self._sortedSigOEig= sorted(self._sigomatrixEig[0])
        if sigangle is None:
            self._sigangle= self._sigv*1.8
        else:
            self._sigangle= sigangle
        self._sigangle2= self._sigangle**2.
        self._lnsigangle= numpy.log(self._sigangle)
        #Estimate the frequency mean as lying along the direction of the largest eigenvalue
        self._dsigomeanProgDirection= self._sigomatrixEig[1][:,numpy.argmax(self._sigomatrixEig[0])]
        self._progenitor_Omega_along_dOmega= \
            numpy.dot(self._progenitor_Omega,self._dsigomeanProgDirection)
        #Make sure we are modeling the correct part of the stream
        self._leading= leading
        self._sigMeanSign= 1.
        if self._leading and self._progenitor_Omega_along_dOmega < 0.:
            self._sigMeanSign= -1.
        elif not self._leading and self._progenitor_Omega_along_dOmega > 0.:
            self._sigMeanSign= -1.
        self._progenitor_Omega_along_dOmega*= self._sigMeanSign 
        self._sigomean= self._progenitor_Omega\
            +self._sigMeanOffset*self._sigMeanSign\
            *numpy.sqrt(numpy.amax(self._sigomatrixEig[0]))\
            *self._dsigomeanProgDirection
#numpy.dot(self._dOdJp,
#                          numpy.array([self._sigjr,self._siglz,self._sigjz]))
        self._dsigomeanProg= self._sigomean-self._progenitor_Omega
        self._meandO= self._sigMeanOffset\
            *numpy.sqrt(numpy.amax(self._sigomatrixEig[0]))
        #Store cholesky of sigomatrix for fast evaluation
        self._sigomatrixNorm=\
            numpy.sqrt(numpy.sum(self._sigomatrix**2.))
        self._sigomatrixinv, self._sigomatrixLogdet= \
            fast_cholesky_invert(self._sigomatrix/self._sigomatrixNorm,
                                 tiny=10.**-15.,logdet=True)
        self._sigomatrixinv/= self._sigomatrixNorm
        deltaAngleTrackLim = (self._sigMeanOffset+4.) * numpy.sqrt(
            self._sortedSigOEig[2]) * self._tdisrupt
        if (deltaAngleTrack is None):  
            deltaAngleTrack = deltaAngleTrackLim
        else:
            if (deltaAngleTrack > deltaAngleTrackLim):
                warnings.warn("WARNING: angle range large compared to plausible value.", galpyWarning)
        self._deltaAngleTrack= deltaAngleTrack
        return None
596623
def eclipseprob(self):
        
        #TODO: incorporate eccentricity/omega for exact calculation?
        s = self.stars
        return ((s['radius_1'] + s['radius_2'])*RSUN /
                (semimajor(s['P'],s['mass_1'] + s['mass_2'])*AU))
1009430
def getKeplerFov(fieldnum):
    
    info = getFieldInfo(fieldnum)
    ra, dec, scRoll = info["ra"], info["dec"], info["roll"]
    # convert from SC roll to FOV coordinates
    # do not use the fovRoll coords anywhere else
    # they are internal to this script only
    fovRoll = fov.getFovAngleFromSpacecraftRoll(scRoll)
    # KeplerFov takes a listen of broken CCD channels as optional argument;
    # these channels will be ignored during plotting and on-silicon determination.
    # Modules 3 and 7 broke prior to the start of K2:
    brokenChannels = [5, 6, 7, 8,  17, 18, 19, 20]
    # Module 4 failed during Campaign 10
    if fieldnum > 10:
        brokenChannels.extend([9, 10, 11, 12])
    # Hack: the Kepler field is defined as "Campaign 1000"
    # and (initially) had no broken channels
    if fieldnum == 1000:
        brokenChannels = []

    return fov.KeplerFov(ra, dec, fovRoll, brokenChannels=brokenChannels)
608638
def _g_3(self):
        """"""
        # return 3 * (1.0 - self._n_3()) / (self._vertices_omegas[3] - self._omega)
        return (3 * self._f(1, 3) * self._f(2, 3) /
                (self._vertices_omegas[3] - self._vertices_omegas[0]))
742548
def _get_reference_band(self, data):
        
        nir = data[..., self.nir_idx].astype("float32")
        red = data[..., self.red_idx].astype("float32")
        return (nir - red) / (nir + red)