SerializableBody

class Astronomy.Ephem.SerializableBody(info=None, name='', observer_info=None)

Bases: ephem.FixedBody

Simple extension to ephem.FixedBody that allows for conversion to and from a Python dictionary.

Examples:

Usage is similar to ephem.FixedBody:

body = SerializableBody(
    name="0521-365",
    info={
        "flux": {
            "C": "6.76",
            "K": "3.50",
            "L": "16",
            "S": "12.50",
            "W": "3.55",
            "X": "5.19"
        }
})
body._ra = 1.4092068106703093
body._dec = -0.6363220818328413
body.compute()
info

Additional information about source.

Type

dict

name

Name of source

Type

str

observer_info

dictionary containing information about an ephem.Observer object.

Type

dict

Methods Summary

from_dict(src_dict)

Class method for recreating SerializableBody objects from a dictionary.

get_observer()

Return an ephem.Observer object from the body’s observer_info dictionary.

register_with_Pyro5()

Make sure that we can serialize and deserialize this class when sending SerializableBody between Pyro5 clients and servers.

to_dict()

Dump object to a dictionary.

Methods Documentation

classmethod from_dict(src_dict)

Class method for recreating SerializableBody objects from a dictionary.

Parameters

src_dict (dict) – dictionary returned from to_dict instance method.

Returns

SerializableBody

get_observer()

Return an ephem.Observer object from the body’s observer_info dictionary.

classmethod register_with_Pyro5()

Make sure that we can serialize and deserialize this class when sending SerializableBody between Pyro5 clients and servers.

to_dict()

Dump object to a dictionary.