id int32 0 252k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
229,900 | google/textfsm | textfsm/parser.py | TextFSM._GetValue | def _GetValue(self, name):
"""Returns the TextFSMValue object natching the requested name."""
for value in self.values:
if value.name == name:
return value | python | def _GetValue(self, name):
"""Returns the TextFSMValue object natching the requested name."""
for value in self.values:
if value.name == name:
return value | [
"def",
"_GetValue",
"(",
"self",
",",
"name",
")",
":",
"for",
"value",
"in",
"self",
".",
"values",
":",
"if",
"value",
".",
"name",
"==",
"name",
":",
"return",
"value"
] | Returns the TextFSMValue object natching the requested name. | [
"Returns",
"the",
"TextFSMValue",
"object",
"natching",
"the",
"requested",
"name",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L622-L626 |
229,901 | google/textfsm | textfsm/parser.py | TextFSM._AppendRecord | def _AppendRecord(self):
"""Adds current record to result if well formed."""
# If no Values then don't output.
if not self.values:
return
cur_record = []
for value in self.values:
try:
value.OnSaveRecord()
except SkipRecord:
self._ClearRecord()
return
... | python | def _AppendRecord(self):
"""Adds current record to result if well formed."""
# If no Values then don't output.
if not self.values:
return
cur_record = []
for value in self.values:
try:
value.OnSaveRecord()
except SkipRecord:
self._ClearRecord()
return
... | [
"def",
"_AppendRecord",
"(",
"self",
")",
":",
"# If no Values then don't output.",
"if",
"not",
"self",
".",
"values",
":",
"return",
"cur_record",
"=",
"[",
"]",
"for",
"value",
"in",
"self",
".",
"values",
":",
"try",
":",
"value",
".",
"OnSaveRecord",
... | Adds current record to result if well formed. | [
"Adds",
"current",
"record",
"to",
"result",
"if",
"well",
"formed",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L628-L657 |
229,902 | google/textfsm | textfsm/parser.py | TextFSM._Parse | def _Parse(self, template):
"""Parses template file for FSM structure.
Args:
template: Valid template file.
Raises:
TextFSMTemplateError: If template file syntax is invalid.
"""
if not template:
raise TextFSMTemplateError('Null template.')
# Parse header with Variables.
... | python | def _Parse(self, template):
"""Parses template file for FSM structure.
Args:
template: Valid template file.
Raises:
TextFSMTemplateError: If template file syntax is invalid.
"""
if not template:
raise TextFSMTemplateError('Null template.')
# Parse header with Variables.
... | [
"def",
"_Parse",
"(",
"self",
",",
"template",
")",
":",
"if",
"not",
"template",
":",
"raise",
"TextFSMTemplateError",
"(",
"'Null template.'",
")",
"# Parse header with Variables.",
"self",
".",
"_ParseFSMVariables",
"(",
"template",
")",
"# Parse States.",
"while... | Parses template file for FSM structure.
Args:
template: Valid template file.
Raises:
TextFSMTemplateError: If template file syntax is invalid. | [
"Parses",
"template",
"file",
"for",
"FSM",
"structure",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L659-L680 |
229,903 | google/textfsm | textfsm/parser.py | TextFSM._ParseFSMVariables | def _ParseFSMVariables(self, template):
"""Extracts Variables from start of template file.
Values are expected as a contiguous block at the head of the file.
These will be line separated from the State definitions that follow.
Args:
template: Valid template file, with Value definitions at the to... | python | def _ParseFSMVariables(self, template):
"""Extracts Variables from start of template file.
Values are expected as a contiguous block at the head of the file.
These will be line separated from the State definitions that follow.
Args:
template: Valid template file, with Value definitions at the to... | [
"def",
"_ParseFSMVariables",
"(",
"self",
",",
"template",
")",
":",
"self",
".",
"values",
"=",
"[",
"]",
"for",
"line",
"in",
"template",
":",
"self",
".",
"_line_num",
"+=",
"1",
"line",
"=",
"line",
".",
"rstrip",
"(",
")",
"# Blank line signifies en... | Extracts Variables from start of template file.
Values are expected as a contiguous block at the head of the file.
These will be line separated from the State definitions that follow.
Args:
template: Valid template file, with Value definitions at the top.
Raises:
TextFSMTemplateError: If ... | [
"Extracts",
"Variables",
"from",
"start",
"of",
"template",
"file",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L682-L736 |
229,904 | google/textfsm | textfsm/parser.py | TextFSM._ParseFSMState | def _ParseFSMState(self, template):
"""Extracts State and associated Rules from body of template file.
After the Value definitions the remainder of the template is
state definitions. The routine is expected to be called iteratively
until no more states remain - indicated by returning None.
The rou... | python | def _ParseFSMState(self, template):
"""Extracts State and associated Rules from body of template file.
After the Value definitions the remainder of the template is
state definitions. The routine is expected to be called iteratively
until no more states remain - indicated by returning None.
The rou... | [
"def",
"_ParseFSMState",
"(",
"self",
",",
"template",
")",
":",
"if",
"not",
"template",
":",
"return",
"state_name",
"=",
"''",
"# Strip off extra white space lines (including comments).",
"for",
"line",
"in",
"template",
":",
"self",
".",
"_line_num",
"+=",
"1"... | Extracts State and associated Rules from body of template file.
After the Value definitions the remainder of the template is
state definitions. The routine is expected to be called iteratively
until no more states remain - indicated by returning None.
The routine checks that the state names are a well... | [
"Extracts",
"State",
"and",
"associated",
"Rules",
"from",
"body",
"of",
"template",
"file",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L743-L812 |
229,905 | google/textfsm | textfsm/parser.py | TextFSM._ValidateFSM | def _ValidateFSM(self):
"""Checks state names and destinations for validity.
Each destination state must exist, be a valid name and
not be a reserved name.
There must be a 'Start' state and if 'EOF' or 'End' states are specified,
they must be empty.
Returns:
True if FSM is valid.
Ra... | python | def _ValidateFSM(self):
"""Checks state names and destinations for validity.
Each destination state must exist, be a valid name and
not be a reserved name.
There must be a 'Start' state and if 'EOF' or 'End' states are specified,
they must be empty.
Returns:
True if FSM is valid.
Ra... | [
"def",
"_ValidateFSM",
"(",
"self",
")",
":",
"# Must have 'Start' state.",
"if",
"'Start'",
"not",
"in",
"self",
".",
"states",
":",
"raise",
"TextFSMTemplateError",
"(",
"\"Missing state 'Start'.\"",
")",
"# 'End/EOF' state (if specified) must be empty.",
"if",
"self",
... | Checks state names and destinations for validity.
Each destination state must exist, be a valid name and
not be a reserved name.
There must be a 'Start' state and if 'EOF' or 'End' states are specified,
they must be empty.
Returns:
True if FSM is valid.
Raises:
TextFSMTemplateErro... | [
"Checks",
"state",
"names",
"and",
"destinations",
"for",
"validity",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L814-L859 |
229,906 | google/textfsm | textfsm/parser.py | TextFSM.ParseText | def ParseText(self, text, eof=True):
"""Passes CLI output through FSM and returns list of tuples.
First tuple is the header, every subsequent tuple is a row.
Args:
text: (str), Text to parse with embedded newlines.
eof: (boolean), Set to False if we are parsing only part of the file.
... | python | def ParseText(self, text, eof=True):
"""Passes CLI output through FSM and returns list of tuples.
First tuple is the header, every subsequent tuple is a row.
Args:
text: (str), Text to parse with embedded newlines.
eof: (boolean), Set to False if we are parsing only part of the file.
... | [
"def",
"ParseText",
"(",
"self",
",",
"text",
",",
"eof",
"=",
"True",
")",
":",
"lines",
"=",
"[",
"]",
"if",
"text",
":",
"lines",
"=",
"text",
".",
"splitlines",
"(",
")",
"for",
"line",
"in",
"lines",
":",
"self",
".",
"_CheckLine",
"(",
"lin... | Passes CLI output through FSM and returns list of tuples.
First tuple is the header, every subsequent tuple is a row.
Args:
text: (str), Text to parse with embedded newlines.
eof: (boolean), Set to False if we are parsing only part of the file.
Suppresses triggering EOF state.
Rai... | [
"Passes",
"CLI",
"output",
"through",
"FSM",
"and",
"returns",
"list",
"of",
"tuples",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L861-L892 |
229,907 | google/textfsm | textfsm/parser.py | TextFSM.ParseTextToDicts | def ParseTextToDicts(self, *args, **kwargs):
"""Calls ParseText and turns the result into list of dicts.
List items are dicts of rows, dict key is column header and value is column
value.
Args:
text: (str), Text to parse with embedded newlines.
eof: (boolean), Set to False if we are parsin... | python | def ParseTextToDicts(self, *args, **kwargs):
"""Calls ParseText and turns the result into list of dicts.
List items are dicts of rows, dict key is column header and value is column
value.
Args:
text: (str), Text to parse with embedded newlines.
eof: (boolean), Set to False if we are parsin... | [
"def",
"ParseTextToDicts",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"result_lists",
"=",
"self",
".",
"ParseText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"result_dicts",
"=",
"[",
"]",
"for",
"row",
"in",
"result_lis... | Calls ParseText and turns the result into list of dicts.
List items are dicts of rows, dict key is column header and value is column
value.
Args:
text: (str), Text to parse with embedded newlines.
eof: (boolean), Set to False if we are parsing only part of the file.
Suppresses trig... | [
"Calls",
"ParseText",
"and",
"turns",
"the",
"result",
"into",
"list",
"of",
"dicts",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L894-L918 |
229,908 | google/textfsm | textfsm/parser.py | TextFSM._AssignVar | def _AssignVar(self, matched, value):
"""Assigns variable into current record from a matched rule.
If a record entry is a list then append, otherwise values are replaced.
Args:
matched: (regexp.match) Named group for each matched value.
value: (str) The matched value.
"""
_value = self... | python | def _AssignVar(self, matched, value):
"""Assigns variable into current record from a matched rule.
If a record entry is a list then append, otherwise values are replaced.
Args:
matched: (regexp.match) Named group for each matched value.
value: (str) The matched value.
"""
_value = self... | [
"def",
"_AssignVar",
"(",
"self",
",",
"matched",
",",
"value",
")",
":",
"_value",
"=",
"self",
".",
"_GetValue",
"(",
"value",
")",
"if",
"_value",
"is",
"not",
"None",
":",
"_value",
".",
"AssignVar",
"(",
"matched",
".",
"group",
"(",
"value",
")... | Assigns variable into current record from a matched rule.
If a record entry is a list then append, otherwise values are replaced.
Args:
matched: (regexp.match) Named group for each matched value.
value: (str) The matched value. | [
"Assigns",
"variable",
"into",
"current",
"record",
"from",
"a",
"matched",
"rule",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L955-L966 |
229,909 | google/textfsm | textfsm/parser.py | TextFSM._Operations | def _Operations(self, rule, line):
"""Operators on the data record.
Operators come in two parts and are a '.' separated pair:
Operators that effect the input line or the current state (line_op).
'Next' Get next input line and restart parsing (default).
'Continue' Keep current input... | python | def _Operations(self, rule, line):
"""Operators on the data record.
Operators come in two parts and are a '.' separated pair:
Operators that effect the input line or the current state (line_op).
'Next' Get next input line and restart parsing (default).
'Continue' Keep current input... | [
"def",
"_Operations",
"(",
"self",
",",
"rule",
",",
"line",
")",
":",
"# First process the Record operators.",
"if",
"rule",
".",
"record_op",
"==",
"'Record'",
":",
"self",
".",
"_AppendRecord",
"(",
")",
"elif",
"rule",
".",
"record_op",
"==",
"'Clear'",
... | Operators on the data record.
Operators come in two parts and are a '.' separated pair:
Operators that effect the input line or the current state (line_op).
'Next' Get next input line and restart parsing (default).
'Continue' Keep current input line and continue resume parsing.
... | [
"Operators",
"on",
"the",
"data",
"record",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L968-L1020 |
229,910 | google/textfsm | textfsm/parser.py | TextFSM.GetValuesByAttrib | def GetValuesByAttrib(self, attribute):
"""Returns the list of values that have a particular attribute."""
if attribute not in self._options_cls.ValidOptions():
raise ValueError("'%s': Not a valid attribute." % attribute)
result = []
for value in self.values:
if attribute in value.OptionNa... | python | def GetValuesByAttrib(self, attribute):
"""Returns the list of values that have a particular attribute."""
if attribute not in self._options_cls.ValidOptions():
raise ValueError("'%s': Not a valid attribute." % attribute)
result = []
for value in self.values:
if attribute in value.OptionNa... | [
"def",
"GetValuesByAttrib",
"(",
"self",
",",
"attribute",
")",
":",
"if",
"attribute",
"not",
"in",
"self",
".",
"_options_cls",
".",
"ValidOptions",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"'%s': Not a valid attribute.\"",
"%",
"attribute",
")",
"result",... | Returns the list of values that have a particular attribute. | [
"Returns",
"the",
"list",
"of",
"values",
"that",
"have",
"a",
"particular",
"attribute",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/parser.py#L1030-L1041 |
229,911 | google/textfsm | textfsm/terminal.py | _AnsiCmd | def _AnsiCmd(command_list):
"""Takes a list of SGR values and formats them as an ANSI escape sequence.
Args:
command_list: List of strings, each string represents an SGR value.
e.g. 'fg_blue', 'bg_yellow'
Returns:
The ANSI escape sequence.
Raises:
ValueError: if a member of command_list d... | python | def _AnsiCmd(command_list):
"""Takes a list of SGR values and formats them as an ANSI escape sequence.
Args:
command_list: List of strings, each string represents an SGR value.
e.g. 'fg_blue', 'bg_yellow'
Returns:
The ANSI escape sequence.
Raises:
ValueError: if a member of command_list d... | [
"def",
"_AnsiCmd",
"(",
"command_list",
")",
":",
"if",
"not",
"isinstance",
"(",
"command_list",
",",
"list",
")",
":",
"raise",
"ValueError",
"(",
"'Invalid list: %s'",
"%",
"command_list",
")",
"# Checks that entries are valid SGR names.",
"# No checking is done for ... | Takes a list of SGR values and formats them as an ANSI escape sequence.
Args:
command_list: List of strings, each string represents an SGR value.
e.g. 'fg_blue', 'bg_yellow'
Returns:
The ANSI escape sequence.
Raises:
ValueError: if a member of command_list does not map to a valid SGR value. | [
"Takes",
"a",
"list",
"of",
"SGR",
"values",
"and",
"formats",
"them",
"as",
"an",
"ANSI",
"escape",
"sequence",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/terminal.py#L115-L138 |
229,912 | google/textfsm | textfsm/terminal.py | TerminalSize | def TerminalSize():
"""Returns terminal length and width as a tuple."""
try:
with open(os.ctermid(), 'r') as tty_instance:
length_width = struct.unpack(
'hh', fcntl.ioctl(tty_instance.fileno(), termios.TIOCGWINSZ, '1234'))
except (IOError, OSError):
try:
length_width = (int(os.enviro... | python | def TerminalSize():
"""Returns terminal length and width as a tuple."""
try:
with open(os.ctermid(), 'r') as tty_instance:
length_width = struct.unpack(
'hh', fcntl.ioctl(tty_instance.fileno(), termios.TIOCGWINSZ, '1234'))
except (IOError, OSError):
try:
length_width = (int(os.enviro... | [
"def",
"TerminalSize",
"(",
")",
":",
"try",
":",
"with",
"open",
"(",
"os",
".",
"ctermid",
"(",
")",
",",
"'r'",
")",
"as",
"tty_instance",
":",
"length_width",
"=",
"struct",
".",
"unpack",
"(",
"'hh'",
",",
"fcntl",
".",
"ioctl",
"(",
"tty_instan... | Returns terminal length and width as a tuple. | [
"Returns",
"terminal",
"length",
"and",
"width",
"as",
"a",
"tuple",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/terminal.py#L170-L182 |
229,913 | google/textfsm | textfsm/terminal.py | main | def main(argv=None):
"""Routine to page text or determine window size via command line."""
if argv is None:
argv = sys.argv
try:
opts, args = getopt.getopt(argv[1:], 'dhs', ['nodelay', 'help', 'size'])
except getopt.error as msg:
raise Usage(msg)
# Print usage and return, regardless of presence... | python | def main(argv=None):
"""Routine to page text or determine window size via command line."""
if argv is None:
argv = sys.argv
try:
opts, args = getopt.getopt(argv[1:], 'dhs', ['nodelay', 'help', 'size'])
except getopt.error as msg:
raise Usage(msg)
# Print usage and return, regardless of presence... | [
"def",
"main",
"(",
"argv",
"=",
"None",
")",
":",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"try",
":",
"opts",
",",
"args",
"=",
"getopt",
".",
"getopt",
"(",
"argv",
"[",
"1",
":",
"]",
",",
"'dhs'",
",",
"[",
"'nod... | Routine to page text or determine window size via command line. | [
"Routine",
"to",
"page",
"text",
"or",
"determine",
"window",
"size",
"via",
"command",
"line",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/terminal.py#L447-L484 |
229,914 | google/textfsm | textfsm/terminal.py | Pager.Reset | def Reset(self):
"""Reset the pager to the top of the text."""
self._displayed = 0
self._currentpagelines = 0
self._lastscroll = 1
self._lines_to_show = self._cli_lines | python | def Reset(self):
"""Reset the pager to the top of the text."""
self._displayed = 0
self._currentpagelines = 0
self._lastscroll = 1
self._lines_to_show = self._cli_lines | [
"def",
"Reset",
"(",
"self",
")",
":",
"self",
".",
"_displayed",
"=",
"0",
"self",
".",
"_currentpagelines",
"=",
"0",
"self",
".",
"_lastscroll",
"=",
"1",
"self",
".",
"_lines_to_show",
"=",
"self",
".",
"_cli_lines"
] | Reset the pager to the top of the text. | [
"Reset",
"the",
"pager",
"to",
"the",
"top",
"of",
"the",
"text",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/terminal.py#L302-L307 |
229,915 | google/textfsm | textfsm/terminal.py | Pager.SetLines | def SetLines(self, lines):
"""Set number of screen lines.
Args:
lines: An int, number of lines. If None, use terminal dimensions.
Raises:
ValueError, TypeError: Not a valid integer representation.
"""
(self._cli_lines, self._cli_cols) = TerminalSize()
if lines:
self._cli_li... | python | def SetLines(self, lines):
"""Set number of screen lines.
Args:
lines: An int, number of lines. If None, use terminal dimensions.
Raises:
ValueError, TypeError: Not a valid integer representation.
"""
(self._cli_lines, self._cli_cols) = TerminalSize()
if lines:
self._cli_li... | [
"def",
"SetLines",
"(",
"self",
",",
"lines",
")",
":",
"(",
"self",
".",
"_cli_lines",
",",
"self",
".",
"_cli_cols",
")",
"=",
"TerminalSize",
"(",
")",
"if",
"lines",
":",
"self",
".",
"_cli_lines",
"=",
"int",
"(",
"lines",
")"
] | Set number of screen lines.
Args:
lines: An int, number of lines. If None, use terminal dimensions.
Raises:
ValueError, TypeError: Not a valid integer representation. | [
"Set",
"number",
"of",
"screen",
"lines",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/terminal.py#L309-L322 |
229,916 | google/textfsm | textfsm/terminal.py | Pager.Page | def Page(self, text=None, show_percent=None):
"""Page text.
Continues to page through any text supplied in the constructor. Also, any
text supplied to this method will be appended to the total text to be
displayed. The method returns when all available text has been displayed to
the user, or the us... | python | def Page(self, text=None, show_percent=None):
"""Page text.
Continues to page through any text supplied in the constructor. Also, any
text supplied to this method will be appended to the total text to be
displayed. The method returns when all available text has been displayed to
the user, or the us... | [
"def",
"Page",
"(",
"self",
",",
"text",
"=",
"None",
",",
"show_percent",
"=",
"None",
")",
":",
"if",
"text",
"is",
"not",
"None",
":",
"self",
".",
"_text",
"+=",
"text",
"if",
"show_percent",
"is",
"None",
":",
"show_percent",
"=",
"text",
"is",
... | Page text.
Continues to page through any text supplied in the constructor. Also, any
text supplied to this method will be appended to the total text to be
displayed. The method returns when all available text has been displayed to
the user, or the user quits the pager.
Args:
text: A string, ... | [
"Page",
"text",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/terminal.py#L329-L383 |
229,917 | google/textfsm | textfsm/terminal.py | Pager._Scroll | def _Scroll(self, lines=None):
"""Set attributes to scroll the buffer correctly.
Args:
lines: An int, number of lines to scroll. If None, scrolls
by the terminal length.
"""
if lines is None:
lines = self._cli_lines
if lines < 0:
self._displayed -= self._cli_lines
s... | python | def _Scroll(self, lines=None):
"""Set attributes to scroll the buffer correctly.
Args:
lines: An int, number of lines to scroll. If None, scrolls
by the terminal length.
"""
if lines is None:
lines = self._cli_lines
if lines < 0:
self._displayed -= self._cli_lines
s... | [
"def",
"_Scroll",
"(",
"self",
",",
"lines",
"=",
"None",
")",
":",
"if",
"lines",
"is",
"None",
":",
"lines",
"=",
"self",
".",
"_cli_lines",
"if",
"lines",
"<",
"0",
":",
"self",
".",
"_displayed",
"-=",
"self",
".",
"_cli_lines",
"self",
".",
"_... | Set attributes to scroll the buffer correctly.
Args:
lines: An int, number of lines to scroll. If None, scrolls
by the terminal length. | [
"Set",
"attributes",
"to",
"scroll",
"the",
"buffer",
"correctly",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/terminal.py#L385-L404 |
229,918 | google/textfsm | textfsm/terminal.py | Pager._AskUser | def _AskUser(self):
"""Prompt the user for the next action.
Returns:
A string, the character entered by the user.
"""
if self._show_percent:
progress = int(self._displayed*100 / (len(self._text.splitlines())))
progress_text = ' (%d%%)' % progress
else:
progress_text = ''
... | python | def _AskUser(self):
"""Prompt the user for the next action.
Returns:
A string, the character entered by the user.
"""
if self._show_percent:
progress = int(self._displayed*100 / (len(self._text.splitlines())))
progress_text = ' (%d%%)' % progress
else:
progress_text = ''
... | [
"def",
"_AskUser",
"(",
"self",
")",
":",
"if",
"self",
".",
"_show_percent",
":",
"progress",
"=",
"int",
"(",
"self",
".",
"_displayed",
"*",
"100",
"/",
"(",
"len",
"(",
"self",
".",
"_text",
".",
"splitlines",
"(",
")",
")",
")",
")",
"progress... | Prompt the user for the next action.
Returns:
A string, the character entered by the user. | [
"Prompt",
"the",
"user",
"for",
"the",
"next",
"action",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/terminal.py#L406-L426 |
229,919 | google/textfsm | textfsm/terminal.py | Pager._GetCh | def _GetCh(self):
"""Read a single character from the user.
Returns:
A string, the character read.
"""
fd = self._tty.fileno()
old = termios.tcgetattr(fd)
try:
tty.setraw(fd)
ch = self._tty.read(1)
# Also support arrow key shortcuts (escape + 2 chars)
if ord(ch) ==... | python | def _GetCh(self):
"""Read a single character from the user.
Returns:
A string, the character read.
"""
fd = self._tty.fileno()
old = termios.tcgetattr(fd)
try:
tty.setraw(fd)
ch = self._tty.read(1)
# Also support arrow key shortcuts (escape + 2 chars)
if ord(ch) ==... | [
"def",
"_GetCh",
"(",
"self",
")",
":",
"fd",
"=",
"self",
".",
"_tty",
".",
"fileno",
"(",
")",
"old",
"=",
"termios",
".",
"tcgetattr",
"(",
"fd",
")",
"try",
":",
"tty",
".",
"setraw",
"(",
"fd",
")",
"ch",
"=",
"self",
".",
"_tty",
".",
"... | Read a single character from the user.
Returns:
A string, the character read. | [
"Read",
"a",
"single",
"character",
"from",
"the",
"user",
"."
] | 63a2aaece33e07947aa80963dca99b893964633b | https://github.com/google/textfsm/blob/63a2aaece33e07947aa80963dca99b893964633b/textfsm/terminal.py#L428-L444 |
229,920 | skyfielders/python-skyfield | skyfield/relativity.py | add_deflection | def add_deflection(position, observer, ephemeris, t,
include_earth_deflection, count=3):
"""Update `position` for how solar system masses will deflect its light.
Given the ICRS `position` [x,y,z] of an object (au) that is being
viewed from the `observer` also expressed as [x,y,z], and gi... | python | def add_deflection(position, observer, ephemeris, t,
include_earth_deflection, count=3):
"""Update `position` for how solar system masses will deflect its light.
Given the ICRS `position` [x,y,z] of an object (au) that is being
viewed from the `observer` also expressed as [x,y,z], and gi... | [
"def",
"add_deflection",
"(",
"position",
",",
"observer",
",",
"ephemeris",
",",
"t",
",",
"include_earth_deflection",
",",
"count",
"=",
"3",
")",
":",
"# Compute light-time to observed object.",
"tlt",
"=",
"length_of",
"(",
"position",
")",
"/",
"C_AUDAY",
"... | Update `position` for how solar system masses will deflect its light.
Given the ICRS `position` [x,y,z] of an object (au) that is being
viewed from the `observer` also expressed as [x,y,z], and given an
ephemeris that can be used to determine solar system body positions,
and given the time `t` and Bool... | [
"Update",
"position",
"for",
"how",
"solar",
"system",
"masses",
"will",
"deflect",
"its",
"light",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/relativity.py#L23-L97 |
229,921 | skyfielders/python-skyfield | skyfield/relativity.py | _add_deflection | def _add_deflection(position, observer, deflector, rmass):
"""Correct a position vector for how one particular mass deflects light.
Given the ICRS `position` [x,y,z] of an object (AU) together with
the positions of an `observer` and a `deflector` of reciprocal mass
`rmass`, this function updates `posit... | python | def _add_deflection(position, observer, deflector, rmass):
"""Correct a position vector for how one particular mass deflects light.
Given the ICRS `position` [x,y,z] of an object (AU) together with
the positions of an `observer` and a `deflector` of reciprocal mass
`rmass`, this function updates `posit... | [
"def",
"_add_deflection",
"(",
"position",
",",
"observer",
",",
"deflector",
",",
"rmass",
")",
":",
"# Construct vector 'pq' from gravitating body to observed object and",
"# construct vector 'pe' from gravitating body to observer.",
"pq",
"=",
"observer",
"+",
"position",
"-... | Correct a position vector for how one particular mass deflects light.
Given the ICRS `position` [x,y,z] of an object (AU) together with
the positions of an `observer` and a `deflector` of reciprocal mass
`rmass`, this function updates `position` in-place to show how much
the presence of the deflector w... | [
"Correct",
"a",
"position",
"vector",
"for",
"how",
"one",
"particular",
"mass",
"deflects",
"light",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/relativity.py#L121-L166 |
229,922 | skyfielders/python-skyfield | skyfield/relativity.py | add_aberration | def add_aberration(position, velocity, light_time):
"""Correct a relative position vector for aberration of light.
Given the relative `position` [x,y,z] of an object (AU) from a
particular observer, the `velocity` [dx,dy,dz] at which the observer
is traveling (AU/day), and the light propagation delay `... | python | def add_aberration(position, velocity, light_time):
"""Correct a relative position vector for aberration of light.
Given the relative `position` [x,y,z] of an object (AU) from a
particular observer, the `velocity` [dx,dy,dz] at which the observer
is traveling (AU/day), and the light propagation delay `... | [
"def",
"add_aberration",
"(",
"position",
",",
"velocity",
",",
"light_time",
")",
":",
"p1mag",
"=",
"light_time",
"*",
"C_AUDAY",
"vemag",
"=",
"length_of",
"(",
"velocity",
")",
"beta",
"=",
"vemag",
"/",
"C_AUDAY",
"dot",
"=",
"dots",
"(",
"position",
... | Correct a relative position vector for aberration of light.
Given the relative `position` [x,y,z] of an object (AU) from a
particular observer, the `velocity` [dx,dy,dz] at which the observer
is traveling (AU/day), and the light propagation delay `light_time`
to the object (days), this function updates... | [
"Correct",
"a",
"relative",
"position",
"vector",
"for",
"aberration",
"of",
"light",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/relativity.py#L170-L193 |
229,923 | skyfielders/python-skyfield | skyfield/jpllib.py | _center | def _center(code, segment_dict):
"""Starting with `code`, follow segments from target to center."""
while code in segment_dict:
segment = segment_dict[code]
yield segment
code = segment.center | python | def _center(code, segment_dict):
"""Starting with `code`, follow segments from target to center."""
while code in segment_dict:
segment = segment_dict[code]
yield segment
code = segment.center | [
"def",
"_center",
"(",
"code",
",",
"segment_dict",
")",
":",
"while",
"code",
"in",
"segment_dict",
":",
"segment",
"=",
"segment_dict",
"[",
"code",
"]",
"yield",
"segment",
"code",
"=",
"segment",
".",
"center"
] | Starting with `code`, follow segments from target to center. | [
"Starting",
"with",
"code",
"follow",
"segments",
"from",
"target",
"to",
"center",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/jpllib.py#L217-L222 |
229,924 | skyfielders/python-skyfield | skyfield/jpllib.py | SpiceKernel.names | def names(self):
"""Return all target names that are valid with this kernel.
>>> pprint(planets.names())
{0: ['SOLAR_SYSTEM_BARYCENTER', 'SSB', 'SOLAR SYSTEM BARYCENTER'],
1: ['MERCURY_BARYCENTER', 'MERCURY BARYCENTER'],
2: ['VENUS_BARYCENTER', 'VENUS BARYCENTER'],
3:... | python | def names(self):
"""Return all target names that are valid with this kernel.
>>> pprint(planets.names())
{0: ['SOLAR_SYSTEM_BARYCENTER', 'SSB', 'SOLAR SYSTEM BARYCENTER'],
1: ['MERCURY_BARYCENTER', 'MERCURY BARYCENTER'],
2: ['VENUS_BARYCENTER', 'VENUS BARYCENTER'],
3:... | [
"def",
"names",
"(",
"self",
")",
":",
"d",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"code",
",",
"name",
"in",
"target_name_pairs",
":",
"if",
"code",
"in",
"self",
".",
"codes",
":",
"d",
"[",
"code",
"]",
".",
"append",
"(",
"name",
")",
"... | Return all target names that are valid with this kernel.
>>> pprint(planets.names())
{0: ['SOLAR_SYSTEM_BARYCENTER', 'SSB', 'SOLAR SYSTEM BARYCENTER'],
1: ['MERCURY_BARYCENTER', 'MERCURY BARYCENTER'],
2: ['VENUS_BARYCENTER', 'VENUS BARYCENTER'],
3: ['EARTH_BARYCENTER',
... | [
"Return",
"all",
"target",
"names",
"that",
"are",
"valid",
"with",
"this",
"kernel",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/jpllib.py#L106-L126 |
229,925 | skyfielders/python-skyfield | skyfield/jpllib.py | SpiceKernel.decode | def decode(self, name):
"""Translate a target name into its integer code.
>>> planets.decode('Venus')
299
Raises ``ValueError`` if you supply an unknown name, or
``KeyError`` if the target is missing from this kernel. You can
supply an integer code if you already have ... | python | def decode(self, name):
"""Translate a target name into its integer code.
>>> planets.decode('Venus')
299
Raises ``ValueError`` if you supply an unknown name, or
``KeyError`` if the target is missing from this kernel. You can
supply an integer code if you already have ... | [
"def",
"decode",
"(",
"self",
",",
"name",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"int",
")",
":",
"code",
"=",
"name",
"else",
":",
"name",
"=",
"name",
".",
"upper",
"(",
")",
"code",
"=",
"_targets",
".",
"get",
"(",
"name",
")",
"i... | Translate a target name into its integer code.
>>> planets.decode('Venus')
299
Raises ``ValueError`` if you supply an unknown name, or
``KeyError`` if the target is missing from this kernel. You can
supply an integer code if you already have one and just want to
check ... | [
"Translate",
"a",
"target",
"name",
"into",
"its",
"integer",
"code",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/jpllib.py#L128-L152 |
229,926 | skyfielders/python-skyfield | skyfield/iokit.py | _search | def _search(mapping, filename):
"""Search a Loader data structure for a filename."""
result = mapping.get(filename)
if result is not None:
return result
name, ext = os.path.splitext(filename)
result = mapping.get(ext)
if result is not None:
for pattern, result2 in result:
... | python | def _search(mapping, filename):
"""Search a Loader data structure for a filename."""
result = mapping.get(filename)
if result is not None:
return result
name, ext = os.path.splitext(filename)
result = mapping.get(ext)
if result is not None:
for pattern, result2 in result:
... | [
"def",
"_search",
"(",
"mapping",
",",
"filename",
")",
":",
"result",
"=",
"mapping",
".",
"get",
"(",
"filename",
")",
"if",
"result",
"is",
"not",
"None",
":",
"return",
"result",
"name",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
... | Search a Loader data structure for a filename. | [
"Search",
"a",
"Loader",
"data",
"structure",
"for",
"a",
"filename",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/iokit.py#L288-L299 |
229,927 | skyfielders/python-skyfield | skyfield/iokit.py | load_file | def load_file(path):
"""Open a file on your local drive, using its extension to guess its type.
This routine only works on ``.bsp`` ephemeris files right now, but
will gain support for additional file types in the future. ::
from skyfield.api import load_file
planets = load_file('~/Downloa... | python | def load_file(path):
"""Open a file on your local drive, using its extension to guess its type.
This routine only works on ``.bsp`` ephemeris files right now, but
will gain support for additional file types in the future. ::
from skyfield.api import load_file
planets = load_file('~/Downloa... | [
"def",
"load_file",
"(",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"path",
")",
"base",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"path",
")",
"if",
"ext",
"==",
"'.bsp'",
":",
"return",
"SpiceKernel"... | Open a file on your local drive, using its extension to guess its type.
This routine only works on ``.bsp`` ephemeris files right now, but
will gain support for additional file types in the future. ::
from skyfield.api import load_file
planets = load_file('~/Downloads/de421.bsp') | [
"Open",
"a",
"file",
"on",
"your",
"local",
"drive",
"using",
"its",
"extension",
"to",
"guess",
"its",
"type",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/iokit.py#L302-L316 |
229,928 | skyfielders/python-skyfield | skyfield/iokit.py | parse_deltat_data | def parse_deltat_data(fileobj):
"""Parse the United States Naval Observatory ``deltat.data`` file.
Each line file gives the date and the value of Delta T::
2016 2 1 68.1577
This function returns a 2xN array of raw Julian dates and matching
Delta T values.
"""
array = np.loadtxt(fileob... | python | def parse_deltat_data(fileobj):
"""Parse the United States Naval Observatory ``deltat.data`` file.
Each line file gives the date and the value of Delta T::
2016 2 1 68.1577
This function returns a 2xN array of raw Julian dates and matching
Delta T values.
"""
array = np.loadtxt(fileob... | [
"def",
"parse_deltat_data",
"(",
"fileobj",
")",
":",
"array",
"=",
"np",
".",
"loadtxt",
"(",
"fileobj",
")",
"year",
",",
"month",
",",
"day",
"=",
"array",
"[",
"-",
"1",
",",
":",
"3",
"]",
".",
"astype",
"(",
"int",
")",
"expiration_date",
"="... | Parse the United States Naval Observatory ``deltat.data`` file.
Each line file gives the date and the value of Delta T::
2016 2 1 68.1577
This function returns a 2xN array of raw Julian dates and matching
Delta T values. | [
"Parse",
"the",
"United",
"States",
"Naval",
"Observatory",
"deltat",
".",
"data",
"file",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/iokit.py#L319-L335 |
229,929 | skyfielders/python-skyfield | skyfield/iokit.py | parse_deltat_preds | def parse_deltat_preds(fileobj):
"""Parse the United States Naval Observatory ``deltat.preds`` file.
The old format supplies a floating point year, the value of Delta T,
and one or two other fields::
2015.75 67.97 0.210 0.02
The new format adds a modified Julian day as ... | python | def parse_deltat_preds(fileobj):
"""Parse the United States Naval Observatory ``deltat.preds`` file.
The old format supplies a floating point year, the value of Delta T,
and one or two other fields::
2015.75 67.97 0.210 0.02
The new format adds a modified Julian day as ... | [
"def",
"parse_deltat_preds",
"(",
"fileobj",
")",
":",
"lines",
"=",
"iter",
"(",
"fileobj",
")",
"header",
"=",
"next",
"(",
"lines",
")",
"if",
"header",
".",
"startswith",
"(",
"b'YEAR'",
")",
":",
"# Format in use until 2019 February",
"next",
"(",
"line... | Parse the United States Naval Observatory ``deltat.preds`` file.
The old format supplies a floating point year, the value of Delta T,
and one or two other fields::
2015.75 67.97 0.210 0.02
The new format adds a modified Julian day as the first field:
58484.000 2019.00... | [
"Parse",
"the",
"United",
"States",
"Naval",
"Observatory",
"deltat",
".",
"preds",
"file",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/iokit.py#L338-L369 |
229,930 | skyfielders/python-skyfield | skyfield/iokit.py | parse_leap_seconds | def parse_leap_seconds(fileobj):
"""Parse the IERS file ``Leap_Second.dat``.
The leap dates array can be searched with::
index = np.searchsorted(leap_dates, jd, 'right')
The resulting index allows (TAI - UTC) to be fetched with::
offset = leap_offsets[index]
"""
lines = iter(fil... | python | def parse_leap_seconds(fileobj):
"""Parse the IERS file ``Leap_Second.dat``.
The leap dates array can be searched with::
index = np.searchsorted(leap_dates, jd, 'right')
The resulting index allows (TAI - UTC) to be fetched with::
offset = leap_offsets[index]
"""
lines = iter(fil... | [
"def",
"parse_leap_seconds",
"(",
"fileobj",
")",
":",
"lines",
"=",
"iter",
"(",
"fileobj",
")",
"for",
"line",
"in",
"lines",
":",
"if",
"line",
".",
"startswith",
"(",
"b'# File expires on'",
")",
":",
"break",
"else",
":",
"raise",
"ValueError",
"(",
... | Parse the IERS file ``Leap_Second.dat``.
The leap dates array can be searched with::
index = np.searchsorted(leap_dates, jd, 'right')
The resulting index allows (TAI - UTC) to be fetched with::
offset = leap_offsets[index] | [
"Parse",
"the",
"IERS",
"file",
"Leap_Second",
".",
"dat",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/iokit.py#L371-L412 |
229,931 | skyfielders/python-skyfield | skyfield/iokit.py | parse_tle | def parse_tle(fileobj):
"""Parse a file of TLE satellite element sets.
Builds an Earth satellite from each pair of adjacent lines in the
file that start with "1 " and "2 " and have 69 or more characters
each. If the preceding line is exactly 24 characters long, then it
is parsed as the satellite's... | python | def parse_tle(fileobj):
"""Parse a file of TLE satellite element sets.
Builds an Earth satellite from each pair of adjacent lines in the
file that start with "1 " and "2 " and have 69 or more characters
each. If the preceding line is exactly 24 characters long, then it
is parsed as the satellite's... | [
"def",
"parse_tle",
"(",
"fileobj",
")",
":",
"b0",
"=",
"b1",
"=",
"b''",
"for",
"b2",
"in",
"fileobj",
":",
"if",
"(",
"b1",
".",
"startswith",
"(",
"b'1 '",
")",
"and",
"len",
"(",
"b1",
")",
">=",
"69",
"and",
"b2",
".",
"startswith",
"(",
... | Parse a file of TLE satellite element sets.
Builds an Earth satellite from each pair of adjacent lines in the
file that start with "1 " and "2 " and have 69 or more characters
each. If the preceding line is exactly 24 characters long, then it
is parsed as the satellite's name. For each satellite foun... | [
"Parse",
"a",
"file",
"of",
"TLE",
"satellite",
"element",
"sets",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/iokit.py#L415-L461 |
229,932 | skyfielders/python-skyfield | skyfield/iokit.py | download | def download(url, path, verbose=None, blocksize=128*1024):
"""Download a file from a URL, possibly displaying a progress bar.
Saves the output to the file named by `path`. If the URL cannot be
downloaded or the file cannot be written, an IOError is raised.
Normally, if the standard error output is a ... | python | def download(url, path, verbose=None, blocksize=128*1024):
"""Download a file from a URL, possibly displaying a progress bar.
Saves the output to the file named by `path`. If the URL cannot be
downloaded or the file cannot be written, an IOError is raised.
Normally, if the standard error output is a ... | [
"def",
"download",
"(",
"url",
",",
"path",
",",
"verbose",
"=",
"None",
",",
"blocksize",
"=",
"128",
"*",
"1024",
")",
":",
"tempname",
"=",
"path",
"+",
"'.download'",
"try",
":",
"connection",
"=",
"urlopen",
"(",
"url",
")",
"except",
"Exception",... | Download a file from a URL, possibly displaying a progress bar.
Saves the output to the file named by `path`. If the URL cannot be
downloaded or the file cannot be written, an IOError is raised.
Normally, if the standard error output is a terminal, then a
progress bar is displayed to keep the user en... | [
"Download",
"a",
"file",
"from",
"a",
"URL",
"possibly",
"displaying",
"a",
"progress",
"bar",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/iokit.py#L464-L536 |
229,933 | skyfielders/python-skyfield | skyfield/iokit.py | Loader.tle | def tle(self, url, reload=False, filename=None):
"""Load and parse a satellite TLE file.
Given a URL or a local path, this loads a file of three-line records in
the common Celestrak file format, or two-line records like those from
space-track.org. For a three-line element set, each firs... | python | def tle(self, url, reload=False, filename=None):
"""Load and parse a satellite TLE file.
Given a URL or a local path, this loads a file of three-line records in
the common Celestrak file format, or two-line records like those from
space-track.org. For a three-line element set, each firs... | [
"def",
"tle",
"(",
"self",
",",
"url",
",",
"reload",
"=",
"False",
",",
"filename",
"=",
"None",
")",
":",
"d",
"=",
"{",
"}",
"with",
"self",
".",
"open",
"(",
"url",
",",
"reload",
"=",
"reload",
",",
"filename",
"=",
"filename",
")",
"as",
... | Load and parse a satellite TLE file.
Given a URL or a local path, this loads a file of three-line records in
the common Celestrak file format, or two-line records like those from
space-track.org. For a three-line element set, each first line gives
the name of a satellite and the followi... | [
"Load",
"and",
"parse",
"a",
"satellite",
"TLE",
"file",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/iokit.py#L199-L224 |
229,934 | skyfielders/python-skyfield | skyfield/iokit.py | Loader.open | def open(self, url, mode='rb', reload=False, filename=None):
"""Open a file, downloading it first if it does not yet exist.
Unlike when you call a loader directly like ``my_loader()``,
this ``my_loader.open()`` method does not attempt to parse or
interpret the file; it simply returns an... | python | def open(self, url, mode='rb', reload=False, filename=None):
"""Open a file, downloading it first if it does not yet exist.
Unlike when you call a loader directly like ``my_loader()``,
this ``my_loader.open()`` method does not attempt to parse or
interpret the file; it simply returns an... | [
"def",
"open",
"(",
"self",
",",
"url",
",",
"mode",
"=",
"'rb'",
",",
"reload",
"=",
"False",
",",
"filename",
"=",
"None",
")",
":",
"if",
"'://'",
"not",
"in",
"url",
":",
"path_that_might_be_relative",
"=",
"url",
"path",
"=",
"os",
".",
"path",
... | Open a file, downloading it first if it does not yet exist.
Unlike when you call a loader directly like ``my_loader()``,
this ``my_loader.open()`` method does not attempt to parse or
interpret the file; it simply returns an open file object.
The ``url`` can be either an external URL, o... | [
"Open",
"a",
"file",
"downloading",
"it",
"first",
"if",
"it",
"does",
"not",
"yet",
"exist",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/iokit.py#L226-L256 |
229,935 | skyfielders/python-skyfield | skyfield/iokit.py | Loader.timescale | def timescale(self, delta_t=None):
"""Open or download three time scale files, returning a `Timescale`.
This method is how most Skyfield users build a `Timescale`
object, which is necessary for building specific `Time` objects
that name specific moments.
This will open or downl... | python | def timescale(self, delta_t=None):
"""Open or download three time scale files, returning a `Timescale`.
This method is how most Skyfield users build a `Timescale`
object, which is necessary for building specific `Time` objects
that name specific moments.
This will open or downl... | [
"def",
"timescale",
"(",
"self",
",",
"delta_t",
"=",
"None",
")",
":",
"if",
"delta_t",
"is",
"not",
"None",
":",
"delta_t_recent",
"=",
"np",
".",
"array",
"(",
"(",
"(",
"-",
"1e99",
",",
"1e99",
")",
",",
"(",
"delta_t",
",",
"delta_t",
")",
... | Open or download three time scale files, returning a `Timescale`.
This method is how most Skyfield users build a `Timescale`
object, which is necessary for building specific `Time` objects
that name specific moments.
This will open or download the three files that Skyfield needs
... | [
"Open",
"or",
"download",
"three",
"time",
"scale",
"files",
"returning",
"a",
"Timescale",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/iokit.py#L258-L281 |
229,936 | skyfielders/python-skyfield | skyfield/contrib/iosurvey.py | get_summary | def get_summary(url, spk=True):
''' simple function to retrieve the header of a BSP file and return SPK object'''
# connect to file at URL
bspurl = urllib2.urlopen(url)
# retrieve the "tip" of a file at URL
bsptip = bspurl.read(10**5) # first 100kB
# save data in fake file object (in-memory)
... | python | def get_summary(url, spk=True):
''' simple function to retrieve the header of a BSP file and return SPK object'''
# connect to file at URL
bspurl = urllib2.urlopen(url)
# retrieve the "tip" of a file at URL
bsptip = bspurl.read(10**5) # first 100kB
# save data in fake file object (in-memory)
... | [
"def",
"get_summary",
"(",
"url",
",",
"spk",
"=",
"True",
")",
":",
"# connect to file at URL",
"bspurl",
"=",
"urllib2",
".",
"urlopen",
"(",
"url",
")",
"# retrieve the \"tip\" of a file at URL",
"bsptip",
"=",
"bspurl",
".",
"read",
"(",
"10",
"**",
"5",
... | simple function to retrieve the header of a BSP file and return SPK object | [
"simple",
"function",
"to",
"retrieve",
"the",
"header",
"of",
"a",
"BSP",
"file",
"and",
"return",
"SPK",
"object"
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/contrib/iosurvey.py#L11-L29 |
229,937 | skyfielders/python-skyfield | skyfield/vectorlib.py | _correct_for_light_travel_time | def _correct_for_light_travel_time(observer, target):
"""Return a light-time corrected astrometric position and velocity.
Given an `observer` that is a `Barycentric` position somewhere in
the solar system, compute where in the sky they will see the body
`target`, by computing the light-time between the... | python | def _correct_for_light_travel_time(observer, target):
"""Return a light-time corrected astrometric position and velocity.
Given an `observer` that is a `Barycentric` position somewhere in
the solar system, compute where in the sky they will see the body
`target`, by computing the light-time between the... | [
"def",
"_correct_for_light_travel_time",
"(",
"observer",
",",
"target",
")",
":",
"t",
"=",
"observer",
".",
"t",
"ts",
"=",
"t",
".",
"ts",
"cposition",
"=",
"observer",
".",
"position",
".",
"au",
"cvelocity",
"=",
"observer",
".",
"velocity",
".",
"a... | Return a light-time corrected astrometric position and velocity.
Given an `observer` that is a `Barycentric` position somewhere in
the solar system, compute where in the sky they will see the body
`target`, by computing the light-time between them and figuring out
where `target` was back when the light... | [
"Return",
"a",
"light",
"-",
"time",
"corrected",
"astrometric",
"position",
"and",
"velocity",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/vectorlib.py#L201-L230 |
229,938 | skyfielders/python-skyfield | skyfield/vectorlib.py | VectorFunction.at | def at(self, t):
"""At time ``t``, compute the target's position relative to the center.
If ``t`` is an array of times, then the returned position object
will specify as many positions as there were times. The kind of
position returned depends on the value of the ``center``
att... | python | def at(self, t):
"""At time ``t``, compute the target's position relative to the center.
If ``t`` is an array of times, then the returned position object
will specify as many positions as there were times. The kind of
position returned depends on the value of the ``center``
att... | [
"def",
"at",
"(",
"self",
",",
"t",
")",
":",
"if",
"not",
"isinstance",
"(",
"t",
",",
"Time",
")",
":",
"raise",
"ValueError",
"(",
"'please provide the at() method with a Time'",
"' instance as its argument, instead of the'",
"' value {0!r}'",
".",
"format",
"(",... | At time ``t``, compute the target's position relative to the center.
If ``t`` is an array of times, then the returned position object
will specify as many positions as there were times. The kind of
position returned depends on the value of the ``center``
attribute:
* Solar Sys... | [
"At",
"time",
"t",
"compute",
"the",
"target",
"s",
"position",
"relative",
"to",
"the",
"center",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/vectorlib.py#L54-L82 |
229,939 | skyfielders/python-skyfield | skyfield/timelib.py | _to_array | def _to_array(value):
"""When `value` is a plain Python sequence, return it as a NumPy array."""
if hasattr(value, 'shape'):
return value
elif hasattr(value, '__len__'):
return array(value)
else:
return float_(value) | python | def _to_array(value):
"""When `value` is a plain Python sequence, return it as a NumPy array."""
if hasattr(value, 'shape'):
return value
elif hasattr(value, '__len__'):
return array(value)
else:
return float_(value) | [
"def",
"_to_array",
"(",
"value",
")",
":",
"if",
"hasattr",
"(",
"value",
",",
"'shape'",
")",
":",
"return",
"value",
"elif",
"hasattr",
"(",
"value",
",",
"'__len__'",
")",
":",
"return",
"array",
"(",
"value",
")",
"else",
":",
"return",
"float_",
... | When `value` is a plain Python sequence, return it as a NumPy array. | [
"When",
"value",
"is",
"a",
"plain",
"Python",
"sequence",
"return",
"it",
"as",
"a",
"NumPy",
"array",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L40-L47 |
229,940 | skyfielders/python-skyfield | skyfield/timelib.py | julian_day | def julian_day(year, month=1, day=1):
"""Given a proleptic Gregorian calendar date, return a Julian day int."""
janfeb = month < 3
return (day
+ 1461 * (year + 4800 - janfeb) // 4
+ 367 * (month - 2 + janfeb * 12) // 12
- 3 * ((year + 4900 - janfeb) // 100) // 4
... | python | def julian_day(year, month=1, day=1):
"""Given a proleptic Gregorian calendar date, return a Julian day int."""
janfeb = month < 3
return (day
+ 1461 * (year + 4800 - janfeb) // 4
+ 367 * (month - 2 + janfeb * 12) // 12
- 3 * ((year + 4900 - janfeb) // 100) // 4
... | [
"def",
"julian_day",
"(",
"year",
",",
"month",
"=",
"1",
",",
"day",
"=",
"1",
")",
":",
"janfeb",
"=",
"month",
"<",
"3",
"return",
"(",
"day",
"+",
"1461",
"*",
"(",
"year",
"+",
"4800",
"-",
"janfeb",
")",
"//",
"4",
"+",
"367",
"*",
"(",... | Given a proleptic Gregorian calendar date, return a Julian day int. | [
"Given",
"a",
"proleptic",
"Gregorian",
"calendar",
"date",
"return",
"a",
"Julian",
"day",
"int",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L700-L707 |
229,941 | skyfielders/python-skyfield | skyfield/timelib.py | julian_date | def julian_date(year, month=1, day=1, hour=0, minute=0, second=0.0):
"""Given a proleptic Gregorian calendar date, return a Julian date float."""
return julian_day(year, month, day) - 0.5 + (
second + minute * 60.0 + hour * 3600.0) / DAY_S | python | def julian_date(year, month=1, day=1, hour=0, minute=0, second=0.0):
"""Given a proleptic Gregorian calendar date, return a Julian date float."""
return julian_day(year, month, day) - 0.5 + (
second + minute * 60.0 + hour * 3600.0) / DAY_S | [
"def",
"julian_date",
"(",
"year",
",",
"month",
"=",
"1",
",",
"day",
"=",
"1",
",",
"hour",
"=",
"0",
",",
"minute",
"=",
"0",
",",
"second",
"=",
"0.0",
")",
":",
"return",
"julian_day",
"(",
"year",
",",
"month",
",",
"day",
")",
"-",
"0.5"... | Given a proleptic Gregorian calendar date, return a Julian date float. | [
"Given",
"a",
"proleptic",
"Gregorian",
"calendar",
"date",
"return",
"a",
"Julian",
"date",
"float",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L709-L712 |
229,942 | skyfielders/python-skyfield | skyfield/timelib.py | tdb_minus_tt | def tdb_minus_tt(jd_tdb):
"""Computes how far TDB is in advance of TT, given TDB.
Given that the two time scales never diverge by more than 2ms, TT
can also be given as the argument to perform the conversion in the
other direction.
"""
t = (jd_tdb - T0) / 36525.0
# USNO Circular 179, eq. ... | python | def tdb_minus_tt(jd_tdb):
"""Computes how far TDB is in advance of TT, given TDB.
Given that the two time scales never diverge by more than 2ms, TT
can also be given as the argument to perform the conversion in the
other direction.
"""
t = (jd_tdb - T0) / 36525.0
# USNO Circular 179, eq. ... | [
"def",
"tdb_minus_tt",
"(",
"jd_tdb",
")",
":",
"t",
"=",
"(",
"jd_tdb",
"-",
"T0",
")",
"/",
"36525.0",
"# USNO Circular 179, eq. 2.6.",
"return",
"(",
"0.001657",
"*",
"sin",
"(",
"628.3076",
"*",
"t",
"+",
"6.2401",
")",
"+",
"0.000022",
"*",
"sin",
... | Computes how far TDB is in advance of TT, given TDB.
Given that the two time scales never diverge by more than 2ms, TT
can also be given as the argument to perform the conversion in the
other direction. | [
"Computes",
"how",
"far",
"TDB",
"is",
"in",
"advance",
"of",
"TT",
"given",
"TDB",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L752-L769 |
229,943 | skyfielders/python-skyfield | skyfield/timelib.py | interpolate_delta_t | def interpolate_delta_t(delta_t_table, tt):
"""Return interpolated Delta T values for the times in `tt`.
The 2xN table should provide TT values as element 0 and
corresponding Delta T values for element 1. For times outside the
range of the table, a long-term formula is used instead.
"""
tt_ar... | python | def interpolate_delta_t(delta_t_table, tt):
"""Return interpolated Delta T values for the times in `tt`.
The 2xN table should provide TT values as element 0 and
corresponding Delta T values for element 1. For times outside the
range of the table, a long-term formula is used instead.
"""
tt_ar... | [
"def",
"interpolate_delta_t",
"(",
"delta_t_table",
",",
"tt",
")",
":",
"tt_array",
",",
"delta_t_array",
"=",
"delta_t_table",
"delta_t",
"=",
"_to_array",
"(",
"interp",
"(",
"tt",
",",
"tt_array",
",",
"delta_t_array",
",",
"nan",
",",
"nan",
")",
")",
... | Return interpolated Delta T values for the times in `tt`.
The 2xN table should provide TT values as element 0 and
corresponding Delta T values for element 1. For times outside the
range of the table, a long-term formula is used instead. | [
"Return",
"interpolated",
"Delta",
"T",
"values",
"for",
"the",
"times",
"in",
"tt",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L771-L790 |
229,944 | skyfielders/python-skyfield | skyfield/timelib.py | build_delta_t_table | def build_delta_t_table(delta_t_recent):
"""Build a table for interpolating Delta T.
Given a 2xN array of recent Delta T values, whose element 0 is a
sorted array of TT Julian dates and element 1 is Delta T values,
this routine returns a more complete table by prepending two
built-in data sources t... | python | def build_delta_t_table(delta_t_recent):
"""Build a table for interpolating Delta T.
Given a 2xN array of recent Delta T values, whose element 0 is a
sorted array of TT Julian dates and element 1 is Delta T values,
this routine returns a more complete table by prepending two
built-in data sources t... | [
"def",
"build_delta_t_table",
"(",
"delta_t_recent",
")",
":",
"ancient",
"=",
"load_bundled_npy",
"(",
"'morrison_stephenson_deltat.npy'",
")",
"historic",
"=",
"load_bundled_npy",
"(",
"'historic_deltat.npy'",
")",
"# Prefer USNO over Morrison and Stephenson where they overlap.... | Build a table for interpolating Delta T.
Given a 2xN array of recent Delta T values, whose element 0 is a
sorted array of TT Julian dates and element 1 is Delta T values,
this routine returns a more complete table by prepending two
built-in data sources that ship with Skyfield as pre-built arrays:
... | [
"Build",
"a",
"table",
"for",
"interpolating",
"Delta",
"T",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L803-L839 |
229,945 | skyfielders/python-skyfield | skyfield/timelib.py | Timescale.utc | def utc(self, year, month=1, day=1, hour=0, minute=0, second=0.0):
"""Build a `Time` from a UTC calendar date.
You can either specify the date as separate components, or
provide a time zone aware Python datetime. The following two
calls are equivalent (the ``utc`` time zone object can ... | python | def utc(self, year, month=1, day=1, hour=0, minute=0, second=0.0):
"""Build a `Time` from a UTC calendar date.
You can either specify the date as separate components, or
provide a time zone aware Python datetime. The following two
calls are equivalent (the ``utc`` time zone object can ... | [
"def",
"utc",
"(",
"self",
",",
"year",
",",
"month",
"=",
"1",
",",
"day",
"=",
"1",
",",
"hour",
"=",
"0",
",",
"minute",
"=",
"0",
",",
"second",
"=",
"0.0",
")",
":",
"if",
"isinstance",
"(",
"year",
",",
"datetime",
")",
":",
"dt",
"=",
... | Build a `Time` from a UTC calendar date.
You can either specify the date as separate components, or
provide a time zone aware Python datetime. The following two
calls are equivalent (the ``utc`` time zone object can be
imported from the ``skyfield.api`` module, or from ``pytz`` if
... | [
"Build",
"a",
"Time",
"from",
"a",
"UTC",
"calendar",
"date",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L91-L127 |
229,946 | skyfielders/python-skyfield | skyfield/timelib.py | Timescale.tai | def tai(self, year=None, month=1, day=1, hour=0, minute=0, second=0.0,
jd=None):
"""Build a `Time` from a TAI calendar date.
Supply the International Atomic Time (TAI) as a proleptic
Gregorian calendar date:
>>> t = ts.tai(2014, 1, 18, 1, 35, 37.5)
>>> t.tai
... | python | def tai(self, year=None, month=1, day=1, hour=0, minute=0, second=0.0,
jd=None):
"""Build a `Time` from a TAI calendar date.
Supply the International Atomic Time (TAI) as a proleptic
Gregorian calendar date:
>>> t = ts.tai(2014, 1, 18, 1, 35, 37.5)
>>> t.tai
... | [
"def",
"tai",
"(",
"self",
",",
"year",
"=",
"None",
",",
"month",
"=",
"1",
",",
"day",
"=",
"1",
",",
"hour",
"=",
"0",
",",
"minute",
"=",
"0",
",",
"second",
"=",
"0.0",
",",
"jd",
"=",
"None",
")",
":",
"if",
"jd",
"is",
"not",
"None",... | Build a `Time` from a TAI calendar date.
Supply the International Atomic Time (TAI) as a proleptic
Gregorian calendar date:
>>> t = ts.tai(2014, 1, 18, 1, 35, 37.5)
>>> t.tai
2456675.56640625
>>> t.tai_calendar()
(2014, 1, 18, 1, 35, 37.5) | [
"Build",
"a",
"Time",
"from",
"a",
"TAI",
"calendar",
"date",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L129-L150 |
229,947 | skyfielders/python-skyfield | skyfield/timelib.py | Timescale.tai_jd | def tai_jd(self, jd):
"""Build a `Time` from a TAI Julian date.
Supply the International Atomic Time (TAI) as a Julian date:
>>> t = ts.tai_jd(2456675.56640625)
>>> t.tai
2456675.56640625
>>> t.tai_calendar()
(2014, 1, 18, 1, 35, 37.5)
"""
tai =... | python | def tai_jd(self, jd):
"""Build a `Time` from a TAI Julian date.
Supply the International Atomic Time (TAI) as a Julian date:
>>> t = ts.tai_jd(2456675.56640625)
>>> t.tai
2456675.56640625
>>> t.tai_calendar()
(2014, 1, 18, 1, 35, 37.5)
"""
tai =... | [
"def",
"tai_jd",
"(",
"self",
",",
"jd",
")",
":",
"tai",
"=",
"_to_array",
"(",
"jd",
")",
"t",
"=",
"Time",
"(",
"self",
",",
"tai",
"+",
"tt_minus_tai",
")",
"t",
".",
"tai",
"=",
"tai",
"return",
"t"
] | Build a `Time` from a TAI Julian date.
Supply the International Atomic Time (TAI) as a Julian date:
>>> t = ts.tai_jd(2456675.56640625)
>>> t.tai
2456675.56640625
>>> t.tai_calendar()
(2014, 1, 18, 1, 35, 37.5) | [
"Build",
"a",
"Time",
"from",
"a",
"TAI",
"Julian",
"date",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L152-L167 |
229,948 | skyfielders/python-skyfield | skyfield/timelib.py | Timescale.tt | def tt(self, year=None, month=1, day=1, hour=0, minute=0, second=0.0,
jd=None):
"""Build a `Time` from a TT calendar date.
Supply the Terrestrial Time (TT) as a proleptic Gregorian
calendar date:
>>> t = ts.tt(2014, 1, 18, 1, 35, 37.5)
>>> t.tt
2456675.566406... | python | def tt(self, year=None, month=1, day=1, hour=0, minute=0, second=0.0,
jd=None):
"""Build a `Time` from a TT calendar date.
Supply the Terrestrial Time (TT) as a proleptic Gregorian
calendar date:
>>> t = ts.tt(2014, 1, 18, 1, 35, 37.5)
>>> t.tt
2456675.566406... | [
"def",
"tt",
"(",
"self",
",",
"year",
"=",
"None",
",",
"month",
"=",
"1",
",",
"day",
"=",
"1",
",",
"hour",
"=",
"0",
",",
"minute",
"=",
"0",
",",
"second",
"=",
"0.0",
",",
"jd",
"=",
"None",
")",
":",
"if",
"jd",
"is",
"not",
"None",
... | Build a `Time` from a TT calendar date.
Supply the Terrestrial Time (TT) as a proleptic Gregorian
calendar date:
>>> t = ts.tt(2014, 1, 18, 1, 35, 37.5)
>>> t.tt
2456675.56640625
>>> t.tt_calendar()
(2014, 1, 18, 1, 35, 37.5) | [
"Build",
"a",
"Time",
"from",
"a",
"TT",
"calendar",
"date",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L169-L191 |
229,949 | skyfielders/python-skyfield | skyfield/timelib.py | Timescale.tdb | def tdb(self, year=None, month=1, day=1, hour=0, minute=0, second=0.0,
jd=None):
"""Build a `Time` from a TDB calendar date.
Supply the Barycentric Dynamical Time (TDB) as a proleptic
Gregorian calendar date:
>>> t = ts.tdb(2014, 1, 18, 1, 35, 37.5)
>>> t.tdb
... | python | def tdb(self, year=None, month=1, day=1, hour=0, minute=0, second=0.0,
jd=None):
"""Build a `Time` from a TDB calendar date.
Supply the Barycentric Dynamical Time (TDB) as a proleptic
Gregorian calendar date:
>>> t = ts.tdb(2014, 1, 18, 1, 35, 37.5)
>>> t.tdb
... | [
"def",
"tdb",
"(",
"self",
",",
"year",
"=",
"None",
",",
"month",
"=",
"1",
",",
"day",
"=",
"1",
",",
"hour",
"=",
"0",
",",
"minute",
"=",
"0",
",",
"second",
"=",
"0.0",
",",
"jd",
"=",
"None",
")",
":",
"if",
"jd",
"is",
"not",
"None",... | Build a `Time` from a TDB calendar date.
Supply the Barycentric Dynamical Time (TDB) as a proleptic
Gregorian calendar date:
>>> t = ts.tdb(2014, 1, 18, 1, 35, 37.5)
>>> t.tdb
2456675.56640625 | [
"Build",
"a",
"Time",
"from",
"a",
"TDB",
"calendar",
"date",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L208-L231 |
229,950 | skyfielders/python-skyfield | skyfield/timelib.py | Timescale.tdb_jd | def tdb_jd(self, jd):
"""Build a `Time` from a TDB Julian date.
Supply the Barycentric Dynamical Time (TDB) as a Julian date:
>>> t = ts.tdb_jd(2456675.56640625)
>>> t.tdb
2456675.56640625
"""
tdb = _to_array(jd)
tt = tdb - tdb_minus_tt(tdb) / DAY_S
... | python | def tdb_jd(self, jd):
"""Build a `Time` from a TDB Julian date.
Supply the Barycentric Dynamical Time (TDB) as a Julian date:
>>> t = ts.tdb_jd(2456675.56640625)
>>> t.tdb
2456675.56640625
"""
tdb = _to_array(jd)
tt = tdb - tdb_minus_tt(tdb) / DAY_S
... | [
"def",
"tdb_jd",
"(",
"self",
",",
"jd",
")",
":",
"tdb",
"=",
"_to_array",
"(",
"jd",
")",
"tt",
"=",
"tdb",
"-",
"tdb_minus_tt",
"(",
"tdb",
")",
"/",
"DAY_S",
"t",
"=",
"Time",
"(",
"self",
",",
"tt",
")",
"t",
".",
"tdb",
"=",
"tdb",
"ret... | Build a `Time` from a TDB Julian date.
Supply the Barycentric Dynamical Time (TDB) as a Julian date:
>>> t = ts.tdb_jd(2456675.56640625)
>>> t.tdb
2456675.56640625 | [
"Build",
"a",
"Time",
"from",
"a",
"TDB",
"Julian",
"date",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L233-L247 |
229,951 | skyfielders/python-skyfield | skyfield/timelib.py | Timescale.ut1 | def ut1(self, year=None, month=1, day=1, hour=0, minute=0, second=0.0,
jd=None):
"""Build a `Time` from a UT1 calendar date.
Supply the Universal Time (UT1) as a proleptic Gregorian
calendar date:
>>> t = ts.ut1(2014, 1, 18, 1, 35, 37.5)
>>> t.ut1
2456675.56... | python | def ut1(self, year=None, month=1, day=1, hour=0, minute=0, second=0.0,
jd=None):
"""Build a `Time` from a UT1 calendar date.
Supply the Universal Time (UT1) as a proleptic Gregorian
calendar date:
>>> t = ts.ut1(2014, 1, 18, 1, 35, 37.5)
>>> t.ut1
2456675.56... | [
"def",
"ut1",
"(",
"self",
",",
"year",
"=",
"None",
",",
"month",
"=",
"1",
",",
"day",
"=",
"1",
",",
"hour",
"=",
"0",
",",
"minute",
"=",
"0",
",",
"second",
"=",
"0.0",
",",
"jd",
"=",
"None",
")",
":",
"if",
"jd",
"is",
"not",
"None",... | Build a `Time` from a UT1 calendar date.
Supply the Universal Time (UT1) as a proleptic Gregorian
calendar date:
>>> t = ts.ut1(2014, 1, 18, 1, 35, 37.5)
>>> t.ut1
2456675.56640625 | [
"Build",
"a",
"Time",
"from",
"a",
"UT1",
"calendar",
"date",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L249-L268 |
229,952 | skyfielders/python-skyfield | skyfield/timelib.py | Timescale.ut1_jd | def ut1_jd(self, jd):
"""Build a `Time` from UT1 a Julian date.
Supply the Universal Time (UT1) as a Julian date:
>>> t = ts.ut1_jd(2456675.56640625)
>>> t.ut1
2456675.56640625
"""
ut1 = _to_array(jd)
# Estimate TT = UT1, to get a rough Delta T estimat... | python | def ut1_jd(self, jd):
"""Build a `Time` from UT1 a Julian date.
Supply the Universal Time (UT1) as a Julian date:
>>> t = ts.ut1_jd(2456675.56640625)
>>> t.ut1
2456675.56640625
"""
ut1 = _to_array(jd)
# Estimate TT = UT1, to get a rough Delta T estimat... | [
"def",
"ut1_jd",
"(",
"self",
",",
"jd",
")",
":",
"ut1",
"=",
"_to_array",
"(",
"jd",
")",
"# Estimate TT = UT1, to get a rough Delta T estimate.",
"tt_approx",
"=",
"ut1",
"delta_t_approx",
"=",
"interpolate_delta_t",
"(",
"self",
".",
"delta_t_table",
",",
"tt_... | Build a `Time` from UT1 a Julian date.
Supply the Universal Time (UT1) as a Julian date:
>>> t = ts.ut1_jd(2456675.56640625)
>>> t.ut1
2456675.56640625 | [
"Build",
"a",
"Time",
"from",
"UT1",
"a",
"Julian",
"date",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L270-L298 |
229,953 | skyfielders/python-skyfield | skyfield/timelib.py | Time.astimezone_and_leap_second | def astimezone_and_leap_second(self, tz):
"""Convert to a Python ``datetime`` and leap second in a timezone.
Convert this time to a Python ``datetime`` and a leap second::
dt, leap_second = t.astimezone_and_leap_second(tz)
The argument ``tz`` should be a timezone from the third-pa... | python | def astimezone_and_leap_second(self, tz):
"""Convert to a Python ``datetime`` and leap second in a timezone.
Convert this time to a Python ``datetime`` and a leap second::
dt, leap_second = t.astimezone_and_leap_second(tz)
The argument ``tz`` should be a timezone from the third-pa... | [
"def",
"astimezone_and_leap_second",
"(",
"self",
",",
"tz",
")",
":",
"dt",
",",
"leap_second",
"=",
"self",
".",
"utc_datetime_and_leap_second",
"(",
")",
"normalize",
"=",
"getattr",
"(",
"tz",
",",
"'normalize'",
",",
"None",
")",
"if",
"self",
".",
"s... | Convert to a Python ``datetime`` and leap second in a timezone.
Convert this time to a Python ``datetime`` and a leap second::
dt, leap_second = t.astimezone_and_leap_second(tz)
The argument ``tz`` should be a timezone from the third-party
``pytz`` package, which must be installed... | [
"Convert",
"to",
"a",
"Python",
"datetime",
"and",
"leap",
"second",
"in",
"a",
"timezone",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L365-L399 |
229,954 | skyfielders/python-skyfield | skyfield/timelib.py | Time.utc_datetime_and_leap_second | def utc_datetime_and_leap_second(self):
"""Convert to a Python ``datetime`` in UTC, plus a leap second value.
Convert this time to a `datetime`_ object and a leap second::
dt, leap_second = t.utc_datetime_and_leap_second()
If the third-party `pytz`_ package is available, then its
... | python | def utc_datetime_and_leap_second(self):
"""Convert to a Python ``datetime`` in UTC, plus a leap second value.
Convert this time to a `datetime`_ object and a leap second::
dt, leap_second = t.utc_datetime_and_leap_second()
If the third-party `pytz`_ package is available, then its
... | [
"def",
"utc_datetime_and_leap_second",
"(",
"self",
")",
":",
"year",
",",
"month",
",",
"day",
",",
"hour",
",",
"minute",
",",
"second",
"=",
"self",
".",
"_utc_tuple",
"(",
"_half_millisecond",
")",
"second",
",",
"fraction",
"=",
"divmod",
"(",
"second... | Convert to a Python ``datetime`` in UTC, plus a leap second value.
Convert this time to a `datetime`_ object and a leap second::
dt, leap_second = t.utc_datetime_and_leap_second()
If the third-party `pytz`_ package is available, then its
``utc`` timezone will be used as the timezo... | [
"Convert",
"to",
"a",
"Python",
"datetime",
"in",
"UTC",
"plus",
"a",
"leap",
"second",
"value",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L425-L462 |
229,955 | skyfielders/python-skyfield | skyfield/timelib.py | Time.utc_strftime | def utc_strftime(self, format):
"""Format the UTC time using a Python date formatting string.
This internally calls the Python ``strftime()`` routine from the
Standard Library ``time()`` module, for which you can find a
quick reference at ``http://strftime.org/``. If this object is
... | python | def utc_strftime(self, format):
"""Format the UTC time using a Python date formatting string.
This internally calls the Python ``strftime()`` routine from the
Standard Library ``time()`` module, for which you can find a
quick reference at ``http://strftime.org/``. If this object is
... | [
"def",
"utc_strftime",
"(",
"self",
",",
"format",
")",
":",
"tup",
"=",
"self",
".",
"_utc_tuple",
"(",
"_half_second",
")",
"year",
",",
"month",
",",
"day",
",",
"hour",
",",
"minute",
",",
"second",
"=",
"tup",
"second",
"=",
"second",
".",
"asty... | Format the UTC time using a Python date formatting string.
This internally calls the Python ``strftime()`` routine from the
Standard Library ``time()`` module, for which you can find a
quick reference at ``http://strftime.org/``. If this object is
an array of times, then a sequence of ... | [
"Format",
"the",
"UTC",
"time",
"using",
"a",
"Python",
"date",
"formatting",
"string",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L520-L538 |
229,956 | skyfielders/python-skyfield | skyfield/timelib.py | Time._utc_year | def _utc_year(self):
"""Return a fractional UTC year, for convenience when plotting.
An experiment, probably superseded by the ``J`` attribute below.
"""
d = self._utc_float() - 1721059.5
#d += offset
C = 365 * 100 + 24
d -= 365
d += d // C - d // (4 * C... | python | def _utc_year(self):
"""Return a fractional UTC year, for convenience when plotting.
An experiment, probably superseded by the ``J`` attribute below.
"""
d = self._utc_float() - 1721059.5
#d += offset
C = 365 * 100 + 24
d -= 365
d += d // C - d // (4 * C... | [
"def",
"_utc_year",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"_utc_float",
"(",
")",
"-",
"1721059.5",
"#d += offset",
"C",
"=",
"365",
"*",
"100",
"+",
"24",
"d",
"-=",
"365",
"d",
"+=",
"d",
"//",
"C",
"-",
"d",
"//",
"(",
"4",
"*",
"C... | Return a fractional UTC year, for convenience when plotting.
An experiment, probably superseded by the ``J`` attribute below. | [
"Return",
"a",
"fractional",
"UTC",
"year",
"for",
"convenience",
"when",
"plotting",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L540-L557 |
229,957 | skyfielders/python-skyfield | skyfield/timelib.py | Time._utc_float | def _utc_float(self):
"""Return UTC as a floating point Julian date."""
tai = self.tai
leap_dates = self.ts.leap_dates
leap_offsets = self.ts.leap_offsets
leap_reverse_dates = leap_dates + leap_offsets / DAY_S
i = searchsorted(leap_reverse_dates, tai, 'right')
ret... | python | def _utc_float(self):
"""Return UTC as a floating point Julian date."""
tai = self.tai
leap_dates = self.ts.leap_dates
leap_offsets = self.ts.leap_offsets
leap_reverse_dates = leap_dates + leap_offsets / DAY_S
i = searchsorted(leap_reverse_dates, tai, 'right')
ret... | [
"def",
"_utc_float",
"(",
"self",
")",
":",
"tai",
"=",
"self",
".",
"tai",
"leap_dates",
"=",
"self",
".",
"ts",
".",
"leap_dates",
"leap_offsets",
"=",
"self",
".",
"ts",
".",
"leap_offsets",
"leap_reverse_dates",
"=",
"leap_dates",
"+",
"leap_offsets",
... | Return UTC as a floating point Julian date. | [
"Return",
"UTC",
"as",
"a",
"floating",
"point",
"Julian",
"date",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/timelib.py#L586-L593 |
229,958 | skyfielders/python-skyfield | skyfield/earthlib.py | terra | def terra(latitude, longitude, elevation, gast):
"""Compute the position and velocity of a terrestrial observer.
`latitude` - Latitude in radians.
`longitude` - Longitude in radians.
`elevation` - Elevation above sea level in au.
`gast` - Hours of Greenwich Apparent Sidereal Time (can be an array).... | python | def terra(latitude, longitude, elevation, gast):
"""Compute the position and velocity of a terrestrial observer.
`latitude` - Latitude in radians.
`longitude` - Longitude in radians.
`elevation` - Elevation above sea level in au.
`gast` - Hours of Greenwich Apparent Sidereal Time (can be an array).... | [
"def",
"terra",
"(",
"latitude",
",",
"longitude",
",",
"elevation",
",",
"gast",
")",
":",
"zero",
"=",
"zeros_like",
"(",
"gast",
")",
"sinphi",
"=",
"sin",
"(",
"latitude",
")",
"cosphi",
"=",
"cos",
"(",
"latitude",
")",
"c",
"=",
"1.0",
"/",
"... | Compute the position and velocity of a terrestrial observer.
`latitude` - Latitude in radians.
`longitude` - Longitude in radians.
`elevation` - Elevation above sea level in au.
`gast` - Hours of Greenwich Apparent Sidereal Time (can be an array).
The return value is a tuple of two 3-vectors `(pos... | [
"Compute",
"the",
"position",
"and",
"velocity",
"of",
"a",
"terrestrial",
"observer",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/earthlib.py#L15-L55 |
229,959 | skyfielders/python-skyfield | skyfield/earthlib.py | compute_limb_angle | def compute_limb_angle(position_au, observer_au):
"""Determine the angle of an object above or below the Earth's limb.
Given an object's GCRS `position_au` [x,y,z] vector and the position
of an `observer_au` as a vector in the same coordinate system,
return a tuple that provides `(limb_ang, nadir_ang)`... | python | def compute_limb_angle(position_au, observer_au):
"""Determine the angle of an object above or below the Earth's limb.
Given an object's GCRS `position_au` [x,y,z] vector and the position
of an `observer_au` as a vector in the same coordinate system,
return a tuple that provides `(limb_ang, nadir_ang)`... | [
"def",
"compute_limb_angle",
"(",
"position_au",
",",
"observer_au",
")",
":",
"# Compute the distance to the object and the distance to the observer.",
"disobj",
"=",
"sqrt",
"(",
"dots",
"(",
"position_au",
",",
"position_au",
")",
")",
"disobs",
"=",
"sqrt",
"(",
"... | Determine the angle of an object above or below the Earth's limb.
Given an object's GCRS `position_au` [x,y,z] vector and the position
of an `observer_au` as a vector in the same coordinate system,
return a tuple that provides `(limb_ang, nadir_ang)`:
limb_angle
Angle of observed object above ... | [
"Determine",
"the",
"angle",
"of",
"an",
"object",
"above",
"or",
"below",
"the",
"Earth",
"s",
"limb",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/earthlib.py#L85-L127 |
229,960 | skyfielders/python-skyfield | skyfield/earthlib.py | sidereal_time | def sidereal_time(t):
"""Compute Greenwich sidereal time at the given ``Time``."""
# Compute the Earth Rotation Angle. Time argument is UT1.
theta = earth_rotation_angle(t.ut1)
# The equinox method. See Circular 179, Section 2.6.2.
# Precession-in-RA terms in mean sidereal time taken from third... | python | def sidereal_time(t):
"""Compute Greenwich sidereal time at the given ``Time``."""
# Compute the Earth Rotation Angle. Time argument is UT1.
theta = earth_rotation_angle(t.ut1)
# The equinox method. See Circular 179, Section 2.6.2.
# Precession-in-RA terms in mean sidereal time taken from third... | [
"def",
"sidereal_time",
"(",
"t",
")",
":",
"# Compute the Earth Rotation Angle. Time argument is UT1.",
"theta",
"=",
"earth_rotation_angle",
"(",
"t",
".",
"ut1",
")",
"# The equinox method. See Circular 179, Section 2.6.2.",
"# Precession-in-RA terms in mean sidereal time taken ... | Compute Greenwich sidereal time at the given ``Time``. | [
"Compute",
"Greenwich",
"sidereal",
"time",
"at",
"the",
"given",
"Time",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/earthlib.py#L130-L151 |
229,961 | skyfielders/python-skyfield | skyfield/earthlib.py | refraction | def refraction(alt_degrees, temperature_C, pressure_mbar):
"""Given an observed altitude, return how much the image is refracted.
Zero refraction is returned both for objects very near the zenith,
as well as for objects more than one degree below the horizon.
"""
r = 0.016667 / tan((alt_degrees + ... | python | def refraction(alt_degrees, temperature_C, pressure_mbar):
"""Given an observed altitude, return how much the image is refracted.
Zero refraction is returned both for objects very near the zenith,
as well as for objects more than one degree below the horizon.
"""
r = 0.016667 / tan((alt_degrees + ... | [
"def",
"refraction",
"(",
"alt_degrees",
",",
"temperature_C",
",",
"pressure_mbar",
")",
":",
"r",
"=",
"0.016667",
"/",
"tan",
"(",
"(",
"alt_degrees",
"+",
"7.31",
"/",
"(",
"alt_degrees",
"+",
"4.4",
")",
")",
"*",
"DEG2RAD",
")",
"d",
"=",
"r",
... | Given an observed altitude, return how much the image is refracted.
Zero refraction is returned both for objects very near the zenith,
as well as for objects more than one degree below the horizon. | [
"Given",
"an",
"observed",
"altitude",
"return",
"how",
"much",
"the",
"image",
"is",
"refracted",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/earthlib.py#L166-L175 |
229,962 | skyfielders/python-skyfield | skyfield/earthlib.py | refract | def refract(alt_degrees, temperature_C, pressure_mbar):
"""Given an unrefracted `alt` determine where it will appear in the sky."""
alt = alt_degrees
while True:
alt1 = alt
alt = alt_degrees + refraction(alt, temperature_C, pressure_mbar)
converged = abs(alt - alt1) <= 3.0e-5
... | python | def refract(alt_degrees, temperature_C, pressure_mbar):
"""Given an unrefracted `alt` determine where it will appear in the sky."""
alt = alt_degrees
while True:
alt1 = alt
alt = alt_degrees + refraction(alt, temperature_C, pressure_mbar)
converged = abs(alt - alt1) <= 3.0e-5
... | [
"def",
"refract",
"(",
"alt_degrees",
",",
"temperature_C",
",",
"pressure_mbar",
")",
":",
"alt",
"=",
"alt_degrees",
"while",
"True",
":",
"alt1",
"=",
"alt",
"alt",
"=",
"alt_degrees",
"+",
"refraction",
"(",
"alt",
",",
"temperature_C",
",",
"pressure_mb... | Given an unrefracted `alt` determine where it will appear in the sky. | [
"Given",
"an",
"unrefracted",
"alt",
"determine",
"where",
"it",
"will",
"appear",
"in",
"the",
"sky",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/earthlib.py#L178-L187 |
229,963 | skyfielders/python-skyfield | skyfield/precessionlib.py | compute_precession | def compute_precession(jd_tdb):
"""Return the rotation matrices for precessing to an array of epochs.
`jd_tdb` - array of TDB Julian dates
The array returned has the shape `(3, 3, n)` where `n` is the number
of dates that have been provided as input.
"""
eps0 = 84381.406
# 't' is time in... | python | def compute_precession(jd_tdb):
"""Return the rotation matrices for precessing to an array of epochs.
`jd_tdb` - array of TDB Julian dates
The array returned has the shape `(3, 3, n)` where `n` is the number
of dates that have been provided as input.
"""
eps0 = 84381.406
# 't' is time in... | [
"def",
"compute_precession",
"(",
"jd_tdb",
")",
":",
"eps0",
"=",
"84381.406",
"# 't' is time in TDB centuries.",
"t",
"=",
"(",
"jd_tdb",
"-",
"T0",
")",
"/",
"36525.0",
"# Numerical coefficients of psi_a, omega_a, and chi_a, along with",
"# epsilon_0, the obliquity at J200... | Return the rotation matrices for precessing to an array of epochs.
`jd_tdb` - array of TDB Julian dates
The array returned has the shape `(3, 3, n)` where `n` is the number
of dates that have been provided as input. | [
"Return",
"the",
"rotation",
"matrices",
"for",
"precessing",
"to",
"an",
"array",
"of",
"epochs",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/precessionlib.py#L5-L69 |
229,964 | skyfielders/python-skyfield | skyfield/nutationlib.py | compute_nutation | def compute_nutation(t):
"""Generate the nutation rotations for Time `t`.
If the Julian date is scalar, a simple ``(3, 3)`` matrix is
returned; if the date is an array of length ``n``, then an array of
matrices is returned with dimensions ``(3, 3, n)``.
"""
oblm, oblt, eqeq, psi, eps = t._eart... | python | def compute_nutation(t):
"""Generate the nutation rotations for Time `t`.
If the Julian date is scalar, a simple ``(3, 3)`` matrix is
returned; if the date is an array of length ``n``, then an array of
matrices is returned with dimensions ``(3, 3, n)``.
"""
oblm, oblt, eqeq, psi, eps = t._eart... | [
"def",
"compute_nutation",
"(",
"t",
")",
":",
"oblm",
",",
"oblt",
",",
"eqeq",
",",
"psi",
",",
"eps",
"=",
"t",
".",
"_earth_tilt",
"cobm",
"=",
"cos",
"(",
"oblm",
"*",
"DEG2RAD",
")",
"sobm",
"=",
"sin",
"(",
"oblm",
"*",
"DEG2RAD",
")",
"co... | Generate the nutation rotations for Time `t`.
If the Julian date is scalar, a simple ``(3, 3)`` matrix is
returned; if the date is an array of length ``n``, then an array of
matrices is returned with dimensions ``(3, 3, n)``. | [
"Generate",
"the",
"nutation",
"rotations",
"for",
"Time",
"t",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/nutationlib.py#L19-L44 |
229,965 | skyfielders/python-skyfield | skyfield/nutationlib.py | earth_tilt | def earth_tilt(t):
"""Return a tuple of information about the earth's axis and position.
`t` - A Time object.
The returned tuple contains five items:
``mean_ob`` - Mean obliquity of the ecliptic in degrees.
``true_ob`` - True obliquity of the ecliptic in degrees.
``eq_eq`` - Equation of the e... | python | def earth_tilt(t):
"""Return a tuple of information about the earth's axis and position.
`t` - A Time object.
The returned tuple contains five items:
``mean_ob`` - Mean obliquity of the ecliptic in degrees.
``true_ob`` - True obliquity of the ecliptic in degrees.
``eq_eq`` - Equation of the e... | [
"def",
"earth_tilt",
"(",
"t",
")",
":",
"dp",
",",
"de",
"=",
"t",
".",
"_nutation_angles",
"c_terms",
"=",
"equation_of_the_equinoxes_complimentary_terms",
"(",
"t",
".",
"tt",
")",
"/",
"ASEC2RAD",
"d_psi",
"=",
"dp",
"*",
"1e-7",
"+",
"t",
".",
"psi_... | Return a tuple of information about the earth's axis and position.
`t` - A Time object.
The returned tuple contains five items:
``mean_ob`` - Mean obliquity of the ecliptic in degrees.
``true_ob`` - True obliquity of the ecliptic in degrees.
``eq_eq`` - Equation of the equinoxes in seconds of tim... | [
"Return",
"a",
"tuple",
"of",
"information",
"about",
"the",
"earth",
"s",
"axis",
"and",
"position",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/nutationlib.py#L46-L75 |
229,966 | skyfielders/python-skyfield | skyfield/nutationlib.py | mean_obliquity | def mean_obliquity(jd_tdb):
"""Return the mean obliquity of the ecliptic in arcseconds.
`jd_tt` - TDB time as a Julian date float, or NumPy array of floats
"""
# Compute time in Julian centuries from epoch J2000.0.
t = (jd_tdb - T0) / 36525.0
# Compute the mean obliquity in arcseconds. Use ... | python | def mean_obliquity(jd_tdb):
"""Return the mean obliquity of the ecliptic in arcseconds.
`jd_tt` - TDB time as a Julian date float, or NumPy array of floats
"""
# Compute time in Julian centuries from epoch J2000.0.
t = (jd_tdb - T0) / 36525.0
# Compute the mean obliquity in arcseconds. Use ... | [
"def",
"mean_obliquity",
"(",
"jd_tdb",
")",
":",
"# Compute time in Julian centuries from epoch J2000.0.",
"t",
"=",
"(",
"jd_tdb",
"-",
"T0",
")",
"/",
"36525.0",
"# Compute the mean obliquity in arcseconds. Use expression from the",
"# reference's eq. (39) with obliquity at J20... | Return the mean obliquity of the ecliptic in arcseconds.
`jd_tt` - TDB time as a Julian date float, or NumPy array of floats | [
"Return",
"the",
"mean",
"obliquity",
"of",
"the",
"ecliptic",
"in",
"arcseconds",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/nutationlib.py#L79-L99 |
229,967 | skyfielders/python-skyfield | skyfield/nutationlib.py | equation_of_the_equinoxes_complimentary_terms | def equation_of_the_equinoxes_complimentary_terms(jd_tt):
"""Compute the complementary terms of the equation of the equinoxes.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats
"""
# Interval between fundamental epoch J2000.0 and current date.
t = (jd_tt - T0) / 36525.0
... | python | def equation_of_the_equinoxes_complimentary_terms(jd_tt):
"""Compute the complementary terms of the equation of the equinoxes.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats
"""
# Interval between fundamental epoch J2000.0 and current date.
t = (jd_tt - T0) / 36525.0
... | [
"def",
"equation_of_the_equinoxes_complimentary_terms",
"(",
"jd_tt",
")",
":",
"# Interval between fundamental epoch J2000.0 and current date.",
"t",
"=",
"(",
"jd_tt",
"-",
"T0",
")",
"/",
"36525.0",
"# Build array for intermediate results.",
"shape",
"=",
"getattr",
"(",
... | Compute the complementary terms of the equation of the equinoxes.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats | [
"Compute",
"the",
"complementary",
"terms",
"of",
"the",
"equation",
"of",
"the",
"equinoxes",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/nutationlib.py#L101-L189 |
229,968 | skyfielders/python-skyfield | skyfield/nutationlib.py | iau2000a | def iau2000a(jd_tt):
"""Compute Earth nutation based on the IAU 2000A nutation model.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats
Returns a tuple ``(delta_psi, delta_epsilon)`` measured in tenths of
a micro-arcsecond. Each value is either a float, or a NumPy array
with... | python | def iau2000a(jd_tt):
"""Compute Earth nutation based on the IAU 2000A nutation model.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats
Returns a tuple ``(delta_psi, delta_epsilon)`` measured in tenths of
a micro-arcsecond. Each value is either a float, or a NumPy array
with... | [
"def",
"iau2000a",
"(",
"jd_tt",
")",
":",
"# Interval between fundamental epoch J2000.0 and given date.",
"t",
"=",
"(",
"jd_tt",
"-",
"T0",
")",
"/",
"36525.0",
"# Compute fundamental arguments from Simon et al. (1994), in radians.",
"a",
"=",
"fundamental_arguments",
"(",
... | Compute Earth nutation based on the IAU 2000A nutation model.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats
Returns a tuple ``(delta_psi, delta_epsilon)`` measured in tenths of
a micro-arcsecond. Each value is either a float, or a NumPy array
with the same dimensions as the ... | [
"Compute",
"Earth",
"nutation",
"based",
"on",
"the",
"IAU",
"2000A",
"nutation",
"model",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/nutationlib.py#L222-L271 |
229,969 | skyfielders/python-skyfield | skyfield/nutationlib.py | iau2000b | def iau2000b(jd_tt):
"""Compute Earth nutation based on the faster IAU 2000B nutation model.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats
Returns a tuple ``(delta_psi, delta_epsilon)`` measured in tenths of
a micro-arcsecond. Each is either a float, or a NumPy array with
... | python | def iau2000b(jd_tt):
"""Compute Earth nutation based on the faster IAU 2000B nutation model.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats
Returns a tuple ``(delta_psi, delta_epsilon)`` measured in tenths of
a micro-arcsecond. Each is either a float, or a NumPy array with
... | [
"def",
"iau2000b",
"(",
"jd_tt",
")",
":",
"dpplan",
"=",
"-",
"0.000135",
"*",
"1e7",
"deplan",
"=",
"0.000388",
"*",
"1e7",
"t",
"=",
"(",
"jd_tt",
"-",
"T0",
")",
"/",
"36525.0",
"# TODO: can these be replaced with fa0 and f1?",
"el",
"=",
"fmod",
"(",
... | Compute Earth nutation based on the faster IAU 2000B nutation model.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats
Returns a tuple ``(delta_psi, delta_epsilon)`` measured in tenths of
a micro-arcsecond. Each is either a float, or a NumPy array with
the same dimensions as the... | [
"Compute",
"Earth",
"nutation",
"based",
"on",
"the",
"faster",
"IAU",
"2000B",
"nutation",
"model",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/nutationlib.py#L273-L325 |
229,970 | skyfielders/python-skyfield | skyfield/data/hipparcos.py | load_dataframe | def load_dataframe(fobj, compression='gzip'):
"""Given an open file for `hip_main.dat.gz`, return a parsed dataframe.
If your copy of ``hip_main.dat`` has already been unzipped, pass the
optional argument ``compression=None``.
"""
try:
from pandas import read_fwf
except ImportError:
... | python | def load_dataframe(fobj, compression='gzip'):
"""Given an open file for `hip_main.dat.gz`, return a parsed dataframe.
If your copy of ``hip_main.dat`` has already been unzipped, pass the
optional argument ``compression=None``.
"""
try:
from pandas import read_fwf
except ImportError:
... | [
"def",
"load_dataframe",
"(",
"fobj",
",",
"compression",
"=",
"'gzip'",
")",
":",
"try",
":",
"from",
"pandas",
"import",
"read_fwf",
"except",
"ImportError",
":",
"raise",
"ImportError",
"(",
"PANDAS_MESSAGE",
")",
"names",
",",
"colspecs",
"=",
"zip",
"("... | Given an open file for `hip_main.dat.gz`, return a parsed dataframe.
If your copy of ``hip_main.dat`` has already been unzipped, pass the
optional argument ``compression=None``. | [
"Given",
"an",
"open",
"file",
"for",
"hip_main",
".",
"dat",
".",
"gz",
"return",
"a",
"parsed",
"dataframe",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/data/hipparcos.py#L44-L71 |
229,971 | skyfielders/python-skyfield | skyfield/toposlib.py | Topos._altaz_rotation | def _altaz_rotation(self, t):
"""Compute the rotation from the ICRF into the alt-az system."""
R_lon = rot_z(- self.longitude.radians - t.gast * tau / 24.0)
return einsum('ij...,jk...,kl...->il...', self.R_lat, R_lon, t.M) | python | def _altaz_rotation(self, t):
"""Compute the rotation from the ICRF into the alt-az system."""
R_lon = rot_z(- self.longitude.radians - t.gast * tau / 24.0)
return einsum('ij...,jk...,kl...->il...', self.R_lat, R_lon, t.M) | [
"def",
"_altaz_rotation",
"(",
"self",
",",
"t",
")",
":",
"R_lon",
"=",
"rot_z",
"(",
"-",
"self",
".",
"longitude",
".",
"radians",
"-",
"t",
".",
"gast",
"*",
"tau",
"/",
"24.0",
")",
"return",
"einsum",
"(",
"'ij...,jk...,kl...->il...'",
",",
"self... | Compute the rotation from the ICRF into the alt-az system. | [
"Compute",
"the",
"rotation",
"from",
"the",
"ICRF",
"into",
"the",
"alt",
"-",
"az",
"system",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/toposlib.py#L70-L73 |
229,972 | skyfielders/python-skyfield | skyfield/toposlib.py | Topos._at | def _at(self, t):
"""Compute the GCRS position and velocity of this Topos at time `t`."""
pos, vel = terra(self.latitude.radians, self.longitude.radians,
self.elevation.au, t.gast)
pos = einsum('ij...,j...->i...', t.MT, pos)
vel = einsum('ij...,j...->i...', t.MT,... | python | def _at(self, t):
"""Compute the GCRS position and velocity of this Topos at time `t`."""
pos, vel = terra(self.latitude.radians, self.longitude.radians,
self.elevation.au, t.gast)
pos = einsum('ij...,j...->i...', t.MT, pos)
vel = einsum('ij...,j...->i...', t.MT,... | [
"def",
"_at",
"(",
"self",
",",
"t",
")",
":",
"pos",
",",
"vel",
"=",
"terra",
"(",
"self",
".",
"latitude",
".",
"radians",
",",
"self",
".",
"longitude",
".",
"radians",
",",
"self",
".",
"elevation",
".",
"au",
",",
"t",
".",
"gast",
")",
"... | Compute the GCRS position and velocity of this Topos at time `t`. | [
"Compute",
"the",
"GCRS",
"position",
"and",
"velocity",
"of",
"this",
"Topos",
"at",
"time",
"t",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/toposlib.py#L75-L89 |
229,973 | skyfielders/python-skyfield | skyfield/elementslib.py | osculating_elements_of | def osculating_elements_of(position, reference_frame=None):
"""Produce the osculating orbital elements for a position.
The ``position`` should be an :class:`~skyfield.positionlib.ICRF`
instance like that returned by the ``at()`` method of any Solar
System body, specifying a position, a velocity, and a ... | python | def osculating_elements_of(position, reference_frame=None):
"""Produce the osculating orbital elements for a position.
The ``position`` should be an :class:`~skyfield.positionlib.ICRF`
instance like that returned by the ``at()`` method of any Solar
System body, specifying a position, a velocity, and a ... | [
"def",
"osculating_elements_of",
"(",
"position",
",",
"reference_frame",
"=",
"None",
")",
":",
"mu",
"=",
"GM_dict",
".",
"get",
"(",
"position",
".",
"center",
",",
"0",
")",
"+",
"GM_dict",
".",
"get",
"(",
"position",
".",
"target",
",",
"0",
")",... | Produce the osculating orbital elements for a position.
The ``position`` should be an :class:`~skyfield.positionlib.ICRF`
instance like that returned by the ``at()`` method of any Solar
System body, specifying a position, a velocity, and a time. An
instance of :class:`~skyfield.elementslib.OsculatingE... | [
"Produce",
"the",
"osculating",
"orbital",
"elements",
"for",
"a",
"position",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/elementslib.py#L12-L34 |
229,974 | skyfielders/python-skyfield | skyfield/sgp4lib.py | theta_GMST1982 | def theta_GMST1982(jd_ut1):
"""Return the angle of Greenwich Mean Standard Time 1982 given the JD.
This angle defines the difference between the idiosyncratic True
Equator Mean Equinox (TEME) frame of reference used by SGP4 and the
more standard Pseudo Earth Fixed (PEF) frame of reference.
From AI... | python | def theta_GMST1982(jd_ut1):
"""Return the angle of Greenwich Mean Standard Time 1982 given the JD.
This angle defines the difference between the idiosyncratic True
Equator Mean Equinox (TEME) frame of reference used by SGP4 and the
more standard Pseudo Earth Fixed (PEF) frame of reference.
From AI... | [
"def",
"theta_GMST1982",
"(",
"jd_ut1",
")",
":",
"t",
"=",
"(",
"jd_ut1",
"-",
"T0",
")",
"/",
"36525.0",
"g",
"=",
"67310.54841",
"+",
"(",
"8640184.812866",
"+",
"(",
"0.093104",
"+",
"(",
"-",
"6.2e-6",
")",
"*",
"t",
")",
"*",
"t",
")",
"*",... | Return the angle of Greenwich Mean Standard Time 1982 given the JD.
This angle defines the difference between the idiosyncratic True
Equator Mean Equinox (TEME) frame of reference used by SGP4 and the
more standard Pseudo Earth Fixed (PEF) frame of reference.
From AIAA 2006-6753 Appendix C. | [
"Return",
"the",
"angle",
"of",
"Greenwich",
"Mean",
"Standard",
"Time",
"1982",
"given",
"the",
"JD",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/sgp4lib.py#L160-L175 |
229,975 | skyfielders/python-skyfield | skyfield/sgp4lib.py | TEME_to_ITRF | def TEME_to_ITRF(jd_ut1, rTEME, vTEME, xp=0.0, yp=0.0):
"""Convert TEME position and velocity into standard ITRS coordinates.
This converts a position and velocity vector in the idiosyncratic
True Equator Mean Equinox (TEME) frame of reference used by the SGP4
theory into vectors into the more standard... | python | def TEME_to_ITRF(jd_ut1, rTEME, vTEME, xp=0.0, yp=0.0):
"""Convert TEME position and velocity into standard ITRS coordinates.
This converts a position and velocity vector in the idiosyncratic
True Equator Mean Equinox (TEME) frame of reference used by the SGP4
theory into vectors into the more standard... | [
"def",
"TEME_to_ITRF",
"(",
"jd_ut1",
",",
"rTEME",
",",
"vTEME",
",",
"xp",
"=",
"0.0",
",",
"yp",
"=",
"0.0",
")",
":",
"theta",
",",
"theta_dot",
"=",
"theta_GMST1982",
"(",
"jd_ut1",
")",
"zero",
"=",
"theta_dot",
"*",
"0.0",
"angular_velocity",
"=... | Convert TEME position and velocity into standard ITRS coordinates.
This converts a position and velocity vector in the idiosyncratic
True Equator Mean Equinox (TEME) frame of reference used by the SGP4
theory into vectors into the more standard ITRS frame of reference.
The velocity should be provided i... | [
"Convert",
"TEME",
"position",
"and",
"velocity",
"into",
"standard",
"ITRS",
"coordinates",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/sgp4lib.py#L177-L208 |
229,976 | skyfielders/python-skyfield | skyfield/sgp4lib.py | EarthSatellite.ITRF_position_velocity_error | def ITRF_position_velocity_error(self, t):
"""Return the ITRF position, velocity, and error at time `t`.
The position is an x,y,z vector measured in au, the velocity is
an x,y,z vector measured in au/day, and the error is a vector of
possible error messages for the time or vector of tim... | python | def ITRF_position_velocity_error(self, t):
"""Return the ITRF position, velocity, and error at time `t`.
The position is an x,y,z vector measured in au, the velocity is
an x,y,z vector measured in au/day, and the error is a vector of
possible error messages for the time or vector of tim... | [
"def",
"ITRF_position_velocity_error",
"(",
"self",
",",
"t",
")",
":",
"rTEME",
",",
"vTEME",
",",
"error",
"=",
"self",
".",
"_position_and_velocity_TEME_km",
"(",
"t",
")",
"rTEME",
"/=",
"AU_KM",
"vTEME",
"/=",
"AU_KM",
"vTEME",
"*=",
"DAY_S",
"rITRF",
... | Return the ITRF position, velocity, and error at time `t`.
The position is an x,y,z vector measured in au, the velocity is
an x,y,z vector measured in au/day, and the error is a vector of
possible error messages for the time or vector of times `t`. | [
"Return",
"the",
"ITRF",
"position",
"velocity",
"and",
"error",
"at",
"time",
"t",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/sgp4lib.py#L136-L149 |
229,977 | skyfielders/python-skyfield | skyfield/sgp4lib.py | EarthSatellite._at | def _at(self, t):
"""Compute this satellite's GCRS position and velocity at time `t`."""
rITRF, vITRF, error = self.ITRF_position_velocity_error(t)
rGCRS, vGCRS = ITRF_to_GCRS2(t, rITRF, vITRF)
return rGCRS, vGCRS, rGCRS, error | python | def _at(self, t):
"""Compute this satellite's GCRS position and velocity at time `t`."""
rITRF, vITRF, error = self.ITRF_position_velocity_error(t)
rGCRS, vGCRS = ITRF_to_GCRS2(t, rITRF, vITRF)
return rGCRS, vGCRS, rGCRS, error | [
"def",
"_at",
"(",
"self",
",",
"t",
")",
":",
"rITRF",
",",
"vITRF",
",",
"error",
"=",
"self",
".",
"ITRF_position_velocity_error",
"(",
"t",
")",
"rGCRS",
",",
"vGCRS",
"=",
"ITRF_to_GCRS2",
"(",
"t",
",",
"rITRF",
",",
"vITRF",
")",
"return",
"rG... | Compute this satellite's GCRS position and velocity at time `t`. | [
"Compute",
"this",
"satellite",
"s",
"GCRS",
"position",
"and",
"velocity",
"at",
"time",
"t",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/sgp4lib.py#L151-L155 |
229,978 | skyfielders/python-skyfield | skyfield/data/earth_orientation.py | morrison_and_stephenson_2004_table | def morrison_and_stephenson_2004_table():
"""Table of smoothed Delta T values from Morrison and Stephenson, 2004."""
import pandas as pd
f = load.open('http://eclipse.gsfc.nasa.gov/SEcat5/deltat.html')
tables = pd.read_html(f.read())
df = tables[0]
return pd.DataFrame({'year': df[0], 'delta_t': ... | python | def morrison_and_stephenson_2004_table():
"""Table of smoothed Delta T values from Morrison and Stephenson, 2004."""
import pandas as pd
f = load.open('http://eclipse.gsfc.nasa.gov/SEcat5/deltat.html')
tables = pd.read_html(f.read())
df = tables[0]
return pd.DataFrame({'year': df[0], 'delta_t': ... | [
"def",
"morrison_and_stephenson_2004_table",
"(",
")",
":",
"import",
"pandas",
"as",
"pd",
"f",
"=",
"load",
".",
"open",
"(",
"'http://eclipse.gsfc.nasa.gov/SEcat5/deltat.html'",
")",
"tables",
"=",
"pd",
".",
"read_html",
"(",
"f",
".",
"read",
"(",
")",
")... | Table of smoothed Delta T values from Morrison and Stephenson, 2004. | [
"Table",
"of",
"smoothed",
"Delta",
"T",
"values",
"from",
"Morrison",
"and",
"Stephenson",
"2004",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/data/earth_orientation.py#L8-L14 |
229,979 | skyfielders/python-skyfield | skyfield/functions.py | angle_between | def angle_between(u_vec, v_vec):
"""Given 2 vectors in `v` and `u`, return the angle separating them.
This works whether `v` and `u` each have the shape ``(3,)``, or
whether they are each whole arrays of corresponding x, y, and z
coordinates and have shape ``(3, N)``. The returned angle will be
bet... | python | def angle_between(u_vec, v_vec):
"""Given 2 vectors in `v` and `u`, return the angle separating them.
This works whether `v` and `u` each have the shape ``(3,)``, or
whether they are each whole arrays of corresponding x, y, and z
coordinates and have shape ``(3, N)``. The returned angle will be
bet... | [
"def",
"angle_between",
"(",
"u_vec",
",",
"v_vec",
")",
":",
"u",
"=",
"length_of",
"(",
"u_vec",
")",
"v",
"=",
"length_of",
"(",
"v_vec",
")",
"num",
"=",
"v",
"*",
"u_vec",
"-",
"u",
"*",
"v_vec",
"denom",
"=",
"v",
"*",
"u_vec",
"+",
"u",
... | Given 2 vectors in `v` and `u`, return the angle separating them.
This works whether `v` and `u` each have the shape ``(3,)``, or
whether they are each whole arrays of corresponding x, y, and z
coordinates and have shape ``(3, N)``. The returned angle will be
between 0 and 180 degrees.
This formul... | [
"Given",
"2",
"vectors",
"in",
"v",
"and",
"u",
"return",
"the",
"angle",
"separating",
"them",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/functions.py#L26-L42 |
229,980 | skyfielders/python-skyfield | skyfield/starlib.py | Star._compute_vectors | def _compute_vectors(self):
"""Compute the star's position as an ICRF position and velocity."""
# Use 1 gigaparsec for stars whose parallax is zero.
parallax = self.parallax_mas
if parallax <= 0.0:
parallax = 1.0e-6
# Convert right ascension, declination, and paral... | python | def _compute_vectors(self):
"""Compute the star's position as an ICRF position and velocity."""
# Use 1 gigaparsec for stars whose parallax is zero.
parallax = self.parallax_mas
if parallax <= 0.0:
parallax = 1.0e-6
# Convert right ascension, declination, and paral... | [
"def",
"_compute_vectors",
"(",
"self",
")",
":",
"# Use 1 gigaparsec for stars whose parallax is zero.",
"parallax",
"=",
"self",
".",
"parallax_mas",
"if",
"parallax",
"<=",
"0.0",
":",
"parallax",
"=",
"1.0e-6",
"# Convert right ascension, declination, and parallax to posi... | Compute the star's position as an ICRF position and velocity. | [
"Compute",
"the",
"star",
"s",
"position",
"as",
"an",
"ICRF",
"position",
"and",
"velocity",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/starlib.py#L126-L170 |
229,981 | skyfielders/python-skyfield | skyfield/units.py | _to_array | def _to_array(value):
"""As a convenience, turn Python lists and tuples into NumPy arrays."""
if isinstance(value, (tuple, list)):
return array(value)
elif isinstance(value, (float, int)):
return np.float64(value)
else:
return value | python | def _to_array(value):
"""As a convenience, turn Python lists and tuples into NumPy arrays."""
if isinstance(value, (tuple, list)):
return array(value)
elif isinstance(value, (float, int)):
return np.float64(value)
else:
return value | [
"def",
"_to_array",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"return",
"array",
"(",
"value",
")",
"elif",
"isinstance",
"(",
"value",
",",
"(",
"float",
",",
"int",
")",
")",
":",
"... | As a convenience, turn Python lists and tuples into NumPy arrays. | [
"As",
"a",
"convenience",
"turn",
"Python",
"lists",
"and",
"tuples",
"into",
"NumPy",
"arrays",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L12-L19 |
229,982 | skyfielders/python-skyfield | skyfield/units.py | _sexagesimalize_to_float | def _sexagesimalize_to_float(value):
"""Decompose `value` into units, minutes, and seconds.
Note that this routine is not appropriate for displaying a value,
because rounding to the smallest digit of display is necessary
before showing a value to the user. Use `_sexagesimalize_to_int()`
for data b... | python | def _sexagesimalize_to_float(value):
"""Decompose `value` into units, minutes, and seconds.
Note that this routine is not appropriate for displaying a value,
because rounding to the smallest digit of display is necessary
before showing a value to the user. Use `_sexagesimalize_to_int()`
for data b... | [
"def",
"_sexagesimalize_to_float",
"(",
"value",
")",
":",
"sign",
"=",
"np",
".",
"sign",
"(",
"value",
")",
"n",
"=",
"abs",
"(",
"value",
")",
"minutes",
",",
"seconds",
"=",
"divmod",
"(",
"n",
"*",
"3600.0",
",",
"60.0",
")",
"units",
",",
"mi... | Decompose `value` into units, minutes, and seconds.
Note that this routine is not appropriate for displaying a value,
because rounding to the smallest digit of display is necessary
before showing a value to the user. Use `_sexagesimalize_to_int()`
for data being displayed to the user.
This routin... | [
"Decompose",
"value",
"into",
"units",
"minutes",
"and",
"seconds",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L310-L332 |
229,983 | skyfielders/python-skyfield | skyfield/units.py | _sexagesimalize_to_int | def _sexagesimalize_to_int(value, places=0):
"""Decompose `value` into units, minutes, seconds, and second fractions.
This routine prepares a value for sexagesimal display, with its
seconds fraction expressed as an integer with `places` digits. The
result is a tuple of five integers:
``(sign [eit... | python | def _sexagesimalize_to_int(value, places=0):
"""Decompose `value` into units, minutes, seconds, and second fractions.
This routine prepares a value for sexagesimal display, with its
seconds fraction expressed as an integer with `places` digits. The
result is a tuple of five integers:
``(sign [eit... | [
"def",
"_sexagesimalize_to_int",
"(",
"value",
",",
"places",
"=",
"0",
")",
":",
"sign",
"=",
"int",
"(",
"np",
".",
"sign",
"(",
"value",
")",
")",
"value",
"=",
"abs",
"(",
"value",
")",
"power",
"=",
"10",
"**",
"places",
"n",
"=",
"int",
"("... | Decompose `value` into units, minutes, seconds, and second fractions.
This routine prepares a value for sexagesimal display, with its
seconds fraction expressed as an integer with `places` digits. The
result is a tuple of five integers:
``(sign [either +1 or -1], units, minutes, seconds, second_fract... | [
"Decompose",
"value",
"into",
"units",
"minutes",
"seconds",
"and",
"second",
"fractions",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L334-L356 |
229,984 | skyfielders/python-skyfield | skyfield/units.py | _hstr | def _hstr(hours, places=2):
"""Convert floating point `hours` into a sexagesimal string.
>>> _hstr(12.125)
'12h 07m 30.00s'
>>> _hstr(12.125, places=4)
'12h 07m 30.0000s'
>>> _hstr(float('nan'))
'nan'
"""
if isnan(hours):
return 'nan'
sgn, h, m, s, etc = _sexagesimalize... | python | def _hstr(hours, places=2):
"""Convert floating point `hours` into a sexagesimal string.
>>> _hstr(12.125)
'12h 07m 30.00s'
>>> _hstr(12.125, places=4)
'12h 07m 30.0000s'
>>> _hstr(float('nan'))
'nan'
"""
if isnan(hours):
return 'nan'
sgn, h, m, s, etc = _sexagesimalize... | [
"def",
"_hstr",
"(",
"hours",
",",
"places",
"=",
"2",
")",
":",
"if",
"isnan",
"(",
"hours",
")",
":",
"return",
"'nan'",
"sgn",
",",
"h",
",",
"m",
",",
"s",
",",
"etc",
"=",
"_sexagesimalize_to_int",
"(",
"hours",
",",
"places",
")",
"sign",
"... | Convert floating point `hours` into a sexagesimal string.
>>> _hstr(12.125)
'12h 07m 30.00s'
>>> _hstr(12.125, places=4)
'12h 07m 30.0000s'
>>> _hstr(float('nan'))
'nan' | [
"Convert",
"floating",
"point",
"hours",
"into",
"a",
"sexagesimal",
"string",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L358-L373 |
229,985 | skyfielders/python-skyfield | skyfield/units.py | _dstr | def _dstr(degrees, places=1, signed=False):
r"""Convert floating point `degrees` into a sexagesimal string.
>>> _dstr(181.875)
'181deg 52\' 30.0"'
>>> _dstr(181.875, places=3)
'181deg 52\' 30.000"'
>>> _dstr(181.875, signed=True)
'+181deg 52\' 30.0"'
>>> _dstr(float('nan'))
'nan'
... | python | def _dstr(degrees, places=1, signed=False):
r"""Convert floating point `degrees` into a sexagesimal string.
>>> _dstr(181.875)
'181deg 52\' 30.0"'
>>> _dstr(181.875, places=3)
'181deg 52\' 30.000"'
>>> _dstr(181.875, signed=True)
'+181deg 52\' 30.0"'
>>> _dstr(float('nan'))
'nan'
... | [
"def",
"_dstr",
"(",
"degrees",
",",
"places",
"=",
"1",
",",
"signed",
"=",
"False",
")",
":",
"if",
"isnan",
"(",
"degrees",
")",
":",
"return",
"'nan'",
"sgn",
",",
"d",
",",
"m",
",",
"s",
",",
"etc",
"=",
"_sexagesimalize_to_int",
"(",
"degree... | r"""Convert floating point `degrees` into a sexagesimal string.
>>> _dstr(181.875)
'181deg 52\' 30.0"'
>>> _dstr(181.875, places=3)
'181deg 52\' 30.000"'
>>> _dstr(181.875, signed=True)
'+181deg 52\' 30.0"'
>>> _dstr(float('nan'))
'nan' | [
"r",
"Convert",
"floating",
"point",
"degrees",
"into",
"a",
"sexagesimal",
"string",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L375-L392 |
229,986 | skyfielders/python-skyfield | skyfield/units.py | _interpret_angle | def _interpret_angle(name, angle_object, angle_float, unit='degrees'):
"""Return an angle in radians from one of two arguments.
It is common for Skyfield routines to accept both an argument like
`alt` that takes an Angle object as well as an `alt_degrees` that
can be given a bare float or a sexagesimal... | python | def _interpret_angle(name, angle_object, angle_float, unit='degrees'):
"""Return an angle in radians from one of two arguments.
It is common for Skyfield routines to accept both an argument like
`alt` that takes an Angle object as well as an `alt_degrees` that
can be given a bare float or a sexagesimal... | [
"def",
"_interpret_angle",
"(",
"name",
",",
"angle_object",
",",
"angle_float",
",",
"unit",
"=",
"'degrees'",
")",
":",
"if",
"angle_object",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"angle_object",
",",
"Angle",
")",
":",
"return",
"angle_object... | Return an angle in radians from one of two arguments.
It is common for Skyfield routines to accept both an argument like
`alt` that takes an Angle object as well as an `alt_degrees` that
can be given a bare float or a sexagesimal tuple. A pair of such
arguments can be passed to this routine for interp... | [
"Return",
"an",
"angle",
"in",
"radians",
"from",
"one",
"of",
"two",
"arguments",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L423-L439 |
229,987 | skyfielders/python-skyfield | skyfield/units.py | _interpret_ltude | def _interpret_ltude(value, name, psuffix, nsuffix):
"""Interpret a string, float, or tuple as a latitude or longitude angle.
`value` - The string to interpret.
`name` - 'latitude' or 'longitude', for use in exception messages.
`positive` - The string that indicates a positive angle ('N' or 'E').
`... | python | def _interpret_ltude(value, name, psuffix, nsuffix):
"""Interpret a string, float, or tuple as a latitude or longitude angle.
`value` - The string to interpret.
`name` - 'latitude' or 'longitude', for use in exception messages.
`positive` - The string that indicates a positive angle ('N' or 'E').
`... | [
"def",
"_interpret_ltude",
"(",
"value",
",",
"name",
",",
"psuffix",
",",
"nsuffix",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"return",
"Angle",
"(",
"degrees",
"=",
"_unsexagesimalize",
"(",
"value",
")",
")",
"value",
... | Interpret a string, float, or tuple as a latitude or longitude angle.
`value` - The string to interpret.
`name` - 'latitude' or 'longitude', for use in exception messages.
`positive` - The string that indicates a positive angle ('N' or 'E').
`negative` - The string that indicates a negative angle ('S' ... | [
"Interpret",
"a",
"string",
"float",
"or",
"tuple",
"as",
"a",
"latitude",
"or",
"longitude",
"angle",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L441-L469 |
229,988 | skyfielders/python-skyfield | skyfield/units.py | Distance.to | def to(self, unit):
"""Convert this distance to the given AstroPy unit."""
from astropy.units import au
return (self.au * au).to(unit) | python | def to(self, unit):
"""Convert this distance to the given AstroPy unit."""
from astropy.units import au
return (self.au * au).to(unit) | [
"def",
"to",
"(",
"self",
",",
"unit",
")",
":",
"from",
"astropy",
".",
"units",
"import",
"au",
"return",
"(",
"self",
".",
"au",
"*",
"au",
")",
".",
"to",
"(",
"unit",
")"
] | Convert this distance to the given AstroPy unit. | [
"Convert",
"this",
"distance",
"to",
"the",
"given",
"AstroPy",
"unit",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L76-L79 |
229,989 | skyfielders/python-skyfield | skyfield/units.py | Velocity.to | def to(self, unit):
"""Convert this velocity to the given AstroPy unit."""
from astropy.units import au, d
return (self.au_per_d * au / d).to(unit) | python | def to(self, unit):
"""Convert this velocity to the given AstroPy unit."""
from astropy.units import au, d
return (self.au_per_d * au / d).to(unit) | [
"def",
"to",
"(",
"self",
",",
"unit",
")",
":",
"from",
"astropy",
".",
"units",
"import",
"au",
",",
"d",
"return",
"(",
"self",
".",
"au_per_d",
"*",
"au",
"/",
"d",
")",
".",
"to",
"(",
"unit",
")"
] | Convert this velocity to the given AstroPy unit. | [
"Convert",
"this",
"velocity",
"to",
"the",
"given",
"AstroPy",
"unit",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L123-L126 |
229,990 | skyfielders/python-skyfield | skyfield/units.py | Angle.hstr | def hstr(self, places=2, warn=True):
"""Convert to a string like ``12h 07m 30.00s``."""
if warn and self.preference != 'hours':
raise WrongUnitError('hstr')
if self.radians.size == 0:
return '<Angle []>'
hours = self._hours
shape = getattr(hours, 'shape', ... | python | def hstr(self, places=2, warn=True):
"""Convert to a string like ``12h 07m 30.00s``."""
if warn and self.preference != 'hours':
raise WrongUnitError('hstr')
if self.radians.size == 0:
return '<Angle []>'
hours = self._hours
shape = getattr(hours, 'shape', ... | [
"def",
"hstr",
"(",
"self",
",",
"places",
"=",
"2",
",",
"warn",
"=",
"True",
")",
":",
"if",
"warn",
"and",
"self",
".",
"preference",
"!=",
"'hours'",
":",
"raise",
"WrongUnitError",
"(",
"'hstr'",
")",
"if",
"self",
".",
"radians",
".",
"size",
... | Convert to a string like ``12h 07m 30.00s``. | [
"Convert",
"to",
"a",
"string",
"like",
"12h",
"07m",
"30",
".",
"00s",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L232-L246 |
229,991 | skyfielders/python-skyfield | skyfield/units.py | Angle.dstr | def dstr(self, places=1, warn=True):
"""Convert to a string like ``181deg 52\' 30.0"``."""
if warn and self.preference != 'degrees':
raise WrongUnitError('dstr')
if self.radians.size == 0:
return '<Angle []>'
degrees = self._degrees
signed = self.signed
... | python | def dstr(self, places=1, warn=True):
"""Convert to a string like ``181deg 52\' 30.0"``."""
if warn and self.preference != 'degrees':
raise WrongUnitError('dstr')
if self.radians.size == 0:
return '<Angle []>'
degrees = self._degrees
signed = self.signed
... | [
"def",
"dstr",
"(",
"self",
",",
"places",
"=",
"1",
",",
"warn",
"=",
"True",
")",
":",
"if",
"warn",
"and",
"self",
".",
"preference",
"!=",
"'degrees'",
":",
"raise",
"WrongUnitError",
"(",
"'dstr'",
")",
"if",
"self",
".",
"radians",
".",
"size",... | Convert to a string like ``181deg 52\' 30.0"``. | [
"Convert",
"to",
"a",
"string",
"like",
"181deg",
"52",
"\\",
"30",
".",
"0",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L270-L285 |
229,992 | skyfielders/python-skyfield | skyfield/units.py | Angle.to | def to(self, unit):
"""Convert this angle to the given AstroPy unit."""
from astropy.units import rad
return (self.radians * rad).to(unit)
# Or should this do:
from astropy.coordinates import Angle
from astropy.units import rad
return Angle(self.radians, rad).to(... | python | def to(self, unit):
"""Convert this angle to the given AstroPy unit."""
from astropy.units import rad
return (self.radians * rad).to(unit)
# Or should this do:
from astropy.coordinates import Angle
from astropy.units import rad
return Angle(self.radians, rad).to(... | [
"def",
"to",
"(",
"self",
",",
"unit",
")",
":",
"from",
"astropy",
".",
"units",
"import",
"rad",
"return",
"(",
"self",
".",
"radians",
"*",
"rad",
")",
".",
"to",
"(",
"unit",
")",
"# Or should this do:",
"from",
"astropy",
".",
"coordinates",
"impo... | Convert this angle to the given AstroPy unit. | [
"Convert",
"this",
"angle",
"to",
"the",
"given",
"AstroPy",
"unit",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/units.py#L287-L295 |
229,993 | skyfielders/python-skyfield | skyfield/positionlib.py | ICRF.separation_from | def separation_from(self, another_icrf):
"""Return the angle between this position and another.
>>> print(ICRF([1,0,0]).separation_from(ICRF([1,1,0])))
45deg 00' 00.0"
You can also compute separations across an array of positions.
>>> directions = ICRF([[1,0,-1,0], [0,1,0,-1],... | python | def separation_from(self, another_icrf):
"""Return the angle between this position and another.
>>> print(ICRF([1,0,0]).separation_from(ICRF([1,1,0])))
45deg 00' 00.0"
You can also compute separations across an array of positions.
>>> directions = ICRF([[1,0,-1,0], [0,1,0,-1],... | [
"def",
"separation_from",
"(",
"self",
",",
"another_icrf",
")",
":",
"p1",
"=",
"self",
".",
"position",
".",
"au",
"p2",
"=",
"another_icrf",
".",
"position",
".",
"au",
"u1",
"=",
"p1",
"/",
"length_of",
"(",
"p1",
")",
"u2",
"=",
"p2",
"/",
"le... | Return the angle between this position and another.
>>> print(ICRF([1,0,0]).separation_from(ICRF([1,1,0])))
45deg 00' 00.0"
You can also compute separations across an array of positions.
>>> directions = ICRF([[1,0,-1,0], [0,1,0,-1], [0,0,0,0]])
>>> directions.separation_from(... | [
"Return",
"the",
"angle",
"between",
"this",
"position",
"and",
"another",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/positionlib.py#L134-L157 |
229,994 | skyfielders/python-skyfield | skyfield/positionlib.py | ICRF.to_skycoord | def to_skycoord(self, unit=None):
"""Convert this distance to an AstroPy ``SkyCoord`` object."""
from astropy.coordinates import SkyCoord
from astropy.units import au
x, y, z = self.position.au
return SkyCoord(representation='cartesian', x=x, y=y, z=z, unit=au) | python | def to_skycoord(self, unit=None):
"""Convert this distance to an AstroPy ``SkyCoord`` object."""
from astropy.coordinates import SkyCoord
from astropy.units import au
x, y, z = self.position.au
return SkyCoord(representation='cartesian', x=x, y=y, z=z, unit=au) | [
"def",
"to_skycoord",
"(",
"self",
",",
"unit",
"=",
"None",
")",
":",
"from",
"astropy",
".",
"coordinates",
"import",
"SkyCoord",
"from",
"astropy",
".",
"units",
"import",
"au",
"x",
",",
"y",
",",
"z",
"=",
"self",
".",
"position",
".",
"au",
"re... | Convert this distance to an AstroPy ``SkyCoord`` object. | [
"Convert",
"this",
"distance",
"to",
"an",
"AstroPy",
"SkyCoord",
"object",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/positionlib.py#L262-L267 |
229,995 | skyfielders/python-skyfield | skyfield/positionlib.py | ICRF.from_altaz | def from_altaz(self, alt=None, az=None, alt_degrees=None, az_degrees=None,
distance=Distance(au=0.1)):
"""Generate an Apparent position from an altitude and azimuth.
The altitude and azimuth can each be provided as an `Angle`
object, or else as a number of degrees provided as... | python | def from_altaz(self, alt=None, az=None, alt_degrees=None, az_degrees=None,
distance=Distance(au=0.1)):
"""Generate an Apparent position from an altitude and azimuth.
The altitude and azimuth can each be provided as an `Angle`
object, or else as a number of degrees provided as... | [
"def",
"from_altaz",
"(",
"self",
",",
"alt",
"=",
"None",
",",
"az",
"=",
"None",
",",
"alt_degrees",
"=",
"None",
",",
"az_degrees",
"=",
"None",
",",
"distance",
"=",
"Distance",
"(",
"au",
"=",
"0.1",
")",
")",
":",
"# TODO: should this method live o... | Generate an Apparent position from an altitude and azimuth.
The altitude and azimuth can each be provided as an `Angle`
object, or else as a number of degrees provided as either a
float or a tuple of degrees, arcminutes, and arcseconds::
alt=Angle(...), az=Angle(...)
al... | [
"Generate",
"an",
"Apparent",
"position",
"from",
"an",
"altitude",
"and",
"azimuth",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/positionlib.py#L277-L304 |
229,996 | skyfielders/python-skyfield | skyfield/positionlib.py | Barycentric.observe | def observe(self, body):
"""Compute the `Astrometric` position of a body from this location.
To compute the body's astrometric position, it is first asked
for its position at the time `t` of this position itself. The
distance to the body is then divided by the speed of light to
... | python | def observe(self, body):
"""Compute the `Astrometric` position of a body from this location.
To compute the body's astrometric position, it is first asked
for its position at the time `t` of this position itself. The
distance to the body is then divided by the speed of light to
... | [
"def",
"observe",
"(",
"self",
",",
"body",
")",
":",
"p",
",",
"v",
",",
"t",
",",
"light_time",
"=",
"body",
".",
"_observe_from_bcrs",
"(",
"self",
")",
"astrometric",
"=",
"Astrometric",
"(",
"p",
",",
"v",
",",
"t",
",",
"observer_data",
"=",
... | Compute the `Astrometric` position of a body from this location.
To compute the body's astrometric position, it is first asked
for its position at the time `t` of this position itself. The
distance to the body is then divided by the speed of light to
find how long it takes its light to... | [
"Compute",
"the",
"Astrometric",
"position",
"of",
"a",
"body",
"from",
"this",
"location",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/positionlib.py#L349-L367 |
229,997 | skyfielders/python-skyfield | skyfield/positionlib.py | Geocentric.subpoint | def subpoint(self):
"""Return the latitude and longitude directly beneath this position.
Returns a :class:`~skyfield.toposlib.Topos` whose ``longitude``
and ``latitude`` are those of the point on the Earth's surface
directly beneath this position, and whose ``elevation`` is the
... | python | def subpoint(self):
"""Return the latitude and longitude directly beneath this position.
Returns a :class:`~skyfield.toposlib.Topos` whose ``longitude``
and ``latitude`` are those of the point on the Earth's surface
directly beneath this position, and whose ``elevation`` is the
... | [
"def",
"subpoint",
"(",
"self",
")",
":",
"if",
"self",
".",
"center",
"!=",
"399",
":",
"# TODO: should an __init__() check this?",
"raise",
"ValueError",
"(",
"\"you can only ask for the geographic subpoint\"",
"\" of a position measured from Earth's center\"",
")",
"t",
... | Return the latitude and longitude directly beneath this position.
Returns a :class:`~skyfield.toposlib.Topos` whose ``longitude``
and ``latitude`` are those of the point on the Earth's surface
directly beneath this position, and whose ``elevation`` is the
height of this position above t... | [
"Return",
"the",
"latitude",
"and",
"longitude",
"directly",
"beneath",
"this",
"position",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/positionlib.py#L454-L478 |
229,998 | skyfielders/python-skyfield | skyfield/charting.py | _plot_stars | def _plot_stars(catalog, observer, project, ax, mag1, mag2, margin=1.25):
"""Experiment in progress, hence the underscore; expect changes."""
art = []
# from astropy import wcs
# w = wcs.WCS(naxis=2)
# w.wcs.crpix = [-234.75, 8.3393]
# w.wcs.cdelt = np.array([-0.066667, 0.066667])
# w.wcs.... | python | def _plot_stars(catalog, observer, project, ax, mag1, mag2, margin=1.25):
"""Experiment in progress, hence the underscore; expect changes."""
art = []
# from astropy import wcs
# w = wcs.WCS(naxis=2)
# w.wcs.crpix = [-234.75, 8.3393]
# w.wcs.cdelt = np.array([-0.066667, 0.066667])
# w.wcs.... | [
"def",
"_plot_stars",
"(",
"catalog",
",",
"observer",
",",
"project",
",",
"ax",
",",
"mag1",
",",
"mag2",
",",
"margin",
"=",
"1.25",
")",
":",
"art",
"=",
"[",
"]",
"# from astropy import wcs",
"# w = wcs.WCS(naxis=2)",
"# w.wcs.crpix = [-234.75, 8.3393]",
"#... | Experiment in progress, hence the underscore; expect changes. | [
"Experiment",
"in",
"progress",
"hence",
"the",
"underscore",
";",
"expect",
"changes",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/charting.py#L9-L82 |
229,999 | skyfielders/python-skyfield | skyfield/almanac.py | phase_angle | def phase_angle(ephemeris, body, t):
"""Compute the phase angle of a body viewed from Earth.
The ``body`` should be an integer or string that can be looked up in
the given ``ephemeris``, which will also be asked to provide
positions for the Earth and Sun. The return value will be an
:class:`~skyfi... | python | def phase_angle(ephemeris, body, t):
"""Compute the phase angle of a body viewed from Earth.
The ``body`` should be an integer or string that can be looked up in
the given ``ephemeris``, which will also be asked to provide
positions for the Earth and Sun. The return value will be an
:class:`~skyfi... | [
"def",
"phase_angle",
"(",
"ephemeris",
",",
"body",
",",
"t",
")",
":",
"earth",
"=",
"ephemeris",
"[",
"'earth'",
"]",
"sun",
"=",
"ephemeris",
"[",
"'sun'",
"]",
"body",
"=",
"ephemeris",
"[",
"body",
"]",
"pe",
"=",
"earth",
".",
"at",
"(",
"t"... | Compute the phase angle of a body viewed from Earth.
The ``body`` should be an integer or string that can be looked up in
the given ``ephemeris``, which will also be asked to provide
positions for the Earth and Sun. The return value will be an
:class:`~skyfield.units.Angle` object. | [
"Compute",
"the",
"phase",
"angle",
"of",
"a",
"body",
"viewed",
"from",
"Earth",
"."
] | 51d9e042e06457f6b1f2415296d50a38cb3a300f | https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/almanac.py#L11-L27 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.