Modify the inner parameters of the Kepler propagator in order to place
        the spacecraft in the right Sphere of Influence
177
def _change_soi(self, body):
        

        if body == self.central:
            self.bodies = [self.central]
            self.step = self.central_step
            self.active = self.central.name
            self.frame = self.central.name
        else:
            soi = self.SOI[body.name]
            self.bodies = [body]
            self.step = self.alt_step
            self.active = body.name
            self.frame = soi.frame
847119
function(moLonLat) {
        return this.sphericalMercator ? 
          this.forwardMercator(moLonLat.lng(), moLonLat.lat()).lon :
          moLonLat.lng();  
    }
566155
function(moLonLat) {
        var lat = this.sphericalMercator ? 
          this.forwardMercator(moLonLat.lng(), moLonLat.lat()).lat :
          moLonLat.lat(); 
        return lat;  
    }
201254
def update_positions(self, positions):
        '''
        '''
        sphs_verts = self.sphs_verts_radii.copy()
        sphs_verts += positions.reshape(self.n_spheres, 1, 3)

        self.tr.update_vertices(sphs_verts)
        self.poslist = positions
621921
def _vmomentsurfaceIntegrand(vR,vT,R,az,df,n,m,sigmaR1,sigmaT1,t,initvmoment):
    """"""
    o= Orbit([R,vR*sigmaR1,vT*sigmaT1,az])
    return vR**n*vT**m*df(o,t)/initvmoment
703466
function() {
    var center = this.center();
    var radiusSquare = 0.0;
    this.eachAtom(function(atom) {
      radiusSquare = Math.max(radiusSquare, vec3.sqrDist(center, atom.pos()));
    });
    return new geom.Sphere(center, Math.sqrt(radiusSquare));
  }
65347
def get_least_orbits(atom_index, cell, site_symmetry, symprec=1e-5):
    """"""
    orbits = _get_orbits(atom_index, cell, site_symmetry, symprec)
    mapping = np.arange(cell.get_number_of_atoms())

    for i, orb in enumerate(orbits):
        for num in np.unique(orb):
            if mapping[num] > mapping[i]:
                mapping[num] = mapping[i]

    return np.unique(mapping)
581100
public static void Forward(double[] data) {
        double[] result = new double[data.length];

        for (int k = 0; k < result.length; k++) {
            double sum = 0;
            for (int n = 0; n < data.length; n++) {
                double theta = ((2.0 * Math.PI) / data.length) * k * n;
                sum += data[n] * cas(theta);
            }
            result[k] = (1.0 / Math.sqrt(data.length)) * sum;
        }

        for (int i = 0; i < result.length; i++) {
            data[i] = result[i];
        }

    }
1248724
function cl (jde, earth, saturn) { // (jde float64, earth, saturn *pp.V87Planet)  (f1 func() (ΔU, B float64),
  // f2 func() (Bʹ, P, aEdge, bEdge float64))
  const p = Math.PI / 180
  let i, Ω
  let l0, b0, R
  let Δ = 9.0
  let λ, β
  let si, ci, sβ, cβ, sB
  let sbʹ, cbʹ, slʹΩ, clʹΩ
  const f1 = function () { // (ΔU, B float64)
    // (45.1), p. 318
    const T = base.J2000Century(jde)
    i = base.horner(T, 28.075216 * p, -0.012998 * p, 0.000004 * p)
    Ω = base.horner(T, 169.50847 * p, 1.394681 * p, 0.000412 * p)
    // Step 2.0
    const earthPos = earth.position(jde)
    R = earthPos.range
    const fk5 = planetposition.toFK5(earthPos.lon, earthPos.lat, jde)
    l0 = fk5.lon
    b0 = fk5.lat
    const [sl0, cl0] = base.sincos(l0)
    const sb0 = Math.sin(b0)
    // Steps 3, 4.0
    let l, b, r, x, y, z
    const f = function () {
      const τ = base.lightTime(Δ)
      const saturnPos = saturn.position(jde - τ)
      r = saturnPos.range
      const fk5 = planetposition.toFK5(saturnPos.lon, saturnPos.lat, jde)
      l = fk5.lon
      b = fk5.lat
      const [sl, cl] = base.sincos(l)
      const [sb, cb] = base.sincos(b)
      x = r * cb * cl - R * cl0
      y = r * cb * sl - R * sl0
      z = r * sb - R * sb0
      Δ = Math.sqrt(x * x + y * y + z * z)
    }
    f()
    f()
    // Step 5.0
    λ = Math.atan2(y, x)
    β = Math.atan(z / Math.hypot(x, y))
    // First part of step 6.0
    si = Math.sin(i)
    ci = Math.cos(i)
    sβ = Math.sin(β)
    cβ = Math.cos(β)
    sB = si * cβ * Math.sin(λ - Ω) - ci * sβ
    const B = Math.asin(sB) // return value
    // Step 7.0
    const N = 113.6655 * p + 0.8771 * p * T
    const lʹ = l - 0.01759 * p / r
    const bʹ = b - 0.000764 * p * Math.cos(l - N) / r
    // Setup for steps 8, 9.0
    sbʹ = Math.sin(bʹ)
    cbʹ = Math.cos(bʹ)
    slʹΩ = Math.sin(lʹ - Ω)
    clʹΩ = Math.cos(lʹ - Ω)
    // Step 9.0
    const [sλΩ, cλΩ] = base.sincos(λ - Ω)
    const U1 = Math.atan2(si * sbʹ + ci * cbʹ * slʹΩ, cbʹ * clʹΩ)
    const U2 = Math.atan2(si * sβ + ci * cβ * sλΩ, cβ * cλΩ)
    const ΔU = Math.abs(U1 - U2) // return value
    return [ΔU, B]
  }
  const f2 = function () { // (Bʹ, P, aEdge, bEdge) {
    // Remainder of step 6.0
    const aEdge = 375.35 / 3600 * p / Δ // return value
    const bEdge = aEdge * Math.abs(sB) // return value
    // Step 8.0
    const sBʹ = si * cbʹ * slʹΩ - ci * sbʹ
    const Bʹ = Math.asin(sBʹ) // return value
    // Step 10.0
    const [Δψ, Δε] = nutation.nutation(jde)
    const ε = nutation.meanObliquity(jde) + Δε
    // Step 11.0
    let λ0 = Ω - Math.PI / 2
    const β0 = Math.PI / 2 - i
    // Step 12.0
    const [sl0λ, cl0λ] = base.sincos(l0 - λ)
    λ += 0.005693 * p * cl0λ / cβ
    β += 0.005693 * p * sl0λ * sβ
    // Step 13.0
    λ0 += Δψ
    λ += Δψ
    // Step 14.0
    let eq = new coord.Ecliptic(λ0, β0).toEquatorial(ε)
    const [α0, δ0] = [eq.ra, eq.dec]
    eq = new coord.Ecliptic(λ, β).toEquatorial(ε)
    const [α, δ] = [eq.ra, eq.dec]
    // Step 15.0
    const [sδ0, cδ0] = base.sincos(δ0)
    const [sδ, cδ] = base.sincos(δ)
    const [sα0α, cα0α] = base.sincos(α0 - α)
    const P = Math.atan2(cδ0 * sα0α, sδ0 * cδ - cδ0 * sδ * cα0α) // return value
    return [Bʹ, P, aEdge, bEdge]
  }
  return [f1, f2]
}
410429
void applyFreshParticleOffScreen(
            @NonNull final Scene scene,
            final int position) {
        final int w = scene.getWidth();
        final int h = scene.getHeight();
        if (w == 0 || h == 0) {
            throw new IllegalStateException(
                    "Cannot generate particles if scene width or height is 0");
        }

        float x = random.nextInt(w);
        float y = random.nextInt(h);

        // The offset to make when creating point of out bounds
        final short offset = (short) (scene.getParticleRadiusMin() + scene.getLineLength());

        // Point angle range
        final float startAngle;
        float endAngle;

        // Make random offset and calulate angles so that the direction of travel will always be
        // towards our View
        switch (random.nextInt(4)) {
            case 0:
                // offset to left
                x = (short) -offset;
                startAngle = angleDeg(pcc, pcc, x, y);
                endAngle = angleDeg(pcc, h - pcc, x, y);
                break;

            case 1:
                // offset to top
                y = (short) -offset;
                startAngle = angleDeg(w - pcc, pcc, x, y);
                endAngle = angleDeg(pcc, pcc, x, y);
                break;

            case 2:
                // offset to right
                x = (short) (w + offset);
                startAngle = angleDeg(w - pcc, h - pcc, x, y);
                endAngle = angleDeg(w - pcc, pcc, x, y);
                break;

            case 3:
                // offset to bottom
                y = (short) (h + offset);
                startAngle = angleDeg(pcc, h - pcc, x, y);
                endAngle = angleDeg(w - pcc, h - pcc, x, y);
                break;

            default:
                throw new IllegalArgumentException("Supplied value out of range");
        }

        if (endAngle < startAngle) {
            endAngle += 360;
        }

        // Get random angle from angle range
        final float randomAngleInRange = startAngle + (random
                .nextInt((int) Math.abs(endAngle - startAngle)));
        final double direction = Math.toRadians(randomAngleInRange);

        final float dCos = (float) Math.cos(direction);
        final float dSin = (float) Math.sin(direction);
        final float speedFactor = newRandomIndividualParticleSpeedFactor();
        final float radius = newRandomIndividualParticleRadius(scene);

        scene.setParticleData(
                position,
                x,
                y,
                dCos,
                dSin,
                radius,
                speedFactor);
    }
1203847
def coords_for_computations(self):
        

        # TODO: need to subtract the position offset if a Mesh (in orbit)
        if self._compute_at_vertices:
            if self.pvertices is not None:
                return self.pvertices - self._pos_center
            else:
                return self.vertices - self._pos_center
        else:
            return self.centers - self._pos_center
1353524
def iter(self, **kwargs):
        
        if self.propagator.orbit is not self:
            self.propagator.orbit = self

        return self.propagator.iter(**kwargs)
640257
function forward$8(p) {
        var lon = p.x;
        var lat = p.y;
        var dlon = adjust_lon(lon - this.long0);
        var us, vs;
        var con;
        if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
            if (lat > 0) {
                con = -1;
            }
            else {
                con = 1;
            }
            vs = this.al / this.bl * Math.log(Math.tan(FORTPI + con * this.gamma0 * 0.5));
            us = -1 * con * HALF_PI * this.al / this.bl;
        }
        else {
            var t = tsfnz(this.e, lat, Math.sin(lat));
            var ql = this.el / Math.pow(t, this.bl);
            var sl = 0.5 * (ql - 1 / ql);
            var tl = 0.5 * (ql + 1 / ql);
            var vl = Math.sin(this.bl * (dlon));
            var ul = (sl * Math.sin(this.gamma0) - vl * Math.cos(this.gamma0)) / tl;
            if (Math.abs(Math.abs(ul) - 1) <= EPSLN) {
                vs = Number.POSITIVE_INFINITY;
            }
            else {
                vs = 0.5 * this.al * Math.log((1 - ul) / (1 + ul)) / this.bl;
            }
            if (Math.abs(Math.cos(this.bl * (dlon))) <= EPSLN) {
                us = this.al * this.bl * (dlon);
            }
            else {
                us = this.al * Math.atan2(sl * Math.cos(this.gamma0) + vl * Math.sin(this.gamma0), Math.cos(this.bl * dlon)) / this.bl;
            }
        }

        if (this.no_rot) {
            p.x = this.x0 + us;
            p.y = this.y0 + vs;
        }
        else {

            us -= this.uc;
            p.x = this.x0 + vs * Math.cos(this.alpha) + us * Math.sin(this.alpha);
            p.y = this.y0 + us * Math.cos(this.alpha) - vs * Math.sin(this.alpha);
        }
        return p;
    }
1333682
def _keplerian_to_keplerian_circular(cls, coord, center):
        
        a, e, i, Ω, ω, ν = coord

        ex = e * cos(ω)
        ey = e * sin(ω)
        u = ω + ν

        return np.array([a, ex, ey, i, Ω, u], dtype=float)
706056
def _polarBreaks(self):
        

        if self.orbit_index is None:
            raise ValueError('Orbit properties must be defined at ' +
                             'pysat.Instrument object instantiation.' + 
                             'See Instrument docs.')
        else:
            try:
                self.sat[self.orbit_index]
            except ValueError:
                raise ValueError('Provided orbit index does not appear to ' +
                                 'exist in loaded data')

        # determine where orbit index goes from positive to negative
        pos = (self.sat[self.orbit_index] >= 0)
        npos = -pos
        change = (pos.values[:-1] & npos.values[1:]) | (npos.values[:-1] &
                                                        pos.values[1:])

        ind, = np.where(change)
        ind += 1

        ut_diff = Series(self.sat.data.index).diff()
        ut_ind, = np.where(ut_diff / self.orbit_period > 0.95)

        if len(ut_ind) > 0:
            ind = np.hstack((ind, ut_ind))
            ind = np.sort(ind)
            ind = np.unique(ind)
            # print 'Time Gap'

        # create orbitbreak index, ensure first element is always 0
        if ind[0] != 0:
            ind = np.hstack((np.array([0]), ind))
        # number of orbits
        num_orbits = len(ind)
        # set index of orbit breaks
        self._orbit_breaks = ind
        # set number of orbits for the day
        self.num = num_orbits
817360
function(mat,updateNormals) {
				if(updateNormals === undefined){
					updateNormals = true;
				}
				var l = this.vertices.length;
				for(var i=0;i<l;i++){
					var v = this.vertices[i];
					v.set(mat.applyTo(v));
				}
				if(updateNormals){
					this.computeFaceNormals();
				}
				return this;
			}
934308
function init$16() {
        //no-op
        if (!this.sphere) {
            this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
        }
    }