Module csw.Coords

Classes

class AltAzCoord (tag: Tag,
alt: astropy.coordinates.angles.core.Angle = <factory>,
az: astropy.coordinates.angles.core.Angle = <factory>)
Expand source code
@dataclass
class AltAzCoord(Coord):
    """
    Represents Alt-Az Coordinates (mirrors class of same name in the CSW Scala code).
    """
    alt: Angle = field(default_factory=lambda: Angle("0 deg"))
    az: Angle = field(default_factory=lambda: Angle("0 deg"))

    @staticmethod
    def make(tag: str = "BASE", alt: any = "0 deg", az: any = "0 deg"):
        """
        Convenience factory method.
        Note that the alt and az args should be in a format accepted by astropy's Angle class.
        """
        return AltAzCoord(Tag(tag), Angle(alt), Angle(az))

    def _asDict(self):
        return {
            "_type": self.__class__.__name__,
            "tag": self.tag.name,
            "alt": _CswAngle.fromAngle(self.alt).uas,
            "az": _CswAngle.fromAngle(self.az).uas
        }

    @staticmethod
    def _fromValueDict(obj: dict):
        return AltAzCoord(
            tag=Tag(obj["tag"]),
            alt=_CswAngle(obj["alt"]).toAngle().to(u.deg),
            az=_CswAngle(obj["az"]).toAngle().to(u.deg),
        )

Represents Alt-Az Coordinates (mirrors class of same name in the CSW Scala code).

Ancestors

Static methods

def make(tag: str = 'BASE',
alt:  = '0 deg',
az:  = '0 deg')
Expand source code
@staticmethod
def make(tag: str = "BASE", alt: any = "0 deg", az: any = "0 deg"):
    """
    Convenience factory method.
    Note that the alt and az args should be in a format accepted by astropy's Angle class.
    """
    return AltAzCoord(Tag(tag), Angle(alt), Angle(az))

Convenience factory method. Note that the alt and az args should be in a format accepted by astropy's Angle class.

Instance variables

var alt : astropy.coordinates.angles.core.Angle

The type of the None singleton.

var az : astropy.coordinates.angles.core.Angle

The type of the None singleton.

Inherited members

class CometCoord (tag: Tag,
epochOfPerihelion: float,
inclination: astropy.coordinates.angles.core.Angle,
longAscendingNode: astropy.coordinates.angles.core.Angle,
argOfPerihelion: astropy.coordinates.angles.core.Angle,
perihelionDistance: float,
eccentricity: float)
Expand source code
@dataclass
class CometCoord(Coord):
    """
    Represents Comet Coordinates (mirrors class of same name in the CSW Scala code).
    """
    epochOfPerihelion: float  # TT as a Modified Julian Date
    inclination: Angle
    longAscendingNode: Angle
    argOfPerihelion: Angle
    perihelionDistance: float  # AU
    eccentricity: float

    @staticmethod
    def make(tag: str, epochOfPerihelion: float, inclination: any, longAscendingNode: any, argOfPerihelion: any,
             perihelionDistance: float, eccentricity: float):
        """
        Convenience factory method.
        Note that the inclination, longAscendingNode and argOfPerihelion args
        should be in a format accepted by astropy's Angle class.
        """
        return CometCoord(Tag(tag), epochOfPerihelion, Angle(inclination), Angle(longAscendingNode),
                          Angle(argOfPerihelion),
                          perihelionDistance, eccentricity)

    def _asDict(self):
        return {
            "_type": self.__class__.__name__,
            "tag": self.tag.name,
            "epochOfPerihelion": self.epochOfPerihelion,
            "inclination": _CswAngle.fromAngle(self.inclination).uas,
            "longAscendingNode": _CswAngle.fromAngle(self.longAscendingNode).uas,
            "argOfPerihelion": _CswAngle.fromAngle(self.argOfPerihelion).uas,
            "perihelionDistance": self.perihelionDistance,
            "eccentricity": self.eccentricity
        }

    @staticmethod
    def _fromValueDict(obj: dict):
        return CometCoord(
            tag=Tag(obj["tag"]),
            epochOfPerihelion=obj["epochOfPerihelion"],
            inclination=_CswAngle(obj["inclination"]).toAngle().to(u.deg),
            longAscendingNode=_CswAngle(obj["longAscendingNode"]).toAngle().to(u.deg),
            argOfPerihelion=_CswAngle(obj["argOfPerihelion"]).toAngle().to(u.deg),
            perihelionDistance=obj["perihelionDistance"],
            eccentricity=obj["eccentricity"]
        )

Represents Comet Coordinates (mirrors class of same name in the CSW Scala code).

Ancestors

Static methods

def make(tag: str,
epochOfPerihelion: float,
inclination: ,
longAscendingNode: ,
argOfPerihelion: ,
perihelionDistance: float,
eccentricity: float)
Expand source code
@staticmethod
def make(tag: str, epochOfPerihelion: float, inclination: any, longAscendingNode: any, argOfPerihelion: any,
         perihelionDistance: float, eccentricity: float):
    """
    Convenience factory method.
    Note that the inclination, longAscendingNode and argOfPerihelion args
    should be in a format accepted by astropy's Angle class.
    """
    return CometCoord(Tag(tag), epochOfPerihelion, Angle(inclination), Angle(longAscendingNode),
                      Angle(argOfPerihelion),
                      perihelionDistance, eccentricity)

Convenience factory method. Note that the inclination, longAscendingNode and argOfPerihelion args should be in a format accepted by astropy's Angle class.

Instance variables

var argOfPerihelion : astropy.coordinates.angles.core.Angle

The type of the None singleton.

var eccentricity : float

The type of the None singleton.

var epochOfPerihelion : float

The type of the None singleton.

var inclination : astropy.coordinates.angles.core.Angle

The type of the None singleton.

var longAscendingNode : astropy.coordinates.angles.core.Angle

The type of the None singleton.

var perihelionDistance : float

The type of the None singleton.

Inherited members

class Coord (tag: Tag)
Expand source code
@dataclass
class Coord:
    """
    This is the base class of the coordinate types.
    If the key type is CoordKey, the value type can be any of the Coord subtypes.
    The dict key gives the class name.

    Args:
        tag (Tag): a label to indicate the use of the coordinate

    """
    tag: Tag

    @staticmethod
    def _fromDict(obj: dict):
        switcher = {
            "EqCoord": EqCoord,
            "SolarSystemCoord": SolarSystemCoord,
            "MinorPlanetCoord": MinorPlanetCoord,
            "CometCoord": CometCoord,
            "AltAzCoord": AltAzCoord
        }
        typ = obj["_type"]
        return switcher[typ]._fromValueDict(obj)

    def _asDict(self):
        pass

This is the base class of the coordinate types. If the key type is CoordKey, the value type can be any of the Coord subtypes. The dict key gives the class name.

Args

tag : Tag
a label to indicate the use of the coordinate

Subclasses

Instance variables

var tagTag

The type of the None singleton.

class EqCoord (tag: Tag,
ra: astropy.coordinates.angles.core.Angle,
dec: astropy.coordinates.angles.core.Angle,
frame: EqFrame,
catalogName: str,
pm: ProperMotion)
Expand source code
@dataclass
class EqCoord(Coord):
    """
    Represents equatorial coordinates (mirrors class of same name in the CSW Scala code).
    """
    ra: Angle
    dec: Angle
    frame: EqFrame
    catalogName: str
    pm: ProperMotion

    @staticmethod
    def make(tag: str = "BASE", ra: any = "0 deg", dec: any = "0 deg", frame: EqFrame = EqFrame.ICRS,
             catalogName: str = "none", pm: tuple = (0.0, 0.0)):
        """
        Convenience factory method.
        Note that the ra and dec args should be in a format accepted by astropy's Angle class.
        """
        return EqCoord(Tag(tag), Angle(ra), Angle(dec), frame, catalogName, ProperMotion(pm[0], pm[1]))

    def _asDict(self):
        return {
            "_type": self.__class__.__name__,
            "tag": self.tag.name,
            "ra": _CswAngle.fromAngle(self.ra).uas,
            "dec": _CswAngle.fromAngle(self.dec).uas,
            "frame": self.frame.name,
            "catalogName": self.catalogName,
            "pm": asdict(self.pm)
        }

    @staticmethod
    def _fromValueDict(obj: dict):
        return EqCoord(
            tag=Tag(obj["tag"]),
            ra=_CswAngle(obj["ra"]).toAngle().to(u.deg),
            dec=_CswAngle(obj["dec"]).toAngle().to(u.deg),
            frame=EqFrame[obj["frame"]],
            catalogName=obj["catalogName"],
            pm=ProperMotion(**obj["pm"]),
        )

Represents equatorial coordinates (mirrors class of same name in the CSW Scala code).

Ancestors

Static methods

def make(tag: str = 'BASE',
ra:  = '0 deg',
dec:  = '0 deg',
frame: EqFrame = EqFrame.ICRS,
catalogName: str = 'none',
pm: tuple = (0.0, 0.0))
Expand source code
@staticmethod
def make(tag: str = "BASE", ra: any = "0 deg", dec: any = "0 deg", frame: EqFrame = EqFrame.ICRS,
         catalogName: str = "none", pm: tuple = (0.0, 0.0)):
    """
    Convenience factory method.
    Note that the ra and dec args should be in a format accepted by astropy's Angle class.
    """
    return EqCoord(Tag(tag), Angle(ra), Angle(dec), frame, catalogName, ProperMotion(pm[0], pm[1]))

Convenience factory method. Note that the ra and dec args should be in a format accepted by astropy's Angle class.

Instance variables

var catalogName : str

The type of the None singleton.

var dec : astropy.coordinates.angles.core.Angle

The type of the None singleton.

var frameEqFrame

The type of the None singleton.

var pmProperMotion

The type of the None singleton.

var ra : astropy.coordinates.angles.core.Angle

The type of the None singleton.

Inherited members

class EqFrame (*args, **kwds)
Expand source code
class EqFrame(Enum):
    ICRS = 0
    FK5 = 1

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Ancestors

  • enum.Enum

Class variables

var FK5

The type of the None singleton.

var ICRS

The type of the None singleton.

class MinorPlanetCoord (tag: Tag,
epoch: float,
inclination: astropy.coordinates.angles.core.Angle,
longAscendingNode: astropy.coordinates.angles.core.Angle,
argOfPerihelion: astropy.coordinates.angles.core.Angle,
meanDistance: float,
eccentricity: float,
meanAnomaly: astropy.coordinates.angles.core.Angle)
Expand source code
@dataclass
class MinorPlanetCoord(Coord):
    """
    Represents Minor Planet Coordinates (mirrors class of same name in the CSW Scala code).
    """
    epoch: float  # TT as a Modified Julian Date
    inclination: Angle
    longAscendingNode: Angle
    argOfPerihelion: Angle
    meanDistance: float  # AU
    eccentricity: float
    meanAnomaly: Angle

    @staticmethod
    def make(tag: str, epoch: float, inclination: any, longAscendingNode: any, argOfPerihelion: any,
             meanDistance: float, eccentricity: float, meanAnomaly: any):
        """
        Convenience factory method.
        Note that the inclination, longAscendingNode, argOfPerihelion and meanAnomaly args
        should be in a format accepted by astropy's Angle class.
        """
        return MinorPlanetCoord(Tag(tag), epoch, Angle(inclination), Angle(longAscendingNode), Angle(argOfPerihelion),
                                meanDistance, eccentricity, Angle(meanAnomaly))

    def _asDict(self):
        return {
            "_type": self.__class__.__name__,
            "tag": self.tag.name,
            "epoch": self.epoch,
            "inclination": _CswAngle.fromAngle(self.inclination).uas,
            "longAscendingNode": _CswAngle.fromAngle(self.longAscendingNode).uas,
            "argOfPerihelion": _CswAngle.fromAngle(self.argOfPerihelion).uas,
            "meanDistance": self.meanDistance,
            "eccentricity": self.eccentricity,
            "meanAnomaly": _CswAngle.fromAngle(self.meanAnomaly).uas
        }

    @staticmethod
    def _fromValueDict(obj: dict):
        return MinorPlanetCoord(
            tag=Tag(obj["tag"]),
            epoch=obj["epoch"],
            inclination=_CswAngle(obj["inclination"]).toAngle().to(u.deg),
            longAscendingNode=_CswAngle(obj["longAscendingNode"]).toAngle().to(u.deg),
            argOfPerihelion=_CswAngle(obj["argOfPerihelion"]).toAngle().to(u.deg),
            meanDistance=obj["meanDistance"],
            eccentricity=obj["eccentricity"],
            meanAnomaly=_CswAngle(obj["meanAnomaly"]).toAngle().to(u.deg)
        )

Represents Minor Planet Coordinates (mirrors class of same name in the CSW Scala code).

Ancestors

Static methods

def make(tag: str,
epoch: float,
inclination: ,
longAscendingNode: ,
argOfPerihelion: ,
meanDistance: float,
eccentricity: float,
meanAnomaly: )
Expand source code
@staticmethod
def make(tag: str, epoch: float, inclination: any, longAscendingNode: any, argOfPerihelion: any,
         meanDistance: float, eccentricity: float, meanAnomaly: any):
    """
    Convenience factory method.
    Note that the inclination, longAscendingNode, argOfPerihelion and meanAnomaly args
    should be in a format accepted by astropy's Angle class.
    """
    return MinorPlanetCoord(Tag(tag), epoch, Angle(inclination), Angle(longAscendingNode), Angle(argOfPerihelion),
                            meanDistance, eccentricity, Angle(meanAnomaly))

Convenience factory method. Note that the inclination, longAscendingNode, argOfPerihelion and meanAnomaly args should be in a format accepted by astropy's Angle class.

Instance variables

var argOfPerihelion : astropy.coordinates.angles.core.Angle

The type of the None singleton.

var eccentricity : float

The type of the None singleton.

var epoch : float

The type of the None singleton.

var inclination : astropy.coordinates.angles.core.Angle

The type of the None singleton.

var longAscendingNode : astropy.coordinates.angles.core.Angle

The type of the None singleton.

var meanAnomaly : astropy.coordinates.angles.core.Angle

The type of the None singleton.

var meanDistance : float

The type of the None singleton.

Inherited members

class ProperMotion (pmx: float, pmy: float)
Expand source code
@dataclass
class ProperMotion:
    pmx: float
    pmy: float

ProperMotion(pmx: float, pmy: float)

Instance variables

var pmx : float

The type of the None singleton.

var pmy : float

The type of the None singleton.

class SolarSystemCoord (tag: Tag,
body: SolarSystemObject)
Expand source code
@dataclass
class SolarSystemCoord(Coord):
    """
    Represents Solar System Coordinates (mirrors class of same name in the CSW Scala code).
    """
    body: SolarSystemObject

    @staticmethod
    def make(tag: str, body: SolarSystemObject):
        return SolarSystemCoord(Tag(tag), body)

    def _asDict(self):
        return {
            "_type": self.__class__.__name__,
            "tag": self.tag.name,
            "body": self.body.name,
        }

    @staticmethod
    def _fromValueDict(obj: dict):
        return SolarSystemCoord(
            tag=Tag(obj["tag"]),
            body=SolarSystemObject[obj["body"]]
        )

Represents Solar System Coordinates (mirrors class of same name in the CSW Scala code).

Ancestors

Static methods

def make(tag: str,
body: SolarSystemObject)
Expand source code
@staticmethod
def make(tag: str, body: SolarSystemObject):
    return SolarSystemCoord(Tag(tag), body)

Instance variables

var bodySolarSystemObject

The type of the None singleton.

Inherited members

class SolarSystemObject (*args, **kwds)
Expand source code
class SolarSystemObject(Enum):
    """
    Enum type: Represents the possible values for a Solar System Object.
    """
    Mercury = 0
    Venus = 1
    Moon = 2
    Mars = 3
    Jupiter = 4
    Saturn = 5
    Neptune = 6
    Uranus = 7
    Pluto = 8

Enum type: Represents the possible values for a Solar System Object.

Ancestors

  • enum.Enum

Class variables

var Jupiter

The type of the None singleton.

var Mars

The type of the None singleton.

var Mercury

The type of the None singleton.

var Moon

The type of the None singleton.

var Neptune

The type of the None singleton.

var Pluto

The type of the None singleton.

var Saturn

The type of the None singleton.

var Uranus

The type of the None singleton.

var Venus

The type of the None singleton.

class Tag (name: str)
Expand source code
@dataclass
class Tag:
    """
    A tag is a label to indicate the use of the coordinate
    """
    name: str

A tag is a label to indicate the use of the coordinate

Instance variables

var name : str

The type of the None singleton.