Example #1
0
 def saturn(self) -> CelestialObject:
     return makeObject(
         ObjectType.PLANET,
         "Saturn",
         self._ephemerides["saturn barycenter"],
         symbol="\u2644",
     )
Example #2
0
 def mars(self) -> CelestialObject:
     return makeObject(
         ObjectType.PLANET,
         "Mars",
         self._ephemerides["mars barycenter"],
         symbol="\u2642",
     )
Example #3
0
 def jupiter(self) -> CelestialObject:
     return makeObject(
         ObjectType.PLANET,
         "Jupiter",
         self._ephemerides["jupiter barycenter"],
         symbol="\u2643",
     )
Example #4
0
 def neptune(self) -> CelestialObject:
     return makeObject(
         ObjectType.PLANET,
         "Neptune",
         self._ephemerides["neptune barycenter"],
         symbol="\u2646",
     )
Example #5
0
 def sun(self) -> CelestialObject:
     return makeObject(
         ObjectType.STAR,
         "The Sun",
         self._ephemerides["sun"],
         symbol="\u2609",
     )
Example #6
0
 def uranus(self) -> CelestialObject:
     return makeObject(
         ObjectType.PLANET,
         "Uranus",
         self._ephemerides["uranus barycenter"],
         symbol="\u2645",
     )
Example #7
0
 def pluto(self) -> CelestialObject:
     # Still in the JPL planet ephemerides!
     return makeObject(
         ObjectType.MINOR_PLANET,
         "Pluto",
         self._ephemerides["pluto barycenter"],
         symbol="\u2647",
     )
Example #8
0
 def comet(self, designation: str) -> CelestialObject:
     """Look up a comet by its designation, e.g. 1P/Halley"""
     # NB: mpc.comet_orbit returns an orbit centered on the Sun, so we need to offset it!
     row = self._comets.loc[designation]
     return makeObject(
         type=ObjectType.COMET,
         name=designation[designation.find("/") + 1:],
         position=self.sun.position +
         mpc.comet_orbit(row, self.timescale, GM_SUN),
         dataFrame=row,
     )
Example #9
0
 def minorPlanet(self,
                 designation: str,
                 symbol: Optional[str] = None) -> CelestialObject:
     """Look up a minor planet by its designation, e.g. (2060) Chiron"""
     data = self._minorPlanets.loc[designation]
     shortName = designation[designation.find(") ") + 2:]
     return makeObject(
         type=ObjectType.MINOR_PLANET,
         name=shortName,
         position=self.sun.position +
         mpc.mpcorb_orbit(data, self.timescale, GM_SUN),
         dataFrame=data,
         symbol=symbol,
     )
Example #10
0
    def star(self,
             ref: Union[str, int],
             culture: Optional[str] = None) -> CelestialObject:
        """Fetch a star by its name or Hipparcos catalogue number.

        Args:
            ref: Either the string common name, or the int catalogue number, e.g. 87937 for
                Barnard's Star.
            culture: If given, use as a hint to understand the common name.
        """
        number = ref if isinstance(ref, int) else self.starNumber(ref)
        data = self._stars.loc[number]
        names = self._starNames.allNames(number)
        primaryName = (ref if isinstance(ref, str) else names["western"]
                       if "western" in names else names["hip"])
        star = Star.from_dataframe(data)
        return makeObject(
            type=ObjectType.STAR,
            name=primaryName,
            position=star,
            dataFrame=data,
            names=names,
        )
Example #11
0
 def earth(self) -> CelestialObject:
     return makeObject(ObjectType.PLANET,
                       "Earth",
                       self._ephemerides["earth"],
                       symbol="\u2641")
Example #12
0
 def venus(self) -> CelestialObject:
     return makeObject(ObjectType.PLANET,
                       "Venus",
                       self._ephemerides["venus"],
                       symbol="\u2640")
Example #13
0
 def mercury(self) -> CelestialObject:
     return makeObject(ObjectType.PLANET,
                       "Mercury",
                       self._ephemerides["mercury"],
                       symbol="\u263f")
Example #14
0
 def moon(self) -> CelestialObject:
     return makeObject(ObjectType.MOON,
                       "The Moon",
                       self._ephemerides["moon"],
                       symbol="\u263D")