Evaluate the need for SOI transition, by comparing the radial distance
        between the considered body and the spacecraft

        If therer is no body in sight, default to central body.
427616
def _soi(self, orb):
        

        for body in self.alt:
            soi = self.SOI[body.name]
            sph = orb.copy(frame=soi.frame, form='spherical')
            if sph.r < soi.radius:
                active = body
                break
        else:
            active = self.central

        return active
310434
def coord(self):
        """"""
        if self._coordinate is None:
            self._coordinate = SkyCoord(self.origin.ra, self.origin.dec + 45 * units.arcsec)
        return self._coordinate
46669
def galactic_xyz(self):
        """"""
        vector = _GALACTIC.dot(self.position.au)
        return Distance(vector)
1101956
function capsuleVsSphere(contactPoint, contactNormal, capsule, sphere) {
  const sphereCenter = sphere.centerOfVolume;
  findClosestPointOnSegmentToPoint(contactPoint, capsule.segment, sphereCenter);
  vec3.subtract(contactNormal, sphereCenter, contactPoint);
  vec3.normalize(contactNormal, contactNormal);
  vec3.scaleAndAdd(contactPoint, contactPoint, contactNormal, capsule.radius);
}
346827
def from_sky(cls, distancelimit=15, magnitudelimit=18):
        '''
        

        '''

        # define a query for cone search surrounding this center
        criteria = []
        if distancelimit is not None:
            criteria.append('parallax >= {}'.format(1000.0/distancelimit))
        if magnitudelimit is not None:
            criteria.append('phot_g_mean_mag <= {}'.format(magnitudelimit))

        allskyquery = """{} WHERE {}""".format(cls.basequery, ' and '.join(criteria))
        print(allskyquery)

        # run the query
        print('querying Gaia DR2, for distance<{} and G<{}'.format(distancelimit, magnitudelimit))
        table = query(allskyquery)

        # store the search parameters in this object
        c = cls(cls.standardize_table(table))

        c.standardized.meta['query'] = allskyquery
        c.standardized.meta['magnitudelimit'] = magnitudelimit
        c.standardized.meta['distancelimit'] = distancelimit

        #c.distancelimit = distancelimit
        #c.magnitudelimit = magnitudelimit or c.magnitudelimit
        return c
13963
def is_within(self, cutoff_dist, point, ligands=True):
        """"""
        return find_atoms_within_distance(self.get_atoms(ligands=ligands), cutoff_dist, point)
974499
def time_delay_from_earth_center(self, right_ascension, declination, t_gps):
        
        return self.time_delay_from_location(np.array([0, 0, 0]),
                                             right_ascension,
                                             declination,
                                             t_gps)
944542
def transition(self, duration, brightness=None, temperature=None):
        
        # Transition immediately if duration is zero.
        if duration == 0:
            if brightness is not None:
                self.brightness = brightness
            if temperature is not None:
                self.temperature = temperature
            return
        if brightness != self.brightness or temperature != self.temperature:
            self._transition(duration, brightness, temperature)
1153147
def calcPeriod(self):
        

        return eq.KeplersThirdLaw(self.a, self.star.M).P
18760
function (spaceIdentifier, data) {
    var path;
    if (data) {
      path = this.constructPath(constants.SPACES, spaceIdentifier);
      return this.Core.PATCH(path, data);
    } else {
      return this.rejectRequest('Bad Request: Space data is required');
    }
  }
865588
def _check_consistent_units_orbitInput(self,orb):
        """"""
        if self._roSet and orb._roSet:
            assert m.fabs(self._ro-orb._ro) < 10.**-10., 'Physical conversion for the actionAngle object is not consistent with that of the Orbit given to it'
        if self._voSet and orb._voSet:
            assert m.fabs(self._vo-orb._vo) < 10.**-10., 'Physical conversion for the actionAngle object is not consistent with that of the Orbit given to it'
        return None
567030
def b(self):
        '''
        

        '''
        b = Point(self.center)

        if self.xAxisIsMinor:
            b.x += self.minorRadius
        else:
            b.y += self.minorRadius
        return b
666398
public static boolean isInside(Circle c1, Circle c2)
    {
        return distanceFromCenter(c1, c2.getX(), c2.getY())+c2.getRadius() < c1.getRadius();
    }
237254
void defineCoordinateSystem(View viewA, Motion motion) {

		View viewB = motion.destination(viewA);
		viewA.viewToWorld.reset(); // identity since it's the origin
		viewB.viewToWorld.set(motion.motionSrcToDst(viewB));
		// translation is only known up to a scale factor so pick a reasonable scale factor
		double scale = viewB.viewToWorld.T.norm();
		viewB.viewToWorld.T.scale(1.0/scale);

		viewsAdded.add(viewA);
		viewsAdded.add(viewB);

		viewA.state = ViewState.PROCESSED;
		viewB.state = ViewState.PROCESSED;

		// Take the already triangulated points and turn them into official 3D features
		boolean originIsDst = viewA == motion.viewDst;
		for (int i = 0; i < motion.stereoTriangulations.size(); i++) {
			Feature3D f = motion.stereoTriangulations.get(i);

			if( f.obsIdx.size != 2 )
				throw new RuntimeException("BUG");

			int indexSrc = f.obsIdx.get(0);
			int indexDst = f.obsIdx.get(1);

			motion.viewSrc.features3D[indexSrc] = f;
			motion.viewDst.features3D[indexDst] = f;

			if( originIsDst ) {
				SePointOps_F64.transform(motion.a_to_b,f.worldPt,f.worldPt);
			}

			f.worldPt.scale(1.0/scale);
			graph.features3D.add(f);
		}

		// free memory and mark as already processed
		motion.stereoTriangulations = new ArrayList<>();

		// All features which can be added using triangulation should now be added
		addTriangulatedFeaturesForAllEdges(viewA);
		addTriangulatedFeaturesForAllEdges(viewB);

		if( verbose != null ) {
			verbose.println("root  = " + viewA.index);
			verbose.println("other = " + viewB.index);
			verbose.println("-------------");
		}
	}
67298
def _check(self):
        """"""
        # Run the super method
        super(Photometry, self)._check()

        err_str = None
        has_flux = self._KEYS.FLUX in self
        has_flux_dens = self._KEYS.FLUX_DENSITY in self
        has_u_flux = self._KEYS.U_FLUX in self
        has_u_flux_dens = self._KEYS.U_FLUX_DENSITY in self

        has_freq = self._KEYS.FREQUENCY in self
        has_band = self._KEYS.BAND in self
        has_ener = self._KEYS.ENERGY in self
        has_u_freq = self._KEYS.U_FREQUENCY in self
        has_u_ener = self._KEYS.U_ENERGY in self

        if has_flux or has_flux_dens:
            if not any([has_freq, has_band, has_ener]):
                err_str = ("Has `{}` or `{}`".format(self._KEYS.FLUX,
                                                     self._KEYS.FLUX_DENSITY) +
                           " but None of `{}`, `{}`, `{}`".format(
                               self._KEYS.FREQUENCY, self._KEYS.BAND,
                               self._KEYS.ENERGY))
            elif has_flux and not has_u_flux:
                err_str = "`{}` provided without `{}`.".format(
                    self._KEYS.FLUX, self._KEYS.U_FLUX)
            elif has_flux_dens and not has_u_flux_dens:
                err_str = "`{}` provided without `{}`.".format(
                    self._KEYS.FLUX_DENSITY, self._KEYS.U_FLUX_DENSITY)
            elif has_freq and not has_u_freq:
                err_str = "`{}` provided without `{}`.".format(
                    self._KEYS.FREQUENCY, self._KEYS.U_FREQUENCY)
            elif has_ener and not has_u_ener:
                err_str = "`{}` provided without `{}`.".format(
                    self._KEYS.ENERGY, self._KEYS.U_ENERGY)

        if err_str is not None:
            raise ValueError(err_str)

        return
175906
def isAboveHorizon(ra, decl, mcRA, lat):
    
    # This function checks if the equatorial distance from 
    # the object to the MC is within its diurnal semi-arc.
    
    dArc, _ = dnarcs(decl, lat)
    dist = abs(angle.closestdistance(mcRA, ra))
    return dist <= dArc/2.0 + 0.0003
899811
def go_to(self, x, y, z=DEFAULT, velocity=DEFAULT):
        

        z = self._height(z)

        dx = x - self._x
        dy = y - self._y
        dz = z - self._z
        distance = math.sqrt(dx * dx + dy * dy + dz * dz)

        duration_s = distance / self._velocity(velocity)
        self._hl_commander.go_to(x, y, z, 0, duration_s)
        time.sleep(duration_s)

        self._x = x
        self._y = y
        self._z = z