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
OSSOS/MOP
src/ossos/core/ossos/storage.py
reset_datasec
def reset_datasec(cutout, datasec, naxis1, naxis2): """ reset the datasec to account for a possible cutout. @param cutout: @param datasec: @param naxis1: size of the original image in the 'x' direction @param naxis2: size of the oringal image in the 'y' direction @return: """ if cu...
python
def reset_datasec(cutout, datasec, naxis1, naxis2): """ reset the datasec to account for a possible cutout. @param cutout: @param datasec: @param naxis1: size of the original image in the 'x' direction @param naxis2: size of the oringal image in the 'y' direction @return: """ if cu...
[ "def", "reset_datasec", "(", "cutout", ",", "datasec", ",", "naxis1", ",", "naxis2", ")", ":", "if", "cutout", "is", "None", "or", "cutout", "==", "\"[*,*]\"", ":", "return", "datasec", "try", ":", "datasec", "=", "datasec_to_list", "(", "datasec", ")", ...
reset the datasec to account for a possible cutout. @param cutout: @param datasec: @param naxis1: size of the original image in the 'x' direction @param naxis2: size of the oringal image in the 'y' direction @return:
[ "reset", "the", "datasec", "to", "account", "for", "a", "possible", "cutout", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L956-L1017
OSSOS/MOP
src/ossos/core/ossos/storage.py
get_hdu
def get_hdu(uri, cutout=None): """Get a at the given uri from VOSpace, possibly doing a cutout. If the cutout is flips the image then we also must flip the datasec keywords. Also, we must offset the datasec to reflect the cutout area being used. @param uri: The URI in VOSpace of the image to HDU to r...
python
def get_hdu(uri, cutout=None): """Get a at the given uri from VOSpace, possibly doing a cutout. If the cutout is flips the image then we also must flip the datasec keywords. Also, we must offset the datasec to reflect the cutout area being used. @param uri: The URI in VOSpace of the image to HDU to r...
[ "def", "get_hdu", "(", "uri", ",", "cutout", "=", "None", ")", ":", "try", ":", "# the filename is based on the Simple FITS images file.", "filename", "=", "os", ".", "path", ".", "basename", "(", "uri", ")", "if", "os", ".", "access", "(", "filename", ",", ...
Get a at the given uri from VOSpace, possibly doing a cutout. If the cutout is flips the image then we also must flip the datasec keywords. Also, we must offset the datasec to reflect the cutout area being used. @param uri: The URI in VOSpace of the image to HDU to retrieve. @param cutout: A CADC dat...
[ "Get", "a", "at", "the", "given", "uri", "from", "VOSpace", "possibly", "doing", "a", "cutout", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1020-L1066
OSSOS/MOP
src/ossos/core/ossos/storage.py
get_fwhm_tag
def get_fwhm_tag(expnum, ccd, prefix=None, version='p'): """ Get the FWHM from the VOSpace annotation. @param expnum: @param ccd: @param prefix: @param version: @return: """ uri = get_uri(expnum, ccd, version, ext='fwhm', prefix=prefix) if uri not in fwhm: key = "fwhm_{:...
python
def get_fwhm_tag(expnum, ccd, prefix=None, version='p'): """ Get the FWHM from the VOSpace annotation. @param expnum: @param ccd: @param prefix: @param version: @return: """ uri = get_uri(expnum, ccd, version, ext='fwhm', prefix=prefix) if uri not in fwhm: key = "fwhm_{:...
[ "def", "get_fwhm_tag", "(", "expnum", ",", "ccd", ",", "prefix", "=", "None", ",", "version", "=", "'p'", ")", ":", "uri", "=", "get_uri", "(", "expnum", ",", "ccd", ",", "version", ",", "ext", "=", "'fwhm'", ",", "prefix", "=", "prefix", ")", "if"...
Get the FWHM from the VOSpace annotation. @param expnum: @param ccd: @param prefix: @param version: @return:
[ "Get", "the", "FWHM", "from", "the", "VOSpace", "annotation", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1093-L1107
OSSOS/MOP
src/ossos/core/ossos/storage.py
get_fwhm
def get_fwhm(expnum, ccd, prefix=None, version='p'): """Get the FWHM computed for the given expnum/ccd combo. @param expnum: @param ccd: @param prefix: @param version: @return: """ uri = get_uri(expnum, ccd, version, ext='fwhm', prefix=prefix) filename = os.path.basename(uri) ...
python
def get_fwhm(expnum, ccd, prefix=None, version='p'): """Get the FWHM computed for the given expnum/ccd combo. @param expnum: @param ccd: @param prefix: @param version: @return: """ uri = get_uri(expnum, ccd, version, ext='fwhm', prefix=prefix) filename = os.path.basename(uri) ...
[ "def", "get_fwhm", "(", "expnum", ",", "ccd", ",", "prefix", "=", "None", ",", "version", "=", "'p'", ")", ":", "uri", "=", "get_uri", "(", "expnum", ",", "ccd", ",", "version", ",", "ext", "=", "'fwhm'", ",", "prefix", "=", "prefix", ")", "filenam...
Get the FWHM computed for the given expnum/ccd combo. @param expnum: @param ccd: @param prefix: @param version: @return:
[ "Get", "the", "FWHM", "computed", "for", "the", "given", "expnum", "/", "ccd", "combo", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1110-L1140
OSSOS/MOP
src/ossos/core/ossos/storage.py
_get_zeropoint
def _get_zeropoint(expnum, ccd, prefix=None, version='p'): """ Retrieve the zeropoint stored in the tags associated with this image. @param expnum: Exposure number @param ccd: ccd of the exposure @param prefix: possible prefix (such as 'fk') @param version: which version: p, s, or o ? @retur...
python
def _get_zeropoint(expnum, ccd, prefix=None, version='p'): """ Retrieve the zeropoint stored in the tags associated with this image. @param expnum: Exposure number @param ccd: ccd of the exposure @param prefix: possible prefix (such as 'fk') @param version: which version: p, s, or o ? @retur...
[ "def", "_get_zeropoint", "(", "expnum", ",", "ccd", ",", "prefix", "=", "None", ",", "version", "=", "'p'", ")", ":", "if", "prefix", "is", "not", "None", ":", "DeprecationWarning", "(", "\"Prefix is no longer used here as the 'fk' and 's' have the same zeropoint.\"",...
Retrieve the zeropoint stored in the tags associated with this image. @param expnum: Exposure number @param ccd: ccd of the exposure @param prefix: possible prefix (such as 'fk') @param version: which version: p, s, or o ? @return: zeropoint
[ "Retrieve", "the", "zeropoint", "stored", "in", "the", "tags", "associated", "with", "this", "image", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1143-L1156
OSSOS/MOP
src/ossos/core/ossos/storage.py
get_zeropoint
def get_zeropoint(expnum, ccd, prefix=None, version='p'): """Get the zeropoint for this exposure using the zeropoint.used file created during source planting.. This command expects that there is a file called #######p##.zeropoint.used which contains the zeropoint. @param expnum: exposure to get zeropoint ...
python
def get_zeropoint(expnum, ccd, prefix=None, version='p'): """Get the zeropoint for this exposure using the zeropoint.used file created during source planting.. This command expects that there is a file called #######p##.zeropoint.used which contains the zeropoint. @param expnum: exposure to get zeropoint ...
[ "def", "get_zeropoint", "(", "expnum", ",", "ccd", ",", "prefix", "=", "None", ",", "version", "=", "'p'", ")", ":", "uri", "=", "get_uri", "(", "expnum", ",", "ccd", ",", "version", ",", "ext", "=", "'zeropoint.used'", ",", "prefix", "=", "prefix", ...
Get the zeropoint for this exposure using the zeropoint.used file created during source planting.. This command expects that there is a file called #######p##.zeropoint.used which contains the zeropoint. @param expnum: exposure to get zeropoint of @param ccd: which ccd (extension - 1) to get zp @param...
[ "Get", "the", "zeropoint", "for", "this", "exposure", "using", "the", "zeropoint", ".", "used", "file", "created", "during", "source", "planting", ".." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1159-L1183
OSSOS/MOP
src/ossos/core/ossos/storage.py
mkdir
def mkdir(dirname): """make directory tree in vospace. @param dirname: name of the directory to make """ dir_list = [] while not client.isdir(dirname): dir_list.append(dirname) dirname = os.path.dirname(dirname) while len(dir_list) > 0: logging.info("Creating directory:...
python
def mkdir(dirname): """make directory tree in vospace. @param dirname: name of the directory to make """ dir_list = [] while not client.isdir(dirname): dir_list.append(dirname) dirname = os.path.dirname(dirname) while len(dir_list) > 0: logging.info("Creating directory:...
[ "def", "mkdir", "(", "dirname", ")", ":", "dir_list", "=", "[", "]", "while", "not", "client", ".", "isdir", "(", "dirname", ")", ":", "dir_list", ".", "append", "(", "dirname", ")", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "dirname", ...
make directory tree in vospace. @param dirname: name of the directory to make
[ "make", "directory", "tree", "in", "vospace", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1186-L1204
OSSOS/MOP
src/ossos/core/ossos/storage.py
vofile
def vofile(filename, **kwargs): """ Open and return a handle on a VOSpace data connection @param filename: @param kwargs: @return: """ basename = os.path.basename(filename) if os.access(basename, os.R_OK): return open(basename, 'r') kwargs['view'] = kwargs.get('view', 'data')...
python
def vofile(filename, **kwargs): """ Open and return a handle on a VOSpace data connection @param filename: @param kwargs: @return: """ basename = os.path.basename(filename) if os.access(basename, os.R_OK): return open(basename, 'r') kwargs['view'] = kwargs.get('view', 'data')...
[ "def", "vofile", "(", "filename", ",", "*", "*", "kwargs", ")", ":", "basename", "=", "os", ".", "path", ".", "basename", "(", "filename", ")", "if", "os", ".", "access", "(", "basename", ",", "os", ".", "R_OK", ")", ":", "return", "open", "(", "...
Open and return a handle on a VOSpace data connection @param filename: @param kwargs: @return:
[ "Open", "and", "return", "a", "handle", "on", "a", "VOSpace", "data", "connection" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1207-L1218
OSSOS/MOP
src/ossos/core/ossos/storage.py
open_vos_or_local
def open_vos_or_local(path, mode="rb"): """ Opens a file which can either be in VOSpace or the local filesystem. @param path: @param mode: @return: """ filename = os.path.basename(path) if os.access(filename, os.F_OK): return open(filename, mode) if path.startswith("vos:"): ...
python
def open_vos_or_local(path, mode="rb"): """ Opens a file which can either be in VOSpace or the local filesystem. @param path: @param mode: @return: """ filename = os.path.basename(path) if os.access(filename, os.F_OK): return open(filename, mode) if path.startswith("vos:"): ...
[ "def", "open_vos_or_local", "(", "path", ",", "mode", "=", "\"rb\"", ")", ":", "filename", "=", "os", ".", "path", ".", "basename", "(", "path", ")", "if", "os", ".", "access", "(", "filename", ",", "os", ".", "F_OK", ")", ":", "return", "open", "(...
Opens a file which can either be in VOSpace or the local filesystem. @param path: @param mode: @return:
[ "Opens", "a", "file", "which", "can", "either", "be", "in", "VOSpace", "or", "the", "local", "filesystem", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1221-L1245
OSSOS/MOP
src/ossos/core/ossos/storage.py
copy
def copy(source, dest): """ use the vospace service to get a file. @param source: @param dest: @return: """ logger.info("copying {} -> {}".format(source, dest)) return client.copy(source, dest)
python
def copy(source, dest): """ use the vospace service to get a file. @param source: @param dest: @return: """ logger.info("copying {} -> {}".format(source, dest)) return client.copy(source, dest)
[ "def", "copy", "(", "source", ",", "dest", ")", ":", "logger", ".", "info", "(", "\"copying {} -> {}\"", ".", "format", "(", "source", ",", "dest", ")", ")", "return", "client", ".", "copy", "(", "source", ",", "dest", ")" ]
use the vospace service to get a file. @param source: @param dest: @return:
[ "use", "the", "vospace", "service", "to", "get", "a", "file", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1248-L1258
OSSOS/MOP
src/ossos/core/ossos/storage.py
vlink
def vlink(s_expnum, s_ccd, s_version, s_ext, l_expnum, l_ccd, l_version, l_ext, s_prefix=None, l_prefix=None): """make a link between two version of a file. @param s_expnum: @param s_ccd: @param s_version: @param s_ext: @param l_expnum: @param l_ccd: @param l_version: @par...
python
def vlink(s_expnum, s_ccd, s_version, s_ext, l_expnum, l_ccd, l_version, l_ext, s_prefix=None, l_prefix=None): """make a link between two version of a file. @param s_expnum: @param s_ccd: @param s_version: @param s_ext: @param l_expnum: @param l_ccd: @param l_version: @par...
[ "def", "vlink", "(", "s_expnum", ",", "s_ccd", ",", "s_version", ",", "s_ext", ",", "l_expnum", ",", "l_ccd", ",", "l_version", ",", "l_ext", ",", "s_prefix", "=", "None", ",", "l_prefix", "=", "None", ")", ":", "source_uri", "=", "get_uri", "(", "s_ex...
make a link between two version of a file. @param s_expnum: @param s_ccd: @param s_version: @param s_ext: @param l_expnum: @param l_ccd: @param l_version: @param l_ext: @param s_prefix: @param l_prefix: @return:
[ "make", "a", "link", "between", "two", "version", "of", "a", "file", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1261-L1280
OSSOS/MOP
src/ossos/core/ossos/storage.py
delete
def delete(expnum, ccd, version, ext, prefix=None): """ delete a file, no error on does not exist @param expnum: @param ccd: @param version: @param ext: @param prefix: @return: """ uri = get_uri(expnum, ccd=ccd, version=version, ext=ext, prefix=prefix) remove(uri)
python
def delete(expnum, ccd, version, ext, prefix=None): """ delete a file, no error on does not exist @param expnum: @param ccd: @param version: @param ext: @param prefix: @return: """ uri = get_uri(expnum, ccd=ccd, version=version, ext=ext, prefix=prefix) remove(uri)
[ "def", "delete", "(", "expnum", ",", "ccd", ",", "version", ",", "ext", ",", "prefix", "=", "None", ")", ":", "uri", "=", "get_uri", "(", "expnum", ",", "ccd", "=", "ccd", ",", "version", "=", "version", ",", "ext", "=", "ext", ",", "prefix", "="...
delete a file, no error on does not exist @param expnum: @param ccd: @param version: @param ext: @param prefix: @return:
[ "delete", "a", "file", "no", "error", "on", "does", "not", "exist" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1290-L1302
OSSOS/MOP
src/ossos/core/ossos/storage.py
my_glob
def my_glob(pattern): """ get a listing matching pattern @param pattern: @return: """ result = [] if pattern[0:4] == 'vos:': dirname = os.path.dirname(pattern) flist = listdir(dirname) for fname in flist: fname = '/'.join([dirname, fname]) if ...
python
def my_glob(pattern): """ get a listing matching pattern @param pattern: @return: """ result = [] if pattern[0:4] == 'vos:': dirname = os.path.dirname(pattern) flist = listdir(dirname) for fname in flist: fname = '/'.join([dirname, fname]) if ...
[ "def", "my_glob", "(", "pattern", ")", ":", "result", "=", "[", "]", "if", "pattern", "[", "0", ":", "4", "]", "==", "'vos:'", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "pattern", ")", "flist", "=", "listdir", "(", "dirname", "...
get a listing matching pattern @param pattern: @return:
[ "get", "a", "listing", "matching", "pattern" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1305-L1322
OSSOS/MOP
src/ossos/core/ossos/storage.py
has_property
def has_property(node_uri, property_name, ossos_base=True): """ Checks if a node in VOSpace has the specified property. @param node_uri: @param property_name: @param ossos_base: @return: """ if get_property(node_uri, property_name, ossos_base) is None: return False else: ...
python
def has_property(node_uri, property_name, ossos_base=True): """ Checks if a node in VOSpace has the specified property. @param node_uri: @param property_name: @param ossos_base: @return: """ if get_property(node_uri, property_name, ossos_base) is None: return False else: ...
[ "def", "has_property", "(", "node_uri", ",", "property_name", ",", "ossos_base", "=", "True", ")", ":", "if", "get_property", "(", "node_uri", ",", "property_name", ",", "ossos_base", ")", "is", "None", ":", "return", "False", "else", ":", "return", "True" ]
Checks if a node in VOSpace has the specified property. @param node_uri: @param property_name: @param ossos_base: @return:
[ "Checks", "if", "a", "node", "in", "VOSpace", "has", "the", "specified", "property", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1351-L1363
OSSOS/MOP
src/ossos/core/ossos/storage.py
get_property
def get_property(node_uri, property_name, ossos_base=True): """ Retrieves the value associated with a property on a node in VOSpace. @param node_uri: @param property_name: @param ossos_base: @return: """ # Must use force or we could have a cached copy of the node from before # prope...
python
def get_property(node_uri, property_name, ossos_base=True): """ Retrieves the value associated with a property on a node in VOSpace. @param node_uri: @param property_name: @param ossos_base: @return: """ # Must use force or we could have a cached copy of the node from before # prope...
[ "def", "get_property", "(", "node_uri", ",", "property_name", ",", "ossos_base", "=", "True", ")", ":", "# Must use force or we could have a cached copy of the node from before", "# properties of interest were set/updated.", "node", "=", "client", ".", "get_node", "(", "node_...
Retrieves the value associated with a property on a node in VOSpace. @param node_uri: @param property_name: @param ossos_base: @return:
[ "Retrieves", "the", "value", "associated", "with", "a", "property", "on", "a", "node", "in", "VOSpace", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1366-L1383
OSSOS/MOP
src/ossos/core/ossos/storage.py
set_property
def set_property(node_uri, property_name, property_value, ossos_base=True): """ Sets the value of a property on a node in VOSpace. If the property already has a value then it is first cleared and then set. @param node_uri: @param property_name: @param property_value: @param ossos_base: ...
python
def set_property(node_uri, property_name, property_value, ossos_base=True): """ Sets the value of a property on a node in VOSpace. If the property already has a value then it is first cleared and then set. @param node_uri: @param property_name: @param property_value: @param ossos_base: ...
[ "def", "set_property", "(", "node_uri", ",", "property_name", ",", "property_value", ",", "ossos_base", "=", "True", ")", ":", "node", "=", "client", ".", "get_node", "(", "node_uri", ")", "property_uri", "=", "tag_uri", "(", "property_name", ")", "if", "oss...
Sets the value of a property on a node in VOSpace. If the property already has a value then it is first cleared and then set. @param node_uri: @param property_name: @param property_value: @param ossos_base: @return:
[ "Sets", "the", "value", "of", "a", "property", "on", "a", "node", "in", "VOSpace", ".", "If", "the", "property", "already", "has", "a", "value", "then", "it", "is", "first", "cleared", "and", "then", "set", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1386-L1406
OSSOS/MOP
src/ossos/core/ossos/storage.py
build_counter_tag
def build_counter_tag(epoch_field, dry_run=False): """ Builds the tag for the counter of a given epoch/field, without the OSSOS base. @param epoch_field: @param dry_run: @return: """ logger.info("Epoch Field: {}, OBJECT_COUNT {}".format(str(epoch_field), str(OBJECT_COUNT))) tag = epoch_...
python
def build_counter_tag(epoch_field, dry_run=False): """ Builds the tag for the counter of a given epoch/field, without the OSSOS base. @param epoch_field: @param dry_run: @return: """ logger.info("Epoch Field: {}, OBJECT_COUNT {}".format(str(epoch_field), str(OBJECT_COUNT))) tag = epoch_...
[ "def", "build_counter_tag", "(", "epoch_field", ",", "dry_run", "=", "False", ")", ":", "logger", ".", "info", "(", "\"Epoch Field: {}, OBJECT_COUNT {}\"", ".", "format", "(", "str", "(", "epoch_field", ")", ",", "str", "(", "OBJECT_COUNT", ")", ")", ")", "t...
Builds the tag for the counter of a given epoch/field, without the OSSOS base. @param epoch_field: @param dry_run: @return:
[ "Builds", "the", "tag", "for", "the", "counter", "of", "a", "given", "epoch", "/", "field", "without", "the", "OSSOS", "base", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1409-L1423
OSSOS/MOP
src/ossos/core/ossos/storage.py
read_object_counter
def read_object_counter(node_uri, epoch_field, dry_run=False): """ Reads the object counter for the given epoch/field on the specified node. @param node_uri: @param epoch_field: @param dry_run: @return: the current object count. """ return get_property(node_uri, build_counter_tag(epoch_...
python
def read_object_counter(node_uri, epoch_field, dry_run=False): """ Reads the object counter for the given epoch/field on the specified node. @param node_uri: @param epoch_field: @param dry_run: @return: the current object count. """ return get_property(node_uri, build_counter_tag(epoch_...
[ "def", "read_object_counter", "(", "node_uri", ",", "epoch_field", ",", "dry_run", "=", "False", ")", ":", "return", "get_property", "(", "node_uri", ",", "build_counter_tag", "(", "epoch_field", ",", "dry_run", ")", ",", "ossos_base", "=", "True", ")" ]
Reads the object counter for the given epoch/field on the specified node. @param node_uri: @param epoch_field: @param dry_run: @return: the current object count.
[ "Reads", "the", "object", "counter", "for", "the", "given", "epoch", "/", "field", "on", "the", "specified", "node", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1426-L1436
OSSOS/MOP
src/ossos/core/ossos/storage.py
increment_object_counter
def increment_object_counter(node_uri, epoch_field, dry_run=False): """ Increment the object counter used to create unique object identifiers. @param node_uri: @param epoch_field: @param dry_run: @return: The object count AFTER incrementing. """ current_count = read_object_counter(node...
python
def increment_object_counter(node_uri, epoch_field, dry_run=False): """ Increment the object counter used to create unique object identifiers. @param node_uri: @param epoch_field: @param dry_run: @return: The object count AFTER incrementing. """ current_count = read_object_counter(node...
[ "def", "increment_object_counter", "(", "node_uri", ",", "epoch_field", ",", "dry_run", "=", "False", ")", ":", "current_count", "=", "read_object_counter", "(", "node_uri", ",", "epoch_field", ",", "dry_run", "=", "dry_run", ")", "if", "current_count", "is", "N...
Increment the object counter used to create unique object identifiers. @param node_uri: @param epoch_field: @param dry_run: @return: The object count AFTER incrementing.
[ "Increment", "the", "object", "counter", "used", "to", "create", "unique", "object", "identifiers", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1439-L1462
OSSOS/MOP
src/ossos/core/ossos/storage.py
get_mopheader
def get_mopheader(expnum, ccd, version='p', prefix=None): """ Retrieve the mopheader, either from cache or from vospace @param expnum: @param ccd: @param version: @param prefix: @return: Header """ prefix = prefix is None and "" or prefix mopheader_uri = dbimages_uri(expnum=expn...
python
def get_mopheader(expnum, ccd, version='p', prefix=None): """ Retrieve the mopheader, either from cache or from vospace @param expnum: @param ccd: @param version: @param prefix: @return: Header """ prefix = prefix is None and "" or prefix mopheader_uri = dbimages_uri(expnum=expn...
[ "def", "get_mopheader", "(", "expnum", ",", "ccd", ",", "version", "=", "'p'", ",", "prefix", "=", "None", ")", ":", "prefix", "=", "prefix", "is", "None", "and", "\"\"", "or", "prefix", "mopheader_uri", "=", "dbimages_uri", "(", "expnum", "=", "expnum",...
Retrieve the mopheader, either from cache or from vospace @param expnum: @param ccd: @param version: @param prefix: @return: Header
[ "Retrieve", "the", "mopheader", "either", "from", "cache", "or", "from", "vospace" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1465-L1512
OSSOS/MOP
src/ossos/core/ossos/storage.py
_get_sghead
def _get_sghead(expnum): """ Use the data web service to retrieve the stephen's astrometric header. :param expnum: CFHT exposure number you want the header for :rtype : list of astropy.io.fits.Header objects. """ version = 'p' key = "{}{}".format(expnum, version) if key in sgheaders: ...
python
def _get_sghead(expnum): """ Use the data web service to retrieve the stephen's astrometric header. :param expnum: CFHT exposure number you want the header for :rtype : list of astropy.io.fits.Header objects. """ version = 'p' key = "{}{}".format(expnum, version) if key in sgheaders: ...
[ "def", "_get_sghead", "(", "expnum", ")", ":", "version", "=", "'p'", "key", "=", "\"{}{}\"", ".", "format", "(", "expnum", ",", "version", ")", "if", "key", "in", "sgheaders", ":", "return", "sgheaders", "[", "key", "]", "url", "=", "\"http://www.cadc-c...
Use the data web service to retrieve the stephen's astrometric header. :param expnum: CFHT exposure number you want the header for :rtype : list of astropy.io.fits.Header objects.
[ "Use", "the", "data", "web", "service", "to", "retrieve", "the", "stephen", "s", "astrometric", "header", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1515-L1543
OSSOS/MOP
src/ossos/core/ossos/storage.py
get_header
def get_header(uri): """ Pull a FITS header from observation at the given URI @param uri: The URI of the image in VOSpace. """ if uri not in astheaders: astheaders[uri] = get_hdu(uri, cutout="[1:1,1:1]")[0].header return astheaders[uri]
python
def get_header(uri): """ Pull a FITS header from observation at the given URI @param uri: The URI of the image in VOSpace. """ if uri not in astheaders: astheaders[uri] = get_hdu(uri, cutout="[1:1,1:1]")[0].header return astheaders[uri]
[ "def", "get_header", "(", "uri", ")", ":", "if", "uri", "not", "in", "astheaders", ":", "astheaders", "[", "uri", "]", "=", "get_hdu", "(", "uri", ",", "cutout", "=", "\"[1:1,1:1]\"", ")", "[", "0", "]", ".", "header", "return", "astheaders", "[", "u...
Pull a FITS header from observation at the given URI @param uri: The URI of the image in VOSpace.
[ "Pull", "a", "FITS", "header", "from", "observation", "at", "the", "given", "URI" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1546-L1554
OSSOS/MOP
src/ossos/core/ossos/storage.py
get_astheader
def get_astheader(expnum, ccd, version='p', prefix=None): """ Retrieve the header for a given dbimages file. @param expnum: CFHT odometer number @param ccd: which ccd based extension (0..35) @param version: 'o','p', or 's' @param prefix: @return: """ logger.debug("Getting ast heade...
python
def get_astheader(expnum, ccd, version='p', prefix=None): """ Retrieve the header for a given dbimages file. @param expnum: CFHT odometer number @param ccd: which ccd based extension (0..35) @param version: 'o','p', or 's' @param prefix: @return: """ logger.debug("Getting ast heade...
[ "def", "get_astheader", "(", "expnum", ",", "ccd", ",", "version", "=", "'p'", ",", "prefix", "=", "None", ")", ":", "logger", ".", "debug", "(", "\"Getting ast header for {}\"", ".", "format", "(", "expnum", ")", ")", "if", "version", "==", "'p'", ":", ...
Retrieve the header for a given dbimages file. @param expnum: CFHT odometer number @param ccd: which ccd based extension (0..35) @param version: 'o','p', or 's' @param prefix: @return:
[ "Retrieve", "the", "header", "for", "a", "given", "dbimages", "file", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1557-L1595
OSSOS/MOP
src/ossos/core/ossos/storage.py
Task.tag
def tag(self): """ Get the string representation of the tag used to annotate the status in VOSpace. @return: str """ return "{}{}_{}{:02d}".format(self.target.prefix, self, self.target.version, ...
python
def tag(self): """ Get the string representation of the tag used to annotate the status in VOSpace. @return: str """ return "{}{}_{}{:02d}".format(self.target.prefix, self, self.target.version, ...
[ "def", "tag", "(", "self", ")", ":", "return", "\"{}{}_{}{:02d}\"", ".", "format", "(", "self", ".", "target", ".", "prefix", ",", "self", ",", "self", ".", "target", ".", "version", ",", "self", ".", "target", ".", "ccd", ")" ]
Get the string representation of the tag used to annotate the status in VOSpace. @return: str
[ "Get", "the", "string", "representation", "of", "the", "tag", "used", "to", "annotate", "the", "status", "in", "VOSpace", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L468-L476
OSSOS/MOP
src/ossos/core/scripts/scramble.py
scramble
def scramble(expnums, ccd, version='p', dry_run=False): """run the plant script on this combination of exposures""" mjds = [] fobjs = [] for expnum in expnums: filename = storage.get_image(expnum, ccd=ccd, version=version) fobjs.append(fits.open(filename)) # Pull out values to r...
python
def scramble(expnums, ccd, version='p', dry_run=False): """run the plant script on this combination of exposures""" mjds = [] fobjs = [] for expnum in expnums: filename = storage.get_image(expnum, ccd=ccd, version=version) fobjs.append(fits.open(filename)) # Pull out values to r...
[ "def", "scramble", "(", "expnums", ",", "ccd", ",", "version", "=", "'p'", ",", "dry_run", "=", "False", ")", ":", "mjds", "=", "[", "]", "fobjs", "=", "[", "]", "for", "expnum", "in", "expnums", ":", "filename", "=", "storage", ".", "get_image", "...
run the plant script on this combination of exposures
[ "run", "the", "plant", "script", "on", "this", "combination", "of", "exposures" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/scramble.py#L37-L67
OSSOS/MOP
src/ossos/core/scripts/scramble.py
main
def main(): """Run the script.""" parser = argparse.ArgumentParser() parser.add_argument('--ccd', action='store', type=int, default=None, help='which ccd to process') parser.add_argument("--dbimages", ...
python
def main(): """Run the script.""" parser = argparse.ArgumentParser() parser.add_argument('--ccd', action='store', type=int, default=None, help='which ccd to process') parser.add_argument("--dbimages", ...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'--ccd'", ",", "action", "=", "'store'", ",", "type", "=", "int", ",", "default", "=", "None", ",", "help", "=", "'which ccd ...
Run the script.
[ "Run", "the", "script", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/scramble.py#L70-L143
OSSOS/MOP
src/ossos/core/scripts/mk_mopheader.py
mk_mopheader
def mk_mopheader(expnum, ccd, version, dry_run=False, prefix=""): """Run the OSSOS mopheader script. """ ## confirm destination directory exists. destdir = os.path.dirname( storage.dbimages_uri(expnum, ccd, prefix=prefix, version=version, ext='fits')) if not dry_run: storage.mkdir(d...
python
def mk_mopheader(expnum, ccd, version, dry_run=False, prefix=""): """Run the OSSOS mopheader script. """ ## confirm destination directory exists. destdir = os.path.dirname( storage.dbimages_uri(expnum, ccd, prefix=prefix, version=version, ext='fits')) if not dry_run: storage.mkdir(d...
[ "def", "mk_mopheader", "(", "expnum", ",", "ccd", ",", "version", ",", "dry_run", "=", "False", ",", "prefix", "=", "\"\"", ")", ":", "## confirm destination directory exists.", "destdir", "=", "os", ".", "path", ".", "dirname", "(", "storage", ".", "dbimage...
Run the OSSOS mopheader script.
[ "Run", "the", "OSSOS", "mopheader", "script", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/mk_mopheader.py#L36-L67
OSSOS/MOP
src/jjk/preproc/t.py
read_cands
def read_cands(filename): """Read in the contents of a cands comb file""" import sre lines=file(filename).readlines() exps=[] cands=[] coo=[] for line in lines: if ( line[0:2]=="##" ) : break exps.append(line[2:].strip()) for line in lines: if ( ...
python
def read_cands(filename): """Read in the contents of a cands comb file""" import sre lines=file(filename).readlines() exps=[] cands=[] coo=[] for line in lines: if ( line[0:2]=="##" ) : break exps.append(line[2:].strip()) for line in lines: if ( ...
[ "def", "read_cands", "(", "filename", ")", ":", "import", "sre", "lines", "=", "file", "(", "filename", ")", ".", "readlines", "(", ")", "exps", "=", "[", "]", "cands", "=", "[", "]", "coo", "=", "[", "]", "for", "line", "in", "lines", ":", "if",...
Read in the contents of a cands comb file
[ "Read", "in", "the", "contents", "of", "a", "cands", "comb", "file" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/t.py#L4-L34
OSSOS/MOP
src/jjk/preproc/t.py
discands
def discands(record): """Display the candidates contained in a candidate record list""" import pyraf, pyfits pyraf.iraf.tv() display = pyraf.iraf.tv.display width=128 cands = record['cands'] exps= record['fileId'] ### load some header info from the mophead file headers=...
python
def discands(record): """Display the candidates contained in a candidate record list""" import pyraf, pyfits pyraf.iraf.tv() display = pyraf.iraf.tv.display width=128 cands = record['cands'] exps= record['fileId'] ### load some header info from the mophead file headers=...
[ "def", "discands", "(", "record", ")", ":", "import", "pyraf", ",", "pyfits", "pyraf", ".", "iraf", ".", "tv", "(", ")", "display", "=", "pyraf", ".", "iraf", ".", "tv", ".", "display", "width", "=", "128", "cands", "=", "record", "[", "'cands'", "...
Display the candidates contained in a candidate record list
[ "Display", "the", "candidates", "contained", "in", "a", "candidate", "record", "list" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/t.py#L36-L88
OSSOS/MOP
src/ossos/core/ossos/planning/ObsStatus.py
query_for_observations
def query_for_observations(mjd, observable, runid_list): """Do a QUERY on the TAP service for all observations that are part of runid, where taken after mjd and have calibration 'observable'. Schema is at: http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/tap/tables mjd : float observable: str ( 2 or ...
python
def query_for_observations(mjd, observable, runid_list): """Do a QUERY on the TAP service for all observations that are part of runid, where taken after mjd and have calibration 'observable'. Schema is at: http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/tap/tables mjd : float observable: str ( 2 or ...
[ "def", "query_for_observations", "(", "mjd", ",", "observable", ",", "runid_list", ")", ":", "data", "=", "{", "\"QUERY\"", ":", "(", "\"SELECT Observation.target_name as TargetName, \"", "\"COORD1(CENTROID(Plane.position_bounds)) AS RA,\"", "\"COORD2(CENTROID(Plane.position_boun...
Do a QUERY on the TAP service for all observations that are part of runid, where taken after mjd and have calibration 'observable'. Schema is at: http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/tap/tables mjd : float observable: str ( 2 or 1 ) runid: tuple eg. ('13AP05', '13AP06')
[ "Do", "a", "QUERY", "on", "the", "TAP", "service", "for", "all", "observations", "that", "are", "part", "of", "runid", "where", "taken", "after", "mjd", "and", "have", "calibration", "observable", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/ObsStatus.py#L22-L74
OSSOS/MOP
src/ossos/core/ossos/planning/ObsStatus.py
create_ascii_table
def create_ascii_table(observation_table, outfile): """Given a table of observations create an ascii log file for easy parsing. Store the result in outfile (could/should be a vospace dataNode) observation_table: astropy.votable.array object outfile: str (name of the vospace dataNode to store the result...
python
def create_ascii_table(observation_table, outfile): """Given a table of observations create an ascii log file for easy parsing. Store the result in outfile (could/should be a vospace dataNode) observation_table: astropy.votable.array object outfile: str (name of the vospace dataNode to store the result...
[ "def", "create_ascii_table", "(", "observation_table", ",", "outfile", ")", ":", "logging", ".", "info", "(", "\"writing text log to %s\"", "%", "outfile", ")", "stamp", "=", "\"#\\n# Last Updated: \"", "+", "time", ".", "asctime", "(", ")", "+", "\"\\n#\\n\"", ...
Given a table of observations create an ascii log file for easy parsing. Store the result in outfile (could/should be a vospace dataNode) observation_table: astropy.votable.array object outfile: str (name of the vospace dataNode to store the result to)
[ "Given", "a", "table", "of", "observations", "create", "an", "ascii", "log", "file", "for", "easy", "parsing", ".", "Store", "the", "result", "in", "outfile", "(", "could", "/", "should", "be", "a", "vospace", "dataNode", ")" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/ObsStatus.py#L77-L131
OSSOS/MOP
src/ossos/core/ossos/planning/ObsStatus.py
create_sky_plot
def create_sky_plot(observation_table, outfile): """Given a VOTable that describes the observation coverage provide a PDF of the skycoverge. observation_table: vostable.arrary outfile: name of file to write results to. """ # camera dimensions width = 0.98 height = 0.98 ax = None i...
python
def create_sky_plot(observation_table, outfile): """Given a VOTable that describes the observation coverage provide a PDF of the skycoverge. observation_table: vostable.arrary outfile: name of file to write results to. """ # camera dimensions width = 0.98 height = 0.98 ax = None i...
[ "def", "create_sky_plot", "(", "observation_table", ",", "outfile", ")", ":", "# camera dimensions", "width", "=", "0.98", "height", "=", "0.98", "ax", "=", "None", "if", "outfile", "[", "0", ":", "4", "]", "==", "'vos:'", ":", "temp_file", "=", "tempfile"...
Given a VOTable that describes the observation coverage provide a PDF of the skycoverge. observation_table: vostable.arrary outfile: name of file to write results to.
[ "Given", "a", "VOTable", "that", "describes", "the", "observation", "coverage", "provide", "a", "PDF", "of", "the", "skycoverge", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/ObsStatus.py#L134-L211
OSSOS/MOP
src/ossos/utils/update_astrometry_files.py
load_observations
def load_observations((observations, regex, rename), path, filenames): """ Returns a provisional name based dictionary of observations of the object. Each observations is keyed on the date. ie. a dictionary of dictionaries. :rtype : None :param observations: dictionary to store observtions into ...
python
def load_observations((observations, regex, rename), path, filenames): """ Returns a provisional name based dictionary of observations of the object. Each observations is keyed on the date. ie. a dictionary of dictionaries. :rtype : None :param observations: dictionary to store observtions into ...
[ "def", "load_observations", "(", "(", "observations", ",", "regex", ",", "rename", ")", ",", "path", ",", "filenames", ")", ":", "for", "filename", "in", "filenames", ":", "if", "re", ".", "search", "(", "regex", ",", "filename", ")", "is", "None", ":"...
Returns a provisional name based dictionary of observations of the object. Each observations is keyed on the date. ie. a dictionary of dictionaries. :rtype : None :param observations: dictionary to store observtions into :param path: the directory where filenames are. :param filenames: list of file...
[ "Returns", "a", "provisional", "name", "based", "dictionary", "of", "observations", "of", "the", "object", ".", "Each", "observations", "is", "keyed", "on", "the", "date", ".", "ie", ".", "a", "dictionary", "of", "dictionaries", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/update_astrometry_files.py#L14-L49
OSSOS/MOP
src/ossos/core/ossos/mopheader.py
MOPHeader.writeto
def writeto(self, filename, **kwargs): """ Write the header to a fits file. :param filename: :return: """ fits.PrimaryHDU(header=self).writeto(filename, output_verify='ignore', **kwargs)
python
def writeto(self, filename, **kwargs): """ Write the header to a fits file. :param filename: :return: """ fits.PrimaryHDU(header=self).writeto(filename, output_verify='ignore', **kwargs)
[ "def", "writeto", "(", "self", ",", "filename", ",", "*", "*", "kwargs", ")", ":", "fits", ".", "PrimaryHDU", "(", "header", "=", "self", ")", ".", "writeto", "(", "filename", ",", "output_verify", "=", "'ignore'", ",", "*", "*", "kwargs", ")" ]
Write the header to a fits file. :param filename: :return:
[ "Write", "the", "header", "to", "a", "fits", "file", ".", ":", "param", "filename", ":", ":", "return", ":" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mopheader.py#L74-L80
OSSOS/MOP
src/ossos/core/ossos/mopheader.py
MOPHeader.crpix
def crpix(self): """ The location of the reference coordinate in the pixel frame. First simple respond with the header values, if they don't exist try usnig the DETSEC values @rtype: float, float """ try: return self.wcs.crpix1, self.wcs.crpix2 except...
python
def crpix(self): """ The location of the reference coordinate in the pixel frame. First simple respond with the header values, if they don't exist try usnig the DETSEC values @rtype: float, float """ try: return self.wcs.crpix1, self.wcs.crpix2 except...
[ "def", "crpix", "(", "self", ")", ":", "try", ":", "return", "self", ".", "wcs", ".", "crpix1", ",", "self", ".", "wcs", ".", "crpix2", "except", "Exception", "as", "ex", ":", "logging", ".", "debug", "(", "\"Couldn't get CRPIX from WCS: {}\"", ".", "for...
The location of the reference coordinate in the pixel frame. First simple respond with the header values, if they don't exist try usnig the DETSEC values @rtype: float, float
[ "The", "location", "of", "the", "reference", "coordinate", "in", "the", "pixel", "frame", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mopheader.py#L99-L122
OSSOS/MOP
src/ossos/core/ossos/mopheader.py
MOPHeader.mjd_obsc
def mjd_obsc(self): """Given a CFHT Megaprime image header compute the center of exposure. This routine uses the calibration provide by Richard Wainscoat: From: Richard Wainscoat <rjw@ifa.hawaii.edu> Subject: Fwd: timing for MegaCam Date: April 24, 2015 at 7:23:09 PM EDT ...
python
def mjd_obsc(self): """Given a CFHT Megaprime image header compute the center of exposure. This routine uses the calibration provide by Richard Wainscoat: From: Richard Wainscoat <rjw@ifa.hawaii.edu> Subject: Fwd: timing for MegaCam Date: April 24, 2015 at 7:23:09 PM EDT ...
[ "def", "mjd_obsc", "(", "self", ")", ":", "# TODO Check if this exposure was taken afer or before correction needed.", "try", ":", "utc_end", "=", "self", "[", "'UTCEND'", "]", "exposure_time", "=", "float", "(", "self", "[", "'EXPTIME'", "]", ")", "date_obs", "=", ...
Given a CFHT Megaprime image header compute the center of exposure. This routine uses the calibration provide by Richard Wainscoat: From: Richard Wainscoat <rjw@ifa.hawaii.edu> Subject: Fwd: timing for MegaCam Date: April 24, 2015 at 7:23:09 PM EDT To: David Tholen <tholen@ifa....
[ "Given", "a", "CFHT", "Megaprime", "image", "header", "compute", "the", "center", "of", "exposure", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mopheader.py#L125-L151
OSSOS/MOP
src/ossos/core/ossos/mopheader.py
MOPHeader.crval
def crval(self): """ Get the world coordinate of the reference pixel. @rtype: float, float """ try: return self.wcs.crval1, self.wcs.crval2 except Exception as ex: logging.debug("Couldn't get CRVAL from WCS: {}".format(ex)) logging.deb...
python
def crval(self): """ Get the world coordinate of the reference pixel. @rtype: float, float """ try: return self.wcs.crval1, self.wcs.crval2 except Exception as ex: logging.debug("Couldn't get CRVAL from WCS: {}".format(ex)) logging.deb...
[ "def", "crval", "(", "self", ")", ":", "try", ":", "return", "self", ".", "wcs", ".", "crval1", ",", "self", ".", "wcs", ".", "crval2", "except", "Exception", "as", "ex", ":", "logging", ".", "debug", "(", "\"Couldn't get CRVAL from WCS: {}\"", ".", "for...
Get the world coordinate of the reference pixel. @rtype: float, float
[ "Get", "the", "world", "coordinate", "of", "the", "reference", "pixel", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mopheader.py#L154-L170
OSSOS/MOP
src/ossos/core/ossos/mopheader.py
MOPHeader.pixscale
def pixscale(self): """Return the pixel scale of the detector, in arcseconds. This routine first attempts to compute the size of a pixel using the WCS. Then looks for PIXSCAL in header. @return: pixscal @rtype: float """ try: (x, y) = self['NAXIS1'] / 2.0, ...
python
def pixscale(self): """Return the pixel scale of the detector, in arcseconds. This routine first attempts to compute the size of a pixel using the WCS. Then looks for PIXSCAL in header. @return: pixscal @rtype: float """ try: (x, y) = self['NAXIS1'] / 2.0, ...
[ "def", "pixscale", "(", "self", ")", ":", "try", ":", "(", "x", ",", "y", ")", "=", "self", "[", "'NAXIS1'", "]", "/", "2.0", ",", "self", "[", "'NAXIS2'", "]", "/", "2.0", "p1", "=", "SkyCoord", "(", "*", "self", ".", "wcs", ".", "xy2sky", "...
Return the pixel scale of the detector, in arcseconds. This routine first attempts to compute the size of a pixel using the WCS. Then looks for PIXSCAL in header. @return: pixscal @rtype: float
[ "Return", "the", "pixel", "scale", "of", "the", "detector", "in", "arcseconds", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mopheader.py#L173-L189
OSSOS/MOP
src/jjk/preproc/MOPphot.py
iraf_phot
def iraf_phot(f,x,y,zmag=26.5,apin=10,skyin=15,skywidth=10): """Compute the magnitude of the star at location x/y""" import pyfits import re infits=pyfits.open(f,'update') f=re.sub(r'.fits$','',f) ### Get my python routines from pyraf import iraf from pyraf.irafpar import IrafParLis...
python
def iraf_phot(f,x,y,zmag=26.5,apin=10,skyin=15,skywidth=10): """Compute the magnitude of the star at location x/y""" import pyfits import re infits=pyfits.open(f,'update') f=re.sub(r'.fits$','',f) ### Get my python routines from pyraf import iraf from pyraf.irafpar import IrafParLis...
[ "def", "iraf_phot", "(", "f", ",", "x", ",", "y", ",", "zmag", "=", "26.5", ",", "apin", "=", "10", ",", "skyin", "=", "15", ",", "skywidth", "=", "10", ")", ":", "import", "pyfits", "import", "re", "infits", "=", "pyfits", ".", "open", "(", "f...
Compute the magnitude of the star at location x/y
[ "Compute", "the", "magnitude", "of", "the", "star", "at", "location", "x", "/", "y" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPphot.py#L59-L164
OSSOS/MOP
src/jjk/preproc/rate.py
get_rates
def get_rates(file,au_min=25,au_max=150): """ Use the rates program to determine the minimum and maximum bounds for planting""" import os, string rate_command='rate.pl --file %s %d ' % ( file, au_min) rate=os.popen(rate_command) line=rate.readline() print line rate.close() (min_rate, mi...
python
def get_rates(file,au_min=25,au_max=150): """ Use the rates program to determine the minimum and maximum bounds for planting""" import os, string rate_command='rate.pl --file %s %d ' % ( file, au_min) rate=os.popen(rate_command) line=rate.readline() print line rate.close() (min_rate, mi...
[ "def", "get_rates", "(", "file", ",", "au_min", "=", "25", ",", "au_max", "=", "150", ")", ":", "import", "os", ",", "string", "rate_command", "=", "'rate.pl --file %s %d '", "%", "(", "file", ",", "au_min", ")", "rate", "=", "os", ".", "popen", "(", ...
Use the rates program to determine the minimum and maximum bounds for planting
[ "Use", "the", "rates", "program", "to", "determine", "the", "minimum", "and", "maximum", "bounds", "for", "planting" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/rate.py#L7-L27
OSSOS/MOP
src/jjk/preproc/rate.py
kbo_gen
def kbo_gen(file,outfile='objects.list',mmin=22.5,mmax=24.5): """Generate a file with object moving at a range of rates and angles""" header=get_rates(file) print header import pyfits hdulist=pyfits.open(file) header['xmin']=1 header['xmax']=hdulist[0].header.get('NAXIS1',2048) header['...
python
def kbo_gen(file,outfile='objects.list',mmin=22.5,mmax=24.5): """Generate a file with object moving at a range of rates and angles""" header=get_rates(file) print header import pyfits hdulist=pyfits.open(file) header['xmin']=1 header['xmax']=hdulist[0].header.get('NAXIS1',2048) header['...
[ "def", "kbo_gen", "(", "file", ",", "outfile", "=", "'objects.list'", ",", "mmin", "=", "22.5", ",", "mmax", "=", "24.5", ")", ":", "header", "=", "get_rates", "(", "file", ")", "print", "header", "import", "pyfits", "hdulist", "=", "pyfits", ".", "ope...
Generate a file with object moving at a range of rates and angles
[ "Generate", "a", "file", "with", "object", "moving", "at", "a", "range", "of", "rates", "and", "angles" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/rate.py#L29-L64
OSSOS/MOP
src/ossos/utils/get_image_lists.py
main
def main(): """ Input asteroid family, filter type, and image type to query SSOIS """ parser = argparse.ArgumentParser(description='Run SSOIS and return the available images in a particular filter.') parser.add_argument("--filter", action="store", de...
python
def main(): """ Input asteroid family, filter type, and image type to query SSOIS """ parser = argparse.ArgumentParser(description='Run SSOIS and return the available images in a particular filter.') parser.add_argument("--filter", action="store", de...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Run SSOIS and return the available images in a particular filter.'", ")", "parser", ".", "add_argument", "(", "\"--filter\"", ",", "action", "=", "\"store\"", ",...
Input asteroid family, filter type, and image type to query SSOIS
[ "Input", "asteroid", "family", "filter", "type", "and", "image", "type", "to", "query", "SSOIS" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/get_image_lists.py#L17-L46
OSSOS/MOP
src/ossos/utils/get_image_lists.py
get_family_info
def get_family_info(familyname, filtertype='r', imagetype='p'): """ Query the ssois table for images of objects in a given family. Then parse through for desired image type, filter, exposure time, and telescope instrument """ # establish input family_list = '{}/{}_family.txt'.format(_FAMILY_LIS...
python
def get_family_info(familyname, filtertype='r', imagetype='p'): """ Query the ssois table for images of objects in a given family. Then parse through for desired image type, filter, exposure time, and telescope instrument """ # establish input family_list = '{}/{}_family.txt'.format(_FAMILY_LIS...
[ "def", "get_family_info", "(", "familyname", ",", "filtertype", "=", "'r'", ",", "imagetype", "=", "'p'", ")", ":", "# establish input", "family_list", "=", "'{}/{}_family.txt'", ".", "format", "(", "_FAMILY_LISTS", ",", "familyname", ")", "if", "os", ".", "pa...
Query the ssois table for images of objects in a given family. Then parse through for desired image type, filter, exposure time, and telescope instrument
[ "Query", "the", "ssois", "table", "for", "images", "of", "objects", "in", "a", "given", "family", ".", "Then", "parse", "through", "for", "desired", "image", "type", "filter", "exposure", "time", "and", "telescope", "instrument" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/get_image_lists.py#L49-L68
OSSOS/MOP
src/ossos/utils/get_image_lists.py
get_member_info
def get_member_info(object_name, filtertype='r', imagetype='p'): """ Query the ssois table for images of a given object. Then parse through for desired image type, filter, exposure time, and telescope instrument """ # From the given input, identify the desired filter and rename appropriately ...
python
def get_member_info(object_name, filtertype='r', imagetype='p'): """ Query the ssois table for images of a given object. Then parse through for desired image type, filter, exposure time, and telescope instrument """ # From the given input, identify the desired filter and rename appropriately ...
[ "def", "get_member_info", "(", "object_name", ",", "filtertype", "=", "'r'", ",", "imagetype", "=", "'p'", ")", ":", "# From the given input, identify the desired filter and rename appropriately Replace this?", "if", "filtertype", ".", "lower", "(", ")", ...
Query the ssois table for images of a given object. Then parse through for desired image type, filter, exposure time, and telescope instrument
[ "Query", "the", "ssois", "table", "for", "images", "of", "a", "given", "object", ".", "Then", "parse", "through", "for", "desired", "image", "type", "filter", "exposure", "time", "and", "telescope", "instrument" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/get_image_lists.py#L71-L133
OSSOS/MOP
src/ossos/utils/get_image_lists.py
parse_ssois_return
def parse_ssois_return(ssois_return, object_name, imagetype, camera_filter='r.MP9601', telescope_instrument='CFHT/MegaCam'): """ Parse through objects in ssois query and filter out images of desired filter, type, exposure time, and instrument """ assert camera_filter in ['r.MP960...
python
def parse_ssois_return(ssois_return, object_name, imagetype, camera_filter='r.MP9601', telescope_instrument='CFHT/MegaCam'): """ Parse through objects in ssois query and filter out images of desired filter, type, exposure time, and instrument """ assert camera_filter in ['r.MP960...
[ "def", "parse_ssois_return", "(", "ssois_return", ",", "object_name", ",", "imagetype", ",", "camera_filter", "=", "'r.MP9601'", ",", "telescope_instrument", "=", "'CFHT/MegaCam'", ")", ":", "assert", "camera_filter", "in", "[", "'r.MP9601'", ",", "'u.MP9301'", "]",...
Parse through objects in ssois query and filter out images of desired filter, type, exposure time, and instrument
[ "Parse", "through", "objects", "in", "ssois", "query", "and", "filter", "out", "images", "of", "desired", "filter", "type", "exposure", "time", "and", "instrument" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/get_image_lists.py#L136-L168
OSSOS/MOP
src/ossos/core/ossos/match.py
match_mopfiles
def match_mopfiles(mopfile1, mopfile2): """ Given an input list of 'real' detections and candidate detections provide a result file that contains the measured values from candidate detections with a flag indicating if they are real or false. @rtype MOPFile @return mopfile2 with a new column contain...
python
def match_mopfiles(mopfile1, mopfile2): """ Given an input list of 'real' detections and candidate detections provide a result file that contains the measured values from candidate detections with a flag indicating if they are real or false. @rtype MOPFile @return mopfile2 with a new column contain...
[ "def", "match_mopfiles", "(", "mopfile1", ",", "mopfile2", ")", ":", "pos1", "=", "pos2", "=", "numpy", ".", "array", "(", "[", "]", ")", "if", "len", "(", "mopfile1", ".", "data", ")", ">", "0", ":", "X_COL", "=", "\"X_{}\"", ".", "format", "(", ...
Given an input list of 'real' detections and candidate detections provide a result file that contains the measured values from candidate detections with a flag indicating if they are real or false. @rtype MOPFile @return mopfile2 with a new column containing index of matching entry in mopfile1
[ "Given", "an", "input", "list", "of", "real", "detections", "and", "candidate", "detections", "provide", "a", "result", "file", "that", "contains", "the", "measured", "values", "from", "candidate", "detections", "with", "a", "flag", "indicating", "if", "they", ...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/match.py#L18-L45
OSSOS/MOP
src/ossos/core/ossos/match.py
measure_mags
def measure_mags(measures): """ Given a list of readings compute the magnitudes for all sources in each reading. @param measures: list of readings @return: None """ import daophot image_downloader = ImageDownloader() observations = {} for measure in measures: for reading i...
python
def measure_mags(measures): """ Given a list of readings compute the magnitudes for all sources in each reading. @param measures: list of readings @return: None """ import daophot image_downloader = ImageDownloader() observations = {} for measure in measures: for reading i...
[ "def", "measure_mags", "(", "measures", ")", ":", "import", "daophot", "image_downloader", "=", "ImageDownloader", "(", ")", "observations", "=", "{", "}", "for", "measure", "in", "measures", ":", "for", "reading", "in", "measure", ":", "if", "reading", ".",...
Given a list of readings compute the magnitudes for all sources in each reading. @param measures: list of readings @return: None
[ "Given", "a", "list", "of", "readings", "compute", "the", "magnitudes", "for", "all", "sources", "in", "each", "reading", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/match.py#L48-L87
OSSOS/MOP
src/ossos/core/ossos/match.py
match_planted
def match_planted(fk_candidate_observations, match_filename, bright_limit=BRIGHT_LIMIT, object_planted=OBJECT_PLANTED, minimum_bright_detections=MINIMUM_BRIGHT_DETECTIONS, bright_fraction=MINIMUM_BRIGHT_FRACTION): """ Using the fk_candidate_observations as input get the Object.planted file fro...
python
def match_planted(fk_candidate_observations, match_filename, bright_limit=BRIGHT_LIMIT, object_planted=OBJECT_PLANTED, minimum_bright_detections=MINIMUM_BRIGHT_DETECTIONS, bright_fraction=MINIMUM_BRIGHT_FRACTION): """ Using the fk_candidate_observations as input get the Object.planted file fro...
[ "def", "match_planted", "(", "fk_candidate_observations", ",", "match_filename", ",", "bright_limit", "=", "BRIGHT_LIMIT", ",", "object_planted", "=", "OBJECT_PLANTED", ",", "minimum_bright_detections", "=", "MINIMUM_BRIGHT_DETECTIONS", ",", "bright_fraction", "=", "MINIMUM...
Using the fk_candidate_observations as input get the Object.planted file from VOSpace and match planted sources with found sources. The Object.planted list is pulled from VOSpace based on the standard file-layout and name of the first exposure as read from the .astrom file. :param fk_candidate_observa...
[ "Using", "the", "fk_candidate_observations", "as", "input", "get", "the", "Object", ".", "planted", "file", "from", "VOSpace", "and", "match", "planted", "sources", "with", "found", "sources", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/match.py#L90-L266
OSSOS/MOP
src/ossos/core/ossos/gui/models/collections.py
StatefulCollection.append
def append(self, item): """Adds a new item to the end of the collection.""" if len(self) == 0: # Special case, we make this the current item self.index = 0 self.items.append(item)
python
def append(self, item): """Adds a new item to the end of the collection.""" if len(self) == 0: # Special case, we make this the current item self.index = 0 self.items.append(item)
[ "def", "append", "(", "self", ",", "item", ")", ":", "if", "len", "(", "self", ")", "==", "0", ":", "# Special case, we make this the current item", "self", ".", "index", "=", "0", "self", ".", "items", ".", "append", "(", "item", ")" ]
Adds a new item to the end of the collection.
[ "Adds", "a", "new", "item", "to", "the", "end", "of", "the", "collection", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/models/collections.py#L27-L33
OSSOS/MOP
src/ossos/utils/vtag_cleanup.py
fix_tags_on_cands_missing_reals
def fix_tags_on_cands_missing_reals(user_id, vos_dir, property): "At the moment this just checks for a single user's missing reals. Easy to generalise it to all users." con = context.get_context(vos_dir) user_progress = [] listing = con.get_listing(tasks.get_suffix('reals')) mpc_listing = con.get_li...
python
def fix_tags_on_cands_missing_reals(user_id, vos_dir, property): "At the moment this just checks for a single user's missing reals. Easy to generalise it to all users." con = context.get_context(vos_dir) user_progress = [] listing = con.get_listing(tasks.get_suffix('reals')) mpc_listing = con.get_li...
[ "def", "fix_tags_on_cands_missing_reals", "(", "user_id", ",", "vos_dir", ",", "property", ")", ":", "con", "=", "context", ".", "get_context", "(", "vos_dir", ")", "user_progress", "=", "[", "]", "listing", "=", "con", ".", "get_listing", "(", "tasks", ".",...
At the moment this just checks for a single user's missing reals. Easy to generalise it to all users.
[ "At", "the", "moment", "this", "just", "checks", "for", "a", "single", "user", "s", "missing", "reals", ".", "Easy", "to", "generalise", "it", "to", "all", "users", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/vtag_cleanup.py#L64-L93
playpauseandstop/rororo
rororo/schemas/schema.py
Schema.make_error
def make_error(self, message: str, *, error: Exception = None, # ``error_class: Type[Exception]=None`` doesn't work on # Python 3.5.2, but that is exact version ran by Read the # Docs :( More info: http://s...
python
def make_error(self, message: str, *, error: Exception = None, # ``error_class: Type[Exception]=None`` doesn't work on # Python 3.5.2, but that is exact version ran by Read the # Docs :( More info: http://s...
[ "def", "make_error", "(", "self", ",", "message", ":", "str", ",", "*", ",", "error", ":", "Exception", "=", "None", ",", "# ``error_class: Type[Exception]=None`` doesn't work on", "# Python 3.5.2, but that is exact version ran by Read the", "# Docs :( More info: http://stackov...
Return error instantiated from given message. :param message: Message to wrap. :param error: Validation error. :param error_class: Special class to wrap error message into. When omitted ``self.error_class`` will be used.
[ "Return", "error", "instantiated", "from", "given", "message", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/schemas/schema.py#L74-L92
playpauseandstop/rororo
rororo/schemas/schema.py
Schema.make_response
def make_response(self, data: Any = None, **kwargs: Any) -> Any: r"""Validate response data and wrap it inside response factory. :param data: Response data. Could be ommited. :param \*\*kwargs: Keyword arguments to be passed to response factory. ...
python
def make_response(self, data: Any = None, **kwargs: Any) -> Any: r"""Validate response data and wrap it inside response factory. :param data: Response data. Could be ommited. :param \*\*kwargs: Keyword arguments to be passed to response factory. ...
[ "def", "make_response", "(", "self", ",", "data", ":", "Any", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Any", ":", "if", "not", "self", ".", "_valid_request", ":", "logger", ".", "error", "(", "'Request not validated, cannot make respon...
r"""Validate response data and wrap it inside response factory. :param data: Response data. Could be ommited. :param \*\*kwargs: Keyword arguments to be passed to response factory.
[ "r", "Validate", "response", "data", "and", "wrap", "it", "inside", "response", "factory", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/schemas/schema.py#L94-L120
playpauseandstop/rororo
rororo/schemas/schema.py
Schema.validate_request
def validate_request(self, data: Any, *additional: AnyMapping, merged_class: Type[dict] = dict) -> Any: r"""Validate request data against request schema from module. :param data: Request data. :param \*additional: ...
python
def validate_request(self, data: Any, *additional: AnyMapping, merged_class: Type[dict] = dict) -> Any: r"""Validate request data against request schema from module. :param data: Request data. :param \*additional: ...
[ "def", "validate_request", "(", "self", ",", "data", ":", "Any", ",", "*", "additional", ":", "AnyMapping", ",", "merged_class", ":", "Type", "[", "dict", "]", "=", "dict", ")", "->", "Any", ":", "request_schema", "=", "getattr", "(", "self", ".", "mod...
r"""Validate request data against request schema from module. :param data: Request data. :param \*additional: Additional data dicts to be merged with base request data. :param merged_class: When additional data dicts supplied method by default will return mer...
[ "r", "Validate", "request", "data", "against", "request", "schema", "from", "module", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/schemas/schema.py#L122-L157
playpauseandstop/rororo
rororo/schemas/schema.py
Schema._merge_data
def _merge_data(self, data: AnyMapping, *additional: AnyMapping) -> dict: r"""Merge base data and additional dicts. :param data: Base data. :param \*additional: Additional data dicts to be merged into base dict. """ return defaults( dict(data) if not isinstance(data,...
python
def _merge_data(self, data: AnyMapping, *additional: AnyMapping) -> dict: r"""Merge base data and additional dicts. :param data: Base data. :param \*additional: Additional data dicts to be merged into base dict. """ return defaults( dict(data) if not isinstance(data,...
[ "def", "_merge_data", "(", "self", ",", "data", ":", "AnyMapping", ",", "*", "additional", ":", "AnyMapping", ")", "->", "dict", ":", "return", "defaults", "(", "dict", "(", "data", ")", "if", "not", "isinstance", "(", "data", ",", "dict", ")", "else",...
r"""Merge base data and additional dicts. :param data: Base data. :param \*additional: Additional data dicts to be merged into base dict.
[ "r", "Merge", "base", "data", "and", "additional", "dicts", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/schemas/schema.py#L159-L167
playpauseandstop/rororo
rororo/schemas/schema.py
Schema._pure_data
def _pure_data(self, data: Any) -> Any: """ If data is dict-like object, convert it to pure dict instance, so it will be possible to pass to default ``jsonschema.validate`` func. :param data: Request or response data. """ if not isinstance(data, dict) and not isinstance(...
python
def _pure_data(self, data: Any) -> Any: """ If data is dict-like object, convert it to pure dict instance, so it will be possible to pass to default ``jsonschema.validate`` func. :param data: Request or response data. """ if not isinstance(data, dict) and not isinstance(...
[ "def", "_pure_data", "(", "self", ",", "data", ":", "Any", ")", "->", "Any", ":", "if", "not", "isinstance", "(", "data", ",", "dict", ")", "and", "not", "isinstance", "(", "data", ",", "list", ")", ":", "try", ":", "return", "dict", "(", "data", ...
If data is dict-like object, convert it to pure dict instance, so it will be possible to pass to default ``jsonschema.validate`` func. :param data: Request or response data.
[ "If", "data", "is", "dict", "-", "like", "object", "convert", "it", "to", "pure", "dict", "instance", "so", "it", "will", "be", "possible", "to", "pass", "to", "default", "jsonschema", ".", "validate", "func", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/schemas/schema.py#L169-L181
playpauseandstop/rororo
rororo/schemas/schema.py
Schema._validate
def _validate(self, data: Any, schema: AnyMapping) -> Any: """Validate data against given schema. :param data: Data to validate. :param schema: Schema to use for validation. """ try: return self.validate_func(schema, self._pure_data(data)) except self.validat...
python
def _validate(self, data: Any, schema: AnyMapping) -> Any: """Validate data against given schema. :param data: Data to validate. :param schema: Schema to use for validation. """ try: return self.validate_func(schema, self._pure_data(data)) except self.validat...
[ "def", "_validate", "(", "self", ",", "data", ":", "Any", ",", "schema", ":", "AnyMapping", ")", "->", "Any", ":", "try", ":", "return", "self", ".", "validate_func", "(", "schema", ",", "self", ".", "_pure_data", "(", "data", ")", ")", "except", "se...
Validate data against given schema. :param data: Data to validate. :param schema: Schema to use for validation.
[ "Validate", "data", "against", "given", "schema", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/schemas/schema.py#L183-L198
OSSOS/MOP
src/ossos/canfar/cadc_certificates.py
getCert
def getCert(certHost=vos.vos.SERVER, certfile=None, certQuery="/cred/proxyCert?daysValid=",daysValid=2): """Access the cadc certificate server""" if certfile is None: certfile = os.path.join(os.getenv("HOME","/tmp"),".ssl/cadcproxy.pem") dirname = os.path.dirname(certfile) try: ...
python
def getCert(certHost=vos.vos.SERVER, certfile=None, certQuery="/cred/proxyCert?daysValid=",daysValid=2): """Access the cadc certificate server""" if certfile is None: certfile = os.path.join(os.getenv("HOME","/tmp"),".ssl/cadcproxy.pem") dirname = os.path.dirname(certfile) try: ...
[ "def", "getCert", "(", "certHost", "=", "vos", ".", "vos", ".", "SERVER", ",", "certfile", "=", "None", ",", "certQuery", "=", "\"/cred/proxyCert?daysValid=\"", ",", "daysValid", "=", "2", ")", ":", "if", "certfile", "is", "None", ":", "certfile", "=", "...
Access the cadc certificate server
[ "Access", "the", "cadc", "certificate", "server" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/canfar/cadc_certificates.py#L10-L60
OSSOS/MOP
src/ossos/canfar/cadc_certificates.py
getUserPassword
def getUserPassword(host='www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'): """"Getting the username/password for host from .netrc filie """ if os.access(os.path.join(os.environ.get('HOME','/'),".netrc"),os.R_OK): auth=netrc.netrc().authenticators(host) else: auth=False if not auth: sys.st...
python
def getUserPassword(host='www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'): """"Getting the username/password for host from .netrc filie """ if os.access(os.path.join(os.environ.get('HOME','/'),".netrc"),os.R_OK): auth=netrc.netrc().authenticators(host) else: auth=False if not auth: sys.st...
[ "def", "getUserPassword", "(", "host", "=", "'www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'", ")", ":", "if", "os", ".", "access", "(", "os", ".", "path", ".", "join", "(", "os", ".", "environ", ".", "get", "(", "'HOME'", ",", "'/'", ")", ",", "\".netrc\"", ")",...
Getting the username/password for host from .netrc filie
[ "Getting", "the", "username", "/", "password", "for", "host", "from", ".", "netrc", "filie" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/canfar/cadc_certificates.py#L62-L75
OSSOS/MOP
src/ossos/utils/reset_processing_tags.py
clear_tags
def clear_tags(my_expnum, ops_set, my_ccds, dry_run=True): """ Clear the tags for the given expnum/ccd set. @param ops: @param my_expnum: @return: """ for ops in ops_set: for fake in ops[0]: for my_program in ops[1]: for version in ops[2]: props = {...
python
def clear_tags(my_expnum, ops_set, my_ccds, dry_run=True): """ Clear the tags for the given expnum/ccd set. @param ops: @param my_expnum: @return: """ for ops in ops_set: for fake in ops[0]: for my_program in ops[1]: for version in ops[2]: props = {...
[ "def", "clear_tags", "(", "my_expnum", ",", "ops_set", ",", "my_ccds", ",", "dry_run", "=", "True", ")", ":", "for", "ops", "in", "ops_set", ":", "for", "fake", "in", "ops", "[", "0", "]", ":", "for", "my_program", "in", "ops", "[", "1", "]", ":", ...
Clear the tags for the given expnum/ccd set. @param ops: @param my_expnum: @return:
[ "Clear", "the", "tags", "for", "the", "given", "expnum", "/", "ccd", "set", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/reset_processing_tags.py#L33-L53
playpauseandstop/rororo
rororo/utils.py
to_bool
def to_bool(value: Any) -> bool: """Convert string or other Python object to boolean. **Rationalle** Passing flags is one of the most common cases of using environment vars and as values are strings we need to have an easy way to convert them to boolean Python value. Without this function int...
python
def to_bool(value: Any) -> bool: """Convert string or other Python object to boolean. **Rationalle** Passing flags is one of the most common cases of using environment vars and as values are strings we need to have an easy way to convert them to boolean Python value. Without this function int...
[ "def", "to_bool", "(", "value", ":", "Any", ")", "->", "bool", ":", "return", "bool", "(", "strtobool", "(", "value", ")", "if", "isinstance", "(", "value", ",", "str", ")", "else", "value", ")" ]
Convert string or other Python object to boolean. **Rationalle** Passing flags is one of the most common cases of using environment vars and as values are strings we need to have an easy way to convert them to boolean Python value. Without this function int or float string values can be converted...
[ "Convert", "string", "or", "other", "Python", "object", "to", "boolean", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/utils.py#L17-L32
playpauseandstop/rororo
rororo/utils.py
to_int
def to_int(value: str, default: T = None) -> Union[int, Optional[T]]: """Convert given value to int. If conversion failed, return default value without raising Exception. :param value: Value to convert to int. :param default: Default value to use in case of failed conversion. """ try: ...
python
def to_int(value: str, default: T = None) -> Union[int, Optional[T]]: """Convert given value to int. If conversion failed, return default value without raising Exception. :param value: Value to convert to int. :param default: Default value to use in case of failed conversion. """ try: ...
[ "def", "to_int", "(", "value", ":", "str", ",", "default", ":", "T", "=", "None", ")", "->", "Union", "[", "int", ",", "Optional", "[", "T", "]", "]", ":", "try", ":", "return", "int", "(", "value", ")", "except", "(", "TypeError", ",", "ValueErr...
Convert given value to int. If conversion failed, return default value without raising Exception. :param value: Value to convert to int. :param default: Default value to use in case of failed conversion.
[ "Convert", "given", "value", "to", "int", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/utils.py#L35-L46
OSSOS/MOP
src/jjk/preproc/cfeps_object.py
mk_dict
def mk_dict(results,description): """Given a result list and descrition sequence, return a list of dictionaries""" rows=[] for row in results: row_dict={} for idx in range(len(row)): col=description[idx][0] row_dict[col]=row[idx] rows.append(row_dict)...
python
def mk_dict(results,description): """Given a result list and descrition sequence, return a list of dictionaries""" rows=[] for row in results: row_dict={} for idx in range(len(row)): col=description[idx][0] row_dict[col]=row[idx] rows.append(row_dict)...
[ "def", "mk_dict", "(", "results", ",", "description", ")", ":", "rows", "=", "[", "]", "for", "row", "in", "results", ":", "row_dict", "=", "{", "}", "for", "idx", "in", "range", "(", "len", "(", "row", ")", ")", ":", "col", "=", "description", "...
Given a result list and descrition sequence, return a list of dictionaries
[ "Given", "a", "result", "list", "and", "descrition", "sequence", "return", "a", "list", "of", "dictionaries" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/cfeps_object.py#L16-L27
OSSOS/MOP
src/jjk/preproc/cfeps_object.py
get_orbits
def get_orbits(official='%'): """Query the orbit table for the object whose official desingation matches parameter official. By default all entries are returned """ sql= "SELECT * FROM orbits WHERE official LIKE '%s' " % (official, ) cfeps.execute(sql) return mk_dict(cfeps.fetchall(),cfep...
python
def get_orbits(official='%'): """Query the orbit table for the object whose official desingation matches parameter official. By default all entries are returned """ sql= "SELECT * FROM orbits WHERE official LIKE '%s' " % (official, ) cfeps.execute(sql) return mk_dict(cfeps.fetchall(),cfep...
[ "def", "get_orbits", "(", "official", "=", "'%'", ")", ":", "sql", "=", "\"SELECT * FROM orbits WHERE official LIKE '%s' \"", "%", "(", "official", ",", ")", "cfeps", ".", "execute", "(", "sql", ")", "return", "mk_dict", "(", "cfeps", ".", "fetchall", "(", "...
Query the orbit table for the object whose official desingation matches parameter official. By default all entries are returned
[ "Query", "the", "orbit", "table", "for", "the", "object", "whose", "official", "desingation", "matches", "parameter", "official", ".", "By", "default", "all", "entries", "are", "returned" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/cfeps_object.py#L30-L37
OSSOS/MOP
src/jjk/preproc/cfeps_object.py
get_astrom
def get_astrom(official='%',provisional='%'): """Query the measure table for all measurements of a particular object. Default is to return all the astrometry in the measure table, sorted by mjdate""" sql= "SELECT m.* FROM measure m " sql+="LEFT JOIN object o ON m.provisional LIKE o.provisional " ...
python
def get_astrom(official='%',provisional='%'): """Query the measure table for all measurements of a particular object. Default is to return all the astrometry in the measure table, sorted by mjdate""" sql= "SELECT m.* FROM measure m " sql+="LEFT JOIN object o ON m.provisional LIKE o.provisional " ...
[ "def", "get_astrom", "(", "official", "=", "'%'", ",", "provisional", "=", "'%'", ")", ":", "sql", "=", "\"SELECT m.* FROM measure m \"", "sql", "+=", "\"LEFT JOIN object o ON m.provisional LIKE o.provisional \"", "if", "not", "official", ":", "sql", "+=", "\"WHERE o...
Query the measure table for all measurements of a particular object. Default is to return all the astrometry in the measure table, sorted by mjdate
[ "Query", "the", "measure", "table", "for", "all", "measurements", "of", "a", "particular", "object", ".", "Default", "is", "to", "return", "all", "the", "astrometry", "in", "the", "measure", "table", "sorted", "by", "mjdate" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/cfeps_object.py#L40-L54
OSSOS/MOP
src/jjk/preproc/cfeps_object.py
getData
def getData(file_id,ra,dec): """Create a link that connects to a getData URL""" DATA="www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca" BASE="http://"+DATA+"/authProxy/getData" archive="CFHT" wcs="corrected" import re groups=re.match('^(?P<file_id>\d{6}).*',file_id) if not groups: return No...
python
def getData(file_id,ra,dec): """Create a link that connects to a getData URL""" DATA="www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca" BASE="http://"+DATA+"/authProxy/getData" archive="CFHT" wcs="corrected" import re groups=re.match('^(?P<file_id>\d{6}).*',file_id) if not groups: return No...
[ "def", "getData", "(", "file_id", ",", "ra", ",", "dec", ")", ":", "DATA", "=", "\"www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca\"", "BASE", "=", "\"http://\"", "+", "DATA", "+", "\"/authProxy/getData\"", "archive", "=", "\"CFHT\"", "wcs", "=", "\"corrected\"", "import", ...
Create a link that connects to a getData URL
[ "Create", "a", "link", "that", "connects", "to", "a", "getData", "URL" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/cfeps_object.py#L57-L75
etesync/pyetesync
example_crud.py
EtesyncCRUD.create_event
def create_event(self, event): """Create event Parameters ---------- event : iCalendar file as a string (calendar containing one event to be added) """ ev = api.Event.create(self.journal.collection, event) ev.save()
python
def create_event(self, event): """Create event Parameters ---------- event : iCalendar file as a string (calendar containing one event to be added) """ ev = api.Event.create(self.journal.collection, event) ev.save()
[ "def", "create_event", "(", "self", ",", "event", ")", ":", "ev", "=", "api", ".", "Event", ".", "create", "(", "self", ".", "journal", ".", "collection", ",", "event", ")", "ev", ".", "save", "(", ")" ]
Create event Parameters ---------- event : iCalendar file as a string (calendar containing one event to be added)
[ "Create", "event" ]
train
https://github.com/etesync/pyetesync/blob/6b185925b1489912c971e99d6a115583021873bd/example_crud.py#L53-L62
etesync/pyetesync
example_crud.py
EtesyncCRUD.update_event
def update_event(self, event, uid): """Edit event Parameters ---------- event : iCalendar file as a string (calendar containing one event to be updated) uid : uid of event to be updated """ ev_for_change = self.calendar.get(uid) ev_for_change.cont...
python
def update_event(self, event, uid): """Edit event Parameters ---------- event : iCalendar file as a string (calendar containing one event to be updated) uid : uid of event to be updated """ ev_for_change = self.calendar.get(uid) ev_for_change.cont...
[ "def", "update_event", "(", "self", ",", "event", ",", "uid", ")", ":", "ev_for_change", "=", "self", ".", "calendar", ".", "get", "(", "uid", ")", "ev_for_change", ".", "content", "=", "event", "ev_for_change", ".", "save", "(", ")" ]
Edit event Parameters ---------- event : iCalendar file as a string (calendar containing one event to be updated) uid : uid of event to be updated
[ "Edit", "event" ]
train
https://github.com/etesync/pyetesync/blob/6b185925b1489912c971e99d6a115583021873bd/example_crud.py#L64-L75
etesync/pyetesync
example_crud.py
EtesyncCRUD.delete_event
def delete_event(self, uid): """Delete event and sync calendar Parameters ---------- uid : uid of event to be deleted """ ev_for_deletion = self.calendar.get(uid) ev_for_deletion.delete()
python
def delete_event(self, uid): """Delete event and sync calendar Parameters ---------- uid : uid of event to be deleted """ ev_for_deletion = self.calendar.get(uid) ev_for_deletion.delete()
[ "def", "delete_event", "(", "self", ",", "uid", ")", ":", "ev_for_deletion", "=", "self", ".", "calendar", ".", "get", "(", "uid", ")", "ev_for_deletion", ".", "delete", "(", ")" ]
Delete event and sync calendar Parameters ---------- uid : uid of event to be deleted
[ "Delete", "event", "and", "sync", "calendar" ]
train
https://github.com/etesync/pyetesync/blob/6b185925b1489912c971e99d6a115583021873bd/example_crud.py#L100-L108
JohnVinyard/zounds
zounds/util/persistence.py
simple_lmdb_settings
def simple_lmdb_settings(path, map_size=1e9, user_supplied_id=False): """ Creates a decorator that can be used to configure sane default LMDB persistence settings for a model Args: path (str): The path where the LMDB database files will be created map_size (int): The amount of space to ...
python
def simple_lmdb_settings(path, map_size=1e9, user_supplied_id=False): """ Creates a decorator that can be used to configure sane default LMDB persistence settings for a model Args: path (str): The path where the LMDB database files will be created map_size (int): The amount of space to ...
[ "def", "simple_lmdb_settings", "(", "path", ",", "map_size", "=", "1e9", ",", "user_supplied_id", "=", "False", ")", ":", "def", "decorator", "(", "cls", ")", ":", "provider", "=", "ff", ".", "UserSpecifiedIdProvider", "(", "key", "=", "'_id'", ")", "if", ...
Creates a decorator that can be used to configure sane default LMDB persistence settings for a model Args: path (str): The path where the LMDB database files will be created map_size (int): The amount of space to allot for the database
[ "Creates", "a", "decorator", "that", "can", "be", "used", "to", "configure", "sane", "default", "LMDB", "persistence", "settings", "for", "a", "model" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/util/persistence.py#L4-L32
JohnVinyard/zounds
zounds/util/persistence.py
simple_in_memory_settings
def simple_in_memory_settings(cls): """ Decorator that returns a class that "persists" data in-memory. Mostly useful for testing :param cls: the class whose features should be persisted in-memory :return: A new class that will persist features in memory """ class Settings(ff.PersistenceSe...
python
def simple_in_memory_settings(cls): """ Decorator that returns a class that "persists" data in-memory. Mostly useful for testing :param cls: the class whose features should be persisted in-memory :return: A new class that will persist features in memory """ class Settings(ff.PersistenceSe...
[ "def", "simple_in_memory_settings", "(", "cls", ")", ":", "class", "Settings", "(", "ff", ".", "PersistenceSettings", ")", ":", "id_provider", "=", "ff", ".", "UuidProvider", "(", ")", "key_builder", "=", "ff", ".", "StringDelimitedKeyBuilder", "(", ")", "data...
Decorator that returns a class that "persists" data in-memory. Mostly useful for testing :param cls: the class whose features should be persisted in-memory :return: A new class that will persist features in memory
[ "Decorator", "that", "returns", "a", "class", "that", "persists", "data", "in", "-", "memory", ".", "Mostly", "useful", "for", "testing", ":", "param", "cls", ":", "the", "class", "whose", "features", "should", "be", "persisted", "in", "-", "memory", ":", ...
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/util/persistence.py#L53-L71
OSSOS/MOP
src/ossos/core/ossos/cameras.py
Camera.offset
def offset(self, index=0): """Offset the camera pointing to be centred on a particular CCD.""" eta = self._geometry[self.camera][index]["ra"] xi = self._geometry[self.camera][index]["dec"] ra = self.origin.ra - (eta/math.cos(self.dec.radian))*units.degree dec = self.origin.dec - ...
python
def offset(self, index=0): """Offset the camera pointing to be centred on a particular CCD.""" eta = self._geometry[self.camera][index]["ra"] xi = self._geometry[self.camera][index]["dec"] ra = self.origin.ra - (eta/math.cos(self.dec.radian))*units.degree dec = self.origin.dec - ...
[ "def", "offset", "(", "self", ",", "index", "=", "0", ")", ":", "eta", "=", "self", ".", "_geometry", "[", "self", ".", "camera", "]", "[", "index", "]", "[", "\"ra\"", "]", "xi", "=", "self", ".", "_geometry", "[", "self", ".", "camera", "]", ...
Offset the camera pointing to be centred on a particular CCD.
[ "Offset", "the", "camera", "pointing", "to", "be", "centred", "on", "a", "particular", "CCD", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/cameras.py#L213-L219
OSSOS/MOP
src/ossos/core/ossos/cameras.py
Camera.coord
def coord(self): """The center of the camera pointing in sky coordinates""" if self._coordinate is None: self._coordinate = SkyCoord(self.origin.ra, self.origin.dec + 45 * units.arcsec) return self._coordinate
python
def coord(self): """The center of the camera pointing in sky coordinates""" if self._coordinate is None: self._coordinate = SkyCoord(self.origin.ra, self.origin.dec + 45 * units.arcsec) return self._coordinate
[ "def", "coord", "(", "self", ")", ":", "if", "self", ".", "_coordinate", "is", "None", ":", "self", ".", "_coordinate", "=", "SkyCoord", "(", "self", ".", "origin", ".", "ra", ",", "self", ".", "origin", ".", "dec", "+", "45", "*", "units", ".", ...
The center of the camera pointing in sky coordinates
[ "The", "center", "of", "the", "camera", "pointing", "in", "sky", "coordinates" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/cameras.py#L226-L230
OSSOS/MOP
src/ossos/core/ossos/cameras.py
Camera.geometry
def geometry(self): """Return an array of rectangles that represent the 'ra,dec' corners of the FOV @rtype: list """ if self.coord is None: return None ra = self.coord.ra.degree dec = self.coord.dec.degree ccds = [] for geo in self._geometry...
python
def geometry(self): """Return an array of rectangles that represent the 'ra,dec' corners of the FOV @rtype: list """ if self.coord is None: return None ra = self.coord.ra.degree dec = self.coord.dec.degree ccds = [] for geo in self._geometry...
[ "def", "geometry", "(", "self", ")", ":", "if", "self", ".", "coord", "is", "None", ":", "return", "None", "ra", "=", "self", ".", "coord", ".", "ra", ".", "degree", "dec", "=", "self", ".", "coord", ".", "dec", ".", "degree", "ccds", "=", "[", ...
Return an array of rectangles that represent the 'ra,dec' corners of the FOV @rtype: list
[ "Return", "an", "array", "of", "rectangles", "that", "represent", "the", "ra", "dec", "corners", "of", "the", "FOV", "@rtype", ":", "list" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/cameras.py#L283-L305
OSSOS/MOP
src/ossos/core/ossos/cameras.py
Camera.separation
def separation(self, ra, dec): """Compute the separation between self and (ra,dec)""" if self.coord is None: return None return self.coord.separation(SkyCoord(ra, dec, unit=('degree', 'degree')))
python
def separation(self, ra, dec): """Compute the separation between self and (ra,dec)""" if self.coord is None: return None return self.coord.separation(SkyCoord(ra, dec, unit=('degree', 'degree')))
[ "def", "separation", "(", "self", ",", "ra", ",", "dec", ")", ":", "if", "self", ".", "coord", "is", "None", ":", "return", "None", "return", "self", ".", "coord", ".", "separation", "(", "SkyCoord", "(", "ra", ",", "dec", ",", "unit", "=", "(", ...
Compute the separation between self and (ra,dec)
[ "Compute", "the", "separation", "between", "self", "and", "(", "ra", "dec", ")" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/cameras.py#L307-L311
OSSOS/MOP
src/jjk/preproc/preproc.py
trim
def trim(hdu): """TRIM a CFHT MEGAPRIME frame using the DATASEC keyword""" datasec = re.findall(r'(\d+)', hdu.header.get('DATASEC')) l=int(datasec[0])-1 r=int(datasec[1]) b=int(datasec[2])-1 t=int(datasec[3]) if opt.verbose: print "Trimming [%d:%d,%d:%d]" % ...
python
def trim(hdu): """TRIM a CFHT MEGAPRIME frame using the DATASEC keyword""" datasec = re.findall(r'(\d+)', hdu.header.get('DATASEC')) l=int(datasec[0])-1 r=int(datasec[1]) b=int(datasec[2])-1 t=int(datasec[3]) if opt.verbose: print "Trimming [%d:%d,%d:%d]" % ...
[ "def", "trim", "(", "hdu", ")", ":", "datasec", "=", "re", ".", "findall", "(", "r'(\\d+)'", ",", "hdu", ".", "header", ".", "get", "(", "'DATASEC'", ")", ")", "l", "=", "int", "(", "datasec", "[", "0", "]", ")", "-", "1", "r", "=", "int", "(...
TRIM a CFHT MEGAPRIME frame using the DATASEC keyword
[ "TRIM", "a", "CFHT", "MEGAPRIME", "frame", "using", "the", "DATASEC", "keyword" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/preproc.py#L55-L68
OSSOS/MOP
src/jjk/preproc/preproc.py
overscan
def overscan(hdu): """Overscan subtract a CFHT MEGAPRIME frame. oversan(hdu) --> status The BIAS section keywords are expected to be BSEC[A|B] (for amps A and B) and the AMP sectoin is ASEC[A|B]. """ for amp in (['A','B']): AMPKW= 'ASEC'+amp BIASKW= 'BSEC'+amp dsec=re.f...
python
def overscan(hdu): """Overscan subtract a CFHT MEGAPRIME frame. oversan(hdu) --> status The BIAS section keywords are expected to be BSEC[A|B] (for amps A and B) and the AMP sectoin is ASEC[A|B]. """ for amp in (['A','B']): AMPKW= 'ASEC'+amp BIASKW= 'BSEC'+amp dsec=re.f...
[ "def", "overscan", "(", "hdu", ")", ":", "for", "amp", "in", "(", "[", "'A'", ",", "'B'", "]", ")", ":", "AMPKW", "=", "'ASEC'", "+", "amp", "BIASKW", "=", "'BSEC'", "+", "amp", "dsec", "=", "re", ".", "findall", "(", "r'(\\d+)'", ",", "hdu", "...
Overscan subtract a CFHT MEGAPRIME frame. oversan(hdu) --> status The BIAS section keywords are expected to be BSEC[A|B] (for amps A and B) and the AMP sectoin is ASEC[A|B].
[ "Overscan", "subtract", "a", "CFHT", "MEGAPRIME", "frame", ".", "oversan", "(", "hdu", ")", "--", ">", "status" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/preproc.py#L70-L106
OSSOS/MOP
src/ossos/core/ossos/gui/progress.py
requires_lock
def requires_lock(function): """ Decorator to check if the user owns the required lock. The first argument must be the filename. """ def new_lock_requiring_function(self, filename, *args, **kwargs): if self.owns_lock(filename): return function(self, filename, *args, **kwargs) ...
python
def requires_lock(function): """ Decorator to check if the user owns the required lock. The first argument must be the filename. """ def new_lock_requiring_function(self, filename, *args, **kwargs): if self.owns_lock(filename): return function(self, filename, *args, **kwargs) ...
[ "def", "requires_lock", "(", "function", ")", ":", "def", "new_lock_requiring_function", "(", "self", ",", "filename", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "owns_lock", "(", "filename", ")", ":", "return", "function", "...
Decorator to check if the user owns the required lock. The first argument must be the filename.
[ "Decorator", "to", "check", "if", "the", "user", "owns", "the", "required", "lock", ".", "The", "first", "argument", "must", "be", "the", "filename", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/progress.py#L29-L41
OSSOS/MOP
src/ossos/core/ossos/gui/progress.py
LocalProgressManager.clean
def clean(self, suffixes=None): """ Remove all persistence-related files from the directory. """ if suffixes is None: suffixes = [DONE_SUFFIX, LOCK_SUFFIX, PART_SUFFIX] for suffix in suffixes: listing = self.working_context.get_listing(suffix) ...
python
def clean(self, suffixes=None): """ Remove all persistence-related files from the directory. """ if suffixes is None: suffixes = [DONE_SUFFIX, LOCK_SUFFIX, PART_SUFFIX] for suffix in suffixes: listing = self.working_context.get_listing(suffix) ...
[ "def", "clean", "(", "self", ",", "suffixes", "=", "None", ")", ":", "if", "suffixes", "is", "None", ":", "suffixes", "=", "[", "DONE_SUFFIX", ",", "LOCK_SUFFIX", ",", "PART_SUFFIX", "]", "for", "suffix", "in", "suffixes", ":", "listing", "=", "self", ...
Remove all persistence-related files from the directory.
[ "Remove", "all", "persistence", "-", "related", "files", "from", "the", "directory", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/progress.py#L359-L369
OSSOS/MOP
src/ossos/core/ossos/figures.py
setFigForm
def setFigForm(): """set the rcparams to EmulateApJ columnwidth=245.26 pts """ fig_width_pt = 245.26*2 inches_per_pt = 1.0/72.27 golden_mean = (math.sqrt(5.)-1.0)/2.0 fig_width = fig_width_pt*inches_per_pt fig_height = fig_width*golden_mean fig_size = [1.5*fig_width, fig_height] pa...
python
def setFigForm(): """set the rcparams to EmulateApJ columnwidth=245.26 pts """ fig_width_pt = 245.26*2 inches_per_pt = 1.0/72.27 golden_mean = (math.sqrt(5.)-1.0)/2.0 fig_width = fig_width_pt*inches_per_pt fig_height = fig_width*golden_mean fig_size = [1.5*fig_width, fig_height] pa...
[ "def", "setFigForm", "(", ")", ":", "fig_width_pt", "=", "245.26", "*", "2", "inches_per_pt", "=", "1.0", "/", "72.27", "golden_mean", "=", "(", "math", ".", "sqrt", "(", "5.", ")", "-", "1.0", ")", "/", "2.0", "fig_width", "=", "fig_width_pt", "*", ...
set the rcparams to EmulateApJ columnwidth=245.26 pts
[ "set", "the", "rcparams", "to", "EmulateApJ", "columnwidth", "=", "245", ".", "26", "pts" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/figures.py#L5-L30
OSSOS/MOP
src/ossos/web/web/auth/gms.py
getCert
def getCert(username, password, certHost=_SERVER, certfile=None, certQuery=_PROXY): """Access the cadc certificate server.""" if certfile is None: certfile = tempfile.NamedTemporaryFile() # Add the username and password. # If we knew the realm, we could use ...
python
def getCert(username, password, certHost=_SERVER, certfile=None, certQuery=_PROXY): """Access the cadc certificate server.""" if certfile is None: certfile = tempfile.NamedTemporaryFile() # Add the username and password. # If we knew the realm, we could use ...
[ "def", "getCert", "(", "username", ",", "password", ",", "certHost", "=", "_SERVER", ",", "certfile", "=", "None", ",", "certQuery", "=", "_PROXY", ")", ":", "if", "certfile", "is", "None", ":", "certfile", "=", "tempfile", ".", "NamedTemporaryFile", "(", ...
Access the cadc certificate server.
[ "Access", "the", "cadc", "certificate", "server", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/web/web/auth/gms.py#L51-L97
OSSOS/MOP
src/ossos/web/web/auth/gms.py
getGroupsURL
def getGroupsURL(certfile, group): """given a certfile load a list of groups that user is a member of""" GMS = "https://" + _SERVER + _GMS certfile.seek(0) buf = certfile.read() x509 = crypto.load_certificate(crypto.FILETYPE_PEM, buf) sep = "" dn = "" parts = [] for i in x509.get_...
python
def getGroupsURL(certfile, group): """given a certfile load a list of groups that user is a member of""" GMS = "https://" + _SERVER + _GMS certfile.seek(0) buf = certfile.read() x509 = crypto.load_certificate(crypto.FILETYPE_PEM, buf) sep = "" dn = "" parts = [] for i in x509.get_...
[ "def", "getGroupsURL", "(", "certfile", ",", "group", ")", ":", "GMS", "=", "\"https://\"", "+", "_SERVER", "+", "_GMS", "certfile", ".", "seek", "(", "0", ")", "buf", "=", "certfile", ".", "read", "(", ")", "x509", "=", "crypto", ".", "load_certificat...
given a certfile load a list of groups that user is a member of
[ "given", "a", "certfile", "load", "a", "list", "of", "groups", "that", "user", "is", "a", "member", "of" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/web/web/auth/gms.py#L100-L120
OSSOS/MOP
src/ossos/web/web/auth/gms.py
isMember
def isMember(userid, password, group): """Test to see if the given userid/password combo is an authenticated member of group. userid: CADC Username (str) password: CADC Password (str) group: CADC GMS group (str) """ try: certfile = getCert(userid, password) group_url = get...
python
def isMember(userid, password, group): """Test to see if the given userid/password combo is an authenticated member of group. userid: CADC Username (str) password: CADC Password (str) group: CADC GMS group (str) """ try: certfile = getCert(userid, password) group_url = get...
[ "def", "isMember", "(", "userid", ",", "password", ",", "group", ")", ":", "try", ":", "certfile", "=", "getCert", "(", "userid", ",", "password", ")", "group_url", "=", "getGroupsURL", "(", "certfile", ",", "group", ")", "logging", ".", "debug", "(", ...
Test to see if the given userid/password combo is an authenticated member of group. userid: CADC Username (str) password: CADC Password (str) group: CADC GMS group (str)
[ "Test", "to", "see", "if", "the", "given", "userid", "/", "password", "combo", "is", "an", "authenticated", "member", "of", "group", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/web/web/auth/gms.py#L123-L153
OSSOS/MOP
src/ossos/web/web/auth/gms.py
stub
def stub(): """Just some left over code""" form = cgi.FieldStorage() userid = form['userid'].value password = form['passwd'].value group = form['group'].value
python
def stub(): """Just some left over code""" form = cgi.FieldStorage() userid = form['userid'].value password = form['passwd'].value group = form['group'].value
[ "def", "stub", "(", ")", ":", "form", "=", "cgi", ".", "FieldStorage", "(", ")", "userid", "=", "form", "[", "'userid'", "]", ".", "value", "password", "=", "form", "[", "'passwd'", "]", ".", "value", "group", "=", "form", "[", "'group'", "]", ".",...
Just some left over code
[ "Just", "some", "left", "over", "code" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/web/web/auth/gms.py#L156-L161
OSSOS/MOP
src/ossos/core/ossos/wcs.py
sky2xypv
def sky2xypv(ra, dec, crpix1, crpix2, crval1, crval2, dc, pv, nord, maxiter=300): """ Transforms from celestial coordinates to pixel coordinates to taking non-linear distortion into account with the World Coordinate System FITS keywords as used in MegaPipe. For the inverse operation see xy2sky. ...
python
def sky2xypv(ra, dec, crpix1, crpix2, crval1, crval2, dc, pv, nord, maxiter=300): """ Transforms from celestial coordinates to pixel coordinates to taking non-linear distortion into account with the World Coordinate System FITS keywords as used in MegaPipe. For the inverse operation see xy2sky. ...
[ "def", "sky2xypv", "(", "ra", ",", "dec", ",", "crpix1", ",", "crpix2", ",", "crval1", ",", "crval2", ",", "dc", ",", "pv", ",", "nord", ",", "maxiter", "=", "300", ")", ":", "if", "math", ".", "fabs", "(", "ra", "-", "crval1", ")", ">", "100",...
Transforms from celestial coordinates to pixel coordinates to taking non-linear distortion into account with the World Coordinate System FITS keywords as used in MegaPipe. For the inverse operation see xy2sky. Reference material: http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/megapipe/docs/CD_PV_keyw...
[ "Transforms", "from", "celestial", "coordinates", "to", "pixel", "coordinates", "to", "taking", "non", "-", "linear", "distortion", "into", "account", "with", "the", "World", "Coordinate", "System", "FITS", "keywords", "as", "used", "in", "MegaPipe", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/wcs.py#L132-L271
OSSOS/MOP
src/ossos/core/ossos/wcs.py
xy2skypv
def xy2skypv(x, y, crpix1, crpix2, crval1, crval2, cd, pv, nord): """ Transforms from pixel coordinates to celestial coordinates taking non-linear distortion into account with the World Coordinate System FITS keywords as used in MegaPipe. For the inverse operation see sky2xy Reference material...
python
def xy2skypv(x, y, crpix1, crpix2, crval1, crval2, cd, pv, nord): """ Transforms from pixel coordinates to celestial coordinates taking non-linear distortion into account with the World Coordinate System FITS keywords as used in MegaPipe. For the inverse operation see sky2xy Reference material...
[ "def", "xy2skypv", "(", "x", ",", "y", ",", "crpix1", ",", "crpix2", ",", "crval1", ",", "crval2", ",", "cd", ",", "pv", ",", "nord", ")", ":", "xp", "=", "x", "-", "crpix1", "yp", "=", "y", "-", "crpix2", "# IMPORTANT NOTE: 0-based indexing in Python ...
Transforms from pixel coordinates to celestial coordinates taking non-linear distortion into account with the World Coordinate System FITS keywords as used in MegaPipe. For the inverse operation see sky2xy Reference material: http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/megapipe/docs/CD_PV_keywords...
[ "Transforms", "from", "pixel", "coordinates", "to", "celestial", "coordinates", "taking", "non", "-", "linear", "distortion", "into", "account", "with", "the", "World", "Coordinate", "System", "FITS", "keywords", "as", "used", "in", "MegaPipe", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/wcs.py#L274-L370
OSSOS/MOP
src/ossos/core/ossos/wcs.py
parse_pv
def parse_pv(header): """ Parses the PV array from an astropy FITS header. Args: header: astropy.io.fits.header.Header The header containing the PV values. Returns: cd: 2d array (list(list(float)) [[PV1_0, PV1_1, ... PV1_N], [PV2_0, PV2_1, ... PV2_N]] Note that N de...
python
def parse_pv(header): """ Parses the PV array from an astropy FITS header. Args: header: astropy.io.fits.header.Header The header containing the PV values. Returns: cd: 2d array (list(list(float)) [[PV1_0, PV1_1, ... PV1_N], [PV2_0, PV2_1, ... PV2_N]] Note that N de...
[ "def", "parse_pv", "(", "header", ")", ":", "order_fit", "=", "parse_order_fit", "(", "header", ")", "def", "parse_with_base", "(", "i", ")", ":", "key_base", "=", "\"PV%d_\"", "%", "i", "pvi_x", "=", "[", "header", "[", "key_base", "+", "\"0\"", "]", ...
Parses the PV array from an astropy FITS header. Args: header: astropy.io.fits.header.Header The header containing the PV values. Returns: cd: 2d array (list(list(float)) [[PV1_0, PV1_1, ... PV1_N], [PV2_0, PV2_1, ... PV2_N]] Note that N depends on the order of the fit. Fo...
[ "Parses", "the", "PV", "array", "from", "an", "astropy", "FITS", "header", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/wcs.py#L389-L425
JohnVinyard/zounds
zounds/nputil/npx.py
safe_unit_norm
def safe_unit_norm(a): """ Ensure that the vector or vectors have unit norm """ if 1 == len(a.shape): n = np.linalg.norm(a) if n: return a / n return a norm = np.sum(np.abs(a) ** 2, axis=-1) ** (1. / 2) # Dividing by a norm of zero will cause a warning to be...
python
def safe_unit_norm(a): """ Ensure that the vector or vectors have unit norm """ if 1 == len(a.shape): n = np.linalg.norm(a) if n: return a / n return a norm = np.sum(np.abs(a) ** 2, axis=-1) ** (1. / 2) # Dividing by a norm of zero will cause a warning to be...
[ "def", "safe_unit_norm", "(", "a", ")", ":", "if", "1", "==", "len", "(", "a", ".", "shape", ")", ":", "n", "=", "np", ".", "linalg", ".", "norm", "(", "a", ")", "if", "n", ":", "return", "a", "/", "n", "return", "a", "norm", "=", "np", "."...
Ensure that the vector or vectors have unit norm
[ "Ensure", "that", "the", "vector", "or", "vectors", "have", "unit", "norm" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/nputil/npx.py#L47-L63
JohnVinyard/zounds
zounds/nputil/npx.py
pad
def pad(a, desiredlength): """ Pad an n-dimensional numpy array with zeros along the zero-th dimension so that it is the desired length. Return it unchanged if it is greater than or equal to the desired length """ if len(a) >= desiredlength: return a islist = isinstance(a, list) ...
python
def pad(a, desiredlength): """ Pad an n-dimensional numpy array with zeros along the zero-th dimension so that it is the desired length. Return it unchanged if it is greater than or equal to the desired length """ if len(a) >= desiredlength: return a islist = isinstance(a, list) ...
[ "def", "pad", "(", "a", ",", "desiredlength", ")", ":", "if", "len", "(", "a", ")", ">=", "desiredlength", ":", "return", "a", "islist", "=", "isinstance", "(", "a", ",", "list", ")", "a", "=", "np", ".", "array", "(", "a", ")", "diff", "=", "d...
Pad an n-dimensional numpy array with zeros along the zero-th dimension so that it is the desired length. Return it unchanged if it is greater than or equal to the desired length
[ "Pad", "an", "n", "-", "dimensional", "numpy", "array", "with", "zeros", "along", "the", "zero", "-", "th", "dimension", "so", "that", "it", "is", "the", "desired", "length", ".", "Return", "it", "unchanged", "if", "it", "is", "greater", "than", "or", ...
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/nputil/npx.py#L66-L83
JohnVinyard/zounds
zounds/nputil/npx.py
_wpad
def _wpad(l, windowsize, stepsize): """ Parameters l - The length of the input array windowsize - the size of each window of samples stepsize - the number of samples to move the window each step Returns The length the input array should be so that no samples are leftover ...
python
def _wpad(l, windowsize, stepsize): """ Parameters l - The length of the input array windowsize - the size of each window of samples stepsize - the number of samples to move the window each step Returns The length the input array should be so that no samples are leftover ...
[ "def", "_wpad", "(", "l", ",", "windowsize", ",", "stepsize", ")", ":", "if", "l", "<=", "windowsize", ":", "return", "windowsize", "nsteps", "=", "(", "(", "l", "//", "stepsize", ")", "*", "stepsize", ")", "overlap", "=", "(", "windowsize", "-", "st...
Parameters l - The length of the input array windowsize - the size of each window of samples stepsize - the number of samples to move the window each step Returns The length the input array should be so that no samples are leftover
[ "Parameters", "l", "-", "The", "length", "of", "the", "input", "array", "windowsize", "-", "the", "size", "of", "each", "window", "of", "samples", "stepsize", "-", "the", "number", "of", "samples", "to", "move", "the", "window", "each", "step" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/nputil/npx.py#L86-L106
JohnVinyard/zounds
zounds/nputil/npx.py
_wcut
def _wcut(l, windowsize, stepsize): """ Parameters l - The length of the input array windowsize - the size of each window of samples stepsize - the number of samples to move the window each step Returns The length the input array should be so that leftover samples are ignore...
python
def _wcut(l, windowsize, stepsize): """ Parameters l - The length of the input array windowsize - the size of each window of samples stepsize - the number of samples to move the window each step Returns The length the input array should be so that leftover samples are ignore...
[ "def", "_wcut", "(", "l", ",", "windowsize", ",", "stepsize", ")", ":", "end", "=", "l", "-", "windowsize", "if", "l", "<=", "windowsize", ":", "return", "0", ",", "0", "elif", "end", "%", "stepsize", ":", "l", "=", "windowsize", "+", "(", "(", "...
Parameters l - The length of the input array windowsize - the size of each window of samples stepsize - the number of samples to move the window each step Returns The length the input array should be so that leftover samples are ignored
[ "Parameters", "l", "-", "The", "length", "of", "the", "input", "array", "windowsize", "-", "the", "size", "of", "each", "window", "of", "samples", "stepsize", "-", "the", "number", "of", "samples", "to", "move", "the", "window", "each", "step" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/nputil/npx.py#L109-L125
JohnVinyard/zounds
zounds/nputil/npx.py
windowed
def windowed(a, windowsize, stepsize=None, dopad=False): """ Parameters a - the input array to restructure into overlapping windows windowsize - the size of each window of samples stepsize - the number of samples to shift the window each step. If not speci...
python
def windowed(a, windowsize, stepsize=None, dopad=False): """ Parameters a - the input array to restructure into overlapping windows windowsize - the size of each window of samples stepsize - the number of samples to shift the window each step. If not speci...
[ "def", "windowed", "(", "a", ",", "windowsize", ",", "stepsize", "=", "None", ",", "dopad", "=", "False", ")", ":", "if", "windowsize", "<", "1", ":", "raise", "ValueError", "(", "'windowsize must be greater than or equal to one'", ")", "if", "stepsize", "is",...
Parameters a - the input array to restructure into overlapping windows windowsize - the size of each window of samples stepsize - the number of samples to shift the window each step. If not specified, this defaults to windowsize dopad - If false (defa...
[ "Parameters", "a", "-", "the", "input", "array", "to", "restructure", "into", "overlapping", "windows", "windowsize", "-", "the", "size", "of", "each", "window", "of", "samples", "stepsize", "-", "the", "number", "of", "samples", "to", "shift", "the", "windo...
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/nputil/npx.py#L128-L190
JohnVinyard/zounds
zounds/nputil/npx.py
Growable.append
def append(self, item): """ append a single item to the array, growing the wrapped numpy array if necessary """ try: self._data[self._position] = item except IndexError: self._grow() self._data[self._position] = item self._posit...
python
def append(self, item): """ append a single item to the array, growing the wrapped numpy array if necessary """ try: self._data[self._position] = item except IndexError: self._grow() self._data[self._position] = item self._posit...
[ "def", "append", "(", "self", ",", "item", ")", ":", "try", ":", "self", ".", "_data", "[", "self", ".", "_position", "]", "=", "item", "except", "IndexError", ":", "self", ".", "_grow", "(", ")", "self", ".", "_data", "[", "self", ".", "_position"...
append a single item to the array, growing the wrapped numpy array if necessary
[ "append", "a", "single", "item", "to", "the", "array", "growing", "the", "wrapped", "numpy", "array", "if", "necessary" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/nputil/npx.py#L332-L343
JohnVinyard/zounds
zounds/nputil/npx.py
Growable.extend
def extend(self, items): """ extend the numpy array with multiple items, growing the wrapped array if necessary """ items = np.array(items) pos = items.shape[0] + self.logical_size if pos > self.physical_size: # more physical memory is needed than has ...
python
def extend(self, items): """ extend the numpy array with multiple items, growing the wrapped array if necessary """ items = np.array(items) pos = items.shape[0] + self.logical_size if pos > self.physical_size: # more physical memory is needed than has ...
[ "def", "extend", "(", "self", ",", "items", ")", ":", "items", "=", "np", ".", "array", "(", "items", ")", "pos", "=", "items", ".", "shape", "[", "0", "]", "+", "self", ".", "logical_size", "if", "pos", ">", "self", ".", "physical_size", ":", "#...
extend the numpy array with multiple items, growing the wrapped array if necessary
[ "extend", "the", "numpy", "array", "with", "multiple", "items", "growing", "the", "wrapped", "array", "if", "necessary" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/nputil/npx.py#L345-L367
OSSOS/MOP
src/ossos/core/ossos/fitsviewer/baseviewer.py
WxMPLFitsViewer.display
def display(self, cutout, use_pixel_coords=False): """ :param cutout: source cutout object to be display :type cutout: source.SourceCutout """ logging.debug("Current display list contains: {}".format(self._displayables_by_cutout.keys())) logging.debug("Looking for {}".for...
python
def display(self, cutout, use_pixel_coords=False): """ :param cutout: source cutout object to be display :type cutout: source.SourceCutout """ logging.debug("Current display list contains: {}".format(self._displayables_by_cutout.keys())) logging.debug("Looking for {}".for...
[ "def", "display", "(", "self", ",", "cutout", ",", "use_pixel_coords", "=", "False", ")", ":", "logging", ".", "debug", "(", "\"Current display list contains: {}\"", ".", "format", "(", "self", ".", "_displayables_by_cutout", ".", "keys", "(", ")", ")", ")", ...
:param cutout: source cutout object to be display :type cutout: source.SourceCutout
[ ":", "param", "cutout", ":", "source", "cutout", "object", "to", "be", "display", ":", "type", "cutout", ":", "source", ".", "SourceCutout" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/fitsviewer/baseviewer.py#L34-L53
OSSOS/MOP
src/ossos/core/ossos/fitsviewer/baseviewer.py
WxMPLFitsViewer.draw_uncertainty_ellipse
def draw_uncertainty_ellipse(self, cutout): """ Draws an ErrEllipse with the spcified dimensions. Only one ErrEllipse can be drawn and only once (not movable). """ if not self.mark_prediction: return try: colour = cutout.reading.from_input_file a...
python
def draw_uncertainty_ellipse(self, cutout): """ Draws an ErrEllipse with the spcified dimensions. Only one ErrEllipse can be drawn and only once (not movable). """ if not self.mark_prediction: return try: colour = cutout.reading.from_input_file a...
[ "def", "draw_uncertainty_ellipse", "(", "self", ",", "cutout", ")", ":", "if", "not", "self", ".", "mark_prediction", ":", "return", "try", ":", "colour", "=", "cutout", ".", "reading", ".", "from_input_file", "and", "'b'", "or", "'g'", "colour", "=", "cut...
Draws an ErrEllipse with the spcified dimensions. Only one ErrEllipse can be drawn and only once (not movable).
[ "Draws", "an", "ErrEllipse", "with", "the", "spcified", "dimensions", ".", "Only", "one", "ErrEllipse", "can", "be", "drawn", "and", "only", "once", "(", "not", "movable", ")", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/fitsviewer/baseviewer.py#L58-L112
OSSOS/MOP
src/ossos/core/ossos/fitsviewer/baseviewer.py
WxMPLFitsViewer.align
def align(self, cutout, reading, source): """ Set the display center to the reference point. @param cutout: The cutout to align on @type cutout: SourceCutout @param reading: The reading this cutout is from @type reading: SourceReading @param source: The source ...
python
def align(self, cutout, reading, source): """ Set the display center to the reference point. @param cutout: The cutout to align on @type cutout: SourceCutout @param reading: The reading this cutout is from @type reading: SourceReading @param source: The source ...
[ "def", "align", "(", "self", ",", "cutout", ",", "reading", ",", "source", ")", ":", "if", "not", "self", ".", "current_displayable", ":", "return", "if", "not", "self", ".", "current_displayable", ".", "aligned", ":", "focus_sky_coord", "=", "reading", "....
Set the display center to the reference point. @param cutout: The cutout to align on @type cutout: SourceCutout @param reading: The reading this cutout is from @type reading: SourceReading @param source: The source the reading is from @type source: Source @retu...
[ "Set", "the", "display", "center", "to", "the", "reference", "point", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/fitsviewer/baseviewer.py#L141-L163
OSSOS/MOP
src/ossos/core/ossos/daophot.py
phot
def phot(fits_filename, x_in, y_in, aperture=15, sky=20, swidth=10, apcor=0.3, maxcount=30000.0, exptime=1.0, zmag=None, extno=0, centroid=True): """ Compute the centroids and magnitudes of a bunch sources on fits image. :rtype : astropy.table.Table :param fits_filename: Name of fits image to...
python
def phot(fits_filename, x_in, y_in, aperture=15, sky=20, swidth=10, apcor=0.3, maxcount=30000.0, exptime=1.0, zmag=None, extno=0, centroid=True): """ Compute the centroids and magnitudes of a bunch sources on fits image. :rtype : astropy.table.Table :param fits_filename: Name of fits image to...
[ "def", "phot", "(", "fits_filename", ",", "x_in", ",", "y_in", ",", "aperture", "=", "15", ",", "sky", "=", "20", ",", "swidth", "=", "10", ",", "apcor", "=", "0.3", ",", "maxcount", "=", "30000.0", ",", "exptime", "=", "1.0", ",", "zmag", "=", "...
Compute the centroids and magnitudes of a bunch sources on fits image. :rtype : astropy.table.Table :param fits_filename: Name of fits image to measure source photometry on. :type fits_filename: str :param x_in: x location of source to measure :type x_in: float, numpy.array :param y_in: y loca...
[ "Compute", "the", "centroids", "and", "magnitudes", "of", "a", "bunch", "sources", "on", "fits", "image", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/daophot.py#L19-L158
OSSOS/MOP
src/ossos/core/ossos/daophot.py
phot_mag
def phot_mag(*args, **kwargs): """Wrapper around phot which only returns the computed magnitude directly.""" try: return phot(*args, **kwargs) except IndexError: raise TaskError("No photometric records returned for {0}".format(kwargs))
python
def phot_mag(*args, **kwargs): """Wrapper around phot which only returns the computed magnitude directly.""" try: return phot(*args, **kwargs) except IndexError: raise TaskError("No photometric records returned for {0}".format(kwargs))
[ "def", "phot_mag", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "phot", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "IndexError", ":", "raise", "TaskError", "(", "\"No photometric records returned for {0}\"", "."...
Wrapper around phot which only returns the computed magnitude directly.
[ "Wrapper", "around", "phot", "which", "only", "returns", "the", "computed", "magnitude", "directly", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/daophot.py#L161-L166
OSSOS/MOP
src/ossos/web/web/block/queries.py
BlockQuery.all_blocks
def all_blocks(self): status = OrderedDict.fromkeys(parameters.BLOCKS.keys()) status['13AE'] = ['discovery complete', '50', '24.05'] status['13AO'] = ['discovery complete', '36', '24.40'] status['13BL'] = ['discovery complete', '79', '24.48'] status['14BH'] = ['discovery running...
python
def all_blocks(self): status = OrderedDict.fromkeys(parameters.BLOCKS.keys()) status['13AE'] = ['discovery complete', '50', '24.05'] status['13AO'] = ['discovery complete', '36', '24.40'] status['13BL'] = ['discovery complete', '79', '24.48'] status['14BH'] = ['discovery running...
[ "def", "all_blocks", "(", "self", ")", ":", "status", "=", "OrderedDict", ".", "fromkeys", "(", "parameters", ".", "BLOCKS", ".", "keys", "(", ")", ")", "status", "[", "'13AE'", "]", "=", "[", "'discovery complete'", ",", "'50'", ",", "'24.05'", "]", "...
Overview tal table is expecting: ID observations processing status discoveries m_r 40%
[ "Overview", "tal", "table", "is", "expecting", ":", "ID", "observations", "processing", "status", "discoveries", "m_r", "40%" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/web/web/block/queries.py#L21-L45
playpauseandstop/rororo
rororo/settings.py
from_env
def from_env(key: str, default: T = None) -> Union[str, Optional[T]]: """Shortcut for safely reading environment variable. :param key: Environment var key. :param default: Return default value if environment var not found by given key. By default: ``None`` """ return os.getenv(key, ...
python
def from_env(key: str, default: T = None) -> Union[str, Optional[T]]: """Shortcut for safely reading environment variable. :param key: Environment var key. :param default: Return default value if environment var not found by given key. By default: ``None`` """ return os.getenv(key, ...
[ "def", "from_env", "(", "key", ":", "str", ",", "default", ":", "T", "=", "None", ")", "->", "Union", "[", "str", ",", "Optional", "[", "T", "]", "]", ":", "return", "os", ".", "getenv", "(", "key", ",", "default", ")" ]
Shortcut for safely reading environment variable. :param key: Environment var key. :param default: Return default value if environment var not found by given key. By default: ``None``
[ "Shortcut", "for", "safely", "reading", "environment", "variable", "." ]
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/settings.py#L26-L34