_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q250300
INI.has_option
train
def has_option(self, section, option) -> bool: """Test if file has option. Parameters ---------- section : string Section. option : string Option. Returns ------- boolean """ self.config.read(self.filepath) ...
python
{ "resource": "" }
q250301
INI.has_section
train
def has_section(self, section) -> bool: """Test if file has section. Parameters ---------- section : string Section. Returns ------- boolean """ self.config.read(self.filepath) return self.config.has_section(section)
python
{ "resource": "" }
q250302
INI.read
train
def read(self, section, option): """Read from file. Parameters ---------- section : string Section. option : string Option. Returns ------- string Value. """ self.config.read(self.filepath) raw ...
python
{ "resource": "" }
q250303
INI.sections
train
def sections(self) -> list: """List of sections.""" self.config.read(self.filepath) return self.config.sections()
python
{ "resource": "" }
q250304
INI.write
train
def write(self, section, option, value): """Write to file. Parameters ---------- section : string Section. option : string Option. value : string Value. """ self.config.read(self.filepath) string = tidy_headers....
python
{ "resource": "" }
q250305
timestamp_from_RFC3339
train
def timestamp_from_RFC3339(RFC3339): """Generate a Timestamp object from a RFC3339 formatted string. `Link to RFC3339`__ __ https://www.ietf.org/rfc/rfc3339.txt Parameters ---------- RFC3339 : string RFC3339 formatted string. Returns ------- WrightTools.kit.TimeStamp ...
python
{ "resource": "" }
q250306
TimeStamp.human
train
def human(self): """Human-readable timestamp.""" # get timezone offset delta_sec = time.timezone m, s = divmod(delta_sec, 60) h, m = divmod(m, 60) # create output format_string = "%Y-%m-%d %H:%M:%S" out = self.datetime.strftime(format_string) retur...
python
{ "resource": "" }
q250307
TimeStamp.path
train
def path(self): """Timestamp for placing into filepaths.""" out = self.datetime.strftime("%Y-%m-%d") out += " " ssm = ( self.datetime - self.datetime.replace(hour=0, minute=0, second=0, microsecond=0) ).total_seconds() out += str(int(ssm)).zfill(5) ret...
python
{ "resource": "" }
q250308
zoom2D
train
def zoom2D(xi, yi, zi, xi_zoom=3., yi_zoom=3., order=3, mode="nearest", cval=0.): """Zoom a 2D array, with axes. Parameters ---------- xi : 1D array x axis points. yi : 1D array y axis points. zi : 2D array array values. Shape of (x, y). xi_zoom : float (optional) ...
python
{ "resource": "" }
q250309
apply_rcparams
train
def apply_rcparams(kind="fast"): """Quickly apply rcparams for given purposes. Parameters ---------- kind: {'default', 'fast', 'publication'} (optional) Settings to use. Default is 'fast'. """ if kind == "default": matplotlib.rcdefaults() elif kind == "fast": matplot...
python
{ "resource": "" }
q250310
Axes._apply_labels
train
def _apply_labels( self, autolabel="none", xlabel=None, ylabel=None, data=None, channel_index=0 ): """Apply x and y labels to axes. Parameters ---------- autolabel : {'none', 'both', 'x', 'y'} (optional) Label(s) to apply from data. Default is none. xlabe...
python
{ "resource": "" }
q250311
Axes.add_sideplot
train
def add_sideplot(self, along, pad=0, height=0.75, ymin=0, ymax=1.1): """Add a side axis. Parameters ---------- along : {'x', 'y'} Axis to add along. pad : float (optional) Side axis pad. Default is 0. height : float (optional) Side axi...
python
{ "resource": "" }
q250312
Axes.legend
train
def legend(self, *args, **kwargs): """Add a legend. Parameters ---------- *args matplotlib legend args. *kwargs matplotlib legend kwargs. Returns ------- legend """ if "fancybox" not in kwargs.keys(): k...
python
{ "resource": "" }
q250313
Figure.add_subplot
train
def add_subplot(self, *args, **kwargs): """Add a subplot to the figure. Parameters ---------- *args **kwargs Returns ------- WrightTools.artists.Axes object """ kwargs.setdefault("projection", "wright") return super().add_subplot(...
python
{ "resource": "" }
q250314
WrongFileTypeWarning.warn
train
def warn(filepath, expected): """Raise warning. Parameters ---------- filepath : path-like Given filepath. expected : string Expected file suffix. """ filepath = pathlib.Path(filepath) message = "file {0} has type {1} (expected {2}...
python
{ "resource": "" }
q250315
Data.channel_names
train
def channel_names(self) -> tuple: """Channel names.""" if "channel_names" not in self.attrs.keys(): self.attrs["channel_names"] = np.array([], dtype="S") return tuple(s.decode() for s in self.attrs["channel_names"])
python
{ "resource": "" }
q250316
Data.ndim
train
def ndim(self) -> int: """Get number of dimensions.""" try: assert self._ndim is not None except (AssertionError, AttributeError): if len(self.variables) == 0: self._ndim = 0 else: self._ndim = self.variables[0].ndim fin...
python
{ "resource": "" }
q250317
Data._on_axes_updated
train
def _on_axes_updated(self): """Method to run when axes are changed in any way. Propagates updated axes properly. """ # update attrs self.attrs["axes"] = [a.identity.encode() for a in self._axes] # remove old attributes while len(self._current_axis_identities_in_n...
python
{ "resource": "" }
q250318
Data._on_constants_updated
train
def _on_constants_updated(self): """Method to run when constants are changed in any way. Propagates updated constants properly. """ # update attrs self.attrs["constants"] = [a.identity.encode() for a in self._constants]
python
{ "resource": "" }
q250319
Data.bring_to_front
train
def bring_to_front(self, channel): """Bring a specific channel to the zero-indexed position in channels. All other channels get pushed back but remain in order. Parameters ---------- channel : int or str Channel index or name. """ channel_index = wt_...
python
{ "resource": "" }
q250320
Data.gradient
train
def gradient(self, axis, *, channel=0): """ Compute the gradient along one axis. New channels have names ``<channel name>_<axis name>_gradient``. Parameters ---------- axis : int or str The axis to differentiate along. If given as an integer, the...
python
{ "resource": "" }
q250321
Data.convert
train
def convert(self, destination_units, *, convert_variables=False, verbose=True): """Convert all compatable axes and constants to given units. Parameters ---------- destination_units : str Destination units. convert_variables : boolean (optional) Toggle con...
python
{ "resource": "" }
q250322
Data.create_channel
train
def create_channel( self, name, values=None, *, shape=None, units=None, dtype=None, **kwargs ) -> Channel: """Append a new channel. Parameters ---------- name : string Unique name for this channel. values : array (optional) Array. If None, an ...
python
{ "resource": "" }
q250323
Data.create_variable
train
def create_variable( self, name, values=None, *, shape=None, units=None, dtype=None, **kwargs ) -> Variable: """Add new child variable. Parameters ---------- name : string Unique identifier. values : array-like (optional) Array to populate var...
python
{ "resource": "" }
q250324
Data.get_nadir
train
def get_nadir(self, channel=0) -> tuple: """Get the coordinates, in units, of the minimum in a channel. Parameters ---------- channel : int or str (optional) Channel. Default is 0. Returns ------- generator of numbers Coordinates in units...
python
{ "resource": "" }
q250325
Data.get_zenith
train
def get_zenith(self, channel=0) -> tuple: """Get the coordinates, in units, of the maximum in a channel. Parameters ---------- channel : int or str (optional) Channel. Default is 0. Returns ------- generator of numbers Coordinates in unit...
python
{ "resource": "" }
q250326
Data.heal
train
def heal(self, channel=0, method="linear", fill_value=np.nan, verbose=True): """ Remove nans from channel using interpolation. Parameters ---------- channel : int or str (optional) Channel to heal. Default is 0. method : {'linear', 'nearest', 'cubic'} (option...
python
{ "resource": "" }
q250327
Data.level
train
def level(self, channel, axis, npts, *, verbose=True): """Subtract the average value of npts at the edge of a given axis. Parameters ---------- channel : int or str Channel to level. axis : int Axis to level along. npts : int Number of...
python
{ "resource": "" }
q250328
Data.print_tree
train
def print_tree(self, *, verbose=True): """Print a ascii-formatted tree representation of the data contents.""" print("{0} ({1})".format(self.natural_name, self.filepath)) self._print_branch("", depth=0, verbose=verbose)
python
{ "resource": "" }
q250329
Data.remove_channel
train
def remove_channel(self, channel, *, verbose=True): """Remove channel from data. Parameters ---------- channel : int or str Channel index or name to remove. verbose : boolean (optional) Toggle talkback. Default is True. """ channel_index =...
python
{ "resource": "" }
q250330
Data.remove_variable
train
def remove_variable(self, variable, *, implied=True, verbose=True): """Remove variable from data. Parameters ---------- variable : int or str Variable index or name to remove. implied : boolean (optional) Toggle deletion of other variables that start with...
python
{ "resource": "" }
q250331
Data.rename_channels
train
def rename_channels(self, *, verbose=True, **kwargs): """Rename a set of channels. Parameters ---------- kwargs Keyword arguments of the form current:'new'. verbose : boolean (optional) Toggle talkback. Default is True """ # ensure that it...
python
{ "resource": "" }
q250332
Data.rename_variables
train
def rename_variables(self, *, implied=True, verbose=True, **kwargs): """Rename a set of variables. Parameters ---------- kwargs Keyword arguments of the form current:'new'. implied : boolean (optional) Toggle inclusion of other variables that start with t...
python
{ "resource": "" }
q250333
Data.share_nans
train
def share_nans(self): """Share not-a-numbers between all channels. If any channel is nan at a given index, all channels will be nan at that index after this operation. Uses the share_nans method found in wt.kit. """ def f(_, s, channels): outs = wt_kit.shar...
python
{ "resource": "" }
q250334
Data.smooth
train
def smooth(self, factors, channel=None, verbose=True) -> "Data": """Smooth a channel using an n-dimenional kaiser window. Note, all arrays are loaded into memory. For more info see `Kaiser_window`__ wikipedia entry. __ https://en.wikipedia.org/wiki/Kaiser_window Parameters ...
python
{ "resource": "" }
q250335
Data.transform
train
def transform(self, *axes, verbose=True): """Transform the data. Parameters ---------- axes : strings Expressions for the new set of axes. verbose : boolean (optional) Toggle talkback. Default is True See Also -------- set_constan...
python
{ "resource": "" }
q250336
Data.set_constants
train
def set_constants(self, *constants, verbose=True): """Set the constants associated with the data. Parameters ---------- constants : str Expressions for the new set of constants. verbose : boolean (optional) Toggle talkback. Default is True See Al...
python
{ "resource": "" }
q250337
Data.create_constant
train
def create_constant(self, expression, *, verbose=True): """Append a constant to the stored list. Parameters ---------- expression : str Expression for the new constant. verbose : boolean (optional) Toggle talkback. Default is True See...
python
{ "resource": "" }
q250338
Data.remove_constant
train
def remove_constant(self, constant, *, verbose=True): """Remove a constant from the stored list. Parameters ---------- constant : str or Constant or int Expression for the new constant. verbose : boolean (optional) Toggle talkback. Default is True ...
python
{ "resource": "" }
q250339
Data.zoom
train
def zoom(self, factor, order=1, verbose=True): """Zoom the data array using spline interpolation of the requested order. The number of points along each axis is increased by factor. See `scipy ndimage`__ for more info. __ http://docs.scipy.org/doc/scipy/reference/ g...
python
{ "resource": "" }
q250340
get_path_matching
train
def get_path_matching(name): """Get path matching a name. Parameters ---------- name : string Name to search for. Returns ------- string Full filepath. """ # first try looking in the user folder p = os.path.join(os.path.expanduser("~"), name) # then try expa...
python
{ "resource": "" }
q250341
glob_handler
train
def glob_handler(extension, folder=None, identifier=None): """Return a list of all files matching specified inputs. Parameters ---------- extension : string File extension. folder : string (optional) Folder to search within. Default is None (current working directory). i...
python
{ "resource": "" }
q250342
Channel.major_extent
train
def major_extent(self) -> complex: """Maximum deviation from null.""" return max((self.max() - self.null, self.null - self.min()))
python
{ "resource": "" }
q250343
Channel.minor_extent
train
def minor_extent(self) -> complex: """Minimum deviation from null.""" return min((self.max() - self.null, self.null - self.min()))
python
{ "resource": "" }
q250344
Channel.normalize
train
def normalize(self, mag=1.): """Normalize a Channel, set `null` to 0 and the mag to given value. Parameters ---------- mag : float (optional) New value of mag. Default is 1. """ def f(dataset, s, null, mag): dataset[s] -= null dataset...
python
{ "resource": "" }
q250345
Channel.trim
train
def trim(self, neighborhood, method="ztest", factor=3, replace="nan", verbose=True): """Remove outliers from the dataset. Identifies outliers by comparing each point to its neighbors using a statistical test. Parameters ---------- neighborhood : list of integers ...
python
{ "resource": "" }
q250346
Dataset.units
train
def units(self, value): """Set units.""" if value is None: if "units" in self.attrs.keys(): self.attrs.pop("units") else: try: self.attrs["units"] = value except AttributeError: self.attrs["units"] = value
python
{ "resource": "" }
q250347
Dataset.argmax
train
def argmax(self): """Index of the maximum, ignorning nans.""" if "argmax" not in self.attrs.keys(): def f(dataset, s): arr = dataset[s] try: amin = np.nanargmax(arr) except ValueError: amin = 0 ...
python
{ "resource": "" }
q250348
Dataset.chunkwise
train
def chunkwise(self, func, *args, **kwargs): """Execute a function for each chunk in the dataset. Order of excecution is not guaranteed. Parameters ---------- func : function Function to execute. First two arguments must be dataset, slices. args (...
python
{ "resource": "" }
q250349
Dataset.clip
train
def clip(self, min=None, max=None, replace=np.nan): """Clip values outside of a defined range. Parameters ---------- min : number (optional) New channel minimum. Default is None. max : number (optional) New channel maximum. Default is None. replac...
python
{ "resource": "" }
q250350
Dataset.convert
train
def convert(self, destination_units): """Convert units. Parameters ---------- destination_units : string (optional) Units to convert into. """ if not wt_units.is_valid_conversion(self.units, destination_units): kind = wt_units.kind(self.units) ...
python
{ "resource": "" }
q250351
Dataset.log
train
def log(self, base=np.e, floor=None): """Take the log of the entire dataset. Parameters ---------- base : number (optional) Base of log. Default is e. floor : number (optional) Clip values below floor after log. Default is None. """ def f...
python
{ "resource": "" }
q250352
Dataset.log10
train
def log10(self, floor=None): """Take the log base 10 of the entire dataset. Parameters ---------- floor : number (optional) Clip values below floor after log. Default is None. """ def f(dataset, s, floor): arr = dataset[s] arr = np.lo...
python
{ "resource": "" }
q250353
Dataset.max
train
def max(self): """Maximum, ignorning nans.""" if "max" not in self.attrs.keys(): def f(dataset, s): return np.nanmax(dataset[s]) self.attrs["max"] = np.nanmax(list(self.chunkwise(f).values())) return self.attrs["max"]
python
{ "resource": "" }
q250354
Dataset.min
train
def min(self): """Minimum, ignoring nans.""" if "min" not in self.attrs.keys(): def f(dataset, s): return np.nanmin(dataset[s]) self.attrs["min"] = np.nanmin(list(self.chunkwise(f).values())) return self.attrs["min"]
python
{ "resource": "" }
q250355
Dataset.slices
train
def slices(self): """Returns a generator yielding tuple of slice objects. Order is not guaranteed. """ if self.chunks is None: yield tuple(slice(None, s) for s in self.shape) else: ceilings = tuple(-(-s // c) for s, c in zip(self.shape, self.chunks)) ...
python
{ "resource": "" }
q250356
Constant.label
train
def label(self) -> str: """A latex formatted label representing constant expression and united value.""" label = self.expression.replace("_", "\\;") if self.units_kind: symbol = wt_units.get_symbol(self.units) for v in self.variables: vl = "%s_{%s}" % (sym...
python
{ "resource": "" }
q250357
from_directory
train
def from_directory(filepath, from_methods, *, name=None, parent=None, verbose=True): """Create a WrightTools Collection from a directory of source files. Parameters ---------- filepath: path-like Path to the directory on the file system from_methods: dict<str, callable> Dictionary w...
python
{ "resource": "" }
q250358
is_valid_combination
train
def is_valid_combination(values, names): dictionary = dict(zip(names, values)) """ Should return True if combination is valid and False otherwise. Dictionary that is passed here can be incomplete. To prevent search for unnecessary items filtering function is executed with found subset of data...
python
{ "resource": "" }
q250359
is_valid_combination
train
def is_valid_combination(row): """ This is a filtering function. Filtering functions should return True if combination is valid and False otherwise. Test row that is passed here can be incomplete. To prevent search for unnecessary items filtering function is executed with found subset of data t...
python
{ "resource": "" }
q250360
create_station
train
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
{ "resource": "" }
q250361
TopocentricFrame.visibility
train
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
{ "resource": "" }
q250362
TopocentricFrame._to_parent_frame
train
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
{ "resource": "" }
q250363
TopocentricFrame._geodetic_to_cartesian
train
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
{ "resource": "" }
q250364
TopocentricFrame.get_mask
train
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
{ "resource": "" }
q250365
get_body
train
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
{ "resource": "" }
q250366
MoonPropagator.propagate
train
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
{ "resource": "" }
q250367
SunPropagator.propagate
train
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
{ "resource": "" }
q250368
Propagator.iter
train
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
{ "resource": "" }
q250369
get_orbit
train
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
{ "resource": "" }
q250370
create_frames
train
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
{ "resource": "" }
q250371
get_body
train
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
{ "resource": "" }
q250372
Bsp.open
train
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
{ "resource": "" }
q250373
Bsp.get
train
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
{ "resource": "" }
q250374
get_propagator
train
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
{ "resource": "" }
q250375
stations_listeners
train
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
{ "resource": "" }
q250376
Speaker._bisect
train
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
{ "resource": "" }
q250377
Listener.check
train
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
{ "resource": "" }
q250378
Form._m_to_e
train
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
{ "resource": "" }
q250379
Form._cartesian_to_spherical
train
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
{ "resource": "" }
q250380
Form._spherical_to_cartesian
train
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
{ "resource": "" }
q250381
Ephem.interpolate
train
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
{ "resource": "" }
q250382
Ephem.iter
train
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
{ "resource": "" }
q250383
Ephem.ephem
train
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
{ "resource": "" }
q250384
Ephem.copy
train
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
{ "resource": "" }
q250385
loads
train
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
{ "resource": "" }
q250386
dumps
train
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
{ "resource": "" }
q250387
_float
train
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
{ "resource": "" }
q250388
_tab
train
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
{ "resource": "" }
q250389
_earth_orientation
train
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
{ "resource": "" }
q250390
earth_orientation
train
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
{ "resource": "" }
q250391
_xys
train
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
{ "resource": "" }
q250392
Sgp4.orbit
train
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
{ "resource": "" }
q250393
Sgp4.propagate
train
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
{ "resource": "" }
q250394
to_tnw
train
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
{ "resource": "" }
q250395
to_qsw
train
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
{ "resource": "" }
q250396
_float
train
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
{ "resource": "" }
q250397
_unfloat
train
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
{ "resource": "" }
q250398
Tle._check_validity
train
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
{ "resource": "" }
q250399
Tle._checksum
train
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
{ "resource": "" }