repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
galactics/beyond
beyond/frames/stations.py
create_station
def create_station(name, latlonalt, parent_frame=WGS84, orientation='N', mask=None): """Create a ground station instance Args: name (str): Name of the station latlonalt (tuple of float): coordinates of the station, as follow: * Latitude in degrees * Longitude in degree...
python
def create_station(name, latlonalt, parent_frame=WGS84, orientation='N', mask=None): """Create a ground station instance Args: name (str): Name of the station latlonalt (tuple of float): coordinates of the station, as follow: * Latitude in degrees * Longitude in degree...
[ "def", "create_station", "(", "name", ",", "latlonalt", ",", "parent_frame", "=", "WGS84", ",", "orientation", "=", "'N'", ",", "mask", "=", "None", ")", ":", "if", "isinstance", "(", "orientation", ",", "str", ")", ":", "orient", "=", "{", "'N'", ":",...
Create a ground station instance Args: name (str): Name of the station latlonalt (tuple of float): coordinates of the station, as follow: * Latitude in degrees * Longitude in degrees * Altitude to sea level in meters parent_frame (Frame): Planetocentri...
[ "Create", "a", "ground", "station", "instance" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/stations.py#L135-L181
train
galactics/beyond
beyond/frames/stations.py
TopocentricFrame.visibility
def visibility(cls, orb, **kwargs): """Visibility from a topocentric frame see :py:meth:`Propagator.iter() <beyond.propagators.base.Propagator.iter>` for description of arguments handling. Args: orb (Orbit): Orbit to compute visibility from the station with Keyword...
python
def visibility(cls, orb, **kwargs): """Visibility from a topocentric frame see :py:meth:`Propagator.iter() <beyond.propagators.base.Propagator.iter>` for description of arguments handling. Args: orb (Orbit): Orbit to compute visibility from the station with Keyword...
[ "def", "visibility", "(", "cls", ",", "orb", ",", "**", "kwargs", ")", ":", "from", ".", ".", "orbits", ".", "listeners", "import", "stations_listeners", ",", "Listener", "listeners", "=", "kwargs", ".", "setdefault", "(", "'listeners'", ",", "[", "]", "...
Visibility from a topocentric frame see :py:meth:`Propagator.iter() <beyond.propagators.base.Propagator.iter>` for description of arguments handling. Args: orb (Orbit): Orbit to compute visibility from the station with Keyword Args: start (Date): starting date ...
[ "Visibility", "from", "a", "topocentric", "frame" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/stations.py#L15-L71
train
galactics/beyond
beyond/frames/stations.py
TopocentricFrame._to_parent_frame
def _to_parent_frame(self, *args, **kwargs): """Conversion from Topocentric Frame to parent frame """ lat, lon, _ = self.latlonalt m = rot3(-lon) @ rot2(lat - np.pi / 2.) @ rot3(self.heading) offset = np.zeros(6) offset[:3] = self.coordinates return self._convert(...
python
def _to_parent_frame(self, *args, **kwargs): """Conversion from Topocentric Frame to parent frame """ lat, lon, _ = self.latlonalt m = rot3(-lon) @ rot2(lat - np.pi / 2.) @ rot3(self.heading) offset = np.zeros(6) offset[:3] = self.coordinates return self._convert(...
[ "def", "_to_parent_frame", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "lat", ",", "lon", ",", "_", "=", "self", ".", "latlonalt", "m", "=", "rot3", "(", "-", "lon", ")", "@", "rot2", "(", "lat", "-", "np", ".", "pi", "/", "...
Conversion from Topocentric Frame to parent frame
[ "Conversion", "from", "Topocentric", "Frame", "to", "parent", "frame" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/stations.py#L73-L80
train
galactics/beyond
beyond/frames/stations.py
TopocentricFrame._geodetic_to_cartesian
def _geodetic_to_cartesian(cls, lat, lon, alt): """Conversion from latitude, longitude and altitude coordinates to cartesian with respect to an ellipsoid Args: lat (float): Latitude in radians lon (float): Longitude in radians alt (float): Altitude to sea lev...
python
def _geodetic_to_cartesian(cls, lat, lon, alt): """Conversion from latitude, longitude and altitude coordinates to cartesian with respect to an ellipsoid Args: lat (float): Latitude in radians lon (float): Longitude in radians alt (float): Altitude to sea lev...
[ "def", "_geodetic_to_cartesian", "(", "cls", ",", "lat", ",", "lon", ",", "alt", ")", ":", "C", "=", "Earth", ".", "r", "/", "np", ".", "sqrt", "(", "1", "-", "(", "Earth", ".", "e", "*", "np", ".", "sin", "(", "lat", ")", ")", "**", "2", "...
Conversion from latitude, longitude and altitude coordinates to cartesian with respect to an ellipsoid Args: lat (float): Latitude in radians lon (float): Longitude in radians alt (float): Altitude to sea level in meters Return: numpy.array: 3D e...
[ "Conversion", "from", "latitude", "longitude", "and", "altitude", "coordinates", "to", "cartesian", "with", "respect", "to", "an", "ellipsoid" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/stations.py#L83-L105
train
galactics/beyond
beyond/frames/stations.py
TopocentricFrame.get_mask
def get_mask(cls, azim): """Linear interpolation between two points of the mask """ if cls.mask is None: raise ValueError("No mask defined for the station {}".format(cls.name)) azim %= 2 * np.pi if azim in cls.mask[0, :]: return cls.mask[1, np.where(azi...
python
def get_mask(cls, azim): """Linear interpolation between two points of the mask """ if cls.mask is None: raise ValueError("No mask defined for the station {}".format(cls.name)) azim %= 2 * np.pi if azim in cls.mask[0, :]: return cls.mask[1, np.where(azi...
[ "def", "get_mask", "(", "cls", ",", "azim", ")", ":", "if", "cls", ".", "mask", "is", "None", ":", "raise", "ValueError", "(", "\"No mask defined for the station {}\"", ".", "format", "(", "cls", ".", "name", ")", ")", "azim", "%=", "2", "*", "np", "."...
Linear interpolation between two points of the mask
[ "Linear", "interpolation", "between", "two", "points", "of", "the", "mask" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/stations.py#L108-L132
train
galactics/beyond
beyond/env/solarsystem.py
get_body
def get_body(name): """Retrieve a given body orbits and parameters Args: name (str): Object name Return: Body: """ try: body, propag = _bodies[name.lower()] # attach a propagator to the object body.propagate = propag.propagate except KeyError as e: ...
python
def get_body(name): """Retrieve a given body orbits and parameters Args: name (str): Object name Return: Body: """ try: body, propag = _bodies[name.lower()] # attach a propagator to the object body.propagate = propag.propagate except KeyError as e: ...
[ "def", "get_body", "(", "name", ")", ":", "try", ":", "body", ",", "propag", "=", "_bodies", "[", "name", ".", "lower", "(", ")", "]", "body", ".", "propagate", "=", "propag", ".", "propagate", "except", "KeyError", "as", "e", ":", "raise", "UnknownB...
Retrieve a given body orbits and parameters Args: name (str): Object name Return: Body:
[ "Retrieve", "a", "given", "body", "orbits", "and", "parameters" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/env/solarsystem.py#L13-L30
train
galactics/beyond
beyond/env/solarsystem.py
MoonPropagator.propagate
def propagate(cls, date): """Compute the Moon position at a given date Args: date (~beyond.utils.date.Date) Return: ~beyond.orbits.orbit.Orbit: Position of the Moon in EME2000 frame Example: .. code-block:: python from beyond.utils.d...
python
def propagate(cls, date): """Compute the Moon position at a given date Args: date (~beyond.utils.date.Date) Return: ~beyond.orbits.orbit.Orbit: Position of the Moon in EME2000 frame Example: .. code-block:: python from beyond.utils.d...
[ "def", "propagate", "(", "cls", ",", "date", ")", ":", "date", "=", "date", ".", "change_scale", "(", "'TDB'", ")", "t_tdb", "=", "date", ".", "julian_century", "def", "cos", "(", "angle", ")", ":", "return", "np", ".", "cos", "(", "np", ".", "radi...
Compute the Moon position at a given date Args: date (~beyond.utils.date.Date) Return: ~beyond.orbits.orbit.Orbit: Position of the Moon in EME2000 frame Example: .. code-block:: python from beyond.utils.date import Date MoonP...
[ "Compute", "the", "Moon", "position", "at", "a", "given", "date" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/env/solarsystem.py#L49-L109
train
galactics/beyond
beyond/env/solarsystem.py
SunPropagator.propagate
def propagate(cls, date): """Compute the position of the sun at a given date Args: date (~beyond.utils.date.Date) Return: ~beyond.orbits.orbit.Orbit: Position of the sun in MOD frame Example: .. code-block:: python from beyond.util...
python
def propagate(cls, date): """Compute the position of the sun at a given date Args: date (~beyond.utils.date.Date) Return: ~beyond.orbits.orbit.Orbit: Position of the sun in MOD frame Example: .. code-block:: python from beyond.util...
[ "def", "propagate", "(", "cls", ",", "date", ")", ":", "date", "=", "date", ".", "change_scale", "(", "'UT1'", ")", "t_ut1", "=", "date", ".", "julian_century", "lambda_M", "=", "280.460", "+", "36000.771", "*", "t_ut1", "M", "=", "np", ".", "radians",...
Compute the position of the sun at a given date Args: date (~beyond.utils.date.Date) Return: ~beyond.orbits.orbit.Orbit: Position of the sun in MOD frame Example: .. code-block:: python from beyond.utils.date import Date Su...
[ "Compute", "the", "position", "of", "the", "sun", "at", "a", "given", "date" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/env/solarsystem.py#L119-L167
train
galactics/beyond
beyond/propagators/base.py
Propagator.iter
def iter(self, **kwargs): """Compute a range of orbits between two dates Keyword Arguments: dates (list of :py:class:`~beyond.dates.date.Date`): Dates from which iterate over start (Date or None): Date of the first point stop (Date, timedelta or None): Date of the la...
python
def iter(self, **kwargs): """Compute a range of orbits between two dates Keyword Arguments: dates (list of :py:class:`~beyond.dates.date.Date`): Dates from which iterate over start (Date or None): Date of the first point stop (Date, timedelta or None): Date of the la...
[ "def", "iter", "(", "self", ",", "**", "kwargs", ")", ":", "if", "'dates'", "not", "in", "kwargs", ":", "start", "=", "kwargs", ".", "setdefault", "(", "'start'", ",", "self", ".", "orbit", ".", "date", ")", "stop", "=", "kwargs", ".", "get", "(", ...
Compute a range of orbits between two dates Keyword Arguments: dates (list of :py:class:`~beyond.dates.date.Date`): Dates from which iterate over start (Date or None): Date of the first point stop (Date, timedelta or None): Date of the last point step (timedelta ...
[ "Compute", "a", "range", "of", "orbits", "between", "two", "dates" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/propagators/base.py#L33-L92
train
galactics/beyond
beyond/env/jpl.py
get_orbit
def get_orbit(name, date): """Retrieve the orbit of a solar system object Args: name (str): The name of the body desired. For exact nomenclature, see :py:func:`available_planets` date (Date): Date at which the state vector will be extracted Return: Orbit: Orbit of the de...
python
def get_orbit(name, date): """Retrieve the orbit of a solar system object Args: name (str): The name of the body desired. For exact nomenclature, see :py:func:`available_planets` date (Date): Date at which the state vector will be extracted Return: Orbit: Orbit of the de...
[ "def", "get_orbit", "(", "name", ",", "date", ")", ":", "if", "name", "not", "in", "[", "x", ".", "name", "for", "x", "in", "Bsp", "(", ")", ".", "top", ".", "list", "]", ":", "raise", "UnknownBodyError", "(", "name", ")", "for", "a", ",", "b",...
Retrieve the orbit of a solar system object Args: name (str): The name of the body desired. For exact nomenclature, see :py:func:`available_planets` date (Date): Date at which the state vector will be extracted Return: Orbit: Orbit of the desired object, in the reference fra...
[ "Retrieve", "the", "orbit", "of", "a", "solar", "system", "object" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/env/jpl.py#L341-L379
train
galactics/beyond
beyond/env/jpl.py
create_frames
def create_frames(until=None): """Create frames available in the JPL files Args: until (str): Name of the body you want to create the frame of, and all frames in between. If ``None`` all the frames available in the .bsp files will be created Example: .. code-block:: pytho...
python
def create_frames(until=None): """Create frames available in the JPL files Args: until (str): Name of the body you want to create the frame of, and all frames in between. If ``None`` all the frames available in the .bsp files will be created Example: .. code-block:: pytho...
[ "def", "create_frames", "(", "until", "=", "None", ")", ":", "now", "=", "Date", ".", "now", "(", ")", "if", "until", ":", "get_orbit", "(", "until", ",", "now", ")", "else", ":", "for", "body", "in", "list_bodies", "(", ")", ":", "get_orbit", "(",...
Create frames available in the JPL files Args: until (str): Name of the body you want to create the frame of, and all frames in between. If ``None`` all the frames available in the .bsp files will be created Example: .. code-block:: python # All frames between Earth ...
[ "Create", "frames", "available", "in", "the", "JPL", "files" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/env/jpl.py#L392-L422
train
galactics/beyond
beyond/env/jpl.py
get_body
def get_body(name): """Retrieve the Body structure of a JPL .bsp file object Args: name (str) Return: :py:class:`~beyond.constants.Body` """ body = Pck()[name] body.propagate = lambda date: get_orbit(name, date) return body
python
def get_body(name): """Retrieve the Body structure of a JPL .bsp file object Args: name (str) Return: :py:class:`~beyond.constants.Body` """ body = Pck()[name] body.propagate = lambda date: get_orbit(name, date) return body
[ "def", "get_body", "(", "name", ")", ":", "body", "=", "Pck", "(", ")", "[", "name", "]", "body", ".", "propagate", "=", "lambda", "date", ":", "get_orbit", "(", "name", ",", "date", ")", "return", "body" ]
Retrieve the Body structure of a JPL .bsp file object Args: name (str) Return: :py:class:`~beyond.constants.Body`
[ "Retrieve", "the", "Body", "structure", "of", "a", "JPL", ".", "bsp", "file", "object" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/env/jpl.py#L425-L436
train
galactics/beyond
beyond/env/jpl.py
Bsp.open
def open(self): """Open the files """ segments = [] files = config.get('env', 'jpl', fallback=[]) if not files: raise JplConfigError("No JPL file defined") # Extraction of segments from each .bsp file for filepath in files: filepath = P...
python
def open(self): """Open the files """ segments = [] files = config.get('env', 'jpl', fallback=[]) if not files: raise JplConfigError("No JPL file defined") # Extraction of segments from each .bsp file for filepath in files: filepath = P...
[ "def", "open", "(", "self", ")", ":", "segments", "=", "[", "]", "files", "=", "config", ".", "get", "(", "'env'", ",", "'jpl'", ",", "fallback", "=", "[", "]", ")", "if", "not", "files", ":", "raise", "JplConfigError", "(", "\"No JPL file defined\"", ...
Open the files
[ "Open", "the", "files" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/env/jpl.py#L131-L177
train
galactics/beyond
beyond/env/jpl.py
Bsp.get
def get(self, center, target, date): """Retrieve the position and velocity of a target with respect to a center Args: center (Target): target (Target): date (Date): Return: numpy.array: length-6 array position and velocity (in m and m/s) of the ...
python
def get(self, center, target, date): """Retrieve the position and velocity of a target with respect to a center Args: center (Target): target (Target): date (Date): Return: numpy.array: length-6 array position and velocity (in m and m/s) of the ...
[ "def", "get", "(", "self", ",", "center", ",", "target", ",", "date", ")", ":", "if", "(", "center", ".", "index", ",", "target", ".", "index", ")", "in", "self", ".", "segments", ":", "pos", ",", "vel", "=", "self", ".", "segments", "[", "center...
Retrieve the position and velocity of a target with respect to a center Args: center (Target): target (Target): date (Date): Return: numpy.array: length-6 array position and velocity (in m and m/s) of the target, with respect to the center
[ "Retrieve", "the", "position", "and", "velocity", "of", "a", "target", "with", "respect", "to", "a", "center" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/env/jpl.py#L179-L211
train
galactics/beyond
beyond/propagators/__init__.py
get_propagator
def get_propagator(name): """Retrieve a named propagator Args: name (str): Name of the desired propagator Return: Propagator class """ from .sgp4 import Sgp4 from .sgp4beta import Sgp4Beta scope = locals().copy() scope.update(globals()) if name not in scope: ...
python
def get_propagator(name): """Retrieve a named propagator Args: name (str): Name of the desired propagator Return: Propagator class """ from .sgp4 import Sgp4 from .sgp4beta import Sgp4Beta scope = locals().copy() scope.update(globals()) if name not in scope: ...
[ "def", "get_propagator", "(", "name", ")", ":", "from", ".", "sgp4", "import", "Sgp4", "from", ".", "sgp4beta", "import", "Sgp4Beta", "scope", "=", "locals", "(", ")", ".", "copy", "(", ")", "scope", ".", "update", "(", "globals", "(", ")", ")", "if"...
Retrieve a named propagator Args: name (str): Name of the desired propagator Return: Propagator class
[ "Retrieve", "a", "named", "propagator" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/propagators/__init__.py#L7-L25
train
galactics/beyond
beyond/orbits/listeners.py
stations_listeners
def stations_listeners(stations): """Function for creating listeners for a a list of station Args: stations (iterable): List of TopocentricFrame Return: list of Listener """ stations = stations if isinstance(stations, (list, tuple)) else [stations] listeners = [] for sta in...
python
def stations_listeners(stations): """Function for creating listeners for a a list of station Args: stations (iterable): List of TopocentricFrame Return: list of Listener """ stations = stations if isinstance(stations, (list, tuple)) else [stations] listeners = [] for sta in...
[ "def", "stations_listeners", "(", "stations", ")", ":", "stations", "=", "stations", "if", "isinstance", "(", "stations", ",", "(", "list", ",", "tuple", ")", ")", "else", "[", "stations", "]", "listeners", "=", "[", "]", "for", "sta", "in", "stations", ...
Function for creating listeners for a a list of station Args: stations (iterable): List of TopocentricFrame Return: list of Listener
[ "Function", "for", "creating", "listeners", "for", "a", "a", "list", "of", "station" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/listeners.py#L479-L497
train
galactics/beyond
beyond/orbits/listeners.py
Speaker._bisect
def _bisect(self, begin, end, listener): """This method search for the zero-crossing of the watched parameter Args: begin (Orbit): end (Orbit) listener (Listener) Return Return """ step = (end.date - begin.date) / 2 while...
python
def _bisect(self, begin, end, listener): """This method search for the zero-crossing of the watched parameter Args: begin (Orbit): end (Orbit) listener (Listener) Return Return """ step = (end.date - begin.date) / 2 while...
[ "def", "_bisect", "(", "self", ",", "begin", ",", "end", ",", "listener", ")", ":", "step", "=", "(", "end", ".", "date", "-", "begin", ".", "date", ")", "/", "2", "while", "abs", "(", "step", ")", ">=", "self", ".", "_eps_bisect", ":", "date", ...
This method search for the zero-crossing of the watched parameter Args: begin (Orbit): end (Orbit) listener (Listener) Return Return
[ "This", "method", "search", "for", "the", "zero", "-", "crossing", "of", "the", "watched", "parameter" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/listeners.py#L49-L75
train
galactics/beyond
beyond/orbits/listeners.py
Listener.check
def check(self, orb): """Method that check whether or not the listener is triggered Args: orb (Orbit): Return: bool: True if there is a zero-crossing for the parameter watched by the listener """ return self.prev is not None and np.sign(self(orb)) != np...
python
def check(self, orb): """Method that check whether or not the listener is triggered Args: orb (Orbit): Return: bool: True if there is a zero-crossing for the parameter watched by the listener """ return self.prev is not None and np.sign(self(orb)) != np...
[ "def", "check", "(", "self", ",", "orb", ")", ":", "return", "self", ".", "prev", "is", "not", "None", "and", "np", ".", "sign", "(", "self", "(", "orb", ")", ")", "!=", "np", ".", "sign", "(", "self", "(", "self", ".", "prev", ")", ")" ]
Method that check whether or not the listener is triggered Args: orb (Orbit): Return: bool: True if there is a zero-crossing for the parameter watched by the listener
[ "Method", "that", "check", "whether", "or", "not", "the", "listener", "is", "triggered" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/listeners.py#L84-L94
train
galactics/beyond
beyond/orbits/forms.py
Form._m_to_e
def _m_to_e(cls, e, M): """Conversion from Mean Anomaly to Eccentric anomaly Procedures for solving Kepler's Equation, A. W. Odell and R. H. Gooding, Celestial Mechanics 38 (1986) 307-334 """ k1 = 3 * np.pi + 2 k2 = np.pi - 1 k3 = 6 * np.pi - 1 A = 3 * ...
python
def _m_to_e(cls, e, M): """Conversion from Mean Anomaly to Eccentric anomaly Procedures for solving Kepler's Equation, A. W. Odell and R. H. Gooding, Celestial Mechanics 38 (1986) 307-334 """ k1 = 3 * np.pi + 2 k2 = np.pi - 1 k3 = 6 * np.pi - 1 A = 3 * ...
[ "def", "_m_to_e", "(", "cls", ",", "e", ",", "M", ")", ":", "k1", "=", "3", "*", "np", ".", "pi", "+", "2", "k2", "=", "np", ".", "pi", "-", "1", "k3", "=", "6", "*", "np", ".", "pi", "-", "1", "A", "=", "3", "*", "k2", "**", "2", "...
Conversion from Mean Anomaly to Eccentric anomaly Procedures for solving Kepler's Equation, A. W. Odell and R. H. Gooding, Celestial Mechanics 38 (1986) 307-334
[ "Conversion", "from", "Mean", "Anomaly", "to", "Eccentric", "anomaly" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/forms.py#L146-L191
train
galactics/beyond
beyond/orbits/forms.py
Form._cartesian_to_spherical
def _cartesian_to_spherical(cls, coord, center): """Cartesian to Spherical conversion .. warning:: The spherical form is equatorial, not zenithal """ x, y, z, vx, vy, vz = coord r = np.linalg.norm(coord[:3]) phi = arcsin(z / r) theta = arctan2(y, x) r_do...
python
def _cartesian_to_spherical(cls, coord, center): """Cartesian to Spherical conversion .. warning:: The spherical form is equatorial, not zenithal """ x, y, z, vx, vy, vz = coord r = np.linalg.norm(coord[:3]) phi = arcsin(z / r) theta = arctan2(y, x) r_do...
[ "def", "_cartesian_to_spherical", "(", "cls", ",", "coord", ",", "center", ")", ":", "x", ",", "y", ",", "z", ",", "vx", ",", "vy", ",", "vz", "=", "coord", "r", "=", "np", ".", "linalg", ".", "norm", "(", "coord", "[", ":", "3", "]", ")", "p...
Cartesian to Spherical conversion .. warning:: The spherical form is equatorial, not zenithal
[ "Cartesian", "to", "Spherical", "conversion" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/forms.py#L251-L265
train
galactics/beyond
beyond/orbits/forms.py
Form._spherical_to_cartesian
def _spherical_to_cartesian(cls, coord, center): """Spherical to cartesian conversion """ r, theta, phi, r_dot, theta_dot, phi_dot = coord x = r * cos(phi) * cos(theta) y = r * cos(phi) * sin(theta) z = r * sin(phi) vx = r_dot * x / r - y * theta_dot - z * phi_do...
python
def _spherical_to_cartesian(cls, coord, center): """Spherical to cartesian conversion """ r, theta, phi, r_dot, theta_dot, phi_dot = coord x = r * cos(phi) * cos(theta) y = r * cos(phi) * sin(theta) z = r * sin(phi) vx = r_dot * x / r - y * theta_dot - z * phi_do...
[ "def", "_spherical_to_cartesian", "(", "cls", ",", "coord", ",", "center", ")", ":", "r", ",", "theta", ",", "phi", ",", "r_dot", ",", "theta_dot", ",", "phi_dot", "=", "coord", "x", "=", "r", "*", "cos", "(", "phi", ")", "*", "cos", "(", "theta", ...
Spherical to cartesian conversion
[ "Spherical", "to", "cartesian", "conversion" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/forms.py#L268-L280
train
galactics/beyond
beyond/orbits/ephem.py
Ephem.interpolate
def interpolate(self, date, method=None, order=None): """Interpolate data at a given date Args: date (Date): method (str): Method of interpolation to use order (int): In case of ``LAGRANGE`` method is used Return: Orbit: """ if no...
python
def interpolate(self, date, method=None, order=None): """Interpolate data at a given date Args: date (Date): method (str): Method of interpolation to use order (int): In case of ``LAGRANGE`` method is used Return: Orbit: """ if no...
[ "def", "interpolate", "(", "self", ",", "date", ",", "method", "=", "None", ",", "order", "=", "None", ")", ":", "if", "not", "self", ".", "start", "<=", "date", "<=", "self", ".", "stop", ":", "raise", "ValueError", "(", "\"Date '%s' not in range\"", ...
Interpolate data at a given date Args: date (Date): method (str): Method of interpolation to use order (int): In case of ``LAGRANGE`` method is used Return: Orbit:
[ "Interpolate", "data", "at", "a", "given", "date" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/ephem.py#L102-L177
train
galactics/beyond
beyond/orbits/ephem.py
Ephem.iter
def iter(self, *, dates=None, start=None, stop=None, step=None, strict=True, **kwargs): """Ephemeris generator based on the data of this one, but with different dates Keyword Arguments: dates (list of :py:class:`~beyond.dates.date.Date`): Dates from which iterate over start (Dat...
python
def iter(self, *, dates=None, start=None, stop=None, step=None, strict=True, **kwargs): """Ephemeris generator based on the data of this one, but with different dates Keyword Arguments: dates (list of :py:class:`~beyond.dates.date.Date`): Dates from which iterate over start (Dat...
[ "def", "iter", "(", "self", ",", "*", ",", "dates", "=", "None", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "step", "=", "None", ",", "strict", "=", "True", ",", "**", "kwargs", ")", ":", "listeners", "=", "kwargs", ".", "get", "...
Ephemeris generator based on the data of this one, but with different dates Keyword Arguments: dates (list of :py:class:`~beyond.dates.date.Date`): Dates from which iterate over start (Date or None): Date of the first point stop (Date, timedelta or None): Date of the last po...
[ "Ephemeris", "generator", "based", "on", "the", "data", "of", "this", "one", "but", "with", "different", "dates" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/ephem.py#L184-L307
train
galactics/beyond
beyond/orbits/ephem.py
Ephem.ephem
def ephem(self, *args, **kwargs): """Create an Ephem object which is a subset of this one Take the same keyword arguments as :py:meth:`ephemeris` Return: Ephem: """ return self.__class__(self.ephemeris(*args, **kwargs))
python
def ephem(self, *args, **kwargs): """Create an Ephem object which is a subset of this one Take the same keyword arguments as :py:meth:`ephemeris` Return: Ephem: """ return self.__class__(self.ephemeris(*args, **kwargs))
[ "def", "ephem", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "return", "self", ".", "__class__", "(", "self", ".", "ephemeris", "(", "*", "args", ",", "**", "kwargs", ")", ")" ]
Create an Ephem object which is a subset of this one Take the same keyword arguments as :py:meth:`ephemeris` Return: Ephem:
[ "Create", "an", "Ephem", "object", "which", "is", "a", "subset", "of", "this", "one" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/ephem.py#L316-L325
train
galactics/beyond
beyond/orbits/ephem.py
Ephem.copy
def copy(self, *, form=None, frame=None): # pragma: no cover """Create a deep copy of the ephemeris, and allow frame and form changing """ new = self.ephem() if frame: new.frame = frame if form: new.form = form return new
python
def copy(self, *, form=None, frame=None): # pragma: no cover """Create a deep copy of the ephemeris, and allow frame and form changing """ new = self.ephem() if frame: new.frame = frame if form: new.form = form return new
[ "def", "copy", "(", "self", ",", "*", ",", "form", "=", "None", ",", "frame", "=", "None", ")", ":", "new", "=", "self", ".", "ephem", "(", ")", "if", "frame", ":", "new", ".", "frame", "=", "frame", "if", "form", ":", "new", ".", "form", "="...
Create a deep copy of the ephemeris, and allow frame and form changing
[ "Create", "a", "deep", "copy", "of", "the", "ephemeris", "and", "allow", "frame", "and", "form", "changing" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/ephem.py#L327-L336
train
galactics/beyond
beyond/utils/ccsds.py
loads
def loads(text): """Read CCSDS from a string, and provide the beyond class corresponding; Orbit or list of Orbit if it's an OPM, Ephem if it's an OEM. Args: text (str): Return: Orbit or Ephem Raise: ValueError: when the text is not a recognizable CCSDS format """ if ...
python
def loads(text): """Read CCSDS from a string, and provide the beyond class corresponding; Orbit or list of Orbit if it's an OPM, Ephem if it's an OEM. Args: text (str): Return: Orbit or Ephem Raise: ValueError: when the text is not a recognizable CCSDS format """ if ...
[ "def", "loads", "(", "text", ")", ":", "if", "text", ".", "startswith", "(", "\"CCSDS_OEM_VERS\"", ")", ":", "func", "=", "_read_oem", "elif", "text", ".", "startswith", "(", "\"CCSDS_OPM_VERS\"", ")", ":", "func", "=", "_read_opm", "else", ":", "raise", ...
Read CCSDS from a string, and provide the beyond class corresponding; Orbit or list of Orbit if it's an OPM, Ephem if it's an OEM. Args: text (str): Return: Orbit or Ephem Raise: ValueError: when the text is not a recognizable CCSDS format
[ "Read", "CCSDS", "from", "a", "string", "and", "provide", "the", "beyond", "class", "corresponding", ";", "Orbit", "or", "list", "of", "Orbit", "if", "it", "s", "an", "OPM", "Ephem", "if", "it", "s", "an", "OEM", "." ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/utils/ccsds.py#L31-L48
train
galactics/beyond
beyond/utils/ccsds.py
dumps
def dumps(data, **kwargs): """Create a string CCSDS representation of the object Same arguments and behaviour as :py:func:`dump` """ if isinstance(data, Ephem) or (isinstance(data, Iterable) and all(isinstance(x, Ephem) for x in data)): content = _dump_oem(data, **kwargs) elif isinstance(da...
python
def dumps(data, **kwargs): """Create a string CCSDS representation of the object Same arguments and behaviour as :py:func:`dump` """ if isinstance(data, Ephem) or (isinstance(data, Iterable) and all(isinstance(x, Ephem) for x in data)): content = _dump_oem(data, **kwargs) elif isinstance(da...
[ "def", "dumps", "(", "data", ",", "**", "kwargs", ")", ":", "if", "isinstance", "(", "data", ",", "Ephem", ")", "or", "(", "isinstance", "(", "data", ",", "Iterable", ")", "and", "all", "(", "isinstance", "(", "x", ",", "Ephem", ")", "for", "x", ...
Create a string CCSDS representation of the object Same arguments and behaviour as :py:func:`dump`
[ "Create", "a", "string", "CCSDS", "representation", "of", "the", "object" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/utils/ccsds.py#L66-L78
train
galactics/beyond
beyond/utils/ccsds.py
_float
def _float(value): """Conversion of state vector field, with automatic unit handling """ if "[" in value: # There is a unit field value, sep, unit = value.partition("[") unit = sep + unit # As defined in the CCSDS Orbital Data Message Blue Book, the unit should # be ...
python
def _float(value): """Conversion of state vector field, with automatic unit handling """ if "[" in value: # There is a unit field value, sep, unit = value.partition("[") unit = sep + unit # As defined in the CCSDS Orbital Data Message Blue Book, the unit should # be ...
[ "def", "_float", "(", "value", ")", ":", "if", "\"[\"", "in", "value", ":", "value", ",", "sep", ",", "unit", "=", "value", ".", "partition", "(", "\"[\"", ")", "unit", "=", "sep", "+", "unit", "if", "unit", "in", "(", "\"[km]\"", ",", "\"[km/s]\""...
Conversion of state vector field, with automatic unit handling
[ "Conversion", "of", "state", "vector", "field", "with", "automatic", "unit", "handling" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/utils/ccsds.py#L81-L102
train
galactics/beyond
beyond/frames/iau2010.py
_tab
def _tab(element): """Extraction and caching of IAU2000 nutation coefficients """ elements = { 'x': 'tab5.2a.txt', 'y': 'tab5.2b.txt', 's': 'tab5.2d.txt' } if element.lower() not in elements.keys(): raise ValueError('Unknown element \'%s\'' % element) filepath ...
python
def _tab(element): """Extraction and caching of IAU2000 nutation coefficients """ elements = { 'x': 'tab5.2a.txt', 'y': 'tab5.2b.txt', 's': 'tab5.2d.txt' } if element.lower() not in elements.keys(): raise ValueError('Unknown element \'%s\'' % element) filepath ...
[ "def", "_tab", "(", "element", ")", ":", "elements", "=", "{", "'x'", ":", "'tab5.2a.txt'", ",", "'y'", ":", "'tab5.2b.txt'", ",", "'s'", ":", "'tab5.2d.txt'", "}", "if", "element", ".", "lower", "(", ")", "not", "in", "elements", ".", "keys", "(", "...
Extraction and caching of IAU2000 nutation coefficients
[ "Extraction", "and", "caching", "of", "IAU2000", "nutation", "coefficients" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau2010.py#L15-L51
train
galactics/beyond
beyond/frames/iau2010.py
_earth_orientation
def _earth_orientation(date): """Earth orientation parameters in degrees """ ttt = date.change_scale('TT').julian_century # a_a = 0.12 # a_c = 0.26 # s_prime = -0.0015 * (a_c ** 2 / 1.2 + a_a ** 2) * ttt s_prime = - 0.000047 * ttt return date.eop.x / 3600., date.eop.y / 3600., s_prime ...
python
def _earth_orientation(date): """Earth orientation parameters in degrees """ ttt = date.change_scale('TT').julian_century # a_a = 0.12 # a_c = 0.26 # s_prime = -0.0015 * (a_c ** 2 / 1.2 + a_a ** 2) * ttt s_prime = - 0.000047 * ttt return date.eop.x / 3600., date.eop.y / 3600., s_prime ...
[ "def", "_earth_orientation", "(", "date", ")", ":", "ttt", "=", "date", ".", "change_scale", "(", "'TT'", ")", ".", "julian_century", "s_prime", "=", "-", "0.000047", "*", "ttt", "return", "date", ".", "eop", ".", "x", "/", "3600.", ",", "date", ".", ...
Earth orientation parameters in degrees
[ "Earth", "orientation", "parameters", "in", "degrees" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau2010.py#L54-L64
train
galactics/beyond
beyond/frames/iau2010.py
earth_orientation
def earth_orientation(date): """Earth orientation as a rotating matrix """ x_p, y_p, s_prime = np.deg2rad(_earth_orientation(date)) return rot3(-s_prime) @ rot2(x_p) @ rot1(y_p)
python
def earth_orientation(date): """Earth orientation as a rotating matrix """ x_p, y_p, s_prime = np.deg2rad(_earth_orientation(date)) return rot3(-s_prime) @ rot2(x_p) @ rot1(y_p)
[ "def", "earth_orientation", "(", "date", ")", ":", "x_p", ",", "y_p", ",", "s_prime", "=", "np", ".", "deg2rad", "(", "_earth_orientation", "(", "date", ")", ")", "return", "rot3", "(", "-", "s_prime", ")", "@", "rot2", "(", "x_p", ")", "@", "rot1", ...
Earth orientation as a rotating matrix
[ "Earth", "orientation", "as", "a", "rotating", "matrix" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau2010.py#L67-L72
train
galactics/beyond
beyond/frames/iau2010.py
_xys
def _xys(date): """Get The X, Y and s coordinates Args: date (Date): Return: 3-tuple of float: Values of X, Y and s, in radians """ X, Y, s_xy2 = _xysxy2(date) # convert milli-arcsecond to arcsecond dX, dY = date.eop.dx / 1000., date.eop.dy / 1000. # Convert arcsecond...
python
def _xys(date): """Get The X, Y and s coordinates Args: date (Date): Return: 3-tuple of float: Values of X, Y and s, in radians """ X, Y, s_xy2 = _xysxy2(date) # convert milli-arcsecond to arcsecond dX, dY = date.eop.dx / 1000., date.eop.dy / 1000. # Convert arcsecond...
[ "def", "_xys", "(", "date", ")", ":", "X", ",", "Y", ",", "s_xy2", "=", "_xysxy2", "(", "date", ")", "dX", ",", "dY", "=", "date", ".", "eop", ".", "dx", "/", "1000.", ",", "date", ".", "eop", ".", "dy", "/", "1000.", "X", "=", "np", ".", ...
Get The X, Y and s coordinates Args: date (Date): Return: 3-tuple of float: Values of X, Y and s, in radians
[ "Get", "The", "X", "Y", "and", "s", "coordinates" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau2010.py#L188-L207
train
galactics/beyond
beyond/propagators/sgp4.py
Sgp4.orbit
def orbit(self, orbit): """Initialize the propagator Args: orbit (Orbit) """ self._orbit = orbit tle = Tle.from_orbit(orbit) lines = tle.text.splitlines() if len(lines) == 3: _, line1, line2 = lines else: line1, line2...
python
def orbit(self, orbit): """Initialize the propagator Args: orbit (Orbit) """ self._orbit = orbit tle = Tle.from_orbit(orbit) lines = tle.text.splitlines() if len(lines) == 3: _, line1, line2 = lines else: line1, line2...
[ "def", "orbit", "(", "self", ",", "orbit", ")", ":", "self", ".", "_orbit", "=", "orbit", "tle", "=", "Tle", ".", "from_orbit", "(", "orbit", ")", "lines", "=", "tle", ".", "text", ".", "splitlines", "(", ")", "if", "len", "(", "lines", ")", "=="...
Initialize the propagator Args: orbit (Orbit)
[ "Initialize", "the", "propagator" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/propagators/sgp4.py#L21-L37
train
galactics/beyond
beyond/propagators/sgp4.py
Sgp4.propagate
def propagate(self, date): """Propagate the initialized orbit Args: date (Date or datetime.timedelta) Return: Orbit """ if type(date) is timedelta: date = self.orbit.date + date # Convert the date to a tuple usable by the sgp4 librar...
python
def propagate(self, date): """Propagate the initialized orbit Args: date (Date or datetime.timedelta) Return: Orbit """ if type(date) is timedelta: date = self.orbit.date + date # Convert the date to a tuple usable by the sgp4 librar...
[ "def", "propagate", "(", "self", ",", "date", ")", ":", "if", "type", "(", "date", ")", "is", "timedelta", ":", "date", "=", "self", ".", "orbit", ".", "date", "+", "date", "_date", "=", "[", "float", "(", "x", ")", "for", "x", "in", "\"{:%Y %m %...
Propagate the initialized orbit Args: date (Date or datetime.timedelta) Return: Orbit
[ "Propagate", "the", "initialized", "orbit" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/propagators/sgp4.py#L39-L65
train
galactics/beyond
beyond/frames/local.py
to_tnw
def to_tnw(orbit): """In the TNW Local Orbital Reference Frame, x is oriented along the velocity vector, z along the angular momentum, and y complete the frame. Args: orbit (list): Array of length 6 Return: numpy.ndarray: matrix to convert from inertial frame to TNW. >>> delta_tnw ...
python
def to_tnw(orbit): """In the TNW Local Orbital Reference Frame, x is oriented along the velocity vector, z along the angular momentum, and y complete the frame. Args: orbit (list): Array of length 6 Return: numpy.ndarray: matrix to convert from inertial frame to TNW. >>> delta_tnw ...
[ "def", "to_tnw", "(", "orbit", ")", ":", "pos", ",", "vel", "=", "_split", "(", "orbit", ")", "t", "=", "vel", "/", "norm", "(", "vel", ")", "w", "=", "np", ".", "cross", "(", "pos", ",", "vel", ")", "/", "(", "norm", "(", "pos", ")", "*", ...
In the TNW Local Orbital Reference Frame, x is oriented along the velocity vector, z along the angular momentum, and y complete the frame. Args: orbit (list): Array of length 6 Return: numpy.ndarray: matrix to convert from inertial frame to TNW. >>> delta_tnw = [1, 0, 0] >>> p = [-...
[ "In", "the", "TNW", "Local", "Orbital", "Reference", "Frame", "x", "is", "oriented", "along", "the", "velocity", "vector", "z", "along", "the", "angular", "momentum", "and", "y", "complete", "the", "frame", "." ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/local.py#L13-L38
train
galactics/beyond
beyond/frames/local.py
to_qsw
def to_qsw(orbit): """In the QSW Local Orbital Reference Frame, x is oriented along the position vector, z along the angular momentum, and y complete the frame. The frame is sometimes also called RSW (where R stands for radial) or LVLH (Local Vertical Local Horizontal). Args: orbit (list):...
python
def to_qsw(orbit): """In the QSW Local Orbital Reference Frame, x is oriented along the position vector, z along the angular momentum, and y complete the frame. The frame is sometimes also called RSW (where R stands for radial) or LVLH (Local Vertical Local Horizontal). Args: orbit (list):...
[ "def", "to_qsw", "(", "orbit", ")", ":", "pos", ",", "vel", "=", "_split", "(", "orbit", ")", "q", "=", "pos", "/", "norm", "(", "pos", ")", "w", "=", "np", ".", "cross", "(", "pos", ",", "vel", ")", "/", "(", "norm", "(", "pos", ")", "*", ...
In the QSW Local Orbital Reference Frame, x is oriented along the position vector, z along the angular momentum, and y complete the frame. The frame is sometimes also called RSW (where R stands for radial) or LVLH (Local Vertical Local Horizontal). Args: orbit (list): Array of length 6 Ret...
[ "In", "the", "QSW", "Local", "Orbital", "Reference", "Frame", "x", "is", "oriented", "along", "the", "position", "vector", "z", "along", "the", "angular", "momentum", "and", "y", "complete", "the", "frame", "." ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/local.py#L41-L69
train
galactics/beyond
beyond/orbits/tle.py
_float
def _float(text): """Fonction to convert the 'decimal point assumed' format of TLE to actual float >>> _float('0000+0') 0.0 >>> _float('+0000+0') 0.0 >>> _float('34473-3') 0.00034473 >>> _float('-60129-4') -6.0129e-05 >>> _float('+45871-4') 4.5871e-05 """ text ...
python
def _float(text): """Fonction to convert the 'decimal point assumed' format of TLE to actual float >>> _float('0000+0') 0.0 >>> _float('+0000+0') 0.0 >>> _float('34473-3') 0.00034473 >>> _float('-60129-4') -6.0129e-05 >>> _float('+45871-4') 4.5871e-05 """ text ...
[ "def", "_float", "(", "text", ")", ":", "text", "=", "text", ".", "strip", "(", ")", "if", "text", "[", "0", "]", "in", "(", "'-'", ",", "'+'", ")", ":", "text", "=", "\"%s.%s\"", "%", "(", "text", "[", "0", "]", ",", "text", "[", "1", ":",...
Fonction to convert the 'decimal point assumed' format of TLE to actual float >>> _float('0000+0') 0.0 >>> _float('+0000+0') 0.0 >>> _float('34473-3') 0.00034473 >>> _float('-60129-4') -6.0129e-05 >>> _float('+45871-4') 4.5871e-05
[ "Fonction", "to", "convert", "the", "decimal", "point", "assumed", "format", "of", "TLE", "to", "actual", "float" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/tle.py#L49-L79
train
galactics/beyond
beyond/orbits/tle.py
_unfloat
def _unfloat(flt, precision=5): """Function to convert float to 'decimal point assumed' format >>> _unfloat(0) '00000-0' >>> _unfloat(3.4473e-4) '34473-3' >>> _unfloat(-6.0129e-05) '-60129-4' >>> _unfloat(4.5871e-05) '45871-4' """ if flt == 0.: return "{}-0".format(...
python
def _unfloat(flt, precision=5): """Function to convert float to 'decimal point assumed' format >>> _unfloat(0) '00000-0' >>> _unfloat(3.4473e-4) '34473-3' >>> _unfloat(-6.0129e-05) '-60129-4' >>> _unfloat(4.5871e-05) '45871-4' """ if flt == 0.: return "{}-0".format(...
[ "def", "_unfloat", "(", "flt", ",", "precision", "=", "5", ")", ":", "if", "flt", "==", "0.", ":", "return", "\"{}-0\"", ".", "format", "(", "\"0\"", "*", "precision", ")", "num", ",", "_", ",", "exp", "=", "\"{:.{}e}\"", ".", "format", "(", "flt",...
Function to convert float to 'decimal point assumed' format >>> _unfloat(0) '00000-0' >>> _unfloat(3.4473e-4) '34473-3' >>> _unfloat(-6.0129e-05) '-60129-4' >>> _unfloat(4.5871e-05) '45871-4'
[ "Function", "to", "convert", "float", "to", "decimal", "point", "assumed", "format" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/tle.py#L82-L102
train
galactics/beyond
beyond/orbits/tle.py
Tle._check_validity
def _check_validity(cls, text): """Check the validity of a TLE Args: text (tuple of str) Raise: ValueError """ if not text[0].lstrip().startswith('1 ') or not text[1].lstrip().startswith('2 '): raise ValueError("Line number check failed") ...
python
def _check_validity(cls, text): """Check the validity of a TLE Args: text (tuple of str) Raise: ValueError """ if not text[0].lstrip().startswith('1 ') or not text[1].lstrip().startswith('2 '): raise ValueError("Line number check failed") ...
[ "def", "_check_validity", "(", "cls", ",", "text", ")", ":", "if", "not", "text", "[", "0", "]", ".", "lstrip", "(", ")", ".", "startswith", "(", "'1 '", ")", "or", "not", "text", "[", "1", "]", ".", "lstrip", "(", ")", ".", "startswith", "(", ...
Check the validity of a TLE Args: text (tuple of str) Raise: ValueError
[ "Check", "the", "validity", "of", "a", "TLE" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/tle.py#L163-L178
train
galactics/beyond
beyond/orbits/tle.py
Tle._checksum
def _checksum(cls, line): """Compute the checksum of a full line Args: line (str): Line to compute the checksum from Return: int: Checksum (modulo 10) """ tr_table = str.maketrans({c: None for c in ascii_uppercase + "+ ."}) no_letters = line[:68]....
python
def _checksum(cls, line): """Compute the checksum of a full line Args: line (str): Line to compute the checksum from Return: int: Checksum (modulo 10) """ tr_table = str.maketrans({c: None for c in ascii_uppercase + "+ ."}) no_letters = line[:68]....
[ "def", "_checksum", "(", "cls", ",", "line", ")", ":", "tr_table", "=", "str", ".", "maketrans", "(", "{", "c", ":", "None", "for", "c", "in", "ascii_uppercase", "+", "\"+ .\"", "}", ")", "no_letters", "=", "line", "[", ":", "68", "]", ".", "transl...
Compute the checksum of a full line Args: line (str): Line to compute the checksum from Return: int: Checksum (modulo 10)
[ "Compute", "the", "checksum", "of", "a", "full", "line" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/tle.py#L181-L191
train
galactics/beyond
beyond/orbits/tle.py
Tle.orbit
def orbit(self): """Convert TLE to Orbit object, in order to make computations on it Return: ~beyond.orbits.orbit.Orbit: """ data = { 'bstar': self.bstar, 'ndot': self.ndot, 'ndotdot': self.ndotdot, 'tle': self.text } ...
python
def orbit(self): """Convert TLE to Orbit object, in order to make computations on it Return: ~beyond.orbits.orbit.Orbit: """ data = { 'bstar': self.bstar, 'ndot': self.ndot, 'ndotdot': self.ndotdot, 'tle': self.text } ...
[ "def", "orbit", "(", "self", ")", ":", "data", "=", "{", "'bstar'", ":", "self", ".", "bstar", ",", "'ndot'", ":", "self", ".", "ndot", ",", "'ndotdot'", ":", "self", ".", "ndotdot", ",", "'tle'", ":", "self", ".", "text", "}", "return", "Orbit", ...
Convert TLE to Orbit object, in order to make computations on it Return: ~beyond.orbits.orbit.Orbit:
[ "Convert", "TLE", "to", "Orbit", "object", "in", "order", "to", "make", "computations", "on", "it" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/tle.py#L199-L211
train
galactics/beyond
beyond/orbits/tle.py
Tle.from_string
def from_string(cls, text, comments="#", error="warn"): """Generator of TLEs from a string Args: text (str): A text containing many TLEs comments (str): If a line starts with this character, it is ignored error (str): How to handle errors while parsing the text. Coul...
python
def from_string(cls, text, comments="#", error="warn"): """Generator of TLEs from a string Args: text (str): A text containing many TLEs comments (str): If a line starts with this character, it is ignored error (str): How to handle errors while parsing the text. Coul...
[ "def", "from_string", "(", "cls", ",", "text", ",", "comments", "=", "\"#\"", ",", "error", "=", "\"warn\"", ")", ":", "cache", "=", "[", "]", "for", "line", "in", "text", ".", "splitlines", "(", ")", ":", "if", "not", "line", ".", "strip", "(", ...
Generator of TLEs from a string Args: text (str): A text containing many TLEs comments (str): If a line starts with this character, it is ignored error (str): How to handle errors while parsing the text. Could be 'raise', 'warn' or 'ignore'. Yields: ...
[ "Generator", "of", "TLEs", "from", "a", "string" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/tle.py#L264-L304
train
galactics/beyond
beyond/frames/frames.py
orbit2frame
def orbit2frame(name, ref_orbit, orientation=None, center=None, bypass=False): """Create a frame based on a Orbit or Ephem object. Args: name (str): Name to give the created frame ref_orbit (Orbit or Ephem): orientation (str): Orientation of the created frame bypass (bool): By-p...
python
def orbit2frame(name, ref_orbit, orientation=None, center=None, bypass=False): """Create a frame based on a Orbit or Ephem object. Args: name (str): Name to give the created frame ref_orbit (Orbit or Ephem): orientation (str): Orientation of the created frame bypass (bool): By-p...
[ "def", "orbit2frame", "(", "name", ",", "ref_orbit", ",", "orientation", "=", "None", ",", "center", "=", "None", ",", "bypass", "=", "False", ")", ":", "if", "orientation", "is", "None", ":", "orientation", "=", "ref_orbit", ".", "frame", ".", "orientat...
Create a frame based on a Orbit or Ephem object. Args: name (str): Name to give the created frame ref_orbit (Orbit or Ephem): orientation (str): Orientation of the created frame bypass (bool): By-pass the warning when creating a frame with an already taken name Retur...
[ "Create", "a", "frame", "based", "on", "a", "Orbit", "or", "Ephem", "object", "." ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/frames.py#L296-L364
train
galactics/beyond
beyond/frames/frames.py
Frame.transform
def transform(self, new_frame): """Change the frame of the orbit Args: new_frame (str) Return: numpy.ndarray """ steps = self.__class__.steps(new_frame) orbit = self.orbit for _from, _to in steps: from_obj = _from(self.date...
python
def transform(self, new_frame): """Change the frame of the orbit Args: new_frame (str) Return: numpy.ndarray """ steps = self.__class__.steps(new_frame) orbit = self.orbit for _from, _to in steps: from_obj = _from(self.date...
[ "def", "transform", "(", "self", ",", "new_frame", ")", ":", "steps", "=", "self", ".", "__class__", ".", "steps", "(", "new_frame", ")", "orbit", "=", "self", ".", "orbit", "for", "_from", ",", "_to", "in", "steps", ":", "from_obj", "=", "_from", "(...
Change the frame of the orbit Args: new_frame (str) Return: numpy.ndarray
[ "Change", "the", "frame", "of", "the", "orbit" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/frames.py#L152-L188
train
galactics/beyond
beyond/dates/date.py
Timescale._scale_tdb_minus_tt
def _scale_tdb_minus_tt(self, mjd, eop): """Definition of the Barycentric Dynamic Time scale relatively to Terrestrial Time """ jd = mjd + Date.JD_MJD jj = Date._julian_century(jd) m = radians(357.5277233 + 35999.05034 * jj) delta_lambda = radians(246.11 + 0.90251792 * (j...
python
def _scale_tdb_minus_tt(self, mjd, eop): """Definition of the Barycentric Dynamic Time scale relatively to Terrestrial Time """ jd = mjd + Date.JD_MJD jj = Date._julian_century(jd) m = radians(357.5277233 + 35999.05034 * jj) delta_lambda = radians(246.11 + 0.90251792 * (j...
[ "def", "_scale_tdb_minus_tt", "(", "self", ",", "mjd", ",", "eop", ")", ":", "jd", "=", "mjd", "+", "Date", ".", "JD_MJD", "jj", "=", "Date", ".", "_julian_century", "(", "jd", ")", "m", "=", "radians", "(", "357.5277233", "+", "35999.05034", "*", "j...
Definition of the Barycentric Dynamic Time scale relatively to Terrestrial Time
[ "Definition", "of", "the", "Barycentric", "Dynamic", "Time", "scale", "relatively", "to", "Terrestrial", "Time" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/dates/date.py#L46-L53
train
galactics/beyond
beyond/dates/date.py
Timescale.offset
def offset(self, mjd, new_scale, eop): """Compute the offset necessary in order to convert from one time-scale to another Args: mjd (float): new_scale (str): Name of the desired scale Return: float: offset to apply in seconds """ delta = 0 ...
python
def offset(self, mjd, new_scale, eop): """Compute the offset necessary in order to convert from one time-scale to another Args: mjd (float): new_scale (str): Name of the desired scale Return: float: offset to apply in seconds """ delta = 0 ...
[ "def", "offset", "(", "self", ",", "mjd", ",", "new_scale", ",", "eop", ")", ":", "delta", "=", "0", "for", "one", ",", "two", "in", "self", ".", "steps", "(", "new_scale", ")", ":", "one", "=", "one", ".", "name", ".", "lower", "(", ")", "two"...
Compute the offset necessary in order to convert from one time-scale to another Args: mjd (float): new_scale (str): Name of the desired scale Return: float: offset to apply in seconds
[ "Compute", "the", "offset", "necessary", "in", "order", "to", "convert", "from", "one", "time", "-", "scale", "to", "another" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/dates/date.py#L55-L80
train
galactics/beyond
beyond/dates/date.py
Date.datetime
def datetime(self): """Conversion of the Date object into a ``datetime.datetime`` The resulting object is a timezone-naive instance with the same scale as the originating Date object. """ if 'dt_scale' not in self._cache.keys(): self._cache['dt_scale'] = self._dateti...
python
def datetime(self): """Conversion of the Date object into a ``datetime.datetime`` The resulting object is a timezone-naive instance with the same scale as the originating Date object. """ if 'dt_scale' not in self._cache.keys(): self._cache['dt_scale'] = self._dateti...
[ "def", "datetime", "(", "self", ")", ":", "if", "'dt_scale'", "not", "in", "self", ".", "_cache", ".", "keys", "(", ")", ":", "self", ".", "_cache", "[", "'dt_scale'", "]", "=", "self", ".", "_datetime", "-", "timedelta", "(", "seconds", "=", "self",...
Conversion of the Date object into a ``datetime.datetime`` The resulting object is a timezone-naive instance with the same scale as the originating Date object.
[ "Conversion", "of", "the", "Date", "object", "into", "a", "datetime", ".", "datetime" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/dates/date.py#L326-L334
train
galactics/beyond
beyond/dates/date.py
Date.strptime
def strptime(cls, data, format, scale=DEFAULT_SCALE): # pragma: no cover """Convert a string representation of a date to a Date object """ return cls(datetime.strptime(data, format), scale=scale)
python
def strptime(cls, data, format, scale=DEFAULT_SCALE): # pragma: no cover """Convert a string representation of a date to a Date object """ return cls(datetime.strptime(data, format), scale=scale)
[ "def", "strptime", "(", "cls", ",", "data", ",", "format", ",", "scale", "=", "DEFAULT_SCALE", ")", ":", "return", "cls", "(", "datetime", ".", "strptime", "(", "data", ",", "format", ")", ",", "scale", "=", "scale", ")" ]
Convert a string representation of a date to a Date object
[ "Convert", "a", "string", "representation", "of", "a", "date", "to", "a", "Date", "object" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/dates/date.py#L347-L350
train
galactics/beyond
beyond/dates/date.py
Date.range
def range(cls, start=None, stop=None, step=None, inclusive=False): """Generator of a date range Args: start (Date): stop (Date or datetime.timedelta)! step (timedelta): Keyword Args: inclusive (bool): If ``False``, the stopping date is not include...
python
def range(cls, start=None, stop=None, step=None, inclusive=False): """Generator of a date range Args: start (Date): stop (Date or datetime.timedelta)! step (timedelta): Keyword Args: inclusive (bool): If ``False``, the stopping date is not include...
[ "def", "range", "(", "cls", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "step", "=", "None", ",", "inclusive", "=", "False", ")", ":", "def", "sign", "(", "x", ")", ":", "return", "(", "-", "1", ",", "1", ")", "[", "x", ">=", ...
Generator of a date range Args: start (Date): stop (Date or datetime.timedelta)! step (timedelta): Keyword Args: inclusive (bool): If ``False``, the stopping date is not included. This is the same behavior as the built-in :py:func:`range`....
[ "Generator", "of", "a", "date", "range" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/dates/date.py#L421-L459
train
galactics/beyond
beyond/propagators/kepler.py
Kepler._newton
def _newton(self, orb, step): """Newton's Law of Universal Gravitation """ date = orb.date + step new_body = zeros(6) new_body[:3] = orb[3:] for body in self.bodies: # retrieve the position of the body at the given date orb_body = body.propagate...
python
def _newton(self, orb, step): """Newton's Law of Universal Gravitation """ date = orb.date + step new_body = zeros(6) new_body[:3] = orb[3:] for body in self.bodies: # retrieve the position of the body at the given date orb_body = body.propagate...
[ "def", "_newton", "(", "self", ",", "orb", ",", "step", ")", ":", "date", "=", "orb", ".", "date", "+", "step", "new_body", "=", "zeros", "(", "6", ")", "new_body", "[", ":", "3", "]", "=", "orb", "[", "3", ":", "]", "for", "body", "in", "sel...
Newton's Law of Universal Gravitation
[ "Newton", "s", "Law", "of", "Universal", "Gravitation" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/propagators/kepler.py#L95-L114
train
galactics/beyond
beyond/propagators/kepler.py
Kepler._make_step
def _make_step(self, orb, step): """Compute the next step with the selected method """ method = self.BUTCHER[self.method] a, b, c = method['a'], method['b'], method['c'] y_n = orb.copy() ks = [self._newton(y_n, timedelta(0))] for a, c in zip(a[1:], c[1:]): ...
python
def _make_step(self, orb, step): """Compute the next step with the selected method """ method = self.BUTCHER[self.method] a, b, c = method['a'], method['b'], method['c'] y_n = orb.copy() ks = [self._newton(y_n, timedelta(0))] for a, c in zip(a[1:], c[1:]): ...
[ "def", "_make_step", "(", "self", ",", "orb", ",", "step", ")", ":", "method", "=", "self", ".", "BUTCHER", "[", "self", ".", "method", "]", "a", ",", "b", ",", "c", "=", "method", "[", "'a'", "]", ",", "method", "[", "'b'", "]", ",", "method",...
Compute the next step with the selected method
[ "Compute", "the", "next", "step", "with", "the", "selected", "method" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/propagators/kepler.py#L116-L142
train
galactics/beyond
beyond/propagators/kepler.py
SOIPropagator._soi
def _soi(self, orb): """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. """ for body in self.alt: soi = self.SOI[body.name] sph ...
python
def _soi(self, orb): """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. """ for body in self.alt: soi = self.SOI[body.name] sph ...
[ "def", "_soi", "(", "self", ",", "orb", ")", ":", "for", "body", "in", "self", ".", "alt", ":", "soi", "=", "self", ".", "SOI", "[", "body", ".", "name", "]", "sph", "=", "orb", ".", "copy", "(", "frame", "=", "soi", ".", "frame", ",", "form"...
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.
[ "Evaluate", "the", "need", "for", "SOI", "transition", "by", "comparing", "the", "radial", "distance", "between", "the", "considered", "body", "and", "the", "spacecraft" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/propagators/kepler.py#L232-L248
train
galactics/beyond
beyond/propagators/kepler.py
SOIPropagator._change_soi
def _change_soi(self, body): """Modify the inner parameters of the Kepler propagator in order to place the spacecraft in the right Sphere of Influence """ if body == self.central: self.bodies = [self.central] self.step = self.central_step self.active ...
python
def _change_soi(self, body): """Modify the inner parameters of the Kepler propagator in order to place the spacecraft in the right Sphere of Influence """ if body == self.central: self.bodies = [self.central] self.step = self.central_step self.active ...
[ "def", "_change_soi", "(", "self", ",", "body", ")", ":", "if", "body", "==", "self", ".", "central", ":", "self", ".", "bodies", "=", "[", "self", ".", "central", "]", "self", ".", "step", "=", "self", ".", "central_step", "self", ".", "active", "...
Modify the inner parameters of the Kepler propagator in order to place the spacecraft in the right Sphere of Influence
[ "Modify", "the", "inner", "parameters", "of", "the", "Kepler", "propagator", "in", "order", "to", "place", "the", "spacecraft", "in", "the", "right", "Sphere", "of", "Influence" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/propagators/kepler.py#L250-L265
train
galactics/beyond
beyond/dates/eop.py
register
def register(name=EopDb.DEFAULT_DBNAME): """Decorator for registering an Eop Database Example: .. code-block:: python @register class SqliteEnvDatabase: # sqlite implementation # this database will be known as 'default' @register('json') class Json...
python
def register(name=EopDb.DEFAULT_DBNAME): """Decorator for registering an Eop Database Example: .. code-block:: python @register class SqliteEnvDatabase: # sqlite implementation # this database will be known as 'default' @register('json') class Json...
[ "def", "register", "(", "name", "=", "EopDb", ".", "DEFAULT_DBNAME", ")", ":", "if", "isinstance", "(", "name", ",", "str", ")", ":", "def", "wrapper", "(", "klass", ")", ":", "EopDb", ".", "register", "(", "klass", ",", "name", ")", "return", "klass...
Decorator for registering an Eop Database Example: .. code-block:: python @register class SqliteEnvDatabase: # sqlite implementation # this database will be known as 'default' @register('json') class JsonEnvDatabase: # JSON implementation ...
[ "Decorator", "for", "registering", "an", "Eop", "Database" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/dates/eop.py#L296-L343
train
galactics/beyond
beyond/dates/eop.py
TaiUtc.get_last_next
def get_last_next(self, date): """Provide the last and next leap-second events relative to a date Args: date (float): Date in MJD Return: tuple: """ past, future = (None, None), (None, None) for mjd, value in reversed(self.data): if m...
python
def get_last_next(self, date): """Provide the last and next leap-second events relative to a date Args: date (float): Date in MJD Return: tuple: """ past, future = (None, None), (None, None) for mjd, value in reversed(self.data): if m...
[ "def", "get_last_next", "(", "self", ",", "date", ")", ":", "past", ",", "future", "=", "(", "None", ",", "None", ")", ",", "(", "None", ",", "None", ")", "for", "mjd", ",", "value", "in", "reversed", "(", "self", ".", "data", ")", ":", "if", "...
Provide the last and next leap-second events relative to a date Args: date (float): Date in MJD Return: tuple:
[ "Provide", "the", "last", "and", "next", "leap", "-", "second", "events", "relative", "to", "a", "date" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/dates/eop.py#L51-L67
train
galactics/beyond
beyond/dates/eop.py
EopDb.db
def db(cls, dbname=None): """Retrieve the database Args: dbname: Specify the name of the database to retrieve. If set to `None`, take the name from the configuration (see :ref:`configuration <eop-dbname>`) Return: object """ cls._load_ent...
python
def db(cls, dbname=None): """Retrieve the database Args: dbname: Specify the name of the database to retrieve. If set to `None`, take the name from the configuration (see :ref:`configuration <eop-dbname>`) Return: object """ cls._load_ent...
[ "def", "db", "(", "cls", ",", "dbname", "=", "None", ")", ":", "cls", ".", "_load_entry_points", "(", ")", "dbname", "=", "dbname", "or", "config", ".", "get", "(", "'eop'", ",", "'dbname'", ",", "fallback", "=", "cls", ".", "DEFAULT_DBNAME", ")", "i...
Retrieve the database Args: dbname: Specify the name of the database to retrieve. If set to `None`, take the name from the configuration (see :ref:`configuration <eop-dbname>`) Return: object
[ "Retrieve", "the", "database" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/dates/eop.py#L211-L242
train
galactics/beyond
beyond/dates/eop.py
EopDb.get
def get(cls, mjd: float, dbname: str = None) -> Eop: """Retrieve Earth Orientation Parameters and timescales differences for a given date Args: mjd: Date expressed as Mean Julian Date dbname: Name of the database to use Return: Eop: Interpolated data ...
python
def get(cls, mjd: float, dbname: str = None) -> Eop: """Retrieve Earth Orientation Parameters and timescales differences for a given date Args: mjd: Date expressed as Mean Julian Date dbname: Name of the database to use Return: Eop: Interpolated data ...
[ "def", "get", "(", "cls", ",", "mjd", ":", "float", ",", "dbname", ":", "str", "=", "None", ")", "->", "Eop", ":", "try", ":", "value", "=", "cls", ".", "db", "(", "dbname", ")", "[", "mjd", "]", "except", "(", "EopError", ",", "KeyError", ")",...
Retrieve Earth Orientation Parameters and timescales differences for a given date Args: mjd: Date expressed as Mean Julian Date dbname: Name of the database to use Return: Eop: Interpolated data for this particuliar MJD
[ "Retrieve", "Earth", "Orientation", "Parameters", "and", "timescales", "differences", "for", "a", "given", "date" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/dates/eop.py#L245-L271
train
galactics/beyond
beyond/dates/eop.py
EopDb.register
def register(cls, klass, name=DEFAULT_DBNAME): """Register an Eop Database The only requirement of this database is that it should have ``__getitem__`` method accepting MJD as float. """ if name in cls._dbs: msg = "'{}' is already registered for an Eop database. Ski...
python
def register(cls, klass, name=DEFAULT_DBNAME): """Register an Eop Database The only requirement of this database is that it should have ``__getitem__`` method accepting MJD as float. """ if name in cls._dbs: msg = "'{}' is already registered for an Eop database. Ski...
[ "def", "register", "(", "cls", ",", "klass", ",", "name", "=", "DEFAULT_DBNAME", ")", ":", "if", "name", "in", "cls", ".", "_dbs", ":", "msg", "=", "\"'{}' is already registered for an Eop database. Skipping\"", ".", "format", "(", "name", ")", "log", ".", "...
Register an Eop Database The only requirement of this database is that it should have ``__getitem__`` method accepting MJD as float.
[ "Register", "an", "Eop", "Database" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/dates/eop.py#L282-L293
train
galactics/beyond
beyond/frames/iau1980.py
_tab
def _tab(max_i=None): """Extraction and caching of IAU1980 nutation coefficients """ filepath = Path(__file__).parent / "data" / "tab5.1.txt" result = [] with filepath.open() as fhd: i = 0 for line in fhd.read().splitlines(): if line.startswith("#") or not line.strip():...
python
def _tab(max_i=None): """Extraction and caching of IAU1980 nutation coefficients """ filepath = Path(__file__).parent / "data" / "tab5.1.txt" result = [] with filepath.open() as fhd: i = 0 for line in fhd.read().splitlines(): if line.startswith("#") or not line.strip():...
[ "def", "_tab", "(", "max_i", "=", "None", ")", ":", "filepath", "=", "Path", "(", "__file__", ")", ".", "parent", "/", "\"data\"", "/", "\"tab5.1.txt\"", "result", "=", "[", "]", "with", "filepath", ".", "open", "(", ")", "as", "fhd", ":", "i", "="...
Extraction and caching of IAU1980 nutation coefficients
[ "Extraction", "and", "caching", "of", "IAU1980", "nutation", "coefficients" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau1980.py#L15-L35
train
galactics/beyond
beyond/frames/iau1980.py
_precesion
def _precesion(date): """Precession in degrees """ t = date.change_scale('TT').julian_century zeta = (2306.2181 * t + 0.30188 * t ** 2 + 0.017998 * t ** 3) / 3600. theta = (2004.3109 * t - 0.42665 * t ** 2 - 0.041833 * t ** 3) / 3600. z = (2306.2181 * t + 1.09468 * t ** 2 + 0.018203 * t ** 3) ...
python
def _precesion(date): """Precession in degrees """ t = date.change_scale('TT').julian_century zeta = (2306.2181 * t + 0.30188 * t ** 2 + 0.017998 * t ** 3) / 3600. theta = (2004.3109 * t - 0.42665 * t ** 2 - 0.041833 * t ** 3) / 3600. z = (2306.2181 * t + 1.09468 * t ** 2 + 0.018203 * t ** 3) ...
[ "def", "_precesion", "(", "date", ")", ":", "t", "=", "date", ".", "change_scale", "(", "'TT'", ")", ".", "julian_century", "zeta", "=", "(", "2306.2181", "*", "t", "+", "0.30188", "*", "t", "**", "2", "+", "0.017998", "*", "t", "**", "3", ")", "...
Precession in degrees
[ "Precession", "in", "degrees" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau1980.py#L58-L69
train
galactics/beyond
beyond/frames/iau1980.py
precesion
def precesion(date): # pragma: no cover """Precession as a rotation matrix """ zeta, theta, z = np.deg2rad(_precesion(date)) return rot3(zeta) @ rot2(-theta) @ rot3(z)
python
def precesion(date): # pragma: no cover """Precession as a rotation matrix """ zeta, theta, z = np.deg2rad(_precesion(date)) return rot3(zeta) @ rot2(-theta) @ rot3(z)
[ "def", "precesion", "(", "date", ")", ":", "zeta", ",", "theta", ",", "z", "=", "np", ".", "deg2rad", "(", "_precesion", "(", "date", ")", ")", "return", "rot3", "(", "zeta", ")", "@", "rot2", "(", "-", "theta", ")", "@", "rot3", "(", "z", ")" ...
Precession as a rotation matrix
[ "Precession", "as", "a", "rotation", "matrix" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau1980.py#L72-L76
train
galactics/beyond
beyond/frames/iau1980.py
_nutation
def _nutation(date, eop_correction=True, terms=106): """Model 1980 of nutation as described in Vallado p. 224 Args: date (beyond.utils.date.Date) eop_correction (bool): set to ``True`` to include model correction from 'finals' files. terms (int) Return: tuple : 3...
python
def _nutation(date, eop_correction=True, terms=106): """Model 1980 of nutation as described in Vallado p. 224 Args: date (beyond.utils.date.Date) eop_correction (bool): set to ``True`` to include model correction from 'finals' files. terms (int) Return: tuple : 3...
[ "def", "_nutation", "(", "date", ",", "eop_correction", "=", "True", ",", "terms", "=", "106", ")", ":", "ttt", "=", "date", ".", "change_scale", "(", "'TT'", ")", ".", "julian_century", "r", "=", "360.", "epsilon_bar", "=", "84381.448", "-", "46.8150", ...
Model 1980 of nutation as described in Vallado p. 224 Args: date (beyond.utils.date.Date) eop_correction (bool): set to ``True`` to include model correction from 'finals' files. terms (int) Return: tuple : 3-elements, all floats in degrees 1. ̄ε ...
[ "Model", "1980", "of", "nutation", "as", "described", "in", "Vallado", "p", ".", "224" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau1980.py#L80-L146
train
galactics/beyond
beyond/frames/iau1980.py
nutation
def nutation(date, eop_correction=True, terms=106): # pragma: no cover """Nutation as a rotation matrix """ epsilon_bar, delta_psi, delta_eps = np.deg2rad(_nutation(date, eop_correction, terms)) epsilon = epsilon_bar + delta_eps return rot1(-epsilon_bar) @ rot3(delta_psi) @ rot1(epsilon)
python
def nutation(date, eop_correction=True, terms=106): # pragma: no cover """Nutation as a rotation matrix """ epsilon_bar, delta_psi, delta_eps = np.deg2rad(_nutation(date, eop_correction, terms)) epsilon = epsilon_bar + delta_eps return rot1(-epsilon_bar) @ rot3(delta_psi) @ rot1(epsilon)
[ "def", "nutation", "(", "date", ",", "eop_correction", "=", "True", ",", "terms", "=", "106", ")", ":", "epsilon_bar", ",", "delta_psi", ",", "delta_eps", "=", "np", ".", "deg2rad", "(", "_nutation", "(", "date", ",", "eop_correction", ",", "terms", ")",...
Nutation as a rotation matrix
[ "Nutation", "as", "a", "rotation", "matrix" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau1980.py#L149-L155
train
galactics/beyond
beyond/frames/iau1980.py
equinox
def equinox(date, eop_correction=True, terms=106, kinematic=True): """Equinox equation in degrees """ epsilon_bar, delta_psi, delta_eps = _nutation(date, eop_correction, terms) equin = delta_psi * 3600. * np.cos(np.deg2rad(epsilon_bar)) if date.d >= 50506 and kinematic: # Starting 1992-02-...
python
def equinox(date, eop_correction=True, terms=106, kinematic=True): """Equinox equation in degrees """ epsilon_bar, delta_psi, delta_eps = _nutation(date, eop_correction, terms) equin = delta_psi * 3600. * np.cos(np.deg2rad(epsilon_bar)) if date.d >= 50506 and kinematic: # Starting 1992-02-...
[ "def", "equinox", "(", "date", ",", "eop_correction", "=", "True", ",", "terms", "=", "106", ",", "kinematic", "=", "True", ")", ":", "epsilon_bar", ",", "delta_psi", ",", "delta_eps", "=", "_nutation", "(", "date", ",", "eop_correction", ",", "terms", "...
Equinox equation in degrees
[ "Equinox", "equation", "in", "degrees" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau1980.py#L158-L174
train
galactics/beyond
beyond/frames/iau1980.py
_sideral
def _sideral(date, longitude=0., model='mean', eop_correction=True, terms=106): """Get the sideral time at a defined date Args: date (Date): longitude (float): Longitude of the observer (in degrees) East positive/West negative. model (str): 'mean' or 'apparent' for GMST and ...
python
def _sideral(date, longitude=0., model='mean', eop_correction=True, terms=106): """Get the sideral time at a defined date Args: date (Date): longitude (float): Longitude of the observer (in degrees) East positive/West negative. model (str): 'mean' or 'apparent' for GMST and ...
[ "def", "_sideral", "(", "date", ",", "longitude", "=", "0.", ",", "model", "=", "'mean'", ",", "eop_correction", "=", "True", ",", "terms", "=", "106", ")", ":", "t", "=", "date", ".", "change_scale", "(", "'UT1'", ")", ".", "julian_century", "theta", ...
Get the sideral time at a defined date Args: date (Date): longitude (float): Longitude of the observer (in degrees) East positive/West negative. model (str): 'mean' or 'apparent' for GMST and GAST respectively Return: float: Sideral time in degrees GMST: Greenwi...
[ "Get", "the", "sideral", "time", "at", "a", "defined", "date" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau1980.py#L177-L210
train
galactics/beyond
beyond/frames/iau1980.py
sideral
def sideral(date, longitude=0., model='mean', eop_correction=True, terms=106): # pragma: no cover """Sideral time as a rotation matrix """ theta = _sideral(date, longitude, model, eop_correction, terms) return rot3(np.deg2rad(-theta))
python
def sideral(date, longitude=0., model='mean', eop_correction=True, terms=106): # pragma: no cover """Sideral time as a rotation matrix """ theta = _sideral(date, longitude, model, eop_correction, terms) return rot3(np.deg2rad(-theta))
[ "def", "sideral", "(", "date", ",", "longitude", "=", "0.", ",", "model", "=", "'mean'", ",", "eop_correction", "=", "True", ",", "terms", "=", "106", ")", ":", "theta", "=", "_sideral", "(", "date", ",", "longitude", ",", "model", ",", "eop_correction...
Sideral time as a rotation matrix
[ "Sideral", "time", "as", "a", "rotation", "matrix" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau1980.py#L213-L217
train
galactics/beyond
beyond/orbits/man.py
Maneuver.dv
def dv(self, orb): """Computation of the velocity increment in the reference frame of the orbit Args: orb (Orbit): Return: numpy.array: Velocity increment, length 3 """ orb = orb.copy(form="cartesian") if self.frame == "QSW": mat = t...
python
def dv(self, orb): """Computation of the velocity increment in the reference frame of the orbit Args: orb (Orbit): Return: numpy.array: Velocity increment, length 3 """ orb = orb.copy(form="cartesian") if self.frame == "QSW": mat = t...
[ "def", "dv", "(", "self", ",", "orb", ")", ":", "orb", "=", "orb", ".", "copy", "(", "form", "=", "\"cartesian\"", ")", "if", "self", ".", "frame", "==", "\"QSW\"", ":", "mat", "=", "to_qsw", "(", "orb", ")", ".", "T", "elif", "self", ".", "fra...
Computation of the velocity increment in the reference frame of the orbit Args: orb (Orbit): Return: numpy.array: Velocity increment, length 3
[ "Computation", "of", "the", "velocity", "increment", "in", "the", "reference", "frame", "of", "the", "orbit" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/man.py#L47-L66
train
galactics/beyond
beyond/orbits/orbit.py
Orbit.copy
def copy(self, *, frame=None, form=None): """Provide a new instance of the same point in space-time Keyword Args: frame (str or Frame): Frame to convert the new instance into form (str or Form): Form to convert the new instance into Return: Orbit: Ov...
python
def copy(self, *, frame=None, form=None): """Provide a new instance of the same point in space-time Keyword Args: frame (str or Frame): Frame to convert the new instance into form (str or Form): Form to convert the new instance into Return: Orbit: Ov...
[ "def", "copy", "(", "self", ",", "*", ",", "frame", "=", "None", ",", "form", "=", "None", ")", ":", "new_compl", "=", "{", "}", "for", "k", ",", "v", "in", "self", ".", "complements", ".", "items", "(", ")", ":", "new_compl", "[", "k", "]", ...
Provide a new instance of the same point in space-time Keyword Args: frame (str or Frame): Frame to convert the new instance into form (str or Form): Form to convert the new instance into Return: Orbit: Override :py:meth:`numpy.ndarray.copy()` to include add...
[ "Provide", "a", "new", "instance", "of", "the", "same", "point", "in", "space", "-", "time" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/orbit.py#L94-L120
train
galactics/beyond
beyond/orbits/orbit.py
Orbit.propagate
def propagate(self, date): """Propagate the orbit to a new date Args: date (Date) Return: Orbit """ if self.propagator.orbit is not self: self.propagator.orbit = self return self.propagator.propagate(date)
python
def propagate(self, date): """Propagate the orbit to a new date Args: date (Date) Return: Orbit """ if self.propagator.orbit is not self: self.propagator.orbit = self return self.propagator.propagate(date)
[ "def", "propagate", "(", "self", ",", "date", ")", ":", "if", "self", ".", "propagator", ".", "orbit", "is", "not", "self", ":", "self", ".", "propagator", ".", "orbit", "=", "self", "return", "self", ".", "propagator", ".", "propagate", "(", "date", ...
Propagate the orbit to a new date Args: date (Date) Return: Orbit
[ "Propagate", "the", "orbit", "to", "a", "new", "date" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/orbit.py#L308-L320
train
galactics/beyond
beyond/orbits/orbit.py
Orbit.ephemeris
def ephemeris(self, **kwargs): """Generator giving the propagation of the orbit at different dates Args: start (Date) stop (Date or timedelta) step (timedelta) Yield: Orbit """ for orb in self.iter(inclusive=True, **kwargs): ...
python
def ephemeris(self, **kwargs): """Generator giving the propagation of the orbit at different dates Args: start (Date) stop (Date or timedelta) step (timedelta) Yield: Orbit """ for orb in self.iter(inclusive=True, **kwargs): ...
[ "def", "ephemeris", "(", "self", ",", "**", "kwargs", ")", ":", "for", "orb", "in", "self", ".", "iter", "(", "inclusive", "=", "True", ",", "**", "kwargs", ")", ":", "yield", "orb" ]
Generator giving the propagation of the orbit at different dates Args: start (Date) stop (Date or timedelta) step (timedelta) Yield: Orbit
[ "Generator", "giving", "the", "propagation", "of", "the", "orbit", "at", "different", "dates" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/orbit.py#L330-L342
train
galactics/beyond
beyond/orbits/orbit.py
OrbitInfos.period
def period(self): """Period of the orbit as a timedelta """ return timedelta(seconds=2 * np.pi * np.sqrt(self.kep.a ** 3 / self.mu))
python
def period(self): """Period of the orbit as a timedelta """ return timedelta(seconds=2 * np.pi * np.sqrt(self.kep.a ** 3 / self.mu))
[ "def", "period", "(", "self", ")", ":", "return", "timedelta", "(", "seconds", "=", "2", "*", "np", ".", "pi", "*", "np", ".", "sqrt", "(", "self", ".", "kep", ".", "a", "**", "3", "/", "self", ".", "mu", ")", ")" ]
Period of the orbit as a timedelta
[ "Period", "of", "the", "orbit", "as", "a", "timedelta" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/orbit.py#L402-L405
train
galactics/beyond
beyond/orbits/orbit.py
OrbitInfos.va
def va(self): """Velocity at apocenter """ return np.sqrt(self.mu * (2 / (self.ra) - 1 / self.kep.a))
python
def va(self): """Velocity at apocenter """ return np.sqrt(self.mu * (2 / (self.ra) - 1 / self.kep.a))
[ "def", "va", "(", "self", ")", ":", "return", "np", ".", "sqrt", "(", "self", ".", "mu", "*", "(", "2", "/", "(", "self", ".", "ra", ")", "-", "1", "/", "self", ".", "kep", ".", "a", ")", ")" ]
Velocity at apocenter
[ "Velocity", "at", "apocenter" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/orbit.py#L440-L443
train
galactics/beyond
beyond/orbits/orbit.py
OrbitInfos.vp
def vp(self): """Velocity at pericenter """ return np.sqrt(self.mu * (2 / (self.rp) - 1 / self.kep.a))
python
def vp(self): """Velocity at pericenter """ return np.sqrt(self.mu * (2 / (self.rp) - 1 / self.kep.a))
[ "def", "vp", "(", "self", ")", ":", "return", "np", ".", "sqrt", "(", "self", ".", "mu", "*", "(", "2", "/", "(", "self", ".", "rp", ")", "-", "1", "/", "self", ".", "kep", ".", "a", ")", ")" ]
Velocity at pericenter
[ "Velocity", "at", "pericenter" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/orbits/orbit.py#L446-L449
train
galactics/beyond
beyond/utils/node.py
Node.path
def path(self, goal): """Get the shortest way between two nodes of the graph Args: goal (str): Name of the targeted node Return: list of Node """ if goal == self.name: return [self] if goal not in self.routes: raise ValueE...
python
def path(self, goal): """Get the shortest way between two nodes of the graph Args: goal (str): Name of the targeted node Return: list of Node """ if goal == self.name: return [self] if goal not in self.routes: raise ValueE...
[ "def", "path", "(", "self", ",", "goal", ")", ":", "if", "goal", "==", "self", ".", "name", ":", "return", "[", "self", "]", "if", "goal", "not", "in", "self", ".", "routes", ":", "raise", "ValueError", "(", "\"Unknown '{0}'\"", ".", "format", "(", ...
Get the shortest way between two nodes of the graph Args: goal (str): Name of the targeted node Return: list of Node
[ "Get", "the", "shortest", "way", "between", "two", "nodes", "of", "the", "graph" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/utils/node.py#L118-L139
train
galactics/beyond
beyond/utils/node.py
Node.steps
def steps(self, goal): """Get the list of individual relations leading to the targeted node Args: goal (str): Name of the targeted node Return: list of tuple of Node """ path = self.path(goal) for i in range(len(path) - 1): yield path...
python
def steps(self, goal): """Get the list of individual relations leading to the targeted node Args: goal (str): Name of the targeted node Return: list of tuple of Node """ path = self.path(goal) for i in range(len(path) - 1): yield path...
[ "def", "steps", "(", "self", ",", "goal", ")", ":", "path", "=", "self", ".", "path", "(", "goal", ")", "for", "i", "in", "range", "(", "len", "(", "path", ")", "-", "1", ")", ":", "yield", "path", "[", "i", "]", ",", "path", "[", "i", "+",...
Get the list of individual relations leading to the targeted node Args: goal (str): Name of the targeted node Return: list of tuple of Node
[ "Get", "the", "list", "of", "individual", "relations", "leading", "to", "the", "targeted", "node" ]
7a7590ff0fd4c0bac3e8e383ecca03caa98e5742
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/utils/node.py#L141-L152
train
Patreon/patreon-python
examples/flask/my_site/models/tables/db_wrapper.py
build_if_needed
def build_if_needed(db): """Little helper method for making tables in SQL-Alchemy with SQLite""" if len(db.engine.table_names()) == 0: # import all classes here from my_site.models.tables.user import User db.create_all()
python
def build_if_needed(db): """Little helper method for making tables in SQL-Alchemy with SQLite""" if len(db.engine.table_names()) == 0: # import all classes here from my_site.models.tables.user import User db.create_all()
[ "def", "build_if_needed", "(", "db", ")", ":", "if", "len", "(", "db", ".", "engine", ".", "table_names", "(", ")", ")", "==", "0", ":", "from", "my_site", ".", "models", ".", "tables", ".", "user", "import", "User", "db", ".", "create_all", "(", "...
Little helper method for making tables in SQL-Alchemy with SQLite
[ "Little", "helper", "method", "for", "making", "tables", "in", "SQL", "-", "Alchemy", "with", "SQLite" ]
80c83f018d6bd93b83c188baff727c5e77e01ce6
https://github.com/Patreon/patreon-python/blob/80c83f018d6bd93b83c188baff727c5e77e01ce6/examples/flask/my_site/models/tables/db_wrapper.py#L1-L7
train
andersinno/django-sanitized-dump
sanitized_dump/utils/compat.py
deunicode
def deunicode(item): """ Convert unicode objects to str """ if item is None: return None if isinstance(item, str): return item if isinstance(item, six.text_type): return item.encode('utf-8') if isinstance(item, dict): return { deunicode(key): deunicode(val...
python
def deunicode(item): """ Convert unicode objects to str """ if item is None: return None if isinstance(item, str): return item if isinstance(item, six.text_type): return item.encode('utf-8') if isinstance(item, dict): return { deunicode(key): deunicode(val...
[ "def", "deunicode", "(", "item", ")", ":", "if", "item", "is", "None", ":", "return", "None", "if", "isinstance", "(", "item", ",", "str", ")", ":", "return", "item", "if", "isinstance", "(", "item", ",", "six", ".", "text_type", ")", ":", "return", ...
Convert unicode objects to str
[ "Convert", "unicode", "objects", "to", "str" ]
185a693d153dd9fb56cdc58382e4744635afc2e7
https://github.com/andersinno/django-sanitized-dump/blob/185a693d153dd9fb56cdc58382e4744635afc2e7/sanitized_dump/utils/compat.py#L9-L24
train
srittau/python-asserts
asserts/__init__.py
assert_true
def assert_true(expr, msg_fmt="{msg}"): """Fail the test unless the expression is truthy. >>> assert_true("Hello World!") >>> assert_true("") Traceback (most recent call last): ... AssertionError: '' is not truthy The following msg_fmt arguments are supported: * msg - the default e...
python
def assert_true(expr, msg_fmt="{msg}"): """Fail the test unless the expression is truthy. >>> assert_true("Hello World!") >>> assert_true("") Traceback (most recent call last): ... AssertionError: '' is not truthy The following msg_fmt arguments are supported: * msg - the default e...
[ "def", "assert_true", "(", "expr", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "not", "expr", ":", "msg", "=", "\"{!r} is not truthy\"", ".", "format", "(", "expr", ")", "fail", "(", "msg_fmt", ".", "format", "(", "msg", "=", "msg", ",", "expr", ...
Fail the test unless the expression is truthy. >>> assert_true("Hello World!") >>> assert_true("") Traceback (most recent call last): ... AssertionError: '' is not truthy The following msg_fmt arguments are supported: * msg - the default error message * expr - tested expression
[ "Fail", "the", "test", "unless", "the", "expression", "is", "truthy", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L42-L58
train
srittau/python-asserts
asserts/__init__.py
assert_false
def assert_false(expr, msg_fmt="{msg}"): """Fail the test unless the expression is falsy. >>> assert_false("") >>> assert_false("Hello World!") Traceback (most recent call last): ... AssertionError: 'Hello World!' is not falsy The following msg_fmt arguments are supported: * msg - ...
python
def assert_false(expr, msg_fmt="{msg}"): """Fail the test unless the expression is falsy. >>> assert_false("") >>> assert_false("Hello World!") Traceback (most recent call last): ... AssertionError: 'Hello World!' is not falsy The following msg_fmt arguments are supported: * msg - ...
[ "def", "assert_false", "(", "expr", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "expr", ":", "msg", "=", "\"{!r} is not falsy\"", ".", "format", "(", "expr", ")", "fail", "(", "msg_fmt", ".", "format", "(", "msg", "=", "msg", ",", "expr", "=", ...
Fail the test unless the expression is falsy. >>> assert_false("") >>> assert_false("Hello World!") Traceback (most recent call last): ... AssertionError: 'Hello World!' is not falsy The following msg_fmt arguments are supported: * msg - the default error message * expr - tested ex...
[ "Fail", "the", "test", "unless", "the", "expression", "is", "falsy", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L61-L77
train
srittau/python-asserts
asserts/__init__.py
assert_boolean_true
def assert_boolean_true(expr, msg_fmt="{msg}"): """Fail the test unless the expression is the constant True. >>> assert_boolean_true(True) >>> assert_boolean_true("Hello World!") Traceback (most recent call last): ... AssertionError: 'Hello World!' is not True The following msg_fmt arg...
python
def assert_boolean_true(expr, msg_fmt="{msg}"): """Fail the test unless the expression is the constant True. >>> assert_boolean_true(True) >>> assert_boolean_true("Hello World!") Traceback (most recent call last): ... AssertionError: 'Hello World!' is not True The following msg_fmt arg...
[ "def", "assert_boolean_true", "(", "expr", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "expr", "is", "not", "True", ":", "msg", "=", "\"{!r} is not True\"", ".", "format", "(", "expr", ")", "fail", "(", "msg_fmt", ".", "format", "(", "msg", "=", ...
Fail the test unless the expression is the constant True. >>> assert_boolean_true(True) >>> assert_boolean_true("Hello World!") Traceback (most recent call last): ... AssertionError: 'Hello World!' is not True The following msg_fmt arguments are supported: * msg - the default error mes...
[ "Fail", "the", "test", "unless", "the", "expression", "is", "the", "constant", "True", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L80-L96
train
srittau/python-asserts
asserts/__init__.py
assert_boolean_false
def assert_boolean_false(expr, msg_fmt="{msg}"): """Fail the test unless the expression is the constant False. >>> assert_boolean_false(False) >>> assert_boolean_false(0) Traceback (most recent call last): ... AssertionError: 0 is not False The following msg_fmt arguments are supported...
python
def assert_boolean_false(expr, msg_fmt="{msg}"): """Fail the test unless the expression is the constant False. >>> assert_boolean_false(False) >>> assert_boolean_false(0) Traceback (most recent call last): ... AssertionError: 0 is not False The following msg_fmt arguments are supported...
[ "def", "assert_boolean_false", "(", "expr", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "expr", "is", "not", "False", ":", "msg", "=", "\"{!r} is not False\"", ".", "format", "(", "expr", ")", "fail", "(", "msg_fmt", ".", "format", "(", "msg", "=",...
Fail the test unless the expression is the constant False. >>> assert_boolean_false(False) >>> assert_boolean_false(0) Traceback (most recent call last): ... AssertionError: 0 is not False The following msg_fmt arguments are supported: * msg - the default error message * expr - tes...
[ "Fail", "the", "test", "unless", "the", "expression", "is", "the", "constant", "False", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L99-L115
train
srittau/python-asserts
asserts/__init__.py
assert_is_none
def assert_is_none(expr, msg_fmt="{msg}"): """Fail if the expression is not None. >>> assert_is_none(None) >>> assert_is_none(False) Traceback (most recent call last): ... AssertionError: False is not None The following msg_fmt arguments are supported: * msg - the default error mes...
python
def assert_is_none(expr, msg_fmt="{msg}"): """Fail if the expression is not None. >>> assert_is_none(None) >>> assert_is_none(False) Traceback (most recent call last): ... AssertionError: False is not None The following msg_fmt arguments are supported: * msg - the default error mes...
[ "def", "assert_is_none", "(", "expr", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "expr", "is", "not", "None", ":", "msg", "=", "\"{!r} is not None\"", ".", "format", "(", "expr", ")", "fail", "(", "msg_fmt", ".", "format", "(", "msg", "=", "msg"...
Fail if the expression is not None. >>> assert_is_none(None) >>> assert_is_none(False) Traceback (most recent call last): ... AssertionError: False is not None The following msg_fmt arguments are supported: * msg - the default error message * expr - tested expression
[ "Fail", "if", "the", "expression", "is", "not", "None", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L118-L134
train
srittau/python-asserts
asserts/__init__.py
assert_is_not_none
def assert_is_not_none(expr, msg_fmt="{msg}"): """Fail if the expression is None. >>> assert_is_not_none(0) >>> assert_is_not_none(None) Traceback (most recent call last): ... AssertionError: expression is None The following msg_fmt arguments are supported: * msg - the default erro...
python
def assert_is_not_none(expr, msg_fmt="{msg}"): """Fail if the expression is None. >>> assert_is_not_none(0) >>> assert_is_not_none(None) Traceback (most recent call last): ... AssertionError: expression is None The following msg_fmt arguments are supported: * msg - the default erro...
[ "def", "assert_is_not_none", "(", "expr", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "expr", "is", "None", ":", "msg", "=", "\"expression is None\"", "fail", "(", "msg_fmt", ".", "format", "(", "msg", "=", "msg", ",", "expr", "=", "expr", ")", "...
Fail if the expression is None. >>> assert_is_not_none(0) >>> assert_is_not_none(None) Traceback (most recent call last): ... AssertionError: expression is None The following msg_fmt arguments are supported: * msg - the default error message * expr - tested expression
[ "Fail", "if", "the", "expression", "is", "None", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L137-L152
train
srittau/python-asserts
asserts/__init__.py
assert_equal
def assert_equal(first, second, msg_fmt="{msg}"): """Fail unless first equals second, as determined by the '==' operator. >>> assert_equal(5, 5.0) >>> assert_equal("Hello World!", "Goodbye!") Traceback (most recent call last): ... AssertionError: 'Hello World!' != 'Goodbye!' The follow...
python
def assert_equal(first, second, msg_fmt="{msg}"): """Fail unless first equals second, as determined by the '==' operator. >>> assert_equal(5, 5.0) >>> assert_equal("Hello World!", "Goodbye!") Traceback (most recent call last): ... AssertionError: 'Hello World!' != 'Goodbye!' The follow...
[ "def", "assert_equal", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "isinstance", "(", "first", ",", "dict", ")", "and", "isinstance", "(", "second", ",", "dict", ")", ":", "assert_dict_equal", "(", "first", ",", "second...
Fail unless first equals second, as determined by the '==' operator. >>> assert_equal(5, 5.0) >>> assert_equal("Hello World!", "Goodbye!") Traceback (most recent call last): ... AssertionError: 'Hello World!' != 'Goodbye!' The following msg_fmt arguments are supported: * msg - the defa...
[ "Fail", "unless", "first", "equals", "second", "as", "determined", "by", "the", "==", "operator", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L155-L174
train
srittau/python-asserts
asserts/__init__.py
assert_not_equal
def assert_not_equal(first, second, msg_fmt="{msg}"): """Fail if first equals second, as determined by the '==' operator. >>> assert_not_equal(5, 8) >>> assert_not_equal(-7, -7.0) Traceback (most recent call last): ... AssertionError: -7 == -7.0 The following msg_fmt arguments are supp...
python
def assert_not_equal(first, second, msg_fmt="{msg}"): """Fail if first equals second, as determined by the '==' operator. >>> assert_not_equal(5, 8) >>> assert_not_equal(-7, -7.0) Traceback (most recent call last): ... AssertionError: -7 == -7.0 The following msg_fmt arguments are supp...
[ "def", "assert_not_equal", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "first", "==", "second", ":", "msg", "=", "\"{!r} == {!r}\"", ".", "format", "(", "first", ",", "second", ")", "fail", "(", "msg_fmt", ".", "format"...
Fail if first equals second, as determined by the '==' operator. >>> assert_not_equal(5, 8) >>> assert_not_equal(-7, -7.0) Traceback (most recent call last): ... AssertionError: -7 == -7.0 The following msg_fmt arguments are supported: * msg - the default error message * first - th...
[ "Fail", "if", "first", "equals", "second", "as", "determined", "by", "the", "==", "operator", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L177-L194
train
srittau/python-asserts
asserts/__init__.py
assert_almost_equal
def assert_almost_equal( first, second, msg_fmt="{msg}", places=None, delta=None ): """Fail if first and second are not equal after rounding. By default, the difference between first and second is rounded to 7 decimal places. This can be configured with the places argument. Alternatively, delta can...
python
def assert_almost_equal( first, second, msg_fmt="{msg}", places=None, delta=None ): """Fail if first and second are not equal after rounding. By default, the difference between first and second is rounded to 7 decimal places. This can be configured with the places argument. Alternatively, delta can...
[ "def", "assert_almost_equal", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ",", "places", "=", "None", ",", "delta", "=", "None", ")", ":", "if", "delta", "is", "not", "None", "and", "places", "is", "not", "None", ":", "raise", "TypeE...
Fail if first and second are not equal after rounding. By default, the difference between first and second is rounded to 7 decimal places. This can be configured with the places argument. Alternatively, delta can be used to specify the maximum allowed difference between first and second. If first ...
[ "Fail", "if", "first", "and", "second", "are", "not", "equal", "after", "rounding", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L197-L245
train
srittau/python-asserts
asserts/__init__.py
assert_dict_equal
def assert_dict_equal( first, second, key_msg_fmt="{msg}", value_msg_fmt="{msg}" ): """Fail unless first dictionary equals second. The dictionaries are considered equal, if they both contain the same keys, and their respective values are also equal. >>> assert_dict_equal({"foo": 5}, {"foo": 5}) ...
python
def assert_dict_equal( first, second, key_msg_fmt="{msg}", value_msg_fmt="{msg}" ): """Fail unless first dictionary equals second. The dictionaries are considered equal, if they both contain the same keys, and their respective values are also equal. >>> assert_dict_equal({"foo": 5}, {"foo": 5}) ...
[ "def", "assert_dict_equal", "(", "first", ",", "second", ",", "key_msg_fmt", "=", "\"{msg}\"", ",", "value_msg_fmt", "=", "\"{msg}\"", ")", ":", "first_keys", "=", "set", "(", "first", ".", "keys", "(", ")", ")", "second_keys", "=", "set", "(", "second", ...
Fail unless first dictionary equals second. The dictionaries are considered equal, if they both contain the same keys, and their respective values are also equal. >>> assert_dict_equal({"foo": 5}, {"foo": 5}) >>> assert_dict_equal({"foo": 5}, {}) Traceback (most recent call last): ... ...
[ "Fail", "unless", "first", "dictionary", "equals", "second", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L305-L380
train
srittau/python-asserts
asserts/__init__.py
assert_less
def assert_less(first, second, msg_fmt="{msg}"): """Fail if first is not less than second. >>> assert_less('bar', 'foo') >>> assert_less(5, 5) Traceback (most recent call last): ... AssertionError: 5 is not less than 5 The following msg_fmt arguments are supported: * msg - the defa...
python
def assert_less(first, second, msg_fmt="{msg}"): """Fail if first is not less than second. >>> assert_less('bar', 'foo') >>> assert_less(5, 5) Traceback (most recent call last): ... AssertionError: 5 is not less than 5 The following msg_fmt arguments are supported: * msg - the defa...
[ "def", "assert_less", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "not", "first", "<", "second", ":", "msg", "=", "\"{!r} is not less than {!r}\"", ".", "format", "(", "first", ",", "second", ")", "fail", "(", "msg_fmt", ...
Fail if first is not less than second. >>> assert_less('bar', 'foo') >>> assert_less(5, 5) Traceback (most recent call last): ... AssertionError: 5 is not less than 5 The following msg_fmt arguments are supported: * msg - the default error message * first - the first argument *...
[ "Fail", "if", "first", "is", "not", "less", "than", "second", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L447-L464
train
srittau/python-asserts
asserts/__init__.py
assert_less_equal
def assert_less_equal(first, second, msg_fmt="{msg}"): """Fail if first is not less than or equal to second. >>> assert_less_equal('bar', 'foo') >>> assert_less_equal(5, 5) >>> assert_less_equal(6, 5) Traceback (most recent call last): ... AssertionError: 6 is not less than or equal to ...
python
def assert_less_equal(first, second, msg_fmt="{msg}"): """Fail if first is not less than or equal to second. >>> assert_less_equal('bar', 'foo') >>> assert_less_equal(5, 5) >>> assert_less_equal(6, 5) Traceback (most recent call last): ... AssertionError: 6 is not less than or equal to ...
[ "def", "assert_less_equal", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "not", "first", "<=", "second", ":", "msg", "=", "\"{!r} is not less than or equal to {!r}\"", ".", "format", "(", "first", ",", "second", ")", "fail", ...
Fail if first is not less than or equal to second. >>> assert_less_equal('bar', 'foo') >>> assert_less_equal(5, 5) >>> assert_less_equal(6, 5) Traceback (most recent call last): ... AssertionError: 6 is not less than or equal to 5 The following msg_fmt arguments are supported: * ms...
[ "Fail", "if", "first", "is", "not", "less", "than", "or", "equal", "to", "second", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L467-L485
train
srittau/python-asserts
asserts/__init__.py
assert_greater
def assert_greater(first, second, msg_fmt="{msg}"): """Fail if first is not greater than second. >>> assert_greater('foo', 'bar') >>> assert_greater(5, 5) Traceback (most recent call last): ... AssertionError: 5 is not greater than 5 The following msg_fmt arguments are supported: *...
python
def assert_greater(first, second, msg_fmt="{msg}"): """Fail if first is not greater than second. >>> assert_greater('foo', 'bar') >>> assert_greater(5, 5) Traceback (most recent call last): ... AssertionError: 5 is not greater than 5 The following msg_fmt arguments are supported: *...
[ "def", "assert_greater", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "not", "first", ">", "second", ":", "msg", "=", "\"{!r} is not greater than {!r}\"", ".", "format", "(", "first", ",", "second", ")", "fail", "(", "msg_...
Fail if first is not greater than second. >>> assert_greater('foo', 'bar') >>> assert_greater(5, 5) Traceback (most recent call last): ... AssertionError: 5 is not greater than 5 The following msg_fmt arguments are supported: * msg - the default error message * first - the first ar...
[ "Fail", "if", "first", "is", "not", "greater", "than", "second", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L488-L505
train
srittau/python-asserts
asserts/__init__.py
assert_greater_equal
def assert_greater_equal(first, second, msg_fmt="{msg}"): """Fail if first is not greater than or equal to second. >>> assert_greater_equal('foo', 'bar') >>> assert_greater_equal(5, 5) >>> assert_greater_equal(5, 6) Traceback (most recent call last): ... AssertionError: 5 is not greater...
python
def assert_greater_equal(first, second, msg_fmt="{msg}"): """Fail if first is not greater than or equal to second. >>> assert_greater_equal('foo', 'bar') >>> assert_greater_equal(5, 5) >>> assert_greater_equal(5, 6) Traceback (most recent call last): ... AssertionError: 5 is not greater...
[ "def", "assert_greater_equal", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "not", "first", ">=", "second", ":", "msg", "=", "\"{!r} is not greater than or equal to {!r}\"", ".", "format", "(", "first", ",", "second", ")", "fa...
Fail if first is not greater than or equal to second. >>> assert_greater_equal('foo', 'bar') >>> assert_greater_equal(5, 5) >>> assert_greater_equal(5, 6) Traceback (most recent call last): ... AssertionError: 5 is not greater than or equal to 6 The following msg_fmt arguments are supp...
[ "Fail", "if", "first", "is", "not", "greater", "than", "or", "equal", "to", "second", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L508-L526
train
srittau/python-asserts
asserts/__init__.py
assert_regex
def assert_regex(text, regex, msg_fmt="{msg}"): """Fail if text does not match the regular expression. regex can be either a regular expression string or a compiled regular expression object. >>> assert_regex("Hello World!", r"llo.*rld!$") >>> assert_regex("Hello World!", r"\\d") Traceback (mo...
python
def assert_regex(text, regex, msg_fmt="{msg}"): """Fail if text does not match the regular expression. regex can be either a regular expression string or a compiled regular expression object. >>> assert_regex("Hello World!", r"llo.*rld!$") >>> assert_regex("Hello World!", r"\\d") Traceback (mo...
[ "def", "assert_regex", "(", "text", ",", "regex", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "compiled", "=", "re", ".", "compile", "(", "regex", ")", "if", "not", "compiled", ".", "search", "(", "text", ")", ":", "msg", "=", "\"{!r} does not match {!r}...
Fail if text does not match the regular expression. regex can be either a regular expression string or a compiled regular expression object. >>> assert_regex("Hello World!", r"llo.*rld!$") >>> assert_regex("Hello World!", r"\\d") Traceback (most recent call last): ... AssertionError: '...
[ "Fail", "if", "text", "does", "not", "match", "the", "regular", "expression", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L529-L550
train
srittau/python-asserts
asserts/__init__.py
assert_is
def assert_is(first, second, msg_fmt="{msg}"): """Fail if first and second do not refer to the same object. >>> list1 = [5, "foo"] >>> list2 = [5, "foo"] >>> assert_is(list1, list1) >>> assert_is(list1, list2) Traceback (most recent call last): ... AssertionError: [5, 'foo'] is not ...
python
def assert_is(first, second, msg_fmt="{msg}"): """Fail if first and second do not refer to the same object. >>> list1 = [5, "foo"] >>> list2 = [5, "foo"] >>> assert_is(list1, list1) >>> assert_is(list1, list2) Traceback (most recent call last): ... AssertionError: [5, 'foo'] is not ...
[ "def", "assert_is", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "first", "is", "not", "second", ":", "msg", "=", "\"{!r} is not {!r}\"", ".", "format", "(", "first", ",", "second", ")", "fail", "(", "msg_fmt", ".", "f...
Fail if first and second do not refer to the same object. >>> list1 = [5, "foo"] >>> list2 = [5, "foo"] >>> assert_is(list1, list1) >>> assert_is(list1, list2) Traceback (most recent call last): ... AssertionError: [5, 'foo'] is not [5, 'foo'] The following msg_fmt arguments are su...
[ "Fail", "if", "first", "and", "second", "do", "not", "refer", "to", "the", "same", "object", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L553-L572
train
srittau/python-asserts
asserts/__init__.py
assert_is_not
def assert_is_not(first, second, msg_fmt="{msg}"): """Fail if first and second refer to the same object. >>> list1 = [5, "foo"] >>> list2 = [5, "foo"] >>> assert_is_not(list1, list2) >>> assert_is_not(list1, list1) Traceback (most recent call last): ... AssertionError: both argument...
python
def assert_is_not(first, second, msg_fmt="{msg}"): """Fail if first and second refer to the same object. >>> list1 = [5, "foo"] >>> list2 = [5, "foo"] >>> assert_is_not(list1, list2) >>> assert_is_not(list1, list1) Traceback (most recent call last): ... AssertionError: both argument...
[ "def", "assert_is_not", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "first", "is", "second", ":", "msg", "=", "\"both arguments refer to {!r}\"", ".", "format", "(", "first", ")", "fail", "(", "msg_fmt", ".", "format", "(...
Fail if first and second refer to the same object. >>> list1 = [5, "foo"] >>> list2 = [5, "foo"] >>> assert_is_not(list1, list2) >>> assert_is_not(list1, list1) Traceback (most recent call last): ... AssertionError: both arguments refer to [5, 'foo'] The following msg_fmt arguments...
[ "Fail", "if", "first", "and", "second", "refer", "to", "the", "same", "object", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L575-L594
train
srittau/python-asserts
asserts/__init__.py
assert_in
def assert_in(first, second, msg_fmt="{msg}"): """Fail if first is not in collection second. >>> assert_in("foo", [4, "foo", {}]) >>> assert_in("bar", [4, "foo", {}]) Traceback (most recent call last): ... AssertionError: 'bar' not in [4, 'foo', {}] The following msg_fmt arguments are ...
python
def assert_in(first, second, msg_fmt="{msg}"): """Fail if first is not in collection second. >>> assert_in("foo", [4, "foo", {}]) >>> assert_in("bar", [4, "foo", {}]) Traceback (most recent call last): ... AssertionError: 'bar' not in [4, 'foo', {}] The following msg_fmt arguments are ...
[ "def", "assert_in", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "first", "not", "in", "second", ":", "msg", "=", "\"{!r} not in {!r}\"", ".", "format", "(", "first", ",", "second", ")", "fail", "(", "msg_fmt", ".", "f...
Fail if first is not in collection second. >>> assert_in("foo", [4, "foo", {}]) >>> assert_in("bar", [4, "foo", {}]) Traceback (most recent call last): ... AssertionError: 'bar' not in [4, 'foo', {}] The following msg_fmt arguments are supported: * msg - the default error message *...
[ "Fail", "if", "first", "is", "not", "in", "collection", "second", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L597-L614
train
srittau/python-asserts
asserts/__init__.py
assert_not_in
def assert_not_in(first, second, msg_fmt="{msg}"): """Fail if first is in a collection second. >>> assert_not_in("bar", [4, "foo", {}]) >>> assert_not_in("foo", [4, "foo", {}]) Traceback (most recent call last): ... AssertionError: 'foo' is in [4, 'foo', {}] The following msg_fmt argum...
python
def assert_not_in(first, second, msg_fmt="{msg}"): """Fail if first is in a collection second. >>> assert_not_in("bar", [4, "foo", {}]) >>> assert_not_in("foo", [4, "foo", {}]) Traceback (most recent call last): ... AssertionError: 'foo' is in [4, 'foo', {}] The following msg_fmt argum...
[ "def", "assert_not_in", "(", "first", ",", "second", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "first", "in", "second", ":", "msg", "=", "\"{!r} is in {!r}\"", ".", "format", "(", "first", ",", "second", ")", "fail", "(", "msg_fmt", ".", "format"...
Fail if first is in a collection second. >>> assert_not_in("bar", [4, "foo", {}]) >>> assert_not_in("foo", [4, "foo", {}]) Traceback (most recent call last): ... AssertionError: 'foo' is in [4, 'foo', {}] The following msg_fmt arguments are supported: * msg - the default error message ...
[ "Fail", "if", "first", "is", "in", "a", "collection", "second", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L617-L633
train
srittau/python-asserts
asserts/__init__.py
assert_count_equal
def assert_count_equal(sequence1, sequence2, msg_fmt="{msg}"): """Compare the items of two sequences, ignoring order. >>> assert_count_equal([1, 2], {2, 1}) Items missing in either sequence will be listed: >>> assert_count_equal(["a", "b", "c"], ["a", "d"]) Traceback (most recent call last): ...
python
def assert_count_equal(sequence1, sequence2, msg_fmt="{msg}"): """Compare the items of two sequences, ignoring order. >>> assert_count_equal([1, 2], {2, 1}) Items missing in either sequence will be listed: >>> assert_count_equal(["a", "b", "c"], ["a", "d"]) Traceback (most recent call last): ...
[ "def", "assert_count_equal", "(", "sequence1", ",", "sequence2", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "def", "compare", "(", ")", ":", "missing1", "=", "list", "(", "sequence2", ")", "missing2", "=", "[", "]", "for", "item", "in", "sequence1", ":"...
Compare the items of two sequences, ignoring order. >>> assert_count_equal([1, 2], {2, 1}) Items missing in either sequence will be listed: >>> assert_count_equal(["a", "b", "c"], ["a", "d"]) Traceback (most recent call last): ... AssertionError: missing from sequence 1: 'd'; missing from...
[ "Compare", "the", "items", "of", "two", "sequences", "ignoring", "order", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L636-L692
train
srittau/python-asserts
asserts/__init__.py
assert_is_instance
def assert_is_instance(obj, cls, msg_fmt="{msg}"): """Fail if an object is not an instance of a class or tuple of classes. >>> assert_is_instance(5, int) >>> assert_is_instance('foo', (str, bytes)) >>> assert_is_instance(5, str) Traceback (most recent call last): ... AssertionError: 5 i...
python
def assert_is_instance(obj, cls, msg_fmt="{msg}"): """Fail if an object is not an instance of a class or tuple of classes. >>> assert_is_instance(5, int) >>> assert_is_instance('foo', (str, bytes)) >>> assert_is_instance(5, str) Traceback (most recent call last): ... AssertionError: 5 i...
[ "def", "assert_is_instance", "(", "obj", ",", "cls", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "not", "isinstance", "(", "obj", ",", "cls", ")", ":", "msg", "=", "\"{!r} is an instance of {!r}, expected {!r}\"", ".", "format", "(", "obj", ",", "obj",...
Fail if an object is not an instance of a class or tuple of classes. >>> assert_is_instance(5, int) >>> assert_is_instance('foo', (str, bytes)) >>> assert_is_instance(5, str) Traceback (most recent call last): ... AssertionError: 5 is an instance of <class 'int'>, expected <class 'str'> ...
[ "Fail", "if", "an", "object", "is", "not", "an", "instance", "of", "a", "class", "or", "tuple", "of", "classes", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L723-L743
train
srittau/python-asserts
asserts/__init__.py
assert_has_attr
def assert_has_attr(obj, attribute, msg_fmt="{msg}"): """Fail is an object does not have an attribute. >>> assert_has_attr([], "index") >>> assert_has_attr([], "i_do_not_have_this") Traceback (most recent call last): ... AssertionError: [] does not have attribute 'i_do_not_have_this' T...
python
def assert_has_attr(obj, attribute, msg_fmt="{msg}"): """Fail is an object does not have an attribute. >>> assert_has_attr([], "index") >>> assert_has_attr([], "i_do_not_have_this") Traceback (most recent call last): ... AssertionError: [] does not have attribute 'i_do_not_have_this' T...
[ "def", "assert_has_attr", "(", "obj", ",", "attribute", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "if", "not", "hasattr", "(", "obj", ",", "attribute", ")", ":", "msg", "=", "\"{!r} does not have attribute '{}'\"", ".", "format", "(", "obj", ",", "attribut...
Fail is an object does not have an attribute. >>> assert_has_attr([], "index") >>> assert_has_attr([], "i_do_not_have_this") Traceback (most recent call last): ... AssertionError: [] does not have attribute 'i_do_not_have_this' The following msg_fmt arguments are supported: * msg - the...
[ "Fail", "is", "an", "object", "does", "not", "have", "an", "attribute", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L767-L784
train
srittau/python-asserts
asserts/__init__.py
assert_datetime_about_now
def assert_datetime_about_now(actual, msg_fmt="{msg}"): """Fail if a datetime object is not within 5 seconds of the local time. >>> assert_datetime_about_now(datetime.now()) >>> assert_datetime_about_now(datetime(1900, 1, 1, 12, 0, 0)) Traceback (most recent call last): ... AssertionError: ...
python
def assert_datetime_about_now(actual, msg_fmt="{msg}"): """Fail if a datetime object is not within 5 seconds of the local time. >>> assert_datetime_about_now(datetime.now()) >>> assert_datetime_about_now(datetime(1900, 1, 1, 12, 0, 0)) Traceback (most recent call last): ... AssertionError: ...
[ "def", "assert_datetime_about_now", "(", "actual", ",", "msg_fmt", "=", "\"{msg}\"", ")", ":", "now", "=", "datetime", ".", "now", "(", ")", "if", "actual", "is", "None", ":", "msg", "=", "\"None is not a valid date/time\"", "fail", "(", "msg_fmt", ".", "for...
Fail if a datetime object is not within 5 seconds of the local time. >>> assert_datetime_about_now(datetime.now()) >>> assert_datetime_about_now(datetime(1900, 1, 1, 12, 0, 0)) Traceback (most recent call last): ... AssertionError: datetime.datetime(1900, 1, 1, 12, 0) is not close to current da...
[ "Fail", "if", "a", "datetime", "object", "is", "not", "within", "5", "seconds", "of", "the", "local", "time", "." ]
1d5c797031c68ee27552d1c94e7f918c3d3d0453
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L790-L813
train