repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
playpauseandstop/rororo
rororo/settings.py
immutable_settings
def immutable_settings(defaults: Settings, **optionals: Any) -> types.MappingProxyType: r"""Initialize and return immutable Settings dictionary. Settings dictionary allows you to setup settings values from multiple sources and make sure that values cannot be changed, updated by anyon...
python
def immutable_settings(defaults: Settings, **optionals: Any) -> types.MappingProxyType: r"""Initialize and return immutable Settings dictionary. Settings dictionary allows you to setup settings values from multiple sources and make sure that values cannot be changed, updated by anyon...
[ "def", "immutable_settings", "(", "defaults", ":", "Settings", ",", "*", "*", "optionals", ":", "Any", ")", "->", "types", ".", "MappingProxyType", ":", "settings", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "iter_settings", "(", "d...
r"""Initialize and return immutable Settings dictionary. Settings dictionary allows you to setup settings values from multiple sources and make sure that values cannot be changed, updated by anyone else after initialization. This helps keep things clear and not worry about hidden settings change somewh...
[ "r", "Initialize", "and", "return", "immutable", "Settings", "dictionary", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/settings.py#L37-L67
playpauseandstop/rororo
rororo/settings.py
inject_settings
def inject_settings(mixed: Union[str, Settings], context: MutableMapping[str, Any], fail_silently: bool = False) -> None: """Inject settings values to given context. :param mixed: Settings can be a string (that it will be read from Python path), Python mo...
python
def inject_settings(mixed: Union[str, Settings], context: MutableMapping[str, Any], fail_silently: bool = False) -> None: """Inject settings values to given context. :param mixed: Settings can be a string (that it will be read from Python path), Python mo...
[ "def", "inject_settings", "(", "mixed", ":", "Union", "[", "str", ",", "Settings", "]", ",", "context", ":", "MutableMapping", "[", "str", ",", "Any", "]", ",", "fail_silently", ":", "bool", "=", "False", ")", "->", "None", ":", "if", "isinstance", "("...
Inject settings values to given context. :param mixed: Settings can be a string (that it will be read from Python path), Python module or dict-like instance. :param context: Context to assign settings key values. It should support dict-like item assingment. :param fail_silen...
[ "Inject", "settings", "values", "to", "given", "context", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/settings.py#L70-L94
playpauseandstop/rororo
rororo/settings.py
iter_settings
def iter_settings(mixed: Settings) -> Iterator[Tuple[str, Any]]: """Iterate over settings values from settings module or dict-like instance. :param mixed: Settings instance to iterate. """ if isinstance(mixed, types.ModuleType): for attr in dir(mixed): if not is_setting_key(attr): ...
python
def iter_settings(mixed: Settings) -> Iterator[Tuple[str, Any]]: """Iterate over settings values from settings module or dict-like instance. :param mixed: Settings instance to iterate. """ if isinstance(mixed, types.ModuleType): for attr in dir(mixed): if not is_setting_key(attr): ...
[ "def", "iter_settings", "(", "mixed", ":", "Settings", ")", "->", "Iterator", "[", "Tuple", "[", "str", ",", "Any", "]", "]", ":", "if", "isinstance", "(", "mixed", ",", "types", ".", "ModuleType", ")", ":", "for", "attr", "in", "dir", "(", "mixed", ...
Iterate over settings values from settings module or dict-like instance. :param mixed: Settings instance to iterate.
[ "Iterate", "over", "settings", "values", "from", "settings", "module", "or", "dict", "-", "like", "instance", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/settings.py#L124-L135
playpauseandstop/rororo
rororo/settings.py
setup_locale
def setup_locale(lc_all: str, first_weekday: int = None, *, lc_collate: str = None, lc_ctype: str = None, lc_messages: str = None, lc_monetary: str = None, lc_numeric: str = None, lc_t...
python
def setup_locale(lc_all: str, first_weekday: int = None, *, lc_collate: str = None, lc_ctype: str = None, lc_messages: str = None, lc_monetary: str = None, lc_numeric: str = None, lc_t...
[ "def", "setup_locale", "(", "lc_all", ":", "str", ",", "first_weekday", ":", "int", "=", "None", ",", "*", ",", "lc_collate", ":", "str", "=", "None", ",", "lc_ctype", ":", "str", "=", "None", ",", "lc_messages", ":", "str", "=", "None", ",", "lc_mon...
Shortcut helper to setup locale for backend application. :param lc_all: Locale to use. :param first_weekday: Weekday for start week. 0 for Monday, 6 for Sunday. By default: None :param lc_collate: Collate locale to use. By default: ``<lc_all>`` :param lc_ctype: Ctype locale to use. By default: ...
[ "Shortcut", "helper", "to", "setup", "locale", "for", "backend", "application", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/settings.py#L138-L169
playpauseandstop/rororo
rororo/settings.py
setup_timezone
def setup_timezone(timezone: str) -> None: """Shortcut helper to configure timezone for backend application. :param timezone: Timezone to use, e.g. "UTC", "Europe/Kiev". """ if timezone and hasattr(time, 'tzset'): tz_root = '/usr/share/zoneinfo' tz_filename = os.path.join(tz_root, *(tim...
python
def setup_timezone(timezone: str) -> None: """Shortcut helper to configure timezone for backend application. :param timezone: Timezone to use, e.g. "UTC", "Europe/Kiev". """ if timezone and hasattr(time, 'tzset'): tz_root = '/usr/share/zoneinfo' tz_filename = os.path.join(tz_root, *(tim...
[ "def", "setup_timezone", "(", "timezone", ":", "str", ")", "->", "None", ":", "if", "timezone", "and", "hasattr", "(", "time", ",", "'tzset'", ")", ":", "tz_root", "=", "'/usr/share/zoneinfo'", "tz_filename", "=", "os", ".", "path", ".", "join", "(", "tz...
Shortcut helper to configure timezone for backend application. :param timezone: Timezone to use, e.g. "UTC", "Europe/Kiev".
[ "Shortcut", "helper", "to", "configure", "timezone", "for", "backend", "application", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/settings.py#L172-L185
OSSOS/MOP
src/jjk/preproc/MOPfits_old.py
inputs
def inputs(header): """Read through the HISTORY cards in an image header looking for detrend input lines. Detrend inputs are given on lines like: HISTORY imcombred: file_id We require that the value in file_id be store in the CADC archive before adding to the inputs list. """ import st...
python
def inputs(header): """Read through the HISTORY cards in an image header looking for detrend input lines. Detrend inputs are given on lines like: HISTORY imcombred: file_id We require that the value in file_id be store in the CADC archive before adding to the inputs list. """ import st...
[ "def", "inputs", "(", "header", ")", ":", "import", "string", ",", "re", "inputs", "=", "[", "]", "for", "h", "in", "header", ".", "ascardlist", "(", ")", ":", "if", "h", ".", "key", "==", "\"HISTORY\"", ":", "g", "=", "h", ".", "value", "result"...
Read through the HISTORY cards in an image header looking for detrend input lines. Detrend inputs are given on lines like: HISTORY imcombred: file_id We require that the value in file_id be store in the CADC archive before adding to the inputs list.
[ "Read", "through", "the", "HISTORY", "cards", "in", "an", "image", "header", "looking", "for", "detrend", "input", "lines", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfits_old.py#L138-L188
OSSOS/MOP
src/jjk/preproc/MOPfits_old.py
elixir_decode
def elixir_decode(elixir_filename): """ Takes an elixir style file name and decodes it's content. Values returned as a dictionary. Elixir filenames have the format RUNID.TYPE.FILTER/EXPTIME.CHIPID.VERSION.fits """ import re, pyfits parts_RE=re.compile(r'([^\.\s]+)') dataset_name =...
python
def elixir_decode(elixir_filename): """ Takes an elixir style file name and decodes it's content. Values returned as a dictionary. Elixir filenames have the format RUNID.TYPE.FILTER/EXPTIME.CHIPID.VERSION.fits """ import re, pyfits parts_RE=re.compile(r'([^\.\s]+)') dataset_name =...
[ "def", "elixir_decode", "(", "elixir_filename", ")", ":", "import", "re", ",", "pyfits", "parts_RE", "=", "re", ".", "compile", "(", "r'([^\\.\\s]+)'", ")", "dataset_name", "=", "parts_RE", ".", "findall", "(", "elixir_filename", ")", "### check that this was a va...
Takes an elixir style file name and decodes it's content. Values returned as a dictionary. Elixir filenames have the format RUNID.TYPE.FILTER/EXPTIME.CHIPID.VERSION.fits
[ "Takes", "an", "elixir", "style", "file", "name", "and", "decodes", "it", "s", "content", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfits_old.py#L211-L257
OSSOS/MOP
src/jjk/preproc/MOPfits_old.py
create_mef
def create_mef(filename=None): """ Create a file an MEF fits file called filename. Generate a random filename if None given """ import pyfits, time if not filename: ### here I know what filename is to start with. import tempfile filename=tempfile.mktemp(suffix='.fits') ...
python
def create_mef(filename=None): """ Create a file an MEF fits file called filename. Generate a random filename if None given """ import pyfits, time if not filename: ### here I know what filename is to start with. import tempfile filename=tempfile.mktemp(suffix='.fits') ...
[ "def", "create_mef", "(", "filename", "=", "None", ")", ":", "import", "pyfits", ",", "time", "if", "not", "filename", ":", "### here I know what filename is to start with.", "import", "tempfile", "filename", "=", "tempfile", ".", "mktemp", "(", "suffix", "=", "...
Create a file an MEF fits file called filename. Generate a random filename if None given
[ "Create", "a", "file", "an", "MEF", "fits", "file", "called", "filename", ".", "Generate", "a", "random", "filename", "if", "None", "given" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfits_old.py#L277-L319
OSSOS/MOP
src/jjk/preproc/MOPfits_old.py
strip_pad
def strip_pad(hdu): """Remove the padding lines that CFHT adds to headers""" l = hdu.header.ascardlist() d = [] for index in range(len(l)): if l[index].key in __comment_keys and str(l[index])==__cfht_padding: d.append(index) d.reverse() for index in d: del l[inde...
python
def strip_pad(hdu): """Remove the padding lines that CFHT adds to headers""" l = hdu.header.ascardlist() d = [] for index in range(len(l)): if l[index].key in __comment_keys and str(l[index])==__cfht_padding: d.append(index) d.reverse() for index in d: del l[inde...
[ "def", "strip_pad", "(", "hdu", ")", ":", "l", "=", "hdu", ".", "header", ".", "ascardlist", "(", ")", "d", "=", "[", "]", "for", "index", "in", "range", "(", "len", "(", "l", ")", ")", ":", "if", "l", "[", "index", "]", ".", "key", "in", "...
Remove the padding lines that CFHT adds to headers
[ "Remove", "the", "padding", "lines", "that", "CFHT", "adds", "to", "headers" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfits_old.py#L343-L354
OSSOS/MOP
src/jjk/preproc/MOPfits_old.py
stack
def stack(outfile,infiles,verbose=0): """ Stick infiles into outfiles as FITS extensions. outfile willl contain an MEF format file of the single extension FITS files named in the infiles array """ import os, sys, string, tempfile, shutil import pyfits, re, time ### if there is a pre-e...
python
def stack(outfile,infiles,verbose=0): """ Stick infiles into outfiles as FITS extensions. outfile willl contain an MEF format file of the single extension FITS files named in the infiles array """ import os, sys, string, tempfile, shutil import pyfits, re, time ### if there is a pre-e...
[ "def", "stack", "(", "outfile", ",", "infiles", ",", "verbose", "=", "0", ")", ":", "import", "os", ",", "sys", ",", "string", ",", "tempfile", ",", "shutil", "import", "pyfits", ",", "re", ",", "time", "### if there is a pre-existing MEF file for output then ...
Stick infiles into outfiles as FITS extensions. outfile willl contain an MEF format file of the single extension FITS files named in the infiles array
[ "Stick", "infiles", "into", "outfiles", "as", "FITS", "extensions", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfits_old.py#L380-L474
OSSOS/MOP
src/jjk/preproc/MOPfits_old.py
adGet
def adGet(file_id, archive="CFHT", extno=None, cutout=None ): """Use get a fits image from the CADC.""" import os, string, re,urllib #proxy="http://www1.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/authProxy/getData" proxy="http://test.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/authProxy/getData" if file_id is No...
python
def adGet(file_id, archive="CFHT", extno=None, cutout=None ): """Use get a fits image from the CADC.""" import os, string, re,urllib #proxy="http://www1.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/authProxy/getData" proxy="http://test.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/authProxy/getData" if file_id is No...
[ "def", "adGet", "(", "file_id", ",", "archive", "=", "\"CFHT\"", ",", "extno", "=", "None", ",", "cutout", "=", "None", ")", ":", "import", "os", ",", "string", ",", "re", ",", "urllib", "#proxy=\"http://www1.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/authProxy/getData\"", ...
Use get a fits image from the CADC.
[ "Use", "get", "a", "fits", "image", "from", "the", "CADC", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfits_old.py#L495-L568
OSSOS/MOP
src/jjk/preproc/MOPfits_old.py
_open
def _open(file,mode='copyonwrite'): """Opens a FITS format file and calls _open_fix if header doesn't verify correctly. """ import pyfits try: infits=pyfits.open(file,mode) hdu=infits except (ValueError,pyfits.VerifyError,pyfits.FITS_SevereError): import sys #...
python
def _open(file,mode='copyonwrite'): """Opens a FITS format file and calls _open_fix if header doesn't verify correctly. """ import pyfits try: infits=pyfits.open(file,mode) hdu=infits except (ValueError,pyfits.VerifyError,pyfits.FITS_SevereError): import sys #...
[ "def", "_open", "(", "file", ",", "mode", "=", "'copyonwrite'", ")", ":", "import", "pyfits", "try", ":", "infits", "=", "pyfits", ".", "open", "(", "file", ",", "mode", ")", "hdu", "=", "infits", "except", "(", "ValueError", ",", "pyfits", ".", "Ver...
Opens a FITS format file and calls _open_fix if header doesn't verify correctly.
[ "Opens", "a", "FITS", "format", "file", "and", "calls", "_open_fix", "if", "header", "doesn", "t", "verify", "correctly", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfits_old.py#L590-L611
OSSOS/MOP
src/jjk/preproc/MOPfits_old.py
find_proc_date
def find_proc_date(header): """Search the HISTORY fields of a header looking for the FLIPS processing date. """ import string, re for h in header.ascardlist(): if h.key=="HISTORY": g=h.value if ( string.find(g,'FLIPS 1.0 -:') ): result=re.search('imred...
python
def find_proc_date(header): """Search the HISTORY fields of a header looking for the FLIPS processing date. """ import string, re for h in header.ascardlist(): if h.key=="HISTORY": g=h.value if ( string.find(g,'FLIPS 1.0 -:') ): result=re.search('imred...
[ "def", "find_proc_date", "(", "header", ")", ":", "import", "string", ",", "re", "for", "h", "in", "header", ".", "ascardlist", "(", ")", ":", "if", "h", ".", "key", "==", "\"HISTORY\"", ":", "g", "=", "h", ".", "value", "if", "(", "string", ".", ...
Search the HISTORY fields of a header looking for the FLIPS processing date.
[ "Search", "the", "HISTORY", "fields", "of", "a", "header", "looking", "for", "the", "FLIPS", "processing", "date", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfits_old.py#L631-L646
OSSOS/MOP
src/jjk/preproc/MOPfits_old.py
find_detrend_keyword
def find_detrend_keyword(header, type): """Search through header and find the elixir formated string(s) that match the the input 'type'. header is a FITS HDU. Elixir formated strings are crunid.type.filter/exptime.chipid.version. """ import re, string value='NULL' #print type fo...
python
def find_detrend_keyword(header, type): """Search through header and find the elixir formated string(s) that match the the input 'type'. header is a FITS HDU. Elixir formated strings are crunid.type.filter/exptime.chipid.version. """ import re, string value='NULL' #print type fo...
[ "def", "find_detrend_keyword", "(", "header", ",", "type", ")", ":", "import", "re", ",", "string", "value", "=", "'NULL'", "#print type", "for", "h", "in", "header", ":", "g", "=", "str", "(", "h", ")", "if", "(", "string", ".", "find", "(", "g", ...
Search through header and find the elixir formated string(s) that match the the input 'type'. header is a FITS HDU. Elixir formated strings are crunid.type.filter/exptime.chipid.version.
[ "Search", "through", "header", "and", "find", "the", "elixir", "formated", "string", "(", "s", ")", "that", "match", "the", "the", "input", "type", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfits_old.py#L666-L682
OSSOS/MOP
src/jjk/preproc/MOPfits_old.py
_open_fix
def _open_fix(file): """Takes in a fits file name, open the file in binary mode and creates an HDU. Will attempt to fix some of the header keywords to match the standard FITS format. """ import pyfits, re, string temp = pyfits.HDUList() hdu = pyfits.PrimaryHDU() hdu._file=open(file,'rb') ...
python
def _open_fix(file): """Takes in a fits file name, open the file in binary mode and creates an HDU. Will attempt to fix some of the header keywords to match the standard FITS format. """ import pyfits, re, string temp = pyfits.HDUList() hdu = pyfits.PrimaryHDU() hdu._file=open(file,'rb') ...
[ "def", "_open_fix", "(", "file", ")", ":", "import", "pyfits", ",", "re", ",", "string", "temp", "=", "pyfits", ".", "HDUList", "(", ")", "hdu", "=", "pyfits", ".", "PrimaryHDU", "(", ")", "hdu", ".", "_file", "=", "open", "(", "file", ",", "'rb'",...
Takes in a fits file name, open the file in binary mode and creates an HDU. Will attempt to fix some of the header keywords to match the standard FITS format.
[ "Takes", "in", "a", "fits", "file", "name", "open", "the", "file", "in", "binary", "mode", "and", "creates", "an", "HDU", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfits_old.py#L704-L842
OSSOS/MOP
src/ossos/core/ossos/ssos.py
TracksParser.query_ssos
def query_ssos(self, mpc_observations, lunation_count=None): """Send a query to the SSOS web service, looking for available observations using the given track. :param mpc_observations: a list of mpc.Observations :param lunation_count: how many dark runs (+ and -) to search into :return:...
python
def query_ssos(self, mpc_observations, lunation_count=None): """Send a query to the SSOS web service, looking for available observations using the given track. :param mpc_observations: a list of mpc.Observations :param lunation_count: how many dark runs (+ and -) to search into :return:...
[ "def", "query_ssos", "(", "self", ",", "mpc_observations", ",", "lunation_count", "=", "None", ")", ":", "# we observe ~ a week either side of new moon", "# but we don't know when in the dark run the discovery happened", "# so be generous with the search boundaries, add extra 2 weeks", ...
Send a query to the SSOS web service, looking for available observations using the given track. :param mpc_observations: a list of mpc.Observations :param lunation_count: how many dark runs (+ and -) to search into :return: an SSOSData object :rtype: SSOSData
[ "Send", "a", "query", "to", "the", "SSOS", "web", "service", "looking", "for", "available", "observations", "using", "the", "given", "track", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/ssos.py#L88-L173
OSSOS/MOP
src/ossos/core/ossos/ssos.py
TrackTarget.query_ssos
def query_ssos(self, target_name, lunation_count=None): """Send a query to the SSOS web service, looking for available observations using the given track. :param target_name: name of target to query against SSOIS db :param lunation_count: ignored :rtype: SSOSData """ # ...
python
def query_ssos(self, target_name, lunation_count=None): """Send a query to the SSOS web service, looking for available observations using the given track. :param target_name: name of target to query against SSOIS db :param lunation_count: ignored :rtype: SSOSData """ # ...
[ "def", "query_ssos", "(", "self", ",", "target_name", ",", "lunation_count", "=", "None", ")", ":", "# we observe ~ a week either side of new moon", "# but we don't know when in the dark run the discovery happened", "# so be generous with the search boundaries, add extra 2 weeks", "# c...
Send a query to the SSOS web service, looking for available observations using the given track. :param target_name: name of target to query against SSOIS db :param lunation_count: ignored :rtype: SSOSData
[ "Send", "a", "query", "to", "the", "SSOS", "web", "service", "looking", "for", "available", "observations", "using", "the", "given", "track", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/ssos.py#L189-L239
OSSOS/MOP
src/ossos/core/ossos/ssos.py
SSOSParser.build_source_reading
def build_source_reading(expnum, ccd=None, ftype='p'): """ Build an astrom.Observation object for a SourceReading :param expnum: (str) Name or CFHT Exposure number of the observation. :param ccd: (str) CCD is this observation associated with. (can be None) :param ftype: (str) ex...
python
def build_source_reading(expnum, ccd=None, ftype='p'): """ Build an astrom.Observation object for a SourceReading :param expnum: (str) Name or CFHT Exposure number of the observation. :param ccd: (str) CCD is this observation associated with. (can be None) :param ftype: (str) ex...
[ "def", "build_source_reading", "(", "expnum", ",", "ccd", "=", "None", ",", "ftype", "=", "'p'", ")", ":", "logger", ".", "debug", "(", "\"Building source reading for expnum:{} ccd:{} ftype:{}\"", ".", "format", "(", "expnum", ",", "ccd", ",", "ftype", ")", ")...
Build an astrom.Observation object for a SourceReading :param expnum: (str) Name or CFHT Exposure number of the observation. :param ccd: (str) CCD is this observation associated with. (can be None) :param ftype: (str) exposure time (specific to CFHT imaging) :return: An astrom.Observat...
[ "Build", "an", "astrom", ".", "Observation", "object", "for", "a", "SourceReading" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/ssos.py#L280-L296
OSSOS/MOP
src/ossos/core/ossos/ssos.py
SSOSParser.parse
def parse(self, ssos_result_filename_or_lines, mpc_observations=None): """ given the result table create 'source' objects. :param ssos_result_filename_or_lines: :param mpc_observations: a list of mpc.Observation objects used to retrieve the SSOS observations """ table_re...
python
def parse(self, ssos_result_filename_or_lines, mpc_observations=None): """ given the result table create 'source' objects. :param ssos_result_filename_or_lines: :param mpc_observations: a list of mpc.Observation objects used to retrieve the SSOS observations """ table_re...
[ "def", "parse", "(", "self", ",", "ssos_result_filename_or_lines", ",", "mpc_observations", "=", "None", ")", ":", "table_reader", "=", "ascii", ".", "get_reader", "(", "Reader", "=", "ascii", ".", "Basic", ")", "table_reader", ".", "inconsistent_handler", "=", ...
given the result table create 'source' objects. :param ssos_result_filename_or_lines: :param mpc_observations: a list of mpc.Observation objects used to retrieve the SSOS observations
[ "given", "the", "result", "table", "create", "source", "objects", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/ssos.py#L298-L424
OSSOS/MOP
src/ossos/core/ossos/ssos.py
ParamDictBuilder.search_end_date
def search_end_date(self, search_end_date): """ :type search_end_date: astropy.io.Time :param search_end_date: search for frames take after the given date. """ assert isinstance(search_end_date, Time) self._search_end_date = search_end_date.replicate(format='iso') ...
python
def search_end_date(self, search_end_date): """ :type search_end_date: astropy.io.Time :param search_end_date: search for frames take after the given date. """ assert isinstance(search_end_date, Time) self._search_end_date = search_end_date.replicate(format='iso') ...
[ "def", "search_end_date", "(", "self", ",", "search_end_date", ")", ":", "assert", "isinstance", "(", "search_end_date", ",", "Time", ")", "self", ".", "_search_end_date", "=", "search_end_date", ".", "replicate", "(", "format", "=", "'iso'", ")", "self", ".",...
:type search_end_date: astropy.io.Time :param search_end_date: search for frames take after the given date.
[ ":", "type", "search_end_date", ":", "astropy", ".", "io", ".", "Time", ":", "param", "search_end_date", ":", "search", "for", "frames", "take", "after", "the", "given", "date", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/ssos.py#L580-L587
OSSOS/MOP
src/ossos/core/ossos/ssos.py
ParamDictBuilder.params
def params(self): """ :return: A dictionary of SSOS query parameters. :rtype: dict """ params = dict(format=RESPONSE_FORMAT, verbose=self.verbose, epoch1=str(self.search_start_date), epoch2=str(self.search_end_date...
python
def params(self): """ :return: A dictionary of SSOS query parameters. :rtype: dict """ params = dict(format=RESPONSE_FORMAT, verbose=self.verbose, epoch1=str(self.search_start_date), epoch2=str(self.search_end_date...
[ "def", "params", "(", "self", ")", ":", "params", "=", "dict", "(", "format", "=", "RESPONSE_FORMAT", ",", "verbose", "=", "self", ".", "verbose", ",", "epoch1", "=", "str", "(", "self", ".", "search_start_date", ")", ",", "epoch2", "=", "str", "(", ...
:return: A dictionary of SSOS query parameters. :rtype: dict
[ ":", "return", ":", "A", "dictionary", "of", "SSOS", "query", "parameters", ".", ":", "rtype", ":", "dict" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/ssos.py#L677-L697
OSSOS/MOP
src/ossos/core/ossos/ssos.py
Query.get
def get(self): """ :return: A string containing the TSV result from SSOS :rtype: str :raise: AssertionError """ params = self.param_dict_builder.params logger.debug(pprint.pformat(format(params))) response = requests.post(SSOS_URL, ...
python
def get(self): """ :return: A string containing the TSV result from SSOS :rtype: str :raise: AssertionError """ params = self.param_dict_builder.params logger.debug(pprint.pformat(format(params))) response = requests.post(SSOS_URL, ...
[ "def", "get", "(", "self", ")", ":", "params", "=", "self", ".", "param_dict_builder", ".", "params", "logger", ".", "debug", "(", "pprint", ".", "pformat", "(", "format", "(", "params", ")", ")", ")", "response", "=", "requests", ".", "post", "(", "...
:return: A string containing the TSV result from SSOS :rtype: str :raise: AssertionError
[ ":", "return", ":", "A", "string", "containing", "the", "TSV", "result", "from", "SSOS", ":", "rtype", ":", "str", ":", "raise", ":", "AssertionError" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/ssos.py#L730-L755
OSSOS/MOP
src/ossos/core/ossos/gui/views/mainframe.py
_FocusablePanel.SetFocus
def SetFocus(self, **kwargs): """ Over-rides normal behaviour of shifting focus to any child. Prefers the one set explicityly by use_as_focus. :param **kwargs: """ if self._focus is not None: self._focus.SetFocus() else: # fall back on the...
python
def SetFocus(self, **kwargs): """ Over-rides normal behaviour of shifting focus to any child. Prefers the one set explicityly by use_as_focus. :param **kwargs: """ if self._focus is not None: self._focus.SetFocus() else: # fall back on the...
[ "def", "SetFocus", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_focus", "is", "not", "None", ":", "self", ".", "_focus", ".", "SetFocus", "(", ")", "else", ":", "# fall back on the default behaviour", "super", "(", "_FocusablePanel"...
Over-rides normal behaviour of shifting focus to any child. Prefers the one set explicityly by use_as_focus. :param **kwargs:
[ "Over", "-", "rides", "normal", "behaviour", "of", "shifting", "focus", "to", "any", "child", ".", "Prefers", "the", "one", "set", "explicityly", "by", "use_as_focus", ".", ":", "param", "**", "kwargs", ":" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/views/mainframe.py#L116-L126
OSSOS/MOP
src/ossos/core/scripts/stepI.py
step3
def step3(expnums, ccd, version, rate_min, rate_max, angle, width, field=None, prefix=None, dry_run=False, maximum_flux_ratio=3, minimum_area=5, minimum_median_flux=1000.0): """run the actual step3 on the given exp/ccd combo""" jmp_args = ['step3jmp'] matt_args = ['step3jjk'] idx ...
python
def step3(expnums, ccd, version, rate_min, rate_max, angle, width, field=None, prefix=None, dry_run=False, maximum_flux_ratio=3, minimum_area=5, minimum_median_flux=1000.0): """run the actual step3 on the given exp/ccd combo""" jmp_args = ['step3jmp'] matt_args = ['step3jjk'] idx ...
[ "def", "step3", "(", "expnums", ",", "ccd", ",", "version", ",", "rate_min", ",", "rate_max", ",", "angle", ",", "width", ",", "field", "=", "None", ",", "prefix", "=", "None", ",", "dry_run", "=", "False", ",", "maximum_flux_ratio", "=", "3", ",", "...
run the actual step3 on the given exp/ccd combo
[ "run", "the", "actual", "step3", "on", "the", "given", "exp", "/", "ccd", "combo" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/stepI.py#L38-L93
JohnVinyard/zounds
zounds/persistence/util.py
extract_init_args
def extract_init_args(instance): """ Given an instance, and under the assumption that member variables have the same name as the __init__ arguments, extract the arguments so they can be used to reconstruct the instance when deserializing """ cls = instance.__class__ args = [x for x in inspec...
python
def extract_init_args(instance): """ Given an instance, and under the assumption that member variables have the same name as the __init__ arguments, extract the arguments so they can be used to reconstruct the instance when deserializing """ cls = instance.__class__ args = [x for x in inspec...
[ "def", "extract_init_args", "(", "instance", ")", ":", "cls", "=", "instance", ".", "__class__", "args", "=", "[", "x", "for", "x", "in", "inspect", ".", "getargspec", "(", "cls", ".", "__init__", ")", ".", "args", "if", "x", "!=", "'self'", "]", "re...
Given an instance, and under the assumption that member variables have the same name as the __init__ arguments, extract the arguments so they can be used to reconstruct the instance when deserializing
[ "Given", "an", "instance", "and", "under", "the", "assumption", "that", "member", "variables", "have", "the", "same", "name", "as", "the", "__init__", "arguments", "extract", "the", "arguments", "so", "they", "can", "be", "used", "to", "reconstruct", "the", ...
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/persistence/util.py#L26-L34
OSSOS/MOP
src/jjk/preproc/MOPwindow.py
MOPwindow.list
def list(self,header,choices): "Display list of choices. As many as we can get in a page." if not self.__list_window: (y,x)=self.__main.getmaxyx() self.__list_window = self.__main.subwin(35,x,0,0) _lw=self.__list_window _lw.keypad(1) (y_ma...
python
def list(self,header,choices): "Display list of choices. As many as we can get in a page." if not self.__list_window: (y,x)=self.__main.getmaxyx() self.__list_window = self.__main.subwin(35,x,0,0) _lw=self.__list_window _lw.keypad(1) (y_ma...
[ "def", "list", "(", "self", ",", "header", ",", "choices", ")", ":", "if", "not", "self", ".", "__list_window", ":", "(", "y", ",", "x", ")", "=", "self", ".", "__main", ".", "getmaxyx", "(", ")", "self", ".", "__list_window", "=", "self", ".", "...
Display list of choices. As many as we can get in a page.
[ "Display", "list", "of", "choices", ".", "As", "many", "as", "we", "can", "get", "in", "a", "page", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPwindow.py#L41-L133
OSSOS/MOP
src/jjk/preproc/wcsutil.py
WCSObject.recenter
def recenter(self): """ Reset the reference position values to correspond to the center of the reference frame. Algorithm used here developed by Colin Cox - 27-Jan-2004. """ if self.ctype1.find('TAN') < 0 or self.ctype2.find('TAN') < 0: print 'WCS.recenter() o...
python
def recenter(self): """ Reset the reference position values to correspond to the center of the reference frame. Algorithm used here developed by Colin Cox - 27-Jan-2004. """ if self.ctype1.find('TAN') < 0 or self.ctype2.find('TAN') < 0: print 'WCS.recenter() o...
[ "def", "recenter", "(", "self", ")", ":", "if", "self", ".", "ctype1", ".", "find", "(", "'TAN'", ")", "<", "0", "or", "self", ".", "ctype2", ".", "find", "(", "'TAN'", ")", "<", "0", ":", "print", "'WCS.recenter() only supported for TAN projections.'", ...
Reset the reference position values to correspond to the center of the reference frame. Algorithm used here developed by Colin Cox - 27-Jan-2004.
[ "Reset", "the", "reference", "position", "values", "to", "correspond", "to", "the", "center", "of", "the", "reference", "frame", ".", "Algorithm", "used", "here", "developed", "by", "Colin", "Cox", "-", "27", "-", "Jan", "-", "2004", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/wcsutil.py#L262-L331
OSSOS/MOP
src/jjk/preproc/wcsutil.py
WCSObject._buildNewKeyname
def _buildNewKeyname(self,key,prepend): """ Builds a new keyword based on original keyword name and a prepend string. """ if len(prepend+key) <= 8: _new_key = prepend+key else: _new_key = str(prepend+key)[:8] return _new_key
python
def _buildNewKeyname(self,key,prepend): """ Builds a new keyword based on original keyword name and a prepend string. """ if len(prepend+key) <= 8: _new_key = prepend+key else: _new_key = str(prepend+key)[:8] return _new_key
[ "def", "_buildNewKeyname", "(", "self", ",", "key", ",", "prepend", ")", ":", "if", "len", "(", "prepend", "+", "key", ")", "<=", "8", ":", "_new_key", "=", "prepend", "+", "key", "else", ":", "_new_key", "=", "str", "(", "prepend", "+", "key", ")"...
Builds a new keyword based on original keyword name and a prepend string.
[ "Builds", "a", "new", "keyword", "based", "on", "original", "keyword", "name", "and", "a", "prepend", "string", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/wcsutil.py#L333-L341
OSSOS/MOP
src/jjk/preproc/wcsutil.py
WCSObject.copy
def copy(self,deep=yes): """ Makes a (deep)copy of this object for use by other objects. """ if deep: return copy.deepcopy(self) else: return copy.copy(self)
python
def copy(self,deep=yes): """ Makes a (deep)copy of this object for use by other objects. """ if deep: return copy.deepcopy(self) else: return copy.copy(self)
[ "def", "copy", "(", "self", ",", "deep", "=", "yes", ")", ":", "if", "deep", ":", "return", "copy", ".", "deepcopy", "(", "self", ")", "else", ":", "return", "copy", ".", "copy", "(", "self", ")" ]
Makes a (deep)copy of this object for use by other objects.
[ "Makes", "a", "(", "deep", ")", "copy", "of", "this", "object", "for", "use", "by", "other", "objects", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/wcsutil.py#L344-L350
OSSOS/MOP
src/jjk/preproc/scrample.py
scrambleTriples
def scrambleTriples(expnums,ccd): """Pull the three images and then scramble the MJD-OBS keywords""" import pyfits, MOPfits mjd=[] fid=[] fs=[] filenames=[] for expnum in expnums: if int(ccd)<18: cutout="[-*,-*]" else: cutout="[*,*]" filenames....
python
def scrambleTriples(expnums,ccd): """Pull the three images and then scramble the MJD-OBS keywords""" import pyfits, MOPfits mjd=[] fid=[] fs=[] filenames=[] for expnum in expnums: if int(ccd)<18: cutout="[-*,-*]" else: cutout="[*,*]" filenames....
[ "def", "scrambleTriples", "(", "expnums", ",", "ccd", ")", ":", "import", "pyfits", ",", "MOPfits", "mjd", "=", "[", "]", "fid", "=", "[", "]", "fs", "=", "[", "]", "filenames", "=", "[", "]", "for", "expnum", "in", "expnums", ":", "if", "int", "...
Pull the three images and then scramble the MJD-OBS keywords
[ "Pull", "the", "three", "images", "and", "then", "scramble", "the", "MJD", "-", "OBS", "keywords" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/scrample.py#L22-L59
OSSOS/MOP
src/jjk/preproc/scrample.py
getTriples
def getTriples(expnums,ccd): """Pull the three images and then scramble the MJD-OBS keywords""" import pyfits, MOPfits filenames=[] for expnum in expnums: if int(ccd)<18: cutout="[-*,-*]" else: cutout="[*,*]" filenames.append(MOPfits.adGet(str(expnum)+opt....
python
def getTriples(expnums,ccd): """Pull the three images and then scramble the MJD-OBS keywords""" import pyfits, MOPfits filenames=[] for expnum in expnums: if int(ccd)<18: cutout="[-*,-*]" else: cutout="[*,*]" filenames.append(MOPfits.adGet(str(expnum)+opt....
[ "def", "getTriples", "(", "expnums", ",", "ccd", ")", ":", "import", "pyfits", ",", "MOPfits", "filenames", "=", "[", "]", "for", "expnum", "in", "expnums", ":", "if", "int", "(", "ccd", ")", "<", "18", ":", "cutout", "=", "\"[-*,-*]\"", "else", ":",...
Pull the three images and then scramble the MJD-OBS keywords
[ "Pull", "the", "three", "images", "and", "then", "scramble", "the", "MJD", "-", "OBS", "keywords" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/scrample.py#L62-L87
OSSOS/MOP
src/jjk/preproc/scrample.py
searchTriples
def searchTriples(filenames,plant=False): """Given a list of exposure numbers, find all the KBOs in that set of exposures""" print filenames if opt.none : return import MOPfits,os import MOPdbaccess import string import os.path import pyfits if len(filenames)!=3: ...
python
def searchTriples(filenames,plant=False): """Given a list of exposure numbers, find all the KBOs in that set of exposures""" print filenames if opt.none : return import MOPfits,os import MOPdbaccess import string import os.path import pyfits if len(filenames)!=3: ...
[ "def", "searchTriples", "(", "filenames", ",", "plant", "=", "False", ")", ":", "print", "filenames", "if", "opt", ".", "none", ":", "return", "import", "MOPfits", ",", "os", "import", "MOPdbaccess", "import", "string", "import", "os", ".", "path", "import...
Given a list of exposure numbers, find all the KBOs in that set of exposures
[ "Given", "a", "list", "of", "exposure", "numbers", "find", "all", "the", "KBOs", "in", "that", "set", "of", "exposures" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/scrample.py#L89-L266
OSSOS/MOP
src/jjk/preproc/scrample.py
ushort
def ushort(filename): """Ushort a the pixels""" import pyfits f=pyfits.open(filename,mode='update') f[0].scale('int16','',bzero=32768) f.flush() f.close()
python
def ushort(filename): """Ushort a the pixels""" import pyfits f=pyfits.open(filename,mode='update') f[0].scale('int16','',bzero=32768) f.flush() f.close()
[ "def", "ushort", "(", "filename", ")", ":", "import", "pyfits", "f", "=", "pyfits", ".", "open", "(", "filename", ",", "mode", "=", "'update'", ")", "f", "[", "0", "]", ".", "scale", "(", "'int16'", ",", "''", ",", "bzero", "=", "32768", ")", "f"...
Ushort a the pixels
[ "Ushort", "a", "the", "pixels" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/scrample.py#L268-L274
OSSOS/MOP
src/ossos/core/ossos/astrom.py
AstromParser.parse
def parse(self, filename): """ Parses a file into an AstromData structure. Args: filename: str The name of the file whose contents will be parsed. Returns: data: AstromData The file contents extracted into a data structure for programmatic ...
python
def parse(self, filename): """ Parses a file into an AstromData structure. Args: filename: str The name of the file whose contents will be parsed. Returns: data: AstromData The file contents extracted into a data structure for programmatic ...
[ "def", "parse", "(", "self", ",", "filename", ")", ":", "filehandle", "=", "storage", ".", "open_vos_or_local", "(", "filename", ",", "\"rb\"", ")", "assert", "filehandle", "is", "not", "None", ",", "\"Failed to open file {} \"", ".", "format", "(", "filename"...
Parses a file into an AstromData structure. Args: filename: str The name of the file whose contents will be parsed. Returns: data: AstromData The file contents extracted into a data structure for programmatic access.
[ "Parses", "a", "file", "into", "an", "AstromData", "structure", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L209-L237
OSSOS/MOP
src/ossos/core/ossos/astrom.py
BaseAstromWriter._write_observation_headers
def _write_observation_headers(self, observations): """ See src/pipematt/step1matt-c """ for observation in observations: header = observation.header def get_header_vals(header_list): header_vals = [] for key in header_list: ...
python
def _write_observation_headers(self, observations): """ See src/pipematt/step1matt-c """ for observation in observations: header = observation.header def get_header_vals(header_list): header_vals = [] for key in header_list: ...
[ "def", "_write_observation_headers", "(", "self", ",", "observations", ")", ":", "for", "observation", "in", "observations", ":", "header", "=", "observation", ".", "header", "def", "get_header_vals", "(", "header_list", ")", ":", "header_vals", "=", "[", "]", ...
See src/pipematt/step1matt-c
[ "See", "src", "/", "pipematt", "/", "step1matt", "-", "c" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L345-L373
OSSOS/MOP
src/ossos/core/ossos/astrom.py
BaseAstromWriter._write_sys_header
def _write_sys_header(self, sys_header): """ See src/pipematt/step3matt-c """ header_vals = [sys_header[RMIN], sys_header[RMAX], sys_header[ANGLE], sys_header[AWIDTH]] self._write_line("## RMIN RMAX ANGLE AWIDTH") self._write_line("# %8.1...
python
def _write_sys_header(self, sys_header): """ See src/pipematt/step3matt-c """ header_vals = [sys_header[RMIN], sys_header[RMAX], sys_header[ANGLE], sys_header[AWIDTH]] self._write_line("## RMIN RMAX ANGLE AWIDTH") self._write_line("# %8.1...
[ "def", "_write_sys_header", "(", "self", ",", "sys_header", ")", ":", "header_vals", "=", "[", "sys_header", "[", "RMIN", "]", ",", "sys_header", "[", "RMAX", "]", ",", "sys_header", "[", "ANGLE", "]", ",", "sys_header", "[", "AWIDTH", "]", "]", "self", ...
See src/pipematt/step3matt-c
[ "See", "src", "/", "pipematt", "/", "step3matt", "-", "c" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L375-L382
OSSOS/MOP
src/ossos/core/ossos/astrom.py
BaseAstromWriter._write_source_data
def _write_source_data(self, sources): """ See src/jjk/measure3 """ for i, source in enumerate(sources): self._write_source(source)
python
def _write_source_data(self, sources): """ See src/jjk/measure3 """ for i, source in enumerate(sources): self._write_source(source)
[ "def", "_write_source_data", "(", "self", ",", "sources", ")", ":", "for", "i", ",", "source", "in", "enumerate", "(", "sources", ")", ":", "self", ".", "_write_source", "(", "source", ")" ]
See src/jjk/measure3
[ "See", "src", "/", "jjk", "/", "measure3" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L384-L389
OSSOS/MOP
src/ossos/core/ossos/astrom.py
BaseAstromWriter.write_headers
def write_headers(self, observations, sys_header): """ Writes the header part of the astrom file so that only the source data has to be filled in. """ if self._header_written: raise AstromFormatError("Astrom file already has headers.") self._write_observation...
python
def write_headers(self, observations, sys_header): """ Writes the header part of the astrom file so that only the source data has to be filled in. """ if self._header_written: raise AstromFormatError("Astrom file already has headers.") self._write_observation...
[ "def", "write_headers", "(", "self", ",", "observations", ",", "sys_header", ")", ":", "if", "self", ".", "_header_written", ":", "raise", "AstromFormatError", "(", "\"Astrom file already has headers.\"", ")", "self", ".", "_write_observation_list", "(", "observations...
Writes the header part of the astrom file so that only the source data has to be filled in.
[ "Writes", "the", "header", "part", "of", "the", "astrom", "file", "so", "that", "only", "the", "source", "data", "has", "to", "be", "filled", "in", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L402-L415
OSSOS/MOP
src/ossos/core/ossos/astrom.py
StreamingAstromWriter.write_source
def write_source(self, source): """ Writes out data for a single source. """ if not self._header_written: observations = [reading.get_observation() for reading in source.get_readings()] self.write_headers(observations, self.sys_header) self._write_source(...
python
def write_source(self, source): """ Writes out data for a single source. """ if not self._header_written: observations = [reading.get_observation() for reading in source.get_readings()] self.write_headers(observations, self.sys_header) self._write_source(...
[ "def", "write_source", "(", "self", ",", "source", ")", ":", "if", "not", "self", ".", "_header_written", ":", "observations", "=", "[", "reading", ".", "get_observation", "(", ")", "for", "reading", "in", "source", ".", "get_readings", "(", ")", "]", "s...
Writes out data for a single source.
[ "Writes", "out", "data", "for", "a", "single", "source", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L441-L449
OSSOS/MOP
src/ossos/core/ossos/astrom.py
BulkAstromWriter.write_astrom_data
def write_astrom_data(self, astrom_data): """ Writes a full AstromData structure at once. """ self.write_headers(astrom_data.observations, astrom_data.sys_header) self._write_source_data(astrom_data.sources)
python
def write_astrom_data(self, astrom_data): """ Writes a full AstromData structure at once. """ self.write_headers(astrom_data.observations, astrom_data.sys_header) self._write_source_data(astrom_data.sources)
[ "def", "write_astrom_data", "(", "self", ",", "astrom_data", ")", ":", "self", ".", "write_headers", "(", "astrom_data", ".", "observations", ",", "astrom_data", ".", "sys_header", ")", "self", ".", "_write_source_data", "(", "astrom_data", ".", "sources", ")" ]
Writes a full AstromData structure at once.
[ "Writes", "a", "full", "AstromData", "structure", "at", "once", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L461-L466
OSSOS/MOP
src/ossos/core/ossos/astrom.py
SourceReading._original_frame
def _original_frame(self, x, y): """ Return x/y in the original frame, based on a guess as much as anything. :param x: x pixel coordinate :type x: float :param y: y pixel coordinate :type y: float :return: x,y :rtype: float, float """ if se...
python
def _original_frame(self, x, y): """ Return x/y in the original frame, based on a guess as much as anything. :param x: x pixel coordinate :type x: float :param y: y pixel coordinate :type y: float :return: x,y :rtype: float, float """ if se...
[ "def", "_original_frame", "(", "self", ",", "x", ",", "y", ")", ":", "if", "self", ".", "_inverted", ":", "return", "self", ".", "obs", ".", "naxis1", "-", "x", ",", "self", ".", "obs", ".", "naxis2", "-", "y", "return", "x", ",", "y" ]
Return x/y in the original frame, based on a guess as much as anything. :param x: x pixel coordinate :type x: float :param y: y pixel coordinate :type y: float :return: x,y :rtype: float, float
[ "Return", "x", "/", "y", "in", "the", "original", "frame", "based", "on", "a", "guess", "as", "much", "as", "anything", ".", ":", "param", "x", ":", "x", "pixel", "coordinate", ":", "type", "x", ":", "float", ":", "param", "y", ":", "y", "pixel", ...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L675-L687
OSSOS/MOP
src/ossos/core/ossos/astrom.py
SourceReading.pix_coord
def pix_coord(self, pix_coord): """ :type pix_coord: list :param pix_coord: an x,y pixel coordinate, origin = 1 """ try: pix_coord = list(pix_coord) except: pass if not isinstance(pix_coord, list) or len(pix_coord) != 2: raise V...
python
def pix_coord(self, pix_coord): """ :type pix_coord: list :param pix_coord: an x,y pixel coordinate, origin = 1 """ try: pix_coord = list(pix_coord) except: pass if not isinstance(pix_coord, list) or len(pix_coord) != 2: raise V...
[ "def", "pix_coord", "(", "self", ",", "pix_coord", ")", ":", "try", ":", "pix_coord", "=", "list", "(", "pix_coord", ")", "except", ":", "pass", "if", "not", "isinstance", "(", "pix_coord", ",", "list", ")", "or", "len", "(", "pix_coord", ")", "!=", ...
:type pix_coord: list :param pix_coord: an x,y pixel coordinate, origin = 1
[ ":", "type", "pix_coord", ":", "list", ":", "param", "pix_coord", ":", "an", "x", "y", "pixel", "coordinate", "origin", "=", "1" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L725-L741
OSSOS/MOP
src/ossos/core/ossos/astrom.py
SourceReading.reference_source_point
def reference_source_point(self): """ The location of the source in the reference image, in terms of the current image coordinates. """ xref = isinstance(self.xref, Quantity) and self.xref.value or self.xref yref = isinstance(self.yref, Quantity) and self.yref.value or se...
python
def reference_source_point(self): """ The location of the source in the reference image, in terms of the current image coordinates. """ xref = isinstance(self.xref, Quantity) and self.xref.value or self.xref yref = isinstance(self.yref, Quantity) and self.yref.value or se...
[ "def", "reference_source_point", "(", "self", ")", ":", "xref", "=", "isinstance", "(", "self", ".", "xref", ",", "Quantity", ")", "and", "self", ".", "xref", ".", "value", "or", "self", ".", "xref", "yref", "=", "isinstance", "(", "self", ".", "yref",...
The location of the source in the reference image, in terms of the current image coordinates.
[ "The", "location", "of", "the", "source", "in", "the", "reference", "image", "in", "terms", "of", "the", "current", "image", "coordinates", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L871-L879
OSSOS/MOP
src/ossos/core/ossos/astrom.py
SourceReading.get_coordinate_offset
def get_coordinate_offset(self, other_reading): """ Calculates the offsets between readings' coordinate systems. Args: other_reading: ossos.astrom.SourceReading The reading to compare coordinate systems with. Returns: (offset_x, offset_y): Th...
python
def get_coordinate_offset(self, other_reading): """ Calculates the offsets between readings' coordinate systems. Args: other_reading: ossos.astrom.SourceReading The reading to compare coordinate systems with. Returns: (offset_x, offset_y): Th...
[ "def", "get_coordinate_offset", "(", "self", ",", "other_reading", ")", ":", "my_x", ",", "my_y", "=", "self", ".", "reference_source_point", "other_x", ",", "other_y", "=", "other_reading", ".", "reference_source_point", "return", "my_x", "-", "other_x", ",", "...
Calculates the offsets between readings' coordinate systems. Args: other_reading: ossos.astrom.SourceReading The reading to compare coordinate systems with. Returns: (offset_x, offset_y): The x and y offsets between this reading and the other reading's ...
[ "Calculates", "the", "offsets", "between", "readings", "coordinate", "systems", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L894-L909
OSSOS/MOP
src/ossos/core/ossos/astrom.py
SourceReading.compute_inverted
def compute_inverted(self): """ Returns: inverted: bool True if the stored image is inverted. """ # astheader = storage.get_astheader(self.obs.expnum, self.obs.ccdnum, version=self.obs.ftype) # pvwcs = wcs.WCS(astheader) # (x, y) = pvwcs.sky2xy(self....
python
def compute_inverted(self): """ Returns: inverted: bool True if the stored image is inverted. """ # astheader = storage.get_astheader(self.obs.expnum, self.obs.ccdnum, version=self.obs.ftype) # pvwcs = wcs.WCS(astheader) # (x, y) = pvwcs.sky2xy(self....
[ "def", "compute_inverted", "(", "self", ")", ":", "# astheader = storage.get_astheader(self.obs.expnum, self.obs.ccdnum, version=self.obs.ftype)", "# pvwcs = wcs.WCS(astheader)", "# (x, y) = pvwcs.sky2xy(self.ra, self.dec)", "# logger.debug(\"is_inverted: X,Y {},{} -> wcs X,Y {},{}\".format(self....
Returns: inverted: bool True if the stored image is inverted.
[ "Returns", ":", "inverted", ":", "bool", "True", "if", "the", "stored", "image", "is", "inverted", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L953-L971
OSSOS/MOP
src/ossos/core/ossos/astrom.py
Observation.from_source_reference
def from_source_reference(expnum, ccd, x, y): """ Given the location of a source in the image, create an Observation. """ image_uri = storage.dbimages_uri(expnum=expnum, ccd=None, version='p', ...
python
def from_source_reference(expnum, ccd, x, y): """ Given the location of a source in the image, create an Observation. """ image_uri = storage.dbimages_uri(expnum=expnum, ccd=None, version='p', ...
[ "def", "from_source_reference", "(", "expnum", ",", "ccd", ",", "x", ",", "y", ")", ":", "image_uri", "=", "storage", ".", "dbimages_uri", "(", "expnum", "=", "expnum", ",", "ccd", "=", "None", ",", "version", "=", "'p'", ",", "ext", "=", "'.fits'", ...
Given the location of a source in the image, create an Observation.
[ "Given", "the", "location", "of", "a", "source", "in", "the", "image", "create", "an", "Observation", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L990-L1034
OSSOS/MOP
src/ossos/core/ossos/astrom.py
StreamingVettingWriter.write_source
def write_source(self, source, comment=None, reject=False): """ Writes out data for a single source. """ if not self._header_written: observations = [reading.get_observation() for reading in source.get_readings()] self.write_headers(observations, self.sys_header) ...
python
def write_source(self, source, comment=None, reject=False): """ Writes out data for a single source. """ if not self._header_written: observations = [reading.get_observation() for reading in source.get_readings()] self.write_headers(observations, self.sys_header) ...
[ "def", "write_source", "(", "self", ",", "source", ",", "comment", "=", "None", ",", "reject", "=", "False", ")", ":", "if", "not", "self", ".", "_header_written", ":", "observations", "=", "[", "reading", ".", "get_observation", "(", ")", "for", "readin...
Writes out data for a single source.
[ "Writes", "out", "data", "for", "a", "single", "source", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L1160-L1168
OSSOS/MOP
src/ossos/core/ossos/coord.py
mjd2gmst
def mjd2gmst(mjd): """Convert Modfied Juian Date (JD = 2400000.5) to GMST Taken from P.T. Walace routines. """ tu = (mjd - MJD0) / (100*DPY) st = math.fmod(mjd, 1.0) * D2PI + (24110.54841 + (8640184.812866 + (0.093104 - 6.2e-6 * tu) * tu) * tu) * DS2R w = math.fmod(st, D2PI) if w >=...
python
def mjd2gmst(mjd): """Convert Modfied Juian Date (JD = 2400000.5) to GMST Taken from P.T. Walace routines. """ tu = (mjd - MJD0) / (100*DPY) st = math.fmod(mjd, 1.0) * D2PI + (24110.54841 + (8640184.812866 + (0.093104 - 6.2e-6 * tu) * tu) * tu) * DS2R w = math.fmod(st, D2PI) if w >=...
[ "def", "mjd2gmst", "(", "mjd", ")", ":", "tu", "=", "(", "mjd", "-", "MJD0", ")", "/", "(", "100", "*", "DPY", ")", "st", "=", "math", ".", "fmod", "(", "mjd", ",", "1.0", ")", "*", "D2PI", "+", "(", "24110.54841", "+", "(", "8640184.812866", ...
Convert Modfied Juian Date (JD = 2400000.5) to GMST Taken from P.T. Walace routines.
[ "Convert", "Modfied", "Juian", "Date", "(", "JD", "=", "2400000", ".", "5", ")", "to", "GMST", "Taken", "from", "P", ".", "T", ".", "Walace", "routines", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/coord.py#L12-L27
JohnVinyard/zounds
zounds/learn/wgan.py
WassersteinGanTrainer._gradient_penalty
def _gradient_penalty(self, real_samples, fake_samples, kwargs): """ Compute the norm of the gradients for each sample in a batch, and penalize anything on either side of unit norm """ import torch from torch.autograd import Variable, grad real_samples = real_sam...
python
def _gradient_penalty(self, real_samples, fake_samples, kwargs): """ Compute the norm of the gradients for each sample in a batch, and penalize anything on either side of unit norm """ import torch from torch.autograd import Variable, grad real_samples = real_sam...
[ "def", "_gradient_penalty", "(", "self", ",", "real_samples", ",", "fake_samples", ",", "kwargs", ")", ":", "import", "torch", "from", "torch", ".", "autograd", "import", "Variable", ",", "grad", "real_samples", "=", "real_samples", ".", "view", "(", "fake_sam...
Compute the norm of the gradients for each sample in a batch, and penalize anything on either side of unit norm
[ "Compute", "the", "norm", "of", "the", "gradients", "for", "each", "sample", "in", "a", "batch", "and", "penalize", "anything", "on", "either", "side", "of", "unit", "norm" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/learn/wgan.py#L61-L99
OSSOS/MOP
src/ossos/core/ossos/pipeline/update_astrometry.py
remeasure
def remeasure(mpc_in, reset_pixel_coordinates=True): """ Compute the RA/DEC of the line based on the X/Y in the comment and the WCS of the associated image. Comment of supplied astrometric line (mpc_in) must be in OSSOSComment format. @param mpc_in: An line of astrometric measurement to recompute the ...
python
def remeasure(mpc_in, reset_pixel_coordinates=True): """ Compute the RA/DEC of the line based on the X/Y in the comment and the WCS of the associated image. Comment of supplied astrometric line (mpc_in) must be in OSSOSComment format. @param mpc_in: An line of astrometric measurement to recompute the ...
[ "def", "remeasure", "(", "mpc_in", ",", "reset_pixel_coordinates", "=", "True", ")", ":", "if", "mpc_in", ".", "null_observation", ":", "return", "mpc_in", "mpc_obs", "=", "deepcopy", "(", "mpc_in", ")", "logging", ".", "debug", "(", "\"rm start: {}\"", ".", ...
Compute the RA/DEC of the line based on the X/Y in the comment and the WCS of the associated image. Comment of supplied astrometric line (mpc_in) must be in OSSOSComment format. @param mpc_in: An line of astrometric measurement to recompute the RA/DEC from the X/Y in the comment. @type mpc_in: mp_ephem.Ob...
[ "Compute", "the", "RA", "/", "DEC", "of", "the", "line", "based", "on", "the", "X", "/", "Y", "in", "the", "comment", "and", "the", "WCS", "of", "the", "associated", "image", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/pipeline/update_astrometry.py#L37-L139
OSSOS/MOP
src/ossos/core/ossos/pipeline/update_astrometry.py
_connection_error_wrapper
def _connection_error_wrapper(func, *args, **kwargs): """ Wrap a call to func in a try/except that repeats on ConnectionError @param func: @param args: @param kwargs: @return: """ counter = 0 while counter < 5: try: result = func(*args, **kwargs) retu...
python
def _connection_error_wrapper(func, *args, **kwargs): """ Wrap a call to func in a try/except that repeats on ConnectionError @param func: @param args: @param kwargs: @return: """ counter = 0 while counter < 5: try: result = func(*args, **kwargs) retu...
[ "def", "_connection_error_wrapper", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "counter", "=", "0", "while", "counter", "<", "5", ":", "try", ":", "result", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return...
Wrap a call to func in a try/except that repeats on ConnectionError @param func: @param args: @param kwargs: @return:
[ "Wrap", "a", "call", "to", "func", "in", "a", "try", "/", "except", "that", "repeats", "on", "ConnectionError" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/pipeline/update_astrometry.py#L142-L159
OSSOS/MOP
src/ossos/core/ossos/pipeline/update_astrometry.py
recompute_mag
def recompute_mag(mpc_in, skip_centroids=False): """ Get the mag of the object given the mp_ephem.ephem.Observation """ # TODO this really shouldn't need to build a 'reading' to get the cutout... from ossos.downloads.cutouts import downloader dlm = downloader.ImageCutoutDownloader() mpc_ob...
python
def recompute_mag(mpc_in, skip_centroids=False): """ Get the mag of the object given the mp_ephem.ephem.Observation """ # TODO this really shouldn't need to build a 'reading' to get the cutout... from ossos.downloads.cutouts import downloader dlm = downloader.ImageCutoutDownloader() mpc_ob...
[ "def", "recompute_mag", "(", "mpc_in", ",", "skip_centroids", "=", "False", ")", ":", "# TODO this really shouldn't need to build a 'reading' to get the cutout...", "from", "ossos", ".", "downloads", ".", "cutouts", "import", "downloader", "dlm", "=", "downloader", ".", ...
Get the mag of the object given the mp_ephem.ephem.Observation
[ "Get", "the", "mag", "of", "the", "object", "given", "the", "mp_ephem", ".", "ephem", ".", "Observation" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/pipeline/update_astrometry.py#L162-L262
OSSOS/MOP
src/ossos/core/ossos/pipeline/update_astrometry.py
compare_orbits
def compare_orbits(original_obs, modified_obs, cor_file): """Compare the orbit fit given the oringal and modified astrometry.""" origin = orbfit.Orbfit(original_obs) modified = orbfit.Orbfit(modified_obs) orbpt = file(cor_file+".orb", 'w') # Dump summaries of the orbits orbpt.write("#"*80+"\n...
python
def compare_orbits(original_obs, modified_obs, cor_file): """Compare the orbit fit given the oringal and modified astrometry.""" origin = orbfit.Orbfit(original_obs) modified = orbfit.Orbfit(modified_obs) orbpt = file(cor_file+".orb", 'w') # Dump summaries of the orbits orbpt.write("#"*80+"\n...
[ "def", "compare_orbits", "(", "original_obs", ",", "modified_obs", ",", "cor_file", ")", ":", "origin", "=", "orbfit", ".", "Orbfit", "(", "original_obs", ")", "modified", "=", "orbfit", ".", "Orbfit", "(", "modified_obs", ")", "orbpt", "=", "file", "(", "...
Compare the orbit fit given the oringal and modified astrometry.
[ "Compare", "the", "orbit", "fit", "given", "the", "oringal", "and", "modified", "astrometry", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/pipeline/update_astrometry.py#L343-L432
JohnVinyard/zounds
zounds/timeseries/audiosamples.py
AudioSamples.mono
def mono(self): """ Return this instance summed to mono. If the instance is already mono, this is a no-op. """ if self.channels == 1: return self x = self.sum(axis=1) * 0.5 y = x * 0.5 return AudioSamples(y, self.samplerate)
python
def mono(self): """ Return this instance summed to mono. If the instance is already mono, this is a no-op. """ if self.channels == 1: return self x = self.sum(axis=1) * 0.5 y = x * 0.5 return AudioSamples(y, self.samplerate)
[ "def", "mono", "(", "self", ")", ":", "if", "self", ".", "channels", "==", "1", ":", "return", "self", "x", "=", "self", ".", "sum", "(", "axis", "=", "1", ")", "*", "0.5", "y", "=", "x", "*", "0.5", "return", "AudioSamples", "(", "y", ",", "...
Return this instance summed to mono. If the instance is already mono, this is a no-op.
[ "Return", "this", "instance", "summed", "to", "mono", ".", "If", "the", "instance", "is", "already", "mono", "this", "is", "a", "no", "-", "op", "." ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/timeseries/audiosamples.py#L149-L158
JohnVinyard/zounds
zounds/timeseries/audiosamples.py
AudioSamples.encode
def encode(self, flo=None, fmt='WAV', subtype='PCM_16'): """ Return audio samples encoded as bytes given a particular audio format Args: flo (file-like): A file-like object to write the bytes to. If flo is not supplied, a new :class:`io.BytesIO` instance will be ...
python
def encode(self, flo=None, fmt='WAV', subtype='PCM_16'): """ Return audio samples encoded as bytes given a particular audio format Args: flo (file-like): A file-like object to write the bytes to. If flo is not supplied, a new :class:`io.BytesIO` instance will be ...
[ "def", "encode", "(", "self", ",", "flo", "=", "None", ",", "fmt", "=", "'WAV'", ",", "subtype", "=", "'PCM_16'", ")", ":", "flo", "=", "flo", "or", "BytesIO", "(", ")", "with", "SoundFile", "(", "flo", ",", "mode", "=", "'w'", ",", "channels", "...
Return audio samples encoded as bytes given a particular audio format Args: flo (file-like): A file-like object to write the bytes to. If flo is not supplied, a new :class:`io.BytesIO` instance will be created and returned fmt (str): A libsndfile-friendl...
[ "Return", "audio", "samples", "encoded", "as", "bytes", "given", "a", "particular", "audio", "format" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/timeseries/audiosamples.py#L181-L229
playpauseandstop/rororo
rororo/schemas/validators.py
extend_with_default
def extend_with_default(validator_class: Any) -> Any: """Append defaults from schema to instance need to be validated. :param validator_class: Apply the change for given validator class. """ validate_properties = validator_class.VALIDATORS['properties'] def set_defaults(validator: Any, ...
python
def extend_with_default(validator_class: Any) -> Any: """Append defaults from schema to instance need to be validated. :param validator_class: Apply the change for given validator class. """ validate_properties = validator_class.VALIDATORS['properties'] def set_defaults(validator: Any, ...
[ "def", "extend_with_default", "(", "validator_class", ":", "Any", ")", "->", "Any", ":", "validate_properties", "=", "validator_class", ".", "VALIDATORS", "[", "'properties'", "]", "def", "set_defaults", "(", "validator", ":", "Any", ",", "properties", ":", "dic...
Append defaults from schema to instance need to be validated. :param validator_class: Apply the change for given validator class.
[ "Append", "defaults", "from", "schema", "to", "instance", "need", "to", "be", "validated", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/schemas/validators.py#L33-L53
JohnVinyard/zounds
zounds/spectral/weighting.py
FrequencyWeighting.weights
def weights(self, other): """ Compute weights, given a scale or time-frequency representation :param other: A time-frequency representation, or a scale :return: a numpy array of weights """ try: return self._wdata(other) except AttributeError: ...
python
def weights(self, other): """ Compute weights, given a scale or time-frequency representation :param other: A time-frequency representation, or a scale :return: a numpy array of weights """ try: return self._wdata(other) except AttributeError: ...
[ "def", "weights", "(", "self", ",", "other", ")", ":", "try", ":", "return", "self", ".", "_wdata", "(", "other", ")", "except", "AttributeError", ":", "frequency_dim", "=", "other", ".", "dimensions", "[", "-", "1", "]", "return", "self", ".", "_wdata...
Compute weights, given a scale or time-frequency representation :param other: A time-frequency representation, or a scale :return: a numpy array of weights
[ "Compute", "weights", "given", "a", "scale", "or", "time", "-", "frequency", "representation", ":", "param", "other", ":", "A", "time", "-", "frequency", "representation", "or", "a", "scale", ":", "return", ":", "a", "numpy", "array", "of", "weights" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/weighting.py#L15-L25
OSSOS/MOP
src/ossos/core/scripts/rate_angle_check.py
rates_angles
def rates_angles(fk_candidate_observations): """ :param fk_candidate_observations: name of the fk*reals.astrom file to check against Object.planted """ detections = fk_candidate_observations.get_sources() for detection in detections: measures = detection.get_readings() for measure i...
python
def rates_angles(fk_candidate_observations): """ :param fk_candidate_observations: name of the fk*reals.astrom file to check against Object.planted """ detections = fk_candidate_observations.get_sources() for detection in detections: measures = detection.get_readings() for measure i...
[ "def", "rates_angles", "(", "fk_candidate_observations", ")", ":", "detections", "=", "fk_candidate_observations", ".", "get_sources", "(", ")", "for", "detection", "in", "detections", ":", "measures", "=", "detection", ".", "get_readings", "(", ")", "for", "measu...
:param fk_candidate_observations: name of the fk*reals.astrom file to check against Object.planted
[ ":", "param", "fk_candidate_observations", ":", "name", "of", "the", "fk", "*", "reals", ".", "astrom", "file", "to", "check", "against", "Object", ".", "planted" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/rate_angle_check.py#L47-L97
OSSOS/MOP
src/ossos/core/ossos/downloads/core.py
Downloader.download_hdulist
def download_hdulist(self, uri, **kwargs): """ Downloads a FITS image as a HDUList. Args: uri: The URI of the FITS image to download. kwargs: optional arguments to pass to the vos client. For example, passing view="cutout" and cutout=[1] will result i...
python
def download_hdulist(self, uri, **kwargs): """ Downloads a FITS image as a HDUList. Args: uri: The URI of the FITS image to download. kwargs: optional arguments to pass to the vos client. For example, passing view="cutout" and cutout=[1] will result i...
[ "def", "download_hdulist", "(", "self", ",", "uri", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "debug", "(", "str", "(", "kwargs", ")", ")", "hdulist", "=", "None", "try", ":", "vobj", "=", "storage", ".", "vofile", "(", "uri", ",", "*", "...
Downloads a FITS image as a HDUList. Args: uri: The URI of the FITS image to download. kwargs: optional arguments to pass to the vos client. For example, passing view="cutout" and cutout=[1] will result in a cutout of extension 1 from the FITS image specified by the ...
[ "Downloads", "a", "FITS", "image", "as", "a", "HDUList", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/core.py#L17-L53
OSSOS/MOP
src/ossos/core/ossos/downloads/core.py
Downloader.download_apcor
def download_apcor(self, uri): """ Downloads apcor data. Args: uri: The URI of the apcor data file. Returns: apcor: ossos.downloads.core.ApcorData """ local_file = os.path.basename(uri) if os.access(local_file, os.F_OK): fobj = o...
python
def download_apcor(self, uri): """ Downloads apcor data. Args: uri: The URI of the apcor data file. Returns: apcor: ossos.downloads.core.ApcorData """ local_file = os.path.basename(uri) if os.access(local_file, os.F_OK): fobj = o...
[ "def", "download_apcor", "(", "self", ",", "uri", ")", ":", "local_file", "=", "os", ".", "path", ".", "basename", "(", "uri", ")", "if", "os", ".", "access", "(", "local_file", ",", "os", ".", "F_OK", ")", ":", "fobj", "=", "open", "(", "local_fil...
Downloads apcor data. Args: uri: The URI of the apcor data file. Returns: apcor: ossos.downloads.core.ApcorData
[ "Downloads", "apcor", "data", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/core.py#L55-L75
OSSOS/MOP
src/ossos/core/ossos/downloads/core.py
ApcorData.from_string
def from_string(cls, rawstr): """ Creates an ApcorData record from the raw string format. Expected string format: ap_in ap_out ap_cor apcor_err """ try: args = map(float, rawstr.split()) except Exception as ex: import sys lo...
python
def from_string(cls, rawstr): """ Creates an ApcorData record from the raw string format. Expected string format: ap_in ap_out ap_cor apcor_err """ try: args = map(float, rawstr.split()) except Exception as ex: import sys lo...
[ "def", "from_string", "(", "cls", ",", "rawstr", ")", ":", "try", ":", "args", "=", "map", "(", "float", ",", "rawstr", ".", "split", "(", ")", ")", "except", "Exception", "as", "ex", ":", "import", "sys", "logger", ".", "error", "(", "\"Failed to co...
Creates an ApcorData record from the raw string format. Expected string format: ap_in ap_out ap_cor apcor_err
[ "Creates", "an", "ApcorData", "record", "from", "the", "raw", "string", "format", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/core.py#L95-L108
OSSOS/MOP
src/ossos/core/ossos/pipeline/mkpsf.py
run
def run(expnum, ccd, version, dry_run=False, prefix="", force=False): """Run the OSSOS jmpmakepsf script. """ message = storage.SUCCESS if storage.get_status(task, prefix, expnum, version=version, ccd=ccd) and not force: logging.info("{} completed successfully for {} {} {} {}".format(task, pre...
python
def run(expnum, ccd, version, dry_run=False, prefix="", force=False): """Run the OSSOS jmpmakepsf script. """ message = storage.SUCCESS if storage.get_status(task, prefix, expnum, version=version, ccd=ccd) and not force: logging.info("{} completed successfully for {} {} {} {}".format(task, pre...
[ "def", "run", "(", "expnum", ",", "ccd", ",", "version", ",", "dry_run", "=", "False", ",", "prefix", "=", "\"\"", ",", "force", "=", "False", ")", ":", "message", "=", "storage", ".", "SUCCESS", "if", "storage", ".", "get_status", "(", "task", ",", ...
Run the OSSOS jmpmakepsf script.
[ "Run", "the", "OSSOS", "jmpmakepsf", "script", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/pipeline/mkpsf.py#L37-L109
OSSOS/MOP
src/ossos/core/ossos/pipeline/mk_mopheader.py
run
def run(expnum, ccd, version, dry_run=False, prefix="", force=False, ignore_dependency=False): """Run the OSSOS mopheader script. """ message = storage.SUCCESS logging.info("Attempting to get status on header for {} {}".format(expnum, ccd)) if storage.get_status(task, prefix, expnum, version, ccd) ...
python
def run(expnum, ccd, version, dry_run=False, prefix="", force=False, ignore_dependency=False): """Run the OSSOS mopheader script. """ message = storage.SUCCESS logging.info("Attempting to get status on header for {} {}".format(expnum, ccd)) if storage.get_status(task, prefix, expnum, version, ccd) ...
[ "def", "run", "(", "expnum", ",", "ccd", ",", "version", ",", "dry_run", "=", "False", ",", "prefix", "=", "\"\"", ",", "force", "=", "False", ",", "ignore_dependency", "=", "False", ")", ":", "message", "=", "storage", ".", "SUCCESS", "logging", ".", ...
Run the OSSOS mopheader script.
[ "Run", "the", "OSSOS", "mopheader", "script", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/pipeline/mk_mopheader.py#L39-L100
OSSOS/MOP
src/jjk/preproc/ephemSearch.py
htmIndex
def htmIndex(ra,dec,htm_level=3): """Compute htm index of htm_level at position ra,dec""" import re if os.uname()[0] == "Linux": javabin = '/opt/java2/bin/java ' htm_level = htm_level verc_htm_cmd = javabin+'-classpath /usr/cadc/misc/htm/htmIndex.jar edu.jhu.htm.app.lookup %s %s %s' % (htm_level, ra...
python
def htmIndex(ra,dec,htm_level=3): """Compute htm index of htm_level at position ra,dec""" import re if os.uname()[0] == "Linux": javabin = '/opt/java2/bin/java ' htm_level = htm_level verc_htm_cmd = javabin+'-classpath /usr/cadc/misc/htm/htmIndex.jar edu.jhu.htm.app.lookup %s %s %s' % (htm_level, ra...
[ "def", "htmIndex", "(", "ra", ",", "dec", ",", "htm_level", "=", "3", ")", ":", "import", "re", "if", "os", ".", "uname", "(", ")", "[", "0", "]", "==", "\"Linux\"", ":", "javabin", "=", "'/opt/java2/bin/java '", "htm_level", "=", "htm_level", "verc_ht...
Compute htm index of htm_level at position ra,dec
[ "Compute", "htm", "index", "of", "htm_level", "at", "position", "ra", "dec" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/ephemSearch.py#L70-L82
OSSOS/MOP
src/jjk/preproc/ephemSearch.py
circTOcutout
def circTOcutout(wcs,ra,dec,rad): """Convert an RA/DEC/RADIUS to an imcopy cutout""" (x1,y1)=wcs.rd2xy((ra+rad/2.0,dec-rad/2.0)) (x2,y2)=wcs.rd2xy((ra-rad/2.0,dec+rad/2.0)) xl=min(x1,x2) xr=max(x1,x2) yl=min(y1,y2) yu=max(y1,y2) ### constrain the cutout to be inside the image x1...
python
def circTOcutout(wcs,ra,dec,rad): """Convert an RA/DEC/RADIUS to an imcopy cutout""" (x1,y1)=wcs.rd2xy((ra+rad/2.0,dec-rad/2.0)) (x2,y2)=wcs.rd2xy((ra-rad/2.0,dec+rad/2.0)) xl=min(x1,x2) xr=max(x1,x2) yl=min(y1,y2) yu=max(y1,y2) ### constrain the cutout to be inside the image x1...
[ "def", "circTOcutout", "(", "wcs", ",", "ra", ",", "dec", ",", "rad", ")", ":", "(", "x1", ",", "y1", ")", "=", "wcs", ".", "rd2xy", "(", "(", "ra", "+", "rad", "/", "2.0", ",", "dec", "-", "rad", "/", "2.0", ")", ")", "(", "x2", ",", "y2...
Convert an RA/DEC/RADIUS to an imcopy cutout
[ "Convert", "an", "RA", "/", "DEC", "/", "RADIUS", "to", "an", "imcopy", "cutout" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/ephemSearch.py#L89-L114
OSSOS/MOP
src/jjk/preproc/ephemSearch.py
predict
def predict(abg,date,obs=568): """Run GB's predict using an ABG file as input.""" import orbfit import RO.StringUtil (ra,dec,a,b,ang) = orbfit.predict(abg,date,obs) obj['RA']=ra obj['DEC']=dec obj['dRA']=a obj['dDEC']=b obj['dANG']=ang return obj
python
def predict(abg,date,obs=568): """Run GB's predict using an ABG file as input.""" import orbfit import RO.StringUtil (ra,dec,a,b,ang) = orbfit.predict(abg,date,obs) obj['RA']=ra obj['DEC']=dec obj['dRA']=a obj['dDEC']=b obj['dANG']=ang return obj
[ "def", "predict", "(", "abg", ",", "date", ",", "obs", "=", "568", ")", ":", "import", "orbfit", "import", "RO", ".", "StringUtil", "(", "ra", ",", "dec", ",", "a", ",", "b", ",", "ang", ")", "=", "orbfit", ".", "predict", "(", "abg", ",", "dat...
Run GB's predict using an ABG file as input.
[ "Run", "GB", "s", "predict", "using", "an", "ABG", "file", "as", "input", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/ephemSearch.py#L264-L274
OSSOS/MOP
src/ossos/core/ossos/util.py
config_logging
def config_logging(level): """ Configure the logging given the level desired """ logger = logging.getLogger('') logger.setLevel(level) if level < logging.DEBUG: log_format = "%(asctime)s %(message)s" else: log_format = "%(asctime)s %(module)s : %(lineno)d %(message)s" s...
python
def config_logging(level): """ Configure the logging given the level desired """ logger = logging.getLogger('') logger.setLevel(level) if level < logging.DEBUG: log_format = "%(asctime)s %(message)s" else: log_format = "%(asctime)s %(module)s : %(lineno)d %(message)s" s...
[ "def", "config_logging", "(", "level", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "''", ")", "logger", ".", "setLevel", "(", "level", ")", "if", "level", "<", "logging", ".", "DEBUG", ":", "log_format", "=", "\"%(asctime)s %(message)s\"", "...
Configure the logging given the level desired
[ "Configure", "the", "logging", "given", "the", "level", "desired" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/util.py#L27-L41
OSSOS/MOP
src/ossos/core/ossos/util.py
exec_prog
def exec_prog(args): """Run a subprocess, check for .OK and raise error if does not exist. args: list of arguments, for value is the command to execute. """ program_name = args[0] logging.info(" ".join(args)) output = subprocess.check_output(args, stderr=subprocess.STDOUT) if not os.acces...
python
def exec_prog(args): """Run a subprocess, check for .OK and raise error if does not exist. args: list of arguments, for value is the command to execute. """ program_name = args[0] logging.info(" ".join(args)) output = subprocess.check_output(args, stderr=subprocess.STDOUT) if not os.acces...
[ "def", "exec_prog", "(", "args", ")", ":", "program_name", "=", "args", "[", "0", "]", "logging", ".", "info", "(", "\" \"", ".", "join", "(", "args", ")", ")", "output", "=", "subprocess", ".", "check_output", "(", "args", ",", "stderr", "=", "subpr...
Run a subprocess, check for .OK and raise error if does not exist. args: list of arguments, for value is the command to execute.
[ "Run", "a", "subprocess", "check", "for", ".", "OK", "and", "raise", "error", "if", "does", "not", "exist", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/util.py#L58-L73
OSSOS/MOP
src/ossos/core/ossos/util.py
get_pixel_bounds_from_datasec_keyword
def get_pixel_bounds_from_datasec_keyword(datasec): """ Return the x/y pixel boundaries of the data section. :param datasec: str e.g. '[33:2080,1:4612]' :return: ((xmin,xmax),(ymin,ymax)) """ datasec = re.findall(r'(\d+)', datasec) x1 = min(int(datasec[0]), int(datasec[1])) x2 = max(int(...
python
def get_pixel_bounds_from_datasec_keyword(datasec): """ Return the x/y pixel boundaries of the data section. :param datasec: str e.g. '[33:2080,1:4612]' :return: ((xmin,xmax),(ymin,ymax)) """ datasec = re.findall(r'(\d+)', datasec) x1 = min(int(datasec[0]), int(datasec[1])) x2 = max(int(...
[ "def", "get_pixel_bounds_from_datasec_keyword", "(", "datasec", ")", ":", "datasec", "=", "re", ".", "findall", "(", "r'(\\d+)'", ",", "datasec", ")", "x1", "=", "min", "(", "int", "(", "datasec", "[", "0", "]", ")", ",", "int", "(", "datasec", "[", "1...
Return the x/y pixel boundaries of the data section. :param datasec: str e.g. '[33:2080,1:4612]' :return: ((xmin,xmax),(ymin,ymax))
[ "Return", "the", "x", "/", "y", "pixel", "boundaries", "of", "the", "data", "section", ".", ":", "param", "datasec", ":", "str", "e", ".", "g", ".", "[", "33", ":", "2080", "1", ":", "4612", "]", ":", "return", ":", "((", "xmin", "xmax", ")", "...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/util.py#L133-L145
OSSOS/MOP
src/ossos/core/ossos/util.py
match_lists
def match_lists(pos1, pos2, tolerance=MATCH_TOLERANCE, spherical=False): """ Given two sets of x/y positions match the lists, uniquely. :rtype : numpy.ma, numpy.ma :param pos1: list of x/y positions. :param pos2: list of x/y positions. :param tolerance: float distance, in pixels, to consider a ...
python
def match_lists(pos1, pos2, tolerance=MATCH_TOLERANCE, spherical=False): """ Given two sets of x/y positions match the lists, uniquely. :rtype : numpy.ma, numpy.ma :param pos1: list of x/y positions. :param pos2: list of x/y positions. :param tolerance: float distance, in pixels, to consider a ...
[ "def", "match_lists", "(", "pos1", ",", "pos2", ",", "tolerance", "=", "MATCH_TOLERANCE", ",", "spherical", "=", "False", ")", ":", "assert", "isinstance", "(", "pos1", ",", "numpy", ".", "ndarray", ")", "assert", "isinstance", "(", "pos2", ",", "numpy", ...
Given two sets of x/y positions match the lists, uniquely. :rtype : numpy.ma, numpy.ma :param pos1: list of x/y positions. :param pos2: list of x/y positions. :param tolerance: float distance, in pixels, to consider a match Algorithm: - Find all the members of pos2 that are within toleranc...
[ "Given", "two", "sets", "of", "x", "/", "y", "positions", "match", "the", "lists", "uniquely", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/util.py#L148-L224
OSSOS/MOP
src/ossos/core/ossos/util.py
VOFileHandler.stream
def stream(self): """ the stream to write the log content too. @return: """ if self._stream is None: self._stream = tempfile.NamedTemporaryFile(delete=False) try: self._stream.write(self.client.open(self.filename, view='data').read()) ...
python
def stream(self): """ the stream to write the log content too. @return: """ if self._stream is None: self._stream = tempfile.NamedTemporaryFile(delete=False) try: self._stream.write(self.client.open(self.filename, view='data').read()) ...
[ "def", "stream", "(", "self", ")", ":", "if", "self", ".", "_stream", "is", "None", ":", "self", ".", "_stream", "=", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", "False", ")", "try", ":", "self", ".", "_stream", ".", "write", "(", "sel...
the stream to write the log content too. @return:
[ "the", "stream", "to", "write", "the", "log", "content", "too", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/util.py#L87-L98
OSSOS/MOP
src/ossos/core/ossos/util.py
VOFileHandler.client
def client(self): """ Send back the client we were sent, or construct a default one. @rtype vospace.client """ if self._client is not None: return self._client self._client = vospace.client return self._client
python
def client(self): """ Send back the client we were sent, or construct a default one. @rtype vospace.client """ if self._client is not None: return self._client self._client = vospace.client return self._client
[ "def", "client", "(", "self", ")", ":", "if", "self", ".", "_client", "is", "not", "None", ":", "return", "self", ".", "_client", "self", ".", "_client", "=", "vospace", ".", "client", "return", "self", ".", "_client" ]
Send back the client we were sent, or construct a default one. @rtype vospace.client
[ "Send", "back", "the", "client", "we", "were", "sent", "or", "construct", "a", "default", "one", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/util.py#L101-L110
OSSOS/MOP
src/ossos/core/ossos/util.py
VOFileHandler.close
def close(self): """ Closes the stream. """ self.flush() try: if self.stream is not None: self.stream.flush() _name = self.stream.name self.stream.close() self.client.copy(_name, self.filename) ex...
python
def close(self): """ Closes the stream. """ self.flush() try: if self.stream is not None: self.stream.flush() _name = self.stream.name self.stream.close() self.client.copy(_name, self.filename) ex...
[ "def", "close", "(", "self", ")", ":", "self", ".", "flush", "(", ")", "try", ":", "if", "self", ".", "stream", "is", "not", "None", ":", "self", ".", "stream", ".", "flush", "(", ")", "_name", "=", "self", ".", "stream", ".", "name", "self", "...
Closes the stream.
[ "Closes", "the", "stream", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/util.py#L112-L125
OSSOS/MOP
src/ossos/core/ossos/util.py
TimeMPC.parse_string
def parse_string(self, timestr, subfmts): """Read time from a single string, using a set of possible formats.""" # Datetime components required for conversion to JD by ERFA, along # with the default values. components = ('year', 'mon', 'mday') defaults = (None, 1, 1, 0) #...
python
def parse_string(self, timestr, subfmts): """Read time from a single string, using a set of possible formats.""" # Datetime components required for conversion to JD by ERFA, along # with the default values. components = ('year', 'mon', 'mday') defaults = (None, 1, 1, 0) #...
[ "def", "parse_string", "(", "self", ",", "timestr", ",", "subfmts", ")", ":", "# Datetime components required for conversion to JD by ERFA, along", "# with the default values.", "components", "=", "(", "'year'", ",", "'mon'", ",", "'mday'", ")", "defaults", "=", "(", ...
Read time from a single string, using a set of possible formats.
[ "Read", "time", "from", "a", "single", "string", "using", "a", "set", "of", "possible", "formats", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/util.py#L258-L309
OSSOS/MOP
src/ossos/core/ossos/util.py
TimeMPC.str_kwargs
def str_kwargs(self): """ Generator that yields a dict of values corresponding to the calendar date and time for the internal JD values. """ iys, ims, ids, ihmsfs = d2dtf(self.scale.upper() .encode('utf8'), ...
python
def str_kwargs(self): """ Generator that yields a dict of values corresponding to the calendar date and time for the internal JD values. """ iys, ims, ids, ihmsfs = d2dtf(self.scale.upper() .encode('utf8'), ...
[ "def", "str_kwargs", "(", "self", ")", ":", "iys", ",", "ims", ",", "ids", ",", "ihmsfs", "=", "d2dtf", "(", "self", ".", "scale", ".", "upper", "(", ")", ".", "encode", "(", "'utf8'", ")", ",", "6", ",", "self", ".", "jd1", ",", "self", ".", ...
Generator that yields a dict of values corresponding to the calendar date and time for the internal JD values.
[ "Generator", "that", "yields", "a", "dict", "of", "values", "corresponding", "to", "the", "calendar", "date", "and", "time", "for", "the", "internal", "JD", "values", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/util.py#L311-L341
OSSOS/MOP
src/jjk/webCat/MOPdbaccess.py
_get_db_options
def _get_db_options(args): """Parse through a command line of arguments to over-ride the values in the users .dbrc file. If no user name is given then the environment variable $USERNAME is used. If $USERNAME is not defined then prompt for input. """ import optik, getpass,sys from optik impo...
python
def _get_db_options(args): """Parse through a command line of arguments to over-ride the values in the users .dbrc file. If no user name is given then the environment variable $USERNAME is used. If $USERNAME is not defined then prompt for input. """ import optik, getpass,sys from optik impo...
[ "def", "_get_db_options", "(", "args", ")", ":", "import", "optik", ",", "getpass", ",", "sys", "from", "optik", "import", "OptionParser", "parser", "=", "OptionParser", "(", ")", "parser", ".", "add_option", "(", "\"-d\"", ",", "\"--database\"", ",", "actio...
Parse through a command line of arguments to over-ride the values in the users .dbrc file. If no user name is given then the environment variable $USERNAME is used. If $USERNAME is not defined then prompt for input.
[ "Parse", "through", "a", "command", "line", "of", "arguments", "to", "over", "-", "ride", "the", "values", "in", "the", "users", ".", "dbrc", "file", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/webCat/MOPdbaccess.py#L33-L54
OSSOS/MOP
src/jjk/webCat/MOPdbaccess.py
_get_db_password
def _get_db_password(dbSystem,db,user): """Read through the users .dbrc file to get password for the db/user combination suplied. If no password is found then prompt for one """ import string, getpass, os dbrc = os.environ['HOME']+"/.dbrc" password={} if os.access(dbrc,os.R_OK): fd=...
python
def _get_db_password(dbSystem,db,user): """Read through the users .dbrc file to get password for the db/user combination suplied. If no password is found then prompt for one """ import string, getpass, os dbrc = os.environ['HOME']+"/.dbrc" password={} if os.access(dbrc,os.R_OK): fd=...
[ "def", "_get_db_password", "(", "dbSystem", ",", "db", ",", "user", ")", ":", "import", "string", ",", "getpass", ",", "os", "dbrc", "=", "os", ".", "environ", "[", "'HOME'", "]", "+", "\"/.dbrc\"", "password", "=", "{", "}", "if", "os", ".", "access...
Read through the users .dbrc file to get password for the db/user combination suplied. If no password is found then prompt for one
[ "Read", "through", "the", "users", ".", "dbrc", "file", "to", "get", "password", "for", "the", "db", "/", "user", "combination", "suplied", ".", "If", "no", "password", "is", "found", "then", "prompt", "for", "one" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/webCat/MOPdbaccess.py#L56-L71
OSSOS/MOP
src/jjk/webCat/MOPdbaccess.py
_get_db_connect
def _get_db_connect(dbSystem,db,user,password): """Create a connection to the database specified on the command line """ if dbSystem=='SYBASE': import Sybase try: dbh = Sybase.connect(dbSystem, user, password, ...
python
def _get_db_connect(dbSystem,db,user,password): """Create a connection to the database specified on the command line """ if dbSystem=='SYBASE': import Sybase try: dbh = Sybase.connect(dbSystem, user, password, ...
[ "def", "_get_db_connect", "(", "dbSystem", ",", "db", ",", "user", ",", "password", ")", ":", "if", "dbSystem", "==", "'SYBASE'", ":", "import", "Sybase", "try", ":", "dbh", "=", "Sybase", ".", "connect", "(", "dbSystem", ",", "user", ",", "password", ...
Create a connection to the database specified on the command line
[ "Create", "a", "connection", "to", "the", "database", "specified", "on", "the", "command", "line" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/webCat/MOPdbaccess.py#L73-L95
OSSOS/MOP
src/ossos/utils/search.py
caom2
def caom2(mpc_filename, search_date="2014 07 24.0"): """ builds a TSV file in the format of SSOIS by querying for possilbe observations in CADC/CAOM2. This is a fall back program, should only be useful when SSOIS is behind. """ columns = ('Image', 'Ext', 'X', ...
python
def caom2(mpc_filename, search_date="2014 07 24.0"): """ builds a TSV file in the format of SSOIS by querying for possilbe observations in CADC/CAOM2. This is a fall back program, should only be useful when SSOIS is behind. """ columns = ('Image', 'Ext', 'X', ...
[ "def", "caom2", "(", "mpc_filename", ",", "search_date", "=", "\"2014 07 24.0\"", ")", ":", "columns", "=", "(", "'Image'", ",", "'Ext'", ",", "'X'", ",", "'Y'", ",", "'MJD'", ",", "'Filter'", ",", "'Exptime'", ",", "'Object_RA'", ",", "'Object_Dec'", ",",...
builds a TSV file in the format of SSOIS by querying for possilbe observations in CADC/CAOM2. This is a fall back program, should only be useful when SSOIS is behind.
[ "builds", "a", "TSV", "file", "in", "the", "format", "of", "SSOIS", "by", "querying", "for", "possilbe", "observations", "in", "CADC", "/", "CAOM2", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/search.py#L10-L73
OSSOS/MOP
src/ossos/core/ossos/downloads/cutouts/downloader.py
ImageCutoutDownloader.download_cutout
def download_cutout(self, reading, focus=None, needs_apcor=False): """ Downloads a cutout of the FITS image for a given source reading. Args: reading: ossos.astrom.SourceReading The reading which will be the focus of the downloaded image. focus: tuple(int, int) ...
python
def download_cutout(self, reading, focus=None, needs_apcor=False): """ Downloads a cutout of the FITS image for a given source reading. Args: reading: ossos.astrom.SourceReading The reading which will be the focus of the downloaded image. focus: tuple(int, int) ...
[ "def", "download_cutout", "(", "self", ",", "reading", ",", "focus", "=", "None", ",", "needs_apcor", "=", "False", ")", ":", "logger", ".", "debug", "(", "\"Doing download_cutout with inputs: reading:{} focus:{} needs_apcor:{}\"", ".", "format", "(", "reading", ","...
Downloads a cutout of the FITS image for a given source reading. Args: reading: ossos.astrom.SourceReading The reading which will be the focus of the downloaded image. focus: tuple(int, int) The x, y coordinates that should be the focus of the downloaded ...
[ "Downloads", "a", "cutout", "of", "the", "FITS", "image", "for", "a", "given", "source", "reading", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/downloader.py#L46-L99
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.load_objects
def load_objects(self, directory_name=None): """Load the targets from a file. """ # for name in Neptune: # self.kbos[name] = Neptune[name] if directory_name is not None: # defaults to looking at .ast files only if directory_name == parameters.REAL_KB...
python
def load_objects(self, directory_name=None): """Load the targets from a file. """ # for name in Neptune: # self.kbos[name] = Neptune[name] if directory_name is not None: # defaults to looking at .ast files only if directory_name == parameters.REAL_KB...
[ "def", "load_objects", "(", "self", ",", "directory_name", "=", "None", ")", ":", "# for name in Neptune:", "# self.kbos[name] = Neptune[name]", "if", "directory_name", "is", "not", "None", ":", "# defaults to looking at .ast files only", "if", "directory_name", "==", ...
Load the targets from a file.
[ "Load", "the", "targets", "from", "a", "file", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L219-L240
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.p2c
def p2c(self, p=None): """convert from plot to canvas coordinates. See also c2p.""" if p is None: p = [0, 0] x = (p[0] - self.x1) * self.xscale + self.cx1 y = (p[1] - self.y1) * self.yscale + self.cy1 # logging.debug("p2c: ({},{}) -> ({},{})".format(p[0],p[1]...
python
def p2c(self, p=None): """convert from plot to canvas coordinates. See also c2p.""" if p is None: p = [0, 0] x = (p[0] - self.x1) * self.xscale + self.cx1 y = (p[1] - self.y1) * self.yscale + self.cy1 # logging.debug("p2c: ({},{}) -> ({},{})".format(p[0],p[1]...
[ "def", "p2c", "(", "self", ",", "p", "=", "None", ")", ":", "if", "p", "is", "None", ":", "p", "=", "[", "0", ",", "0", "]", "x", "=", "(", "p", "[", "0", "]", "-", "self", ".", "x1", ")", "*", "self", ".", "xscale", "+", "self", ".", ...
convert from plot to canvas coordinates. See also c2p.
[ "convert", "from", "plot", "to", "canvas", "coordinates", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L266-L276
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.p2s
def p2s(self, p=None): """Convert from plot to screen coordinates""" if not p: p = [0, 0] s = self.p2c(p) return self.c2s(s)
python
def p2s(self, p=None): """Convert from plot to screen coordinates""" if not p: p = [0, 0] s = self.p2c(p) return self.c2s(s)
[ "def", "p2s", "(", "self", ",", "p", "=", "None", ")", ":", "if", "not", "p", ":", "p", "=", "[", "0", ",", "0", "]", "s", "=", "self", ".", "p2c", "(", "p", ")", "return", "self", ".", "c2s", "(", "s", ")" ]
Convert from plot to screen coordinates
[ "Convert", "from", "plot", "to", "screen", "coordinates" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L278-L283
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.c2s
def c2s(self, p=None): """Convert from canvas to screen coordinates""" if not p: p = [0, 0] return p[0] - self.canvasx(self.cx1), p[1] - self.canvasy(self.cy2)
python
def c2s(self, p=None): """Convert from canvas to screen coordinates""" if not p: p = [0, 0] return p[0] - self.canvasx(self.cx1), p[1] - self.canvasy(self.cy2)
[ "def", "c2s", "(", "self", ",", "p", "=", "None", ")", ":", "if", "not", "p", ":", "p", "=", "[", "0", ",", "0", "]", "return", "p", "[", "0", "]", "-", "self", ".", "canvasx", "(", "self", ".", "cx1", ")", ",", "p", "[", "1", "]", "-",...
Convert from canvas to screen coordinates
[ "Convert", "from", "canvas", "to", "screen", "coordinates" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L285-L290
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.centre
def centre(self): """Return the RA/DEC of the center of the visible Canvas.""" return self.p2s(self.canvasx(self.width / 2.0)), self.p2s(self.canvasy(self.height / 2.0))
python
def centre(self): """Return the RA/DEC of the center of the visible Canvas.""" return self.p2s(self.canvasx(self.width / 2.0)), self.p2s(self.canvasy(self.height / 2.0))
[ "def", "centre", "(", "self", ")", ":", "return", "self", ".", "p2s", "(", "self", ".", "canvasx", "(", "self", ".", "width", "/", "2.0", ")", ")", ",", "self", ".", "p2s", "(", "self", ".", "canvasy", "(", "self", ".", "height", "/", "2.0", ")...
Return the RA/DEC of the center of the visible Canvas.
[ "Return", "the", "RA", "/", "DEC", "of", "the", "center", "of", "the", "visible", "Canvas", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L303-L305
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.coord_grid
def coord_grid(self): """Draw a grid of RA/DEC on Canvas.""" ra2 = math.pi * 2 ra1 = 0 dec1 = -1 * math.pi / 2.0 dec2 = math.pi / 2.0 dra = math.fabs((self.x2 - self.x1) / 4.0) ddec = math.fabs((self.y2 - self.y1) / 4.0) logging.debug("Drawing the grid."...
python
def coord_grid(self): """Draw a grid of RA/DEC on Canvas.""" ra2 = math.pi * 2 ra1 = 0 dec1 = -1 * math.pi / 2.0 dec2 = math.pi / 2.0 dra = math.fabs((self.x2 - self.x1) / 4.0) ddec = math.fabs((self.y2 - self.y1) / 4.0) logging.debug("Drawing the grid."...
[ "def", "coord_grid", "(", "self", ")", ":", "ra2", "=", "math", ".", "pi", "*", "2", "ra1", "=", "0", "dec1", "=", "-", "1", "*", "math", ".", "pi", "/", "2.0", "dec2", "=", "math", ".", "pi", "/", "2.0", "dra", "=", "math", ".", "fabs", "(...
Draw a grid of RA/DEC on Canvas.
[ "Draw", "a", "grid", "of", "RA", "/", "DEC", "on", "Canvas", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L327-L377
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.tickmark
def tickmark(self, x, y, size=10, orientation=90): """Draw a line of size and orientation at x,y""" (x1, y1) = self.p2c([x, y]) x2 = x1 + size * math.cos(math.radians(orientation)) y2 = y1 - size * math.sin(math.radians(orientation)) self.create_line(x1, y1, x2, y2)
python
def tickmark(self, x, y, size=10, orientation=90): """Draw a line of size and orientation at x,y""" (x1, y1) = self.p2c([x, y]) x2 = x1 + size * math.cos(math.radians(orientation)) y2 = y1 - size * math.sin(math.radians(orientation)) self.create_line(x1, y1, x2, y2)
[ "def", "tickmark", "(", "self", ",", "x", ",", "y", ",", "size", "=", "10", ",", "orientation", "=", "90", ")", ":", "(", "x1", ",", "y1", ")", "=", "self", ".", "p2c", "(", "[", "x", ",", "y", "]", ")", "x2", "=", "x1", "+", "size", "*",...
Draw a line of size and orientation at x,y
[ "Draw", "a", "line", "of", "size", "and", "orientation", "at", "x", "y" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L425-L431
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.limits
def limits(self, x1, x2, y1, y2): """Set the coordinate boundaries of plot""" self.x1 = x1 self.x2 = x2 self.y1 = y1 self.y2 = y2 self.xscale = (self.cx2 - self.cx1) / (self.x2 - self.x1) self.yscale = (self.cy2 - self.cy1) / (self.y2 - self.y1) # Determ...
python
def limits(self, x1, x2, y1, y2): """Set the coordinate boundaries of plot""" self.x1 = x1 self.x2 = x2 self.y1 = y1 self.y2 = y2 self.xscale = (self.cx2 - self.cx1) / (self.x2 - self.x1) self.yscale = (self.cy2 - self.cy1) / (self.y2 - self.y1) # Determ...
[ "def", "limits", "(", "self", ",", "x1", ",", "x2", ",", "y1", ",", "y2", ")", ":", "self", ".", "x1", "=", "x1", "self", ".", "x2", "=", "x2", "self", ".", "y1", "=", "y1", "self", ".", "y2", "=", "y2", "self", ".", "xscale", "=", "(", "...
Set the coordinate boundaries of plot
[ "Set", "the", "coordinate", "boundaries", "of", "plot" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L439-L454
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.reset
def reset(self): """Expand to the full scale""" sun = ephem.Sun() this_time = Time(self.date.get(), scale='utc') sun.compute(this_time.iso) self.sun = Coord((sun.ra, sun.dec)) self.doplot() self.plot_pointings()
python
def reset(self): """Expand to the full scale""" sun = ephem.Sun() this_time = Time(self.date.get(), scale='utc') sun.compute(this_time.iso) self.sun = Coord((sun.ra, sun.dec)) self.doplot() self.plot_pointings()
[ "def", "reset", "(", "self", ")", ":", "sun", "=", "ephem", ".", "Sun", "(", ")", "this_time", "=", "Time", "(", "self", ".", "date", ".", "get", "(", ")", ",", "scale", "=", "'utc'", ")", "sun", ".", "compute", "(", "this_time", ".", "iso", ")...
Expand to the full scale
[ "Expand", "to", "the", "full", "scale" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L456-L465
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.updateObj
def updateObj(self, event): """Put this object in the search box""" name = self.objList.get("active") self.SearchVar.set(name) self.object_info.set(str(self.kbos.get(name, ''))) return
python
def updateObj(self, event): """Put this object in the search box""" name = self.objList.get("active") self.SearchVar.set(name) self.object_info.set(str(self.kbos.get(name, ''))) return
[ "def", "updateObj", "(", "self", ",", "event", ")", ":", "name", "=", "self", ".", "objList", ".", "get", "(", "\"active\"", ")", "self", ".", "SearchVar", ".", "set", "(", "name", ")", "self", ".", "object_info", ".", "set", "(", "str", "(", "self...
Put this object in the search box
[ "Put", "this", "object", "in", "the", "search", "box" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L467-L473
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.relocate
def relocate(self): """Move to the position of self.SearchVar""" name = self.SearchVar.get() if self.kbos.has_key(name): kbo = self.kbos[name] assert isinstance(kbo, orbfit.Orbfit) this_time = Time(self.date.get(), scale='utc') try: ...
python
def relocate(self): """Move to the position of self.SearchVar""" name = self.SearchVar.get() if self.kbos.has_key(name): kbo = self.kbos[name] assert isinstance(kbo, orbfit.Orbfit) this_time = Time(self.date.get(), scale='utc') try: ...
[ "def", "relocate", "(", "self", ")", ":", "name", "=", "self", ".", "SearchVar", ".", "get", "(", ")", "if", "self", ".", "kbos", ".", "has_key", "(", "name", ")", ":", "kbo", "=", "self", ".", "kbos", "[", "name", "]", "assert", "isinstance", "(...
Move to the position of self.SearchVar
[ "Move", "to", "the", "position", "of", "self", ".", "SearchVar" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L475-L488
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.zoom
def zoom(self, event=None, scale=2.0): """Zoom in""" # compute the x,y of the center of the screen sx1 = (self.cx1 + self.cx2) / 2.0 sy1 = (self.cy1 + self.cy2) / 2.0 if not event is None: logging.debug("EVENT: {},{}".format(event.x, event.y)) sx1 = even...
python
def zoom(self, event=None, scale=2.0): """Zoom in""" # compute the x,y of the center of the screen sx1 = (self.cx1 + self.cx2) / 2.0 sy1 = (self.cy1 + self.cy2) / 2.0 if not event is None: logging.debug("EVENT: {},{}".format(event.x, event.y)) sx1 = even...
[ "def", "zoom", "(", "self", ",", "event", "=", "None", ",", "scale", "=", "2.0", ")", ":", "# compute the x,y of the center of the screen", "sx1", "=", "(", "self", ".", "cx1", "+", "self", ".", "cx2", ")", "/", "2.0", "sy1", "=", "(", "self", ".", "...
Zoom in
[ "Zoom", "in" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L514-L535
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.create_point
def create_point(self, xcen, ycen, size=10, color='red', fill=None): """Plot a circle of size at this x,y location""" if fill is None: fill = color (x, y) = self.p2c((xcen, ycen)) x1 = x - size x2 = x + size y1 = y - size y2 = y + size self.c...
python
def create_point(self, xcen, ycen, size=10, color='red', fill=None): """Plot a circle of size at this x,y location""" if fill is None: fill = color (x, y) = self.p2c((xcen, ycen)) x1 = x - size x2 = x + size y1 = y - size y2 = y + size self.c...
[ "def", "create_point", "(", "self", ",", "xcen", ",", "ycen", ",", "size", "=", "10", ",", "color", "=", "'red'", ",", "fill", "=", "None", ")", ":", "if", "fill", "is", "None", ":", "fill", "=", "color", "(", "x", ",", "y", ")", "=", "self", ...
Plot a circle of size at this x,y location
[ "Plot", "a", "circle", "of", "size", "at", "this", "x", "y", "location" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L559-L570
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.current_pointing
def current_pointing(self, index): """set the color of the currently selected pointing to 'blue'""" if self.current is not None: for item in self.pointings[self.current]['items']: self.itemconfigure(item, outline="black") self.current = index for item in self....
python
def current_pointing(self, index): """set the color of the currently selected pointing to 'blue'""" if self.current is not None: for item in self.pointings[self.current]['items']: self.itemconfigure(item, outline="black") self.current = index for item in self....
[ "def", "current_pointing", "(", "self", ",", "index", ")", ":", "if", "self", ".", "current", "is", "not", "None", ":", "for", "item", "in", "self", ".", "pointings", "[", "self", ".", "current", "]", "[", "'items'", "]", ":", "self", ".", "itemconfi...
set the color of the currently selected pointing to 'blue
[ "set", "the", "color", "of", "the", "currently", "selected", "pointing", "to", "blue" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L572-L579
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.delete_pointing
def delete_pointing(self, event): """Delete the currently active pointing""" if self.current is None: return for item in self.pointings[self.current]['items']: self.delete(item) self.delete(self.pointings[self.current]['label']['id']) del (self.pointings[...
python
def delete_pointing(self, event): """Delete the currently active pointing""" if self.current is None: return for item in self.pointings[self.current]['items']: self.delete(item) self.delete(self.pointings[self.current]['label']['id']) del (self.pointings[...
[ "def", "delete_pointing", "(", "self", ",", "event", ")", ":", "if", "self", ".", "current", "is", "None", ":", "return", "for", "item", "in", "self", ".", "pointings", "[", "self", ".", "current", "]", "[", "'items'", "]", ":", "self", ".", "delete"...
Delete the currently active pointing
[ "Delete", "the", "currently", "active", "pointing" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L581-L591
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.load_pointings
def load_pointings(self, filename=None): """Load some pointings""" filename = ( filename is None and tkFileDialog.askopenfilename() or filename) if filename is None: return f = storage.open_vos_or_local(filename) lines = f.readlines() f.close() poin...
python
def load_pointings(self, filename=None): """Load some pointings""" filename = ( filename is None and tkFileDialog.askopenfilename() or filename) if filename is None: return f = storage.open_vos_or_local(filename) lines = f.readlines() f.close() poin...
[ "def", "load_pointings", "(", "self", ",", "filename", "=", "None", ")", ":", "filename", "=", "(", "filename", "is", "None", "and", "tkFileDialog", ".", "askopenfilename", "(", ")", "or", "filename", ")", "if", "filename", "is", "None", ":", "return", "...
Load some pointings
[ "Load", "some", "pointings" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L593-L672
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.create_pointing
def create_pointing(self, event, label_text=None): """Plot the sky coverage of pointing at event.x,event.y on the canvas. """ x = self.canvasx(event.x) y = self.canvasy(event.y) (ra, dec) = self.c2p((x, y)) this_camera = Camera(ra=float(ra) * units.radian, dec=float(dec)...
python
def create_pointing(self, event, label_text=None): """Plot the sky coverage of pointing at event.x,event.y on the canvas. """ x = self.canvasx(event.x) y = self.canvasy(event.y) (ra, dec) = self.c2p((x, y)) this_camera = Camera(ra=float(ra) * units.radian, dec=float(dec)...
[ "def", "create_pointing", "(", "self", ",", "event", ",", "label_text", "=", "None", ")", ":", "x", "=", "self", ".", "canvasx", "(", "event", ".", "x", ")", "y", "=", "self", ".", "canvasy", "(", "event", ".", "y", ")", "(", "ra", ",", "dec", ...
Plot the sky coverage of pointing at event.x,event.y on the canvas.
[ "Plot", "the", "sky", "coverage", "of", "pointing", "at", "event", ".", "x", "event", ".", "y", "on", "the", "canvas", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L715-L746
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.plot_pointings
def plot_pointings(self, pointings=None): """Plot pointings on canavs""" if pointings is None: pointings = self.pointings i = 0 for pointing in pointings: items = [] i = i + 1 label = {} label['text'] = pointing['label']['text...
python
def plot_pointings(self, pointings=None): """Plot pointings on canavs""" if pointings is None: pointings = self.pointings i = 0 for pointing in pointings: items = [] i = i + 1 label = {} label['text'] = pointing['label']['text...
[ "def", "plot_pointings", "(", "self", ",", "pointings", "=", "None", ")", ":", "if", "pointings", "is", "None", ":", "pointings", "=", "self", ".", "pointings", "i", "=", "0", "for", "pointing", "in", "pointings", ":", "items", "=", "[", "]", "i", "=...
Plot pointings on canavs
[ "Plot", "pointings", "on", "canavs" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L748-L774
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.set_pointing_label
def set_pointing_label(self): """Let the label of the current pointing to the value in the plabel box""" current = self.current pointing = self.pointings[current] self.delete_pointing(None) pointing["label"]['text'] = self.plabel.get() self.pointings.append(pointing) ...
python
def set_pointing_label(self): """Let the label of the current pointing to the value in the plabel box""" current = self.current pointing = self.pointings[current] self.delete_pointing(None) pointing["label"]['text'] = self.plabel.get() self.pointings.append(pointing) ...
[ "def", "set_pointing_label", "(", "self", ")", ":", "current", "=", "self", ".", "current", "pointing", "=", "self", ".", "pointings", "[", "current", "]", "self", ".", "delete_pointing", "(", "None", ")", "pointing", "[", "\"label\"", "]", "[", "'text'", ...
Let the label of the current pointing to the value in the plabel box
[ "Let", "the", "label", "of", "the", "current", "pointing", "to", "the", "value", "in", "the", "plabel", "box" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L776-L785
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.move_pointing
def move_pointing(self, event): """Grab nearest pointing to event.x,event.y and with cursor""" (ra, dec) = self.c2p((self.canvasx(event.x), self.canvasy(event.y))) closest = None this_pointing = None this_index = -1 index = -1 for po...
python
def move_pointing(self, event): """Grab nearest pointing to event.x,event.y and with cursor""" (ra, dec) = self.c2p((self.canvasx(event.x), self.canvasy(event.y))) closest = None this_pointing = None this_index = -1 index = -1 for po...
[ "def", "move_pointing", "(", "self", ",", "event", ")", ":", "(", "ra", ",", "dec", ")", "=", "self", ".", "c2p", "(", "(", "self", ".", "canvasx", "(", "event", ".", "x", ")", ",", "self", ".", "canvasy", "(", "event", ".", "y", ")", ")", ")...
Grab nearest pointing to event.x,event.y and with cursor
[ "Grab", "nearest", "pointing", "to", "event", ".", "x", "event", ".", "y", "and", "with", "cursor" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L787-L823