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/web/web/initiate/populate_ossuary.py | main | def main():
"""
Update the ossuary Postgres db with images observed for OSSOS.
iq: Go through and check all ossuary's images for new existence of IQs/zeropoints.
comment: Go through all ossuary and
Then updates ossuary with new images that are at any stage of processing.
Constructs full image en... | python | def main():
"""
Update the ossuary Postgres db with images observed for OSSOS.
iq: Go through and check all ossuary's images for new existence of IQs/zeropoints.
comment: Go through all ossuary and
Then updates ossuary with new images that are at any stage of processing.
Constructs full image en... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"\"-iq\"",
",",
"\"--iq\"",
",",
"action",
"=",
"\"store_true\"",
",",
"help",
"=",
"\"Check existing images in ossuary that do not yet ha... | Update the ossuary Postgres db with images observed for OSSOS.
iq: Go through and check all ossuary's images for new existence of IQs/zeropoints.
comment: Go through all ossuary and
Then updates ossuary with new images that are at any stage of processing.
Constructs full image entries, including header ... | [
"Update",
"the",
"ossuary",
"Postgres",
"db",
"with",
"images",
"observed",
"for",
"OSSOS",
".",
"iq",
":",
"Go",
"through",
"and",
"check",
"all",
"ossuary",
"s",
"images",
"for",
"new",
"existence",
"of",
"IQs",
"/",
"zeropoints",
".",
"comment",
":",
... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/web/web/initiate/populate_ossuary.py#L298-L370 |
JohnVinyard/zounds | zounds/spectral/frequencyadaptive.py | FrequencyAdaptive.square | def square(self, n_coeffs, do_overlap_add=False):
"""
Compute a "square" view of the frequency adaptive transform, by
resampling each frequency band such that they all contain the same
number of samples, and performing an overlap-add procedure in the
case where the sample frequen... | python | def square(self, n_coeffs, do_overlap_add=False):
"""
Compute a "square" view of the frequency adaptive transform, by
resampling each frequency band such that they all contain the same
number of samples, and performing an overlap-add procedure in the
case where the sample frequen... | [
"def",
"square",
"(",
"self",
",",
"n_coeffs",
",",
"do_overlap_add",
"=",
"False",
")",
":",
"resampled_bands",
"=",
"[",
"self",
".",
"_resample",
"(",
"band",
",",
"n_coeffs",
")",
"for",
"band",
"in",
"self",
".",
"iter_bands",
"(",
")",
"]",
"stac... | Compute a "square" view of the frequency adaptive transform, by
resampling each frequency band such that they all contain the same
number of samples, and performing an overlap-add procedure in the
case where the sample frequency and duration differ
:param n_coeffs: The common size to whi... | [
"Compute",
"a",
"square",
"view",
"of",
"the",
"frequency",
"adaptive",
"transform",
"by",
"resampling",
"each",
"frequency",
"band",
"such",
"that",
"they",
"all",
"contain",
"the",
"same",
"number",
"of",
"samples",
"and",
"performing",
"an",
"overlap",
"-",... | train | https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/frequencyadaptive.py#L94-L145 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/calculator.py | CoordinateConverter.convert | def convert(self, point):
"""
Convert a point from one coordinate system to another.
Args:
point: tuple(int x, int y)
The point in the original coordinate system.
Returns:
converted_point: tuple(int x, int y)
The point in the new coordinate s... | python | def convert(self, point):
"""
Convert a point from one coordinate system to another.
Args:
point: tuple(int x, int y)
The point in the original coordinate system.
Returns:
converted_point: tuple(int x, int y)
The point in the new coordinate s... | [
"def",
"convert",
"(",
"self",
",",
"point",
")",
":",
"x",
",",
"y",
"=",
"point",
"(",
"x1",
",",
"y1",
")",
"=",
"x",
"-",
"self",
".",
"x_offset",
",",
"y",
"-",
"self",
".",
"y_offset",
"logger",
".",
"debug",
"(",
"\"converted {} {} ==> {} {}... | Convert a point from one coordinate system to another.
Args:
point: tuple(int x, int y)
The point in the original coordinate system.
Returns:
converted_point: tuple(int x, int y)
The point in the new coordinate system.
Example: convert coordinate fr... | [
"Convert",
"a",
"point",
"from",
"one",
"coordinate",
"system",
"to",
"another",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/calculator.py#L36-L56 |
JohnVinyard/zounds | zounds/learn/util.py | simple_settings | def simple_settings(cls):
"""
Create sane default persistence settings for learning pipelines
:param cls: The class to decorate
"""
class Settings(ff.PersistenceSettings):
_id = cls.__name__
id_provider = ff.StaticIdProvider(_id)
key_builder = ff.StringDelimitedKeyBuilder()
... | python | def simple_settings(cls):
"""
Create sane default persistence settings for learning pipelines
:param cls: The class to decorate
"""
class Settings(ff.PersistenceSettings):
_id = cls.__name__
id_provider = ff.StaticIdProvider(_id)
key_builder = ff.StringDelimitedKeyBuilder()
... | [
"def",
"simple_settings",
"(",
"cls",
")",
":",
"class",
"Settings",
"(",
"ff",
".",
"PersistenceSettings",
")",
":",
"_id",
"=",
"cls",
".",
"__name__",
"id_provider",
"=",
"ff",
".",
"StaticIdProvider",
"(",
"_id",
")",
"key_builder",
"=",
"ff",
".",
"... | Create sane default persistence settings for learning pipelines
:param cls: The class to decorate | [
"Create",
"sane",
"default",
"persistence",
"settings",
"for",
"learning",
"pipelines",
":",
"param",
"cls",
":",
"The",
"class",
"to",
"decorate"
] | train | https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/learn/util.py#L11-L29 |
JohnVinyard/zounds | zounds/learn/util.py | apply_network | def apply_network(network, x, chunksize=None):
"""
Apply a pytorch network, potentially in chunks
"""
network_is_cuda = next(network.parameters()).is_cuda
x = torch.from_numpy(x)
with torch.no_grad():
if network_is_cuda:
x = x.cuda()
if chunksize is None:
... | python | def apply_network(network, x, chunksize=None):
"""
Apply a pytorch network, potentially in chunks
"""
network_is_cuda = next(network.parameters()).is_cuda
x = torch.from_numpy(x)
with torch.no_grad():
if network_is_cuda:
x = x.cuda()
if chunksize is None:
... | [
"def",
"apply_network",
"(",
"network",
",",
"x",
",",
"chunksize",
"=",
"None",
")",
":",
"network_is_cuda",
"=",
"next",
"(",
"network",
".",
"parameters",
"(",
")",
")",
".",
"is_cuda",
"x",
"=",
"torch",
".",
"from_numpy",
"(",
"x",
")",
"with",
... | Apply a pytorch network, potentially in chunks | [
"Apply",
"a",
"pytorch",
"network",
"potentially",
"in",
"chunks"
] | train | https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/learn/util.py#L92-L109 |
JohnVinyard/zounds | zounds/learn/util.py | sample_norm | def sample_norm(x):
"""
pixel norm as described in section 4.2 here:
https://arxiv.org/pdf/1710.10196.pdf
"""
original = x
# square
x = x ** 2
# feature-map-wise sum
x = torch.sum(x, dim=1)
# scale by number of feature maps
x *= 1.0 / original.shape[1]
x += 10e-8
x = ... | python | def sample_norm(x):
"""
pixel norm as described in section 4.2 here:
https://arxiv.org/pdf/1710.10196.pdf
"""
original = x
# square
x = x ** 2
# feature-map-wise sum
x = torch.sum(x, dim=1)
# scale by number of feature maps
x *= 1.0 / original.shape[1]
x += 10e-8
x = ... | [
"def",
"sample_norm",
"(",
"x",
")",
":",
"original",
"=",
"x",
"# square",
"x",
"=",
"x",
"**",
"2",
"# feature-map-wise sum",
"x",
"=",
"torch",
".",
"sum",
"(",
"x",
",",
"dim",
"=",
"1",
")",
"# scale by number of feature maps",
"x",
"*=",
"1.0",
"... | pixel norm as described in section 4.2 here:
https://arxiv.org/pdf/1710.10196.pdf | [
"pixel",
"norm",
"as",
"described",
"in",
"section",
"4",
".",
"2",
"here",
":",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"pdf",
"/",
"1710",
".",
"10196",
".",
"pdf"
] | train | https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/learn/util.py#L112-L126 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.reset_coord | def reset_coord(self):
"""
Reset the source location based on the init_skycoord values
@return:
"""
(x, y, idx) = self.world2pix(self.init_skycoord.ra,
self.init_skycoord.dec,
usepv=True)
self.updat... | python | def reset_coord(self):
"""
Reset the source location based on the init_skycoord values
@return:
"""
(x, y, idx) = self.world2pix(self.init_skycoord.ra,
self.init_skycoord.dec,
usepv=True)
self.updat... | [
"def",
"reset_coord",
"(",
"self",
")",
":",
"(",
"x",
",",
"y",
",",
"idx",
")",
"=",
"self",
".",
"world2pix",
"(",
"self",
".",
"init_skycoord",
".",
"ra",
",",
"self",
".",
"init_skycoord",
".",
"dec",
",",
"usepv",
"=",
"True",
")",
"self",
... | Reset the source location based on the init_skycoord values
@return: | [
"Reset",
"the",
"source",
"location",
"based",
"on",
"the",
"init_skycoord",
"values"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L63-L71 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.pixel_coord | def pixel_coord(self):
"""
Return the coordinates of the source in the cutout reference frame.
@return:
"""
return self.get_pixel_coordinates(self.reading.pix_coord, self.reading.get_ccd_num()) | python | def pixel_coord(self):
"""
Return the coordinates of the source in the cutout reference frame.
@return:
"""
return self.get_pixel_coordinates(self.reading.pix_coord, self.reading.get_ccd_num()) | [
"def",
"pixel_coord",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_pixel_coordinates",
"(",
"self",
".",
"reading",
".",
"pix_coord",
",",
"self",
".",
"reading",
".",
"get_ccd_num",
"(",
")",
")"
] | Return the coordinates of the source in the cutout reference frame.
@return: | [
"Return",
"the",
"coordinates",
"of",
"the",
"source",
"in",
"the",
"cutout",
"reference",
"frame",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L74-L79 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.get_hdulist_idx | def get_hdulist_idx(self, ccdnum):
"""
The SourceCutout is a list of HDUs, this method returns the index of the HDU that corresponds to the given
ccd number. CCDs are numbers from 0, but the first CCD (CCDNUM=0) is often in extension 1 of an MEF.
@param ccdnum: the number of the CCD in ... | python | def get_hdulist_idx(self, ccdnum):
"""
The SourceCutout is a list of HDUs, this method returns the index of the HDU that corresponds to the given
ccd number. CCDs are numbers from 0, but the first CCD (CCDNUM=0) is often in extension 1 of an MEF.
@param ccdnum: the number of the CCD in ... | [
"def",
"get_hdulist_idx",
"(",
"self",
",",
"ccdnum",
")",
":",
"for",
"(",
"extno",
",",
"hdu",
")",
"in",
"enumerate",
"(",
"self",
".",
"hdulist",
")",
":",
"if",
"ccdnum",
"==",
"int",
"(",
"hdu",
".",
"header",
".",
"get",
"(",
"'EXTVER'",
","... | The SourceCutout is a list of HDUs, this method returns the index of the HDU that corresponds to the given
ccd number. CCDs are numbers from 0, but the first CCD (CCDNUM=0) is often in extension 1 of an MEF.
@param ccdnum: the number of the CCD in the MEF that is being referenced.
@return: the ... | [
"The",
"SourceCutout",
"is",
"a",
"list",
"of",
"HDUs",
"this",
"method",
"returns",
"the",
"index",
"of",
"the",
"HDU",
"that",
"corresponds",
"to",
"the",
"given",
"ccd",
"number",
".",
"CCDs",
"are",
"numbers",
"from",
"0",
"but",
"the",
"first",
"CCD... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L118-L129 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.flip_flip | def flip_flip(self, point):
"""
Sometimes we 'flipped' the X/Y coordinates of the image during processing. This function takes an
(x,y) location from the processing pipeline and returns the x/y location relative to the original
reference frame. (Correctly checks if the coordinate is f... | python | def flip_flip(self, point):
"""
Sometimes we 'flipped' the X/Y coordinates of the image during processing. This function takes an
(x,y) location from the processing pipeline and returns the x/y location relative to the original
reference frame. (Correctly checks if the coordinate is f... | [
"def",
"flip_flip",
"(",
"self",
",",
"point",
")",
":",
"x",
",",
"y",
"=",
"point",
"if",
"self",
".",
"reading",
".",
"compute_inverted",
"(",
")",
":",
"naxis1",
"=",
"self",
".",
"reading",
".",
"obs",
".",
"header",
".",
"get",
"(",
"self",
... | Sometimes we 'flipped' the X/Y coordinates of the image during processing. This function takes an
(x,y) location from the processing pipeline and returns the x/y location relative to the original
reference frame. (Correctly checks if the coordinate is flipped to begin with.)
This is only for... | [
"Sometimes",
"we",
"flipped",
"the",
"X",
"/",
"Y",
"coordinates",
"of",
"the",
"image",
"during",
"processing",
".",
"This",
"function",
"takes",
"an",
"(",
"x",
"y",
")",
"location",
"from",
"the",
"processing",
"pipeline",
"and",
"returns",
"the",
"x",
... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L131-L157 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.update_pixel_location | def update_pixel_location(self, new_pixel_location, hdu_index):
"""
Update the x/y location of the associated reading by using new_pixel_location and transforming from cutout
reference frame to observation refrence frame.
@param new_pixel_location: (x, y) location of the source in cutout... | python | def update_pixel_location(self, new_pixel_location, hdu_index):
"""
Update the x/y location of the associated reading by using new_pixel_location and transforming from cutout
reference frame to observation refrence frame.
@param new_pixel_location: (x, y) location of the source in cutout... | [
"def",
"update_pixel_location",
"(",
"self",
",",
"new_pixel_location",
",",
"hdu_index",
")",
":",
"self",
".",
"reading",
".",
"pix_coord",
"=",
"self",
".",
"get_observation_coordinates",
"(",
"new_pixel_location",
"[",
"0",
"]",
",",
"new_pixel_location",
"[",... | Update the x/y location of the associated reading by using new_pixel_location and transforming from cutout
reference frame to observation refrence frame.
@param new_pixel_location: (x, y) location of the source in cutout pixel reference frame
@param hdu_index: index of the associate hdu in the h... | [
"Update",
"the",
"x",
"/",
"y",
"location",
"of",
"the",
"associated",
"reading",
"by",
"using",
"new_pixel_location",
"and",
"transforming",
"from",
"cutout",
"reference",
"frame",
"to",
"observation",
"refrence",
"frame",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L175-L192 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.get_pixel_coordinates | def get_pixel_coordinates(self, point, ccdnum):
"""
Retrieves the pixel location of a point within the current HDUList given the
location in the original FITS image. This takes into account that
the image may be a cutout of a larger original.
Args:
point: tuple(float,... | python | def get_pixel_coordinates(self, point, ccdnum):
"""
Retrieves the pixel location of a point within the current HDUList given the
location in the original FITS image. This takes into account that
the image may be a cutout of a larger original.
Args:
point: tuple(float,... | [
"def",
"get_pixel_coordinates",
"(",
"self",
",",
"point",
",",
"ccdnum",
")",
":",
"hdulist_index",
"=",
"self",
".",
"get_hdulist_idx",
"(",
"ccdnum",
")",
"if",
"isinstance",
"(",
"point",
"[",
"0",
"]",
",",
"Quantity",
")",
"and",
"isinstance",
"(",
... | Retrieves the pixel location of a point within the current HDUList given the
location in the original FITS image. This takes into account that
the image may be a cutout of a larger original.
Args:
point: tuple(float, float)
(x, y) in original.
Returns:
... | [
"Retrieves",
"the",
"pixel",
"location",
"of",
"a",
"point",
"within",
"the",
"current",
"HDUList",
"given",
"the",
"location",
"in",
"the",
"original",
"FITS",
"image",
".",
"This",
"takes",
"into",
"account",
"that",
"the",
"image",
"may",
"be",
"a",
"cu... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L209-L232 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.get_observation_coordinates | def get_observation_coordinates(self, x, y, hdulist_index):
"""
Retrieves the location of a point using the coordinate system of
the original observation, i.e. the original image before any
cutouts were done.
Returns:
(x, y) in the original image coordinate system.
... | python | def get_observation_coordinates(self, x, y, hdulist_index):
"""
Retrieves the location of a point using the coordinate system of
the original observation, i.e. the original image before any
cutouts were done.
Returns:
(x, y) in the original image coordinate system.
... | [
"def",
"get_observation_coordinates",
"(",
"self",
",",
"x",
",",
"y",
",",
"hdulist_index",
")",
":",
"return",
"self",
".",
"hdulist",
"[",
"hdulist_index",
"]",
".",
"converter",
".",
"get_inverse_converter",
"(",
")",
".",
"convert",
"(",
"(",
"x",
","... | Retrieves the location of a point using the coordinate system of
the original observation, i.e. the original image before any
cutouts were done.
Returns:
(x, y) in the original image coordinate system.
@param x: x-pixel location in the cutout frame of reference
@pa... | [
"Retrieves",
"the",
"location",
"of",
"a",
"point",
"using",
"the",
"coordinate",
"system",
"of",
"the",
"original",
"observation",
"i",
".",
"e",
".",
"the",
"original",
"image",
"before",
"any",
"cutouts",
"were",
"done",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L234-L246 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.world2pix | def world2pix(self, ra, dec, usepv=True):
"""
Convert a given RA/DEC position to the X/Y/HDULIST_INDEX in the cutout frame.
Here we loop over the hdulist to find the extension is RA/DEC are from and then return the appropriate X/Y
:param ra: The Right Ascension of the point
:t... | python | def world2pix(self, ra, dec, usepv=True):
"""
Convert a given RA/DEC position to the X/Y/HDULIST_INDEX in the cutout frame.
Here we loop over the hdulist to find the extension is RA/DEC are from and then return the appropriate X/Y
:param ra: The Right Ascension of the point
:t... | [
"def",
"world2pix",
"(",
"self",
",",
"ra",
",",
"dec",
",",
"usepv",
"=",
"True",
")",
":",
"x",
",",
"y",
",",
"idx",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
"for",
"idx",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"self",
".",
"hdulist",
... | Convert a given RA/DEC position to the X/Y/HDULIST_INDEX in the cutout frame.
Here we loop over the hdulist to find the extension is RA/DEC are from and then return the appropriate X/Y
:param ra: The Right Ascension of the point
:type ra: Quantity
:param dec: The Declination of the po... | [
"Convert",
"a",
"given",
"RA",
"/",
"DEC",
"position",
"to",
"the",
"X",
"/",
"Y",
"/",
"HDULIST_INDEX",
"in",
"the",
"cutout",
"frame",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L252-L272 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.zmag | def zmag(self,):
"""
Return the photometric zeropoint of the CCD associated with the reading.
@return: float
"""
if self._zmag is None:
hdulist_index = self.get_hdulist_idx(self.reading.get_ccd_num())
self._zmag = self.hdulist[hdulist_index].header.get('PH... | python | def zmag(self,):
"""
Return the photometric zeropoint of the CCD associated with the reading.
@return: float
"""
if self._zmag is None:
hdulist_index = self.get_hdulist_idx(self.reading.get_ccd_num())
self._zmag = self.hdulist[hdulist_index].header.get('PH... | [
"def",
"zmag",
"(",
"self",
",",
")",
":",
"if",
"self",
".",
"_zmag",
"is",
"None",
":",
"hdulist_index",
"=",
"self",
".",
"get_hdulist_idx",
"(",
"self",
".",
"reading",
".",
"get_ccd_num",
"(",
")",
")",
"self",
".",
"_zmag",
"=",
"self",
".",
... | Return the photometric zeropoint of the CCD associated with the reading.
@return: float | [
"Return",
"the",
"photometric",
"zeropoint",
"of",
"the",
"CCD",
"associated",
"with",
"the",
"reading",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L275-L283 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.apcor | def apcor(self):
"""
return the aperture correction of for the CCD assocated with the reading.
@return: Apcor
"""
if self._apcor is None:
try:
self._apcor = Downloader().download_apcor(self.reading.get_apcor_uri())
except:
s... | python | def apcor(self):
"""
return the aperture correction of for the CCD assocated with the reading.
@return: Apcor
"""
if self._apcor is None:
try:
self._apcor = Downloader().download_apcor(self.reading.get_apcor_uri())
except:
s... | [
"def",
"apcor",
"(",
"self",
")",
":",
"if",
"self",
".",
"_apcor",
"is",
"None",
":",
"try",
":",
"self",
".",
"_apcor",
"=",
"Downloader",
"(",
")",
".",
"download_apcor",
"(",
"self",
".",
"reading",
".",
"get_apcor_uri",
"(",
")",
")",
"except",
... | return the aperture correction of for the CCD assocated with the reading.
@return: Apcor | [
"return",
"the",
"aperture",
"correction",
"of",
"for",
"the",
"CCD",
"assocated",
"with",
"the",
"reading",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L286-L296 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.get_observed_magnitude | def get_observed_magnitude(self, centroid=True):
# NOTE: this import is only here so that we don't load up IRAF
# unnecessarily (ex: for candidates processing).
"""
Get the magnitude at the current pixel x/y location.
:return: Table
"""
max_count = float(self.as... | python | def get_observed_magnitude(self, centroid=True):
# NOTE: this import is only here so that we don't load up IRAF
# unnecessarily (ex: for candidates processing).
"""
Get the magnitude at the current pixel x/y location.
:return: Table
"""
max_count = float(self.as... | [
"def",
"get_observed_magnitude",
"(",
"self",
",",
"centroid",
"=",
"True",
")",
":",
"# NOTE: this import is only here so that we don't load up IRAF",
"# unnecessarily (ex: for candidates processing).",
"max_count",
"=",
"float",
"(",
"self",
".",
"astrom_header",
".",
"get"... | Get the magnitude at the current pixel x/y location.
:return: Table | [
"Get",
"the",
"magnitude",
"at",
"the",
"current",
"pixel",
"x",
"/",
"y",
"location",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L298-L328 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout._hdu_on_disk | def _hdu_on_disk(self, hdulist_index):
"""
IRAF routines such as daophot need input on disk.
Returns:
filename: str
The name of the file containing the FITS data.
"""
if self._tempfile is None:
self._tempfile = tempfile.NamedTemporaryFile(
... | python | def _hdu_on_disk(self, hdulist_index):
"""
IRAF routines such as daophot need input on disk.
Returns:
filename: str
The name of the file containing the FITS data.
"""
if self._tempfile is None:
self._tempfile = tempfile.NamedTemporaryFile(
... | [
"def",
"_hdu_on_disk",
"(",
"self",
",",
"hdulist_index",
")",
":",
"if",
"self",
".",
"_tempfile",
"is",
"None",
":",
"self",
".",
"_tempfile",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"mode",
"=",
"\"r+b\"",
",",
"suffix",
"=",
"\".fits\"",
")",
... | IRAF routines such as daophot need input on disk.
Returns:
filename: str
The name of the file containing the FITS data. | [
"IRAF",
"routines",
"such",
"as",
"daophot",
"need",
"input",
"on",
"disk",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L330-L342 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.comparison_image_list | def comparison_image_list(self):
"""
returns a list of possible comparison images for the current cutout. Will query CADC to create the list when
first called.
@rtype: Table
"""
if self._comparison_image_list is not None:
return self._comparison_image_list
... | python | def comparison_image_list(self):
"""
returns a list of possible comparison images for the current cutout. Will query CADC to create the list when
first called.
@rtype: Table
"""
if self._comparison_image_list is not None:
return self._comparison_image_list
... | [
"def",
"comparison_image_list",
"(",
"self",
")",
":",
"if",
"self",
".",
"_comparison_image_list",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_comparison_image_list",
"ref_ra",
"=",
"self",
".",
"reading",
".",
"ra",
"*",
"units",
".",
"degree",
"ref... | returns a list of possible comparison images for the current cutout. Will query CADC to create the list when
first called.
@rtype: Table | [
"returns",
"a",
"list",
"of",
"possible",
"comparison",
"images",
"for",
"the",
"current",
"cutout",
".",
"Will",
"query",
"CADC",
"to",
"create",
"the",
"list",
"when",
"first",
"called",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L372-L422 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/source.py | SourceCutout.retrieve_comparison_image | def retrieve_comparison_image(self):
"""
Search the DB for a comparison image for this cutout.
"""
# selecting comparator when on a comparator should load a new one.
collectionID = self.comparison_image_list[self.comparison_image_index]['EXPNUM']
ref_ra = self.reading.ra ... | python | def retrieve_comparison_image(self):
"""
Search the DB for a comparison image for this cutout.
"""
# selecting comparator when on a comparator should load a new one.
collectionID = self.comparison_image_list[self.comparison_image_index]['EXPNUM']
ref_ra = self.reading.ra ... | [
"def",
"retrieve_comparison_image",
"(",
"self",
")",
":",
"# selecting comparator when on a comparator should load a new one.",
"collectionID",
"=",
"self",
".",
"comparison_image_list",
"[",
"self",
".",
"comparison_image_index",
"]",
"[",
"'EXPNUM'",
"]",
"ref_ra",
"=",
... | Search the DB for a comparison image for this cutout. | [
"Search",
"the",
"DB",
"for",
"a",
"comparison",
"image",
"for",
"this",
"cutout",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/source.py#L425-L454 |
OSSOS/MOP | src/ossos/web/web/auth/model.py | User.check_password | def check_password(self, passwd, group):
# This provides authentication via CADC.
"""check that the passwd provided matches the required password."""
return gms.isMember(self.login, passwd, group) | python | def check_password(self, passwd, group):
# This provides authentication via CADC.
"""check that the passwd provided matches the required password."""
return gms.isMember(self.login, passwd, group) | [
"def",
"check_password",
"(",
"self",
",",
"passwd",
",",
"group",
")",
":",
"# This provides authentication via CADC.",
"return",
"gms",
".",
"isMember",
"(",
"self",
".",
"login",
",",
"passwd",
",",
"group",
")"
] | check that the passwd provided matches the required password. | [
"check",
"that",
"the",
"passwd",
"provided",
"matches",
"the",
"required",
"password",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/web/web/auth/model.py#L22-L25 |
JohnVinyard/zounds | zounds/timeseries/timeseries.py | TimeDimension.integer_based_slice | def integer_based_slice(self, ts):
"""
Transform a :class:`TimeSlice` into integer indices that numpy can work
with
Args:
ts (slice, TimeSlice): the time slice to translate into integer
indices
"""
if isinstance(ts, slice):
try:
... | python | def integer_based_slice(self, ts):
"""
Transform a :class:`TimeSlice` into integer indices that numpy can work
with
Args:
ts (slice, TimeSlice): the time slice to translate into integer
indices
"""
if isinstance(ts, slice):
try:
... | [
"def",
"integer_based_slice",
"(",
"self",
",",
"ts",
")",
":",
"if",
"isinstance",
"(",
"ts",
",",
"slice",
")",
":",
"try",
":",
"start",
"=",
"Seconds",
"(",
"0",
")",
"if",
"ts",
".",
"start",
"is",
"None",
"else",
"ts",
".",
"start",
"if",
"... | Transform a :class:`TimeSlice` into integer indices that numpy can work
with
Args:
ts (slice, TimeSlice): the time slice to translate into integer
indices | [
"Transform",
"a",
":",
"class",
":",
"TimeSlice",
"into",
"integer",
"indices",
"that",
"numpy",
"can",
"work",
"with"
] | train | https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/timeseries/timeseries.py#L234-L275 |
OSSOS/MOP | src/ossos/core/ossos/pipeline/build_astrometry_report.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.
@param path: the directory where filenames are.
@type path str
@param f... | 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.
@param path: the directory where filenames are.
@type path str
@param f... | [
"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.
@param path: the directory where filenames are.
@type path str
@param filenames: list of files in path.
@type filenames list
@rtype None | [
"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/core/ossos/pipeline/build_astrometry_report.py#L18-L62 |
OSSOS/MOP | src/ossos/core/scripts/plant.py | plant_kbos | def plant_kbos(filename, psf, kbos, shifts, prefix):
"""
Add KBOs to an image
:param filename: name of the image to add KBOs to
:param psf: the Point Spread Function in IRAF/DAOPHOT format to be used by ADDSTAR
:param kbos: list of KBOs to add, has format as returned by KBOGenerator
:param shift... | python | def plant_kbos(filename, psf, kbos, shifts, prefix):
"""
Add KBOs to an image
:param filename: name of the image to add KBOs to
:param psf: the Point Spread Function in IRAF/DAOPHOT format to be used by ADDSTAR
:param kbos: list of KBOs to add, has format as returned by KBOGenerator
:param shift... | [
"def",
"plant_kbos",
"(",
"filename",
",",
"psf",
",",
"kbos",
",",
"shifts",
",",
"prefix",
")",
":",
"iraf",
".",
"set",
"(",
"uparm",
"=",
"\"./\"",
")",
"iraf",
".",
"digiphot",
"(",
")",
"iraf",
".",
"apphot",
"(",
")",
"iraf",
".",
"daophot",... | Add KBOs to an image
:param filename: name of the image to add KBOs to
:param psf: the Point Spread Function in IRAF/DAOPHOT format to be used by ADDSTAR
:param kbos: list of KBOs to add, has format as returned by KBOGenerator
:param shifts: dictionary with shifts to transfer to coordinates to reference... | [
"Add",
"KBOs",
"to",
"an",
"image",
":",
"param",
"filename",
":",
"name",
"of",
"the",
"image",
"to",
"add",
"KBOs",
"to",
":",
"param",
"psf",
":",
"the",
"Point",
"Spread",
"Function",
"in",
"IRAF",
"/",
"DAOPHOT",
"format",
"to",
"be",
"used",
"b... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/plant.py#L45-L132 |
OSSOS/MOP | src/ossos/core/scripts/plant.py | plant | def plant(expnums, ccd, rmin, rmax, ang, width, number=10, mmin=21.0, mmax=25.5, version='s', dry_run=False):
"""Plant artificial sources into the list of images provided.
:param expnums: list of MegaPrime exposure numbers to add artificial KBOs to
:param ccd: which ccd to work on.
:param rmin: The min... | python | def plant(expnums, ccd, rmin, rmax, ang, width, number=10, mmin=21.0, mmax=25.5, version='s', dry_run=False):
"""Plant artificial sources into the list of images provided.
:param expnums: list of MegaPrime exposure numbers to add artificial KBOs to
:param ccd: which ccd to work on.
:param rmin: The min... | [
"def",
"plant",
"(",
"expnums",
",",
"ccd",
",",
"rmin",
",",
"rmax",
",",
"ang",
",",
"width",
",",
"number",
"=",
"10",
",",
"mmin",
"=",
"21.0",
",",
"mmax",
"=",
"25.5",
",",
"version",
"=",
"'s'",
",",
"dry_run",
"=",
"False",
")",
":",
"#... | Plant artificial sources into the list of images provided.
:param expnums: list of MegaPrime exposure numbers to add artificial KBOs to
:param ccd: which ccd to work on.
:param rmin: The minimum rate of motion to add sources at (''/hour)
:param rmax: The maximum rate of motion to add sources at (''/hou... | [
"Plant",
"artificial",
"sources",
"into",
"the",
"list",
"of",
"images",
"provided",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/plant.py#L141-L192 |
OSSOS/MOP | src/ossos/core/ossos/kbo.py | Orbfit._fit_radec | def _fit_radec(self):
"""
call fit_radec of BK passing in the observations.
"""
# call fitradec with mpcfile, abgfile, resfile
self.orbfit.fitradec.restype = ctypes.c_int
self.orbfit.fitradec.argtypes = [ ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p ]
mpc_... | python | def _fit_radec(self):
"""
call fit_radec of BK passing in the observations.
"""
# call fitradec with mpcfile, abgfile, resfile
self.orbfit.fitradec.restype = ctypes.c_int
self.orbfit.fitradec.argtypes = [ ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p ]
mpc_... | [
"def",
"_fit_radec",
"(",
"self",
")",
":",
"# call fitradec with mpcfile, abgfile, resfile",
"self",
".",
"orbfit",
".",
"fitradec",
".",
"restype",
"=",
"ctypes",
".",
"c_int",
"self",
".",
"orbfit",
".",
"fitradec",
".",
"argtypes",
"=",
"[",
"ctypes",
".",... | call fit_radec of BK passing in the observations. | [
"call",
"fit_radec",
"of",
"BK",
"passing",
"in",
"the",
"observations",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/kbo.py#L21-L46 |
OSSOS/MOP | src/ossos/core/ossos/kbo.py | Orbfit.predict | def predict(self, date, obs_code=568):
"""
use the bk predict method to compute the location of the source on the given date.
"""
time = Time(date, scale='utc', precision=6)
jd = ctypes.c_double(time.jd)
# call predict with agbfile, jdate, obscode
self.orbfit.pred... | python | def predict(self, date, obs_code=568):
"""
use the bk predict method to compute the location of the source on the given date.
"""
time = Time(date, scale='utc', precision=6)
jd = ctypes.c_double(time.jd)
# call predict with agbfile, jdate, obscode
self.orbfit.pred... | [
"def",
"predict",
"(",
"self",
",",
"date",
",",
"obs_code",
"=",
"568",
")",
":",
"time",
"=",
"Time",
"(",
"date",
",",
"scale",
"=",
"'utc'",
",",
"precision",
"=",
"6",
")",
"jd",
"=",
"ctypes",
".",
"c_double",
"(",
"time",
".",
"jd",
")",
... | use the bk predict method to compute the location of the source on the given date. | [
"use",
"the",
"bk",
"predict",
"method",
"to",
"compute",
"the",
"location",
"of",
"the",
"source",
"on",
"the",
"given",
"date",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/kbo.py#L48-L66 |
OSSOS/MOP | src/ossos/core/ossos/gui/views/appview.py | guithread | def guithread(function):
"""
Decorator to make sure the function is called from wx's main GUI
thread. This is needed when trying to trigger UI updates from a thread
other than the main GUI thread (such as some asynchronous data loading
thread).
I learned about doing this from:
wxPython 2.8... | python | def guithread(function):
"""
Decorator to make sure the function is called from wx's main GUI
thread. This is needed when trying to trigger UI updates from a thread
other than the main GUI thread (such as some asynchronous data loading
thread).
I learned about doing this from:
wxPython 2.8... | [
"def",
"guithread",
"(",
"function",
")",
":",
"def",
"new_guithread_function",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"wx",
".",
"Thread_IsMain",
"(",
")",
":",
"return",
"function",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"... | Decorator to make sure the function is called from wx's main GUI
thread. This is needed when trying to trigger UI updates from a thread
other than the main GUI thread (such as some asynchronous data loading
thread).
I learned about doing this from:
wxPython 2.8 Application Development Cookbook, Ch... | [
"Decorator",
"to",
"make",
"sure",
"the",
"function",
"is",
"called",
"from",
"wx",
"s",
"main",
"GUI",
"thread",
".",
"This",
"is",
"needed",
"when",
"trying",
"to",
"trigger",
"UI",
"updates",
"from",
"a",
"thread",
"other",
"than",
"the",
"main",
"GUI... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/views/appview.py#L17-L34 |
OSSOS/MOP | src/jjk/preproc/MOPfiles.py | write | def write(file,hdu,order=None,format=None):
"""Write a file in the crazy MOP format given an mop data hdu."""
if order or format:
warnings.warn('Use of <order> and <format> depricated',DeprecationWarning)
## if the order of the columns isn't constrained just use the keys in what ever order
da... | python | def write(file,hdu,order=None,format=None):
"""Write a file in the crazy MOP format given an mop data hdu."""
if order or format:
warnings.warn('Use of <order> and <format> depricated',DeprecationWarning)
## if the order of the columns isn't constrained just use the keys in what ever order
da... | [
"def",
"write",
"(",
"file",
",",
"hdu",
",",
"order",
"=",
"None",
",",
"format",
"=",
"None",
")",
":",
"if",
"order",
"or",
"format",
":",
"warnings",
".",
"warn",
"(",
"'Use of <order> and <format> depricated'",
",",
"DeprecationWarning",
")",
"## if the... | Write a file in the crazy MOP format given an mop data hdu. | [
"Write",
"a",
"file",
"in",
"the",
"crazy",
"MOP",
"format",
"given",
"an",
"mop",
"data",
"hdu",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfiles.py#L57-L112 |
OSSOS/MOP | src/jjk/preproc/MOPfiles.py | store | def store(hdu,dbase='cfeps',duser='cfhls',dtype='MYSQL',table='source'):
"""Write the contents of a MOP data structure to a SQL table"""
import MOPdbaccess
db=MOPdbaccess.connect(dbase,duser,dbSystem=dtype)
dbc=db.cursor()
### INSERT THE 'HEADER' in the meta-data table
file_id=hdu['header']['i... | python | def store(hdu,dbase='cfeps',duser='cfhls',dtype='MYSQL',table='source'):
"""Write the contents of a MOP data structure to a SQL table"""
import MOPdbaccess
db=MOPdbaccess.connect(dbase,duser,dbSystem=dtype)
dbc=db.cursor()
### INSERT THE 'HEADER' in the meta-data table
file_id=hdu['header']['i... | [
"def",
"store",
"(",
"hdu",
",",
"dbase",
"=",
"'cfeps'",
",",
"duser",
"=",
"'cfhls'",
",",
"dtype",
"=",
"'MYSQL'",
",",
"table",
"=",
"'source'",
")",
":",
"import",
"MOPdbaccess",
"db",
"=",
"MOPdbaccess",
".",
"connect",
"(",
"dbase",
",",
"duser"... | Write the contents of a MOP data structure to a SQL table | [
"Write",
"the",
"contents",
"of",
"a",
"MOP",
"data",
"structure",
"to",
"a",
"SQL",
"table"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfiles.py#L114-L164 |
OSSOS/MOP | src/jjk/preproc/MOPfiles.py | read | def read(file):
"""Read in a file and create a data strucuture that is a hash with members 'header'
and 'data'. The 'header' is a hash of header keywords, the data is a hash of columns.
To get to the nth element of column NAME use hdu[data][NAME][n]. To get the header
information use hdu[header][KEYW... | python | def read(file):
"""Read in a file and create a data strucuture that is a hash with members 'header'
and 'data'. The 'header' is a hash of header keywords, the data is a hash of columns.
To get to the nth element of column NAME use hdu[data][NAME][n]. To get the header
information use hdu[header][KEYW... | [
"def",
"read",
"(",
"file",
")",
":",
"f",
"=",
"open",
"(",
"file",
",",
"'r'",
")",
"lines",
"=",
"f",
".",
"readlines",
"(",
")",
"f",
".",
"close",
"(",
")",
"import",
"re",
",",
"string",
"keywords",
"=",
"[",
"]",
"values",
"=",
"[",
"]... | Read in a file and create a data strucuture that is a hash with members 'header'
and 'data'. The 'header' is a hash of header keywords, the data is a hash of columns.
To get to the nth element of column NAME use hdu[data][NAME][n]. To get the header
information use hdu[header][KEYWORD]. | [
"Read",
"in",
"a",
"file",
"and",
"create",
"a",
"data",
"strucuture",
"that",
"is",
"a",
"hash",
"with",
"members",
"header",
"and",
"data",
".",
"The",
"header",
"is",
"a",
"hash",
"of",
"header",
"keywords",
"the",
"data",
"is",
"a",
"hash",
"of",
... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfiles.py#L168-L242 |
OSSOS/MOP | src/jjk/preproc/MOPfiles.py | xymatch | def xymatch(outfile, filenames, tol=2):
"""Given a list of MOPfiles merge them based on x/y coordinates matching.."""
import math
import sys
output={}
files=[]
for filename in filenames:
this_file=read(filename)
## match files based on the 'X' and 'Y' column.
## if those ... | python | def xymatch(outfile, filenames, tol=2):
"""Given a list of MOPfiles merge them based on x/y coordinates matching.."""
import math
import sys
output={}
files=[]
for filename in filenames:
this_file=read(filename)
## match files based on the 'X' and 'Y' column.
## if those ... | [
"def",
"xymatch",
"(",
"outfile",
",",
"filenames",
",",
"tol",
"=",
"2",
")",
":",
"import",
"math",
"import",
"sys",
"output",
"=",
"{",
"}",
"files",
"=",
"[",
"]",
"for",
"filename",
"in",
"filenames",
":",
"this_file",
"=",
"read",
"(",
"filenam... | Given a list of MOPfiles merge them based on x/y coordinates matching.. | [
"Given",
"a",
"list",
"of",
"MOPfiles",
"merge",
"them",
"based",
"on",
"x",
"/",
"y",
"coordinates",
"matching",
".."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPfiles.py#L245-L299 |
playpauseandstop/rororo | rororo/logger.py | default_logging_dict | def default_logging_dict(*loggers: str, **kwargs: Any) -> DictStrAny:
r"""Prepare logging dict suitable with ``logging.config.dictConfig``.
**Usage**::
from logging.config import dictConfig
dictConfig(default_logging_dict('yourlogger'))
:param \*loggers: Enable logging for each logger in ... | python | def default_logging_dict(*loggers: str, **kwargs: Any) -> DictStrAny:
r"""Prepare logging dict suitable with ``logging.config.dictConfig``.
**Usage**::
from logging.config import dictConfig
dictConfig(default_logging_dict('yourlogger'))
:param \*loggers: Enable logging for each logger in ... | [
"def",
"default_logging_dict",
"(",
"*",
"loggers",
":",
"str",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"DictStrAny",
":",
"kwargs",
".",
"setdefault",
"(",
"'level'",
",",
"'INFO'",
")",
"return",
"{",
"'version'",
":",
"1",
",",
"'disable_exist... | r"""Prepare logging dict suitable with ``logging.config.dictConfig``.
**Usage**::
from logging.config import dictConfig
dictConfig(default_logging_dict('yourlogger'))
:param \*loggers: Enable logging for each logger in sequence.
:param \*\*kwargs: Setup additional logger params via keywor... | [
"r",
"Prepare",
"logging",
"dict",
"suitable",
"with",
"logging",
".",
"config",
".",
"dictConfig",
"."
] | train | https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/logger.py#L28-L75 |
playpauseandstop/rororo | rororo/logger.py | update_sentry_logging | def update_sentry_logging(logging_dict: DictStrAny,
sentry_dsn: Optional[str],
*loggers: str,
level: Union[str, int] = None,
**kwargs: Any) -> None:
r"""Enable Sentry logging if Sentry DSN passed.
.. note::
... | python | def update_sentry_logging(logging_dict: DictStrAny,
sentry_dsn: Optional[str],
*loggers: str,
level: Union[str, int] = None,
**kwargs: Any) -> None:
r"""Enable Sentry logging if Sentry DSN passed.
.. note::
... | [
"def",
"update_sentry_logging",
"(",
"logging_dict",
":",
"DictStrAny",
",",
"sentry_dsn",
":",
"Optional",
"[",
"str",
"]",
",",
"*",
"loggers",
":",
"str",
",",
"level",
":",
"Union",
"[",
"str",
",",
"int",
"]",
"=",
"None",
",",
"*",
"*",
"kwargs",... | r"""Enable Sentry logging if Sentry DSN passed.
.. note::
Sentry logging requires `raven <http://pypi.python.org/pypi/raven>`_
library to be installed.
**Usage**::
from logging.config import dictConfig
LOGGING = default_logging_dict()
SENTRY_DSN = '...'
updat... | [
"r",
"Enable",
"Sentry",
"logging",
"if",
"Sentry",
"DSN",
"passed",
"."
] | train | https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/logger.py#L78-L142 |
OSSOS/MOP | src/ossos/core/scripts/preproc.py | trim | def trim(hdu, datasec='DATASEC'):
"""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])
logger.info("Trimming [%d:%d... | python | def trim(hdu, datasec='DATASEC'):
"""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])
logger.info("Trimming [%d:%d... | [
"def",
"trim",
"(",
"hdu",
",",
"datasec",
"=",
"'DATASEC'",
")",
":",
"datasec",
"=",
"re",
".",
"findall",
"(",
"r'(\\d+)'",
",",
"hdu",
".",
"header",
".",
"get",
"(",
"datasec",
")",
")",
"l",
"=",
"int",
"(",
"datasec",
"[",
"0",
"]",
")",
... | 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/ossos/core/scripts/preproc.py#L77-L93 |
OSSOS/MOP | src/ossos/core/ossos/parsers.py | ossos_release_parser | def ossos_release_parser(table=False, data_release=parameters.RELEASE_VERSION):
"""
extra fun as this is space-separated so using CSV parsers is not an option
"""
names = ['cl', 'p', 'j', 'k', 'sh', 'object', 'mag', 'e_mag', 'Filt', 'Hsur', 'dist', 'e_dist', 'Nobs',
'time', 'av_xres', 'av_y... | python | def ossos_release_parser(table=False, data_release=parameters.RELEASE_VERSION):
"""
extra fun as this is space-separated so using CSV parsers is not an option
"""
names = ['cl', 'p', 'j', 'k', 'sh', 'object', 'mag', 'e_mag', 'Filt', 'Hsur', 'dist', 'e_dist', 'Nobs',
'time', 'av_xres', 'av_y... | [
"def",
"ossos_release_parser",
"(",
"table",
"=",
"False",
",",
"data_release",
"=",
"parameters",
".",
"RELEASE_VERSION",
")",
":",
"names",
"=",
"[",
"'cl'",
",",
"'p'",
",",
"'j'",
",",
"'k'",
",",
"'sh'",
",",
"'object'",
",",
"'mag'",
",",
"'e_mag'"... | extra fun as this is space-separated so using CSV parsers is not an option | [
"extra",
"fun",
"as",
"this",
"is",
"space",
"-",
"separated",
"so",
"using",
"CSV",
"parsers",
"is",
"not",
"an",
"option"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/parsers.py#L23-L41 |
OSSOS/MOP | src/ossos/core/ossos/parsers.py | ossos_discoveries | def ossos_discoveries(directory=parameters.REAL_KBO_AST_DIR,
suffix='ast',
no_nt_and_u=False,
single_object=None,
all_objects=True,
data_release=None,
):
"""
Returns a list of obje... | python | def ossos_discoveries(directory=parameters.REAL_KBO_AST_DIR,
suffix='ast',
no_nt_and_u=False,
single_object=None,
all_objects=True,
data_release=None,
):
"""
Returns a list of obje... | [
"def",
"ossos_discoveries",
"(",
"directory",
"=",
"parameters",
".",
"REAL_KBO_AST_DIR",
",",
"suffix",
"=",
"'ast'",
",",
"no_nt_and_u",
"=",
"False",
",",
"single_object",
"=",
"None",
",",
"all_objects",
"=",
"True",
",",
"data_release",
"=",
"None",
",",
... | Returns a list of objects holding orbfit.Orbfit objects with the observations in the Orbfit.observations field.
Default is to return only the objects corresponding to the current Data Release. | [
"Returns",
"a",
"list",
"of",
"objects",
"holding",
"orbfit",
".",
"Orbfit",
"objects",
"with",
"the",
"observations",
"in",
"the",
"Orbfit",
".",
"observations",
"field",
".",
"Default",
"is",
"to",
"return",
"only",
"the",
"objects",
"corresponding",
"to",
... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/parsers.py#L83-L117 |
OSSOS/MOP | src/ossos/core/ossos/parsers.py | ossos_release_with_metadata | def ossos_release_with_metadata():
"""
Wrap the objects from the Version Releases together with the objects instantiated from fitting their mpc lines
"""
# discoveries = ossos_release_parser()
discoveries = []
observations = ossos_discoveries()
for obj in observations:
discov = [n fo... | python | def ossos_release_with_metadata():
"""
Wrap the objects from the Version Releases together with the objects instantiated from fitting their mpc lines
"""
# discoveries = ossos_release_parser()
discoveries = []
observations = ossos_discoveries()
for obj in observations:
discov = [n fo... | [
"def",
"ossos_release_with_metadata",
"(",
")",
":",
"# discoveries = ossos_release_parser()",
"discoveries",
"=",
"[",
"]",
"observations",
"=",
"ossos_discoveries",
"(",
")",
"for",
"obj",
"in",
"observations",
":",
"discov",
"=",
"[",
"n",
"for",
"n",
"in",
"... | Wrap the objects from the Version Releases together with the objects instantiated from fitting their mpc lines | [
"Wrap",
"the",
"objects",
"from",
"the",
"Version",
"Releases",
"together",
"with",
"the",
"objects",
"instantiated",
"from",
"fitting",
"their",
"mpc",
"lines"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/parsers.py#L120-L149 |
OSSOS/MOP | src/ossos/core/ossos/parsers.py | _kbos_from_survey_sym_model_input_file | def _kbos_from_survey_sym_model_input_file(model_file):
"""
Load a Survey Simulator model file as an array of ephem EllipticalBody objects.
@param model_file:
@return:
"""
lines = storage.open_vos_or_local(model_file).read().split('\n')
kbos = []
for line in lines:
if len(line) =... | python | def _kbos_from_survey_sym_model_input_file(model_file):
"""
Load a Survey Simulator model file as an array of ephem EllipticalBody objects.
@param model_file:
@return:
"""
lines = storage.open_vos_or_local(model_file).read().split('\n')
kbos = []
for line in lines:
if len(line) =... | [
"def",
"_kbos_from_survey_sym_model_input_file",
"(",
"model_file",
")",
":",
"lines",
"=",
"storage",
".",
"open_vos_or_local",
"(",
"model_file",
")",
".",
"read",
"(",
")",
".",
"split",
"(",
"'\\n'",
")",
"kbos",
"=",
"[",
"]",
"for",
"line",
"in",
"li... | Load a Survey Simulator model file as an array of ephem EllipticalBody objects.
@param model_file:
@return: | [
"Load",
"a",
"Survey",
"Simulator",
"model",
"file",
"as",
"an",
"array",
"of",
"ephem",
"EllipticalBody",
"objects",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/parsers.py#L152-L179 |
OSSOS/MOP | src/ossos/core/ossos/parsers.py | round_sig_error | def round_sig_error(num, uncert, pm=False):
"""
Return a string of the number and its uncertainty to the right sig figs via uncertainty's print methods.
The uncertainty determines the sig fig rounding of the number.
https://pythonhosted.org/uncertainties/user_guide.html
"""
u = ufloat(num, uncer... | python | def round_sig_error(num, uncert, pm=False):
"""
Return a string of the number and its uncertainty to the right sig figs via uncertainty's print methods.
The uncertainty determines the sig fig rounding of the number.
https://pythonhosted.org/uncertainties/user_guide.html
"""
u = ufloat(num, uncer... | [
"def",
"round_sig_error",
"(",
"num",
",",
"uncert",
",",
"pm",
"=",
"False",
")",
":",
"u",
"=",
"ufloat",
"(",
"num",
",",
"uncert",
")",
"if",
"pm",
":",
"return",
"'{:.1uL}'",
".",
"format",
"(",
"u",
")",
"else",
":",
"return",
"'{:.1uLS}'",
"... | Return a string of the number and its uncertainty to the right sig figs via uncertainty's print methods.
The uncertainty determines the sig fig rounding of the number.
https://pythonhosted.org/uncertainties/user_guide.html | [
"Return",
"a",
"string",
"of",
"the",
"number",
"and",
"its",
"uncertainty",
"to",
"the",
"right",
"sig",
"figs",
"via",
"uncertainty",
"s",
"print",
"methods",
".",
"The",
"uncertainty",
"determines",
"the",
"sig",
"fig",
"rounding",
"of",
"the",
"number",
... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/parsers.py#L251-L261 |
openstack/python-scciclient | scciclient/irmc/elcm.py | _parse_elcm_response_body_as_json | def _parse_elcm_response_body_as_json(response):
"""parse eLCM response body as json data
eLCM response should be in form of:
_
Key1: value1 <-- optional -->
Key2: value2 <-- optional -->
KeyN: valueN <-- optional -->
- CRLF -
JSON string
-
:param response: eLCM response
... | python | def _parse_elcm_response_body_as_json(response):
"""parse eLCM response body as json data
eLCM response should be in form of:
_
Key1: value1 <-- optional -->
Key2: value2 <-- optional -->
KeyN: valueN <-- optional -->
- CRLF -
JSON string
-
:param response: eLCM response
... | [
"def",
"_parse_elcm_response_body_as_json",
"(",
"response",
")",
":",
"try",
":",
"body",
"=",
"response",
".",
"text",
"body_parts",
"=",
"body",
".",
"split",
"(",
"'\\r\\n'",
")",
"if",
"len",
"(",
"body_parts",
")",
">",
"0",
":",
"return",
"jsonutils... | parse eLCM response body as json data
eLCM response should be in form of:
_
Key1: value1 <-- optional -->
Key2: value2 <-- optional -->
KeyN: valueN <-- optional -->
- CRLF -
JSON string
-
:param response: eLCM response
:return: json object if success
:raise ELCMInvali... | [
"parse",
"eLCM",
"response",
"body",
"as",
"json",
"data"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L149-L177 |
openstack/python-scciclient | scciclient/irmc/elcm.py | elcm_request | def elcm_request(irmc_info, method, path, **kwargs):
"""send an eLCM request to the server
:param irmc_info: dict of iRMC params to access the server node
{
'irmc_address': host,
'irmc_username': user_id,
'irmc_password': password,
'irmc_port': 80 or 443, default... | python | def elcm_request(irmc_info, method, path, **kwargs):
"""send an eLCM request to the server
:param irmc_info: dict of iRMC params to access the server node
{
'irmc_address': host,
'irmc_username': user_id,
'irmc_password': password,
'irmc_port': 80 or 443, default... | [
"def",
"elcm_request",
"(",
"irmc_info",
",",
"method",
",",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"host",
"=",
"irmc_info",
"[",
"'irmc_address'",
"]",
"port",
"=",
"irmc_info",
".",
"get",
"(",
"'irmc_port'",
",",
"443",
")",
"auth_method",
"=",
... | send an eLCM request to the server
:param irmc_info: dict of iRMC params to access the server node
{
'irmc_address': host,
'irmc_username': user_id,
'irmc_password': password,
'irmc_port': 80 or 443, default is 443,
'irmc_auth_method': 'basic' or 'digest', ... | [
"send",
"an",
"eLCM",
"request",
"to",
"the",
"server"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L180-L243 |
openstack/python-scciclient | scciclient/irmc/elcm.py | elcm_profile_get_versions | def elcm_profile_get_versions(irmc_info):
"""send an eLCM request to get profile versions
:param irmc_info: node info
:returns: dict object of profiles if succeed
{
"Server":{
"@Version": "1.01",
"AdapterConfigIrmc":{
"@Version": "1.00... | python | def elcm_profile_get_versions(irmc_info):
"""send an eLCM request to get profile versions
:param irmc_info: node info
:returns: dict object of profiles if succeed
{
"Server":{
"@Version": "1.01",
"AdapterConfigIrmc":{
"@Version": "1.00... | [
"def",
"elcm_profile_get_versions",
"(",
"irmc_info",
")",
":",
"# Send GET request to the server",
"resp",
"=",
"elcm_request",
"(",
"irmc_info",
",",
"method",
"=",
"'GET'",
",",
"path",
"=",
"URL_PATH_PROFILE_MGMT",
"+",
"'version'",
")",
"if",
"resp",
".",
"st... | send an eLCM request to get profile versions
:param irmc_info: node info
:returns: dict object of profiles if succeed
{
"Server":{
"@Version": "1.01",
"AdapterConfigIrmc":{
"@Version": "1.00"
},
"HWConfigura... | [
"send",
"an",
"eLCM",
"request",
"to",
"get",
"profile",
"versions"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L246-L281 |
openstack/python-scciclient | scciclient/irmc/elcm.py | elcm_profile_get | def elcm_profile_get(irmc_info, profile_name):
"""send an eLCM request to get profile data
:param irmc_info: node info
:param profile_name: name of profile
:returns: dict object of profile data if succeed
:raises: ELCMProfileNotFound if profile does not exist
:raises: SCCIClientError if SCCI fa... | python | def elcm_profile_get(irmc_info, profile_name):
"""send an eLCM request to get profile data
:param irmc_info: node info
:param profile_name: name of profile
:returns: dict object of profile data if succeed
:raises: ELCMProfileNotFound if profile does not exist
:raises: SCCIClientError if SCCI fa... | [
"def",
"elcm_profile_get",
"(",
"irmc_info",
",",
"profile_name",
")",
":",
"# Send GET request to the server",
"resp",
"=",
"elcm_request",
"(",
"irmc_info",
",",
"method",
"=",
"'GET'",
",",
"path",
"=",
"URL_PATH_PROFILE_MGMT",
"+",
"profile_name",
")",
"if",
"... | send an eLCM request to get profile data
:param irmc_info: node info
:param profile_name: name of profile
:returns: dict object of profile data if succeed
:raises: ELCMProfileNotFound if profile does not exist
:raises: SCCIClientError if SCCI failed | [
"send",
"an",
"eLCM",
"request",
"to",
"get",
"profile",
"data"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L314-L337 |
openstack/python-scciclient | scciclient/irmc/elcm.py | elcm_profile_create | def elcm_profile_create(irmc_info, param_path):
"""send an eLCM request to create profile
To create a profile, a new session is spawned with status 'running'.
When profile is created completely, the session ends.
:param irmc_info: node info
:param param_path: path of profile
:returns: dict obj... | python | def elcm_profile_create(irmc_info, param_path):
"""send an eLCM request to create profile
To create a profile, a new session is spawned with status 'running'.
When profile is created completely, the session ends.
:param irmc_info: node info
:param param_path: path of profile
:returns: dict obj... | [
"def",
"elcm_profile_create",
"(",
"irmc_info",
",",
"param_path",
")",
":",
"# Send POST request to the server",
"# NOTE: This task may take time, so set a timeout",
"_irmc_info",
"=",
"dict",
"(",
"irmc_info",
")",
"_irmc_info",
"[",
"'irmc_client_timeout'",
"]",
"=",
"PR... | send an eLCM request to create profile
To create a profile, a new session is spawned with status 'running'.
When profile is created completely, the session ends.
:param irmc_info: node info
:param param_path: path of profile
:returns: dict object of session info if succeed
{
'Ses... | [
"send",
"an",
"eLCM",
"request",
"to",
"create",
"profile"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L340-L376 |
openstack/python-scciclient | scciclient/irmc/elcm.py | elcm_profile_set | def elcm_profile_set(irmc_info, input_data):
"""send an eLCM request to set param values
To apply param values, a new session is spawned with status 'running'.
When values are applied or error, the session ends.
:param irmc_info: node info
:param input_data: param values to apply, eg.
{
... | python | def elcm_profile_set(irmc_info, input_data):
"""send an eLCM request to set param values
To apply param values, a new session is spawned with status 'running'.
When values are applied or error, the session ends.
:param irmc_info: node info
:param input_data: param values to apply, eg.
{
... | [
"def",
"elcm_profile_set",
"(",
"irmc_info",
",",
"input_data",
")",
":",
"# Prepare the data to apply",
"if",
"isinstance",
"(",
"input_data",
",",
"dict",
")",
":",
"data",
"=",
"jsonutils",
".",
"dumps",
"(",
"input_data",
")",
"else",
":",
"data",
"=",
"... | send an eLCM request to set param values
To apply param values, a new session is spawned with status 'running'.
When values are applied or error, the session ends.
:param irmc_info: node info
:param input_data: param values to apply, eg.
{
'Server':
{
'SystemCon... | [
"send",
"an",
"eLCM",
"request",
"to",
"set",
"param",
"values"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L379-L436 |
openstack/python-scciclient | scciclient/irmc/elcm.py | elcm_profile_delete | def elcm_profile_delete(irmc_info, profile_name):
"""send an eLCM request to delete a profile
:param irmc_info: node info
:param profile_name: name of profile
:raises: ELCMProfileNotFound if the profile does not exist
:raises: SCCIClientError if SCCI failed
"""
# Send DELETE request to the ... | python | def elcm_profile_delete(irmc_info, profile_name):
"""send an eLCM request to delete a profile
:param irmc_info: node info
:param profile_name: name of profile
:raises: ELCMProfileNotFound if the profile does not exist
:raises: SCCIClientError if SCCI failed
"""
# Send DELETE request to the ... | [
"def",
"elcm_profile_delete",
"(",
"irmc_info",
",",
"profile_name",
")",
":",
"# Send DELETE request to the server",
"resp",
"=",
"elcm_request",
"(",
"irmc_info",
",",
"method",
"=",
"'DELETE'",
",",
"path",
"=",
"URL_PATH_PROFILE_MGMT",
"+",
"profile_name",
")",
... | send an eLCM request to delete a profile
:param irmc_info: node info
:param profile_name: name of profile
:raises: ELCMProfileNotFound if the profile does not exist
:raises: SCCIClientError if SCCI failed | [
"send",
"an",
"eLCM",
"request",
"to",
"delete",
"a",
"profile"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L439-L463 |
openstack/python-scciclient | scciclient/irmc/elcm.py | elcm_session_list | def elcm_session_list(irmc_info):
"""send an eLCM request to list all sessions
:param irmc_info: node info
:returns: dict object of sessions if succeed
{
'SessionList':
{
'Contains':
[
{ 'Id': id1, 'Name': name1 },
{ 'Id': id2,... | python | def elcm_session_list(irmc_info):
"""send an eLCM request to list all sessions
:param irmc_info: node info
:returns: dict object of sessions if succeed
{
'SessionList':
{
'Contains':
[
{ 'Id': id1, 'Name': name1 },
{ 'Id': id2,... | [
"def",
"elcm_session_list",
"(",
"irmc_info",
")",
":",
"# Send GET request to the server",
"resp",
"=",
"elcm_request",
"(",
"irmc_info",
",",
"method",
"=",
"'GET'",
",",
"path",
"=",
"'/sessionInformation/'",
")",
"if",
"resp",
".",
"status_code",
"==",
"200",
... | send an eLCM request to list all sessions
:param irmc_info: node info
:returns: dict object of sessions if succeed
{
'SessionList':
{
'Contains':
[
{ 'Id': id1, 'Name': name1 },
{ 'Id': id2, 'Name': name2 },
{ 'Id': i... | [
"send",
"an",
"eLCM",
"request",
"to",
"list",
"all",
"sessions"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L466-L493 |
openstack/python-scciclient | scciclient/irmc/elcm.py | elcm_session_get_status | def elcm_session_get_status(irmc_info, session_id):
"""send an eLCM request to get session status
:param irmc_info: node info
:param session_id: session id
:returns: dict object of session info if succeed
{
'Session':
{
'Id': id
'Status': status
... | python | def elcm_session_get_status(irmc_info, session_id):
"""send an eLCM request to get session status
:param irmc_info: node info
:param session_id: session id
:returns: dict object of session info if succeed
{
'Session':
{
'Id': id
'Status': status
... | [
"def",
"elcm_session_get_status",
"(",
"irmc_info",
",",
"session_id",
")",
":",
"# Send GET request to the server",
"resp",
"=",
"elcm_request",
"(",
"irmc_info",
",",
"method",
"=",
"'GET'",
",",
"path",
"=",
"'/sessionInformation/%s/status'",
"%",
"session_id",
")"... | send an eLCM request to get session status
:param irmc_info: node info
:param session_id: session id
:returns: dict object of session info if succeed
{
'Session':
{
'Id': id
'Status': status
...
}
}
:raises: ELCMSessionNo... | [
"send",
"an",
"eLCM",
"request",
"to",
"get",
"session",
"status"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L496-L526 |
openstack/python-scciclient | scciclient/irmc/elcm.py | elcm_session_terminate | def elcm_session_terminate(irmc_info, session_id):
"""send an eLCM request to terminate a session
:param irmc_info: node info
:param session_id: session id
:raises: ELCMSessionNotFound if the session does not exist
:raises: SCCIClientError if SCCI failed
"""
# Send DELETE request to the ser... | python | def elcm_session_terminate(irmc_info, session_id):
"""send an eLCM request to terminate a session
:param irmc_info: node info
:param session_id: session id
:raises: ELCMSessionNotFound if the session does not exist
:raises: SCCIClientError if SCCI failed
"""
# Send DELETE request to the ser... | [
"def",
"elcm_session_terminate",
"(",
"irmc_info",
",",
"session_id",
")",
":",
"# Send DELETE request to the server",
"resp",
"=",
"elcm_request",
"(",
"irmc_info",
",",
"method",
"=",
"'DELETE'",
",",
"path",
"=",
"'/sessionInformation/%s/terminate'",
"%",
"session_id... | send an eLCM request to terminate a session
:param irmc_info: node info
:param session_id: session id
:raises: ELCMSessionNotFound if the session does not exist
:raises: SCCIClientError if SCCI failed | [
"send",
"an",
"eLCM",
"request",
"to",
"terminate",
"a",
"session"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L561-L582 |
openstack/python-scciclient | scciclient/irmc/elcm.py | elcm_session_delete | def elcm_session_delete(irmc_info, session_id, terminate=False):
"""send an eLCM request to remove a session from the session list
:param irmc_info: node info
:param session_id: session id
:param terminate: a running session must be terminated before removing
:raises: ELCMSessionNotFound if the ses... | python | def elcm_session_delete(irmc_info, session_id, terminate=False):
"""send an eLCM request to remove a session from the session list
:param irmc_info: node info
:param session_id: session id
:param terminate: a running session must be terminated before removing
:raises: ELCMSessionNotFound if the ses... | [
"def",
"elcm_session_delete",
"(",
"irmc_info",
",",
"session_id",
",",
"terminate",
"=",
"False",
")",
":",
"# Terminate the session first if needs to",
"if",
"terminate",
":",
"# Get session status to check",
"session",
"=",
"elcm_session_get_status",
"(",
"irmc_info",
... | send an eLCM request to remove a session from the session list
:param irmc_info: node info
:param session_id: session id
:param terminate: a running session must be terminated before removing
:raises: ELCMSessionNotFound if the session does not exist
:raises: SCCIClientError if SCCI failed | [
"send",
"an",
"eLCM",
"request",
"to",
"remove",
"a",
"session",
"from",
"the",
"session",
"list"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L585-L617 |
openstack/python-scciclient | scciclient/irmc/elcm.py | _process_session_data | def _process_session_data(irmc_info, operation, session_id,
session_timeout=BIOS_CONFIG_SESSION_TIMEOUT):
"""process session for Bios config backup/restore or RAID config operation
:param irmc_info: node info
:param operation: one of 'BACKUP_BIOS', 'RESTORE_BIOS' or 'CONFIG_RAID'
... | python | def _process_session_data(irmc_info, operation, session_id,
session_timeout=BIOS_CONFIG_SESSION_TIMEOUT):
"""process session for Bios config backup/restore or RAID config operation
:param irmc_info: node info
:param operation: one of 'BACKUP_BIOS', 'RESTORE_BIOS' or 'CONFIG_RAID'
... | [
"def",
"_process_session_data",
"(",
"irmc_info",
",",
"operation",
",",
"session_id",
",",
"session_timeout",
"=",
"BIOS_CONFIG_SESSION_TIMEOUT",
")",
":",
"session_expiration",
"=",
"time",
".",
"time",
"(",
")",
"+",
"session_timeout",
"while",
"time",
".",
"ti... | process session for Bios config backup/restore or RAID config operation
:param irmc_info: node info
:param operation: one of 'BACKUP_BIOS', 'RESTORE_BIOS' or 'CONFIG_RAID'
:param session_id: session id
:param session_timeout: session timeout
:return: a dict with following values:
{
... | [
"process",
"session",
"for",
"Bios",
"config",
"backup",
"/",
"restore",
"or",
"RAID",
"config",
"operation"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L620-L698 |
openstack/python-scciclient | scciclient/irmc/elcm.py | backup_bios_config | def backup_bios_config(irmc_info):
"""backup current bios configuration
This function sends a BACKUP BIOS request to the server. Then when the bios
config data are ready for retrieving, it will return the data to the
caller. Note that this operation may take time.
:param irmc_info: node info
:... | python | def backup_bios_config(irmc_info):
"""backup current bios configuration
This function sends a BACKUP BIOS request to the server. Then when the bios
config data are ready for retrieving, it will return the data to the
caller. Note that this operation may take time.
:param irmc_info: node info
:... | [
"def",
"backup_bios_config",
"(",
"irmc_info",
")",
":",
"# 1. Make sure there is no BiosConfig profile in the store",
"try",
":",
"# Get the profile first, if not found, then an exception",
"# will be raised.",
"elcm_profile_get",
"(",
"irmc_info",
"=",
"irmc_info",
",",
"profile_... | backup current bios configuration
This function sends a BACKUP BIOS request to the server. Then when the bios
config data are ready for retrieving, it will return the data to the
caller. Note that this operation may take time.
:param irmc_info: node info
:return: a dict with following values:
... | [
"backup",
"current",
"bios",
"configuration"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L701-L739 |
openstack/python-scciclient | scciclient/irmc/elcm.py | restore_bios_config | def restore_bios_config(irmc_info, bios_config):
"""restore bios configuration
This function sends a RESTORE BIOS request to the server. Then when the
bios
is ready for restoring, it will apply the provided settings and return.
Note that this operation may take time.
:param irmc_info: node inf... | python | def restore_bios_config(irmc_info, bios_config):
"""restore bios configuration
This function sends a RESTORE BIOS request to the server. Then when the
bios
is ready for restoring, it will apply the provided settings and return.
Note that this operation may take time.
:param irmc_info: node inf... | [
"def",
"restore_bios_config",
"(",
"irmc_info",
",",
"bios_config",
")",
":",
"def",
"_process_bios_config",
"(",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"bios_config",
",",
"dict",
")",
":",
"input_data",
"=",
"bios_config",
"else",
":",
"input_data",
... | restore bios configuration
This function sends a RESTORE BIOS request to the server. Then when the
bios
is ready for restoring, it will apply the provided settings and return.
Note that this operation may take time.
:param irmc_info: node info
:param bios_config: bios config | [
"restore",
"bios",
"configuration"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L742-L797 |
openstack/python-scciclient | scciclient/irmc/elcm.py | get_secure_boot_mode | def get_secure_boot_mode(irmc_info):
"""Get the status if secure boot is enabled or not.
:param irmc_info: node info.
:raises: SecureBootConfigNotFound, if there is no configuration for secure
boot mode in the bios.
:return: True if secure boot mode is enabled on the node, False otherwise.... | python | def get_secure_boot_mode(irmc_info):
"""Get the status if secure boot is enabled or not.
:param irmc_info: node info.
:raises: SecureBootConfigNotFound, if there is no configuration for secure
boot mode in the bios.
:return: True if secure boot mode is enabled on the node, False otherwise.... | [
"def",
"get_secure_boot_mode",
"(",
"irmc_info",
")",
":",
"result",
"=",
"backup_bios_config",
"(",
"irmc_info",
"=",
"irmc_info",
")",
"try",
":",
"bioscfg",
"=",
"result",
"[",
"'bios_config'",
"]",
"[",
"'Server'",
"]",
"[",
"'SystemConfig'",
"]",
"[",
"... | Get the status if secure boot is enabled or not.
:param irmc_info: node info.
:raises: SecureBootConfigNotFound, if there is no configuration for secure
boot mode in the bios.
:return: True if secure boot mode is enabled on the node, False otherwise. | [
"Get",
"the",
"status",
"if",
"secure",
"boot",
"is",
"enabled",
"or",
"not",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L800-L818 |
openstack/python-scciclient | scciclient/irmc/elcm.py | set_secure_boot_mode | def set_secure_boot_mode(irmc_info, enable):
"""Enable/Disable secure boot on the server.
:param irmc_info: node info
:param enable: True, if secure boot needs to be
enabled for next boot, else False.
"""
bios_config_data = {
'Server': {
'@Version': '1.01',
... | python | def set_secure_boot_mode(irmc_info, enable):
"""Enable/Disable secure boot on the server.
:param irmc_info: node info
:param enable: True, if secure boot needs to be
enabled for next boot, else False.
"""
bios_config_data = {
'Server': {
'@Version': '1.01',
... | [
"def",
"set_secure_boot_mode",
"(",
"irmc_info",
",",
"enable",
")",
":",
"bios_config_data",
"=",
"{",
"'Server'",
":",
"{",
"'@Version'",
":",
"'1.01'",
",",
"'SystemConfig'",
":",
"{",
"'BiosConfig'",
":",
"{",
"'@Version'",
":",
"'1.01'",
",",
"'SecurityCo... | Enable/Disable secure boot on the server.
:param irmc_info: node info
:param enable: True, if secure boot needs to be
enabled for next boot, else False. | [
"Enable",
"/",
"Disable",
"secure",
"boot",
"on",
"the",
"server",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L821-L842 |
openstack/python-scciclient | scciclient/irmc/elcm.py | _update_raid_input_data | def _update_raid_input_data(target_raid_config, raid_input):
"""Process raid input data.
:param target_raid_config: node raid info
:param raid_input: raid information for creating via eLCM
:raises ELCMValueError: raise msg if wrong input
:return: raid_input: raid input data which create raid config... | python | def _update_raid_input_data(target_raid_config, raid_input):
"""Process raid input data.
:param target_raid_config: node raid info
:param raid_input: raid information for creating via eLCM
:raises ELCMValueError: raise msg if wrong input
:return: raid_input: raid input data which create raid config... | [
"def",
"_update_raid_input_data",
"(",
"target_raid_config",
",",
"raid_input",
")",
":",
"logical_disk_list",
"=",
"target_raid_config",
"[",
"'logical_disks'",
"]",
"raid_input",
"[",
"'Server'",
"]",
"[",
"'HWConfigurationIrmc'",
"]",
".",
"update",
"(",
"{",
"'@... | Process raid input data.
:param target_raid_config: node raid info
:param raid_input: raid information for creating via eLCM
:raises ELCMValueError: raise msg if wrong input
:return: raid_input: raid input data which create raid configuration
{
"Server":{
"HWConfigurationI... | [
"Process",
"raid",
"input",
"data",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L845-L941 |
openstack/python-scciclient | scciclient/irmc/elcm.py | _get_existing_logical_drives | def _get_existing_logical_drives(raid_adapter):
"""Collect existing logical drives on the server.
:param raid_adapter: raid adapter info
:returns: existing_logical_drives: get logical drive on server
"""
existing_logical_drives = []
logical_drives = raid_adapter['Server']['HWConfigurationIrmc']... | python | def _get_existing_logical_drives(raid_adapter):
"""Collect existing logical drives on the server.
:param raid_adapter: raid adapter info
:returns: existing_logical_drives: get logical drive on server
"""
existing_logical_drives = []
logical_drives = raid_adapter['Server']['HWConfigurationIrmc']... | [
"def",
"_get_existing_logical_drives",
"(",
"raid_adapter",
")",
":",
"existing_logical_drives",
"=",
"[",
"]",
"logical_drives",
"=",
"raid_adapter",
"[",
"'Server'",
"]",
"[",
"'HWConfigurationIrmc'",
"]",
"[",
"'Adapters'",
"]",
"[",
"'RAIDAdapter'",
"]",
"[",
... | Collect existing logical drives on the server.
:param raid_adapter: raid adapter info
:returns: existing_logical_drives: get logical drive on server | [
"Collect",
"existing",
"logical",
"drives",
"on",
"the",
"server",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L958-L971 |
openstack/python-scciclient | scciclient/irmc/elcm.py | _create_raid_adapter_profile | def _create_raid_adapter_profile(irmc_info):
"""Attempt delete exist adapter then create new raid adapter on the server.
:param irmc_info: node info
:returns: result: a dict with following values:
{
'raid_config': <data of raid adapter profile>,
'warn... | python | def _create_raid_adapter_profile(irmc_info):
"""Attempt delete exist adapter then create new raid adapter on the server.
:param irmc_info: node info
:returns: result: a dict with following values:
{
'raid_config': <data of raid adapter profile>,
'warn... | [
"def",
"_create_raid_adapter_profile",
"(",
"irmc_info",
")",
":",
"try",
":",
"# Attempt erase exist adapter on BM Server",
"elcm_profile_delete",
"(",
"irmc_info",
",",
"PROFILE_RAID_CONFIG",
")",
"except",
"ELCMProfileNotFound",
":",
"# Ignore this error as it's not an error i... | Attempt delete exist adapter then create new raid adapter on the server.
:param irmc_info: node info
:returns: result: a dict with following values:
{
'raid_config': <data of raid adapter profile>,
'warning': <warning message if there is>
... | [
"Attempt",
"delete",
"exist",
"adapter",
"then",
"create",
"new",
"raid",
"adapter",
"on",
"the",
"server",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L974-L1000 |
openstack/python-scciclient | scciclient/irmc/elcm.py | create_raid_configuration | def create_raid_configuration(irmc_info, target_raid_config):
"""Process raid_input then perform raid configuration into server.
:param irmc_info: node info
:param target_raid_config: node raid information
"""
if len(target_raid_config['logical_disks']) < 1:
raise ELCMValueError(message="l... | python | def create_raid_configuration(irmc_info, target_raid_config):
"""Process raid_input then perform raid configuration into server.
:param irmc_info: node info
:param target_raid_config: node raid information
"""
if len(target_raid_config['logical_disks']) < 1:
raise ELCMValueError(message="l... | [
"def",
"create_raid_configuration",
"(",
"irmc_info",
",",
"target_raid_config",
")",
":",
"if",
"len",
"(",
"target_raid_config",
"[",
"'logical_disks'",
"]",
")",
"<",
"1",
":",
"raise",
"ELCMValueError",
"(",
"message",
"=",
"\"logical_disks must not be empty\"",
... | Process raid_input then perform raid configuration into server.
:param irmc_info: node info
:param target_raid_config: node raid information | [
"Process",
"raid_input",
"then",
"perform",
"raid",
"configuration",
"into",
"server",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L1003-L1035 |
openstack/python-scciclient | scciclient/irmc/elcm.py | delete_raid_configuration | def delete_raid_configuration(irmc_info):
"""Delete whole raid configuration or one of logical drive on the server.
:param irmc_info: node info
"""
# Attempt to get raid configuration on BM Server
raid_adapter = get_raid_adapter(irmc_info)
existing_logical_drives = _get_existing_logical_drives(... | python | def delete_raid_configuration(irmc_info):
"""Delete whole raid configuration or one of logical drive on the server.
:param irmc_info: node info
"""
# Attempt to get raid configuration on BM Server
raid_adapter = get_raid_adapter(irmc_info)
existing_logical_drives = _get_existing_logical_drives(... | [
"def",
"delete_raid_configuration",
"(",
"irmc_info",
")",
":",
"# Attempt to get raid configuration on BM Server",
"raid_adapter",
"=",
"get_raid_adapter",
"(",
"irmc_info",
")",
"existing_logical_drives",
"=",
"_get_existing_logical_drives",
"(",
"raid_adapter",
")",
"# Ironi... | Delete whole raid configuration or one of logical drive on the server.
:param irmc_info: node info | [
"Delete",
"whole",
"raid",
"configuration",
"or",
"one",
"of",
"logical",
"drive",
"on",
"the",
"server",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L1038-L1067 |
openstack/python-scciclient | scciclient/irmc/elcm.py | set_bios_configuration | def set_bios_configuration(irmc_info, settings):
"""Set BIOS configurations on the server.
:param irmc_info: node info
:param settings: Dictionary containing the BIOS configuration.
:raise: BiosConfigNotFound, if there is wrong settings for bios
configuration.
"""
bios_config_data = {
... | python | def set_bios_configuration(irmc_info, settings):
"""Set BIOS configurations on the server.
:param irmc_info: node info
:param settings: Dictionary containing the BIOS configuration.
:raise: BiosConfigNotFound, if there is wrong settings for bios
configuration.
"""
bios_config_data = {
... | [
"def",
"set_bios_configuration",
"(",
"irmc_info",
",",
"settings",
")",
":",
"bios_config_data",
"=",
"{",
"'Server'",
":",
"{",
"'SystemConfig'",
":",
"{",
"'BiosConfig'",
":",
"{",
"}",
"}",
"}",
"}",
"versions",
"=",
"elcm_profile_get_versions",
"(",
"irmc... | Set BIOS configurations on the server.
:param irmc_info: node info
:param settings: Dictionary containing the BIOS configuration.
:raise: BiosConfigNotFound, if there is wrong settings for bios
configuration. | [
"Set",
"BIOS",
"configurations",
"on",
"the",
"server",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L1070-L1120 |
openstack/python-scciclient | scciclient/irmc/elcm.py | get_bios_settings | def get_bios_settings(irmc_info):
"""Get the current BIOS settings on the server
:param irmc_info: node info.
:returns: a list of dictionary BIOS settings
"""
bios_config = backup_bios_config(irmc_info)['bios_config']
bios_config_data = bios_config['Server']['SystemConfig']['BiosConfig']
s... | python | def get_bios_settings(irmc_info):
"""Get the current BIOS settings on the server
:param irmc_info: node info.
:returns: a list of dictionary BIOS settings
"""
bios_config = backup_bios_config(irmc_info)['bios_config']
bios_config_data = bios_config['Server']['SystemConfig']['BiosConfig']
s... | [
"def",
"get_bios_settings",
"(",
"irmc_info",
")",
":",
"bios_config",
"=",
"backup_bios_config",
"(",
"irmc_info",
")",
"[",
"'bios_config'",
"]",
"bios_config_data",
"=",
"bios_config",
"[",
"'Server'",
"]",
"[",
"'SystemConfig'",
"]",
"[",
"'BiosConfig'",
"]",
... | Get the current BIOS settings on the server
:param irmc_info: node info.
:returns: a list of dictionary BIOS settings | [
"Get",
"the",
"current",
"BIOS",
"settings",
"on",
"the",
"server"
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/elcm.py#L1123-L1141 |
playpauseandstop/rororo | rororo/aio.py | add_resource_context | def add_resource_context(router: web.AbstractRouter,
url_prefix: str = None,
name_prefix: str = None) -> Iterator[Any]:
"""Context manager for adding resources for given router.
Main goal of context manager to easify process of adding resources with
routes ... | python | def add_resource_context(router: web.AbstractRouter,
url_prefix: str = None,
name_prefix: str = None) -> Iterator[Any]:
"""Context manager for adding resources for given router.
Main goal of context manager to easify process of adding resources with
routes ... | [
"def",
"add_resource_context",
"(",
"router",
":",
"web",
".",
"AbstractRouter",
",",
"url_prefix",
":",
"str",
"=",
"None",
",",
"name_prefix",
":",
"str",
"=",
"None",
")",
"->",
"Iterator",
"[",
"Any",
"]",
":",
"def",
"add_resource",
"(",
"url",
":",... | Context manager for adding resources for given router.
Main goal of context manager to easify process of adding resources with
routes to the router. This also allow to reduce amount of repeats, when
supplying new resources by reusing URL & name prefixes for all routes
inside context manager.
Behin... | [
"Context",
"manager",
"for",
"adding",
"resources",
"for",
"given",
"router",
"."
] | train | https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/aio.py#L42-L110 |
playpauseandstop/rororo | rororo/aio.py | parse_aioredis_url | def parse_aioredis_url(url: str) -> DictStrAny:
"""
Convert Redis URL string to dict suitable to pass to
``aioredis.create_redis(...)`` call.
**Usage**::
async def connect_redis(url=None):
url = url or 'redis://localhost:6379/0'
return await create_redis(**get_aioredis_... | python | def parse_aioredis_url(url: str) -> DictStrAny:
"""
Convert Redis URL string to dict suitable to pass to
``aioredis.create_redis(...)`` call.
**Usage**::
async def connect_redis(url=None):
url = url or 'redis://localhost:6379/0'
return await create_redis(**get_aioredis_... | [
"def",
"parse_aioredis_url",
"(",
"url",
":",
"str",
")",
"->",
"DictStrAny",
":",
"parts",
"=",
"urlparse",
"(",
"url",
")",
"db",
"=",
"parts",
".",
"path",
"[",
"1",
":",
"]",
"or",
"None",
"# type: Optional[Union[str, int]]",
"if",
"db",
":",
"db",
... | Convert Redis URL string to dict suitable to pass to
``aioredis.create_redis(...)`` call.
**Usage**::
async def connect_redis(url=None):
url = url or 'redis://localhost:6379/0'
return await create_redis(**get_aioredis_parts(url))
:param url: URL to access Redis instance, s... | [
"Convert",
"Redis",
"URL",
"string",
"to",
"dict",
"suitable",
"to",
"pass",
"to",
"aioredis",
".",
"create_redis",
"(",
"...",
")",
"call",
"."
] | train | https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/aio.py#L124-L146 |
OSSOS/MOP | src/ossos/core/ossos/mpc_time.py | TimeMPC.str_kwargs | def str_kwargs(self):
"""
Generator that yields a dict of values corresponding to the ... | python | def str_kwargs(self):
"""
Generator that yields a dict of values corresponding to the ... | [
"def",
"str_kwargs",
"(",
"self",
")",
":",
"iys",
",",
"ims",
",",
"ids",
",",
"ihmsfs",
"=",
"sofa_time",
".",
"jd_dtf",
"(",
"self",
".",
"scale",
".",
"upper",
"(",
")",
".",
"encode",
"(",
"'utf8'",
")",
",",
"6",
",",
"self",
".",
"jd1",
... | Generator that yields a dict of values corresponding to the
calendar date and time for the internal JD values.
Here we provide the additional 'fracday' element needed by 'mpc' format | [
"Generator",
"that",
"yields",
"a",
"dict",
"of",
"values",
"corresponding",
"to",
"the",
"calendar",
"date",
"and",
"time",
"for",
"the",
"internal",
"JD",
"values",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mpc_time.py#L82-L111 |
JohnVinyard/zounds | zounds/spectral/sliding_window.py | oggvorbis | def oggvorbis(s):
"""
This is taken from the ogg vorbis spec
(http://xiph.org/vorbis/doc/Vorbis_I_spec.html)
:param s: the total length of the window, in samples
"""
try:
s = np.arange(s)
except TypeError:
s = np.arange(s[0])
i = np.sin((s + .5) / len(s) * np.pi) ** 2
... | python | def oggvorbis(s):
"""
This is taken from the ogg vorbis spec
(http://xiph.org/vorbis/doc/Vorbis_I_spec.html)
:param s: the total length of the window, in samples
"""
try:
s = np.arange(s)
except TypeError:
s = np.arange(s[0])
i = np.sin((s + .5) / len(s) * np.pi) ** 2
... | [
"def",
"oggvorbis",
"(",
"s",
")",
":",
"try",
":",
"s",
"=",
"np",
".",
"arange",
"(",
"s",
")",
"except",
"TypeError",
":",
"s",
"=",
"np",
".",
"arange",
"(",
"s",
"[",
"0",
"]",
")",
"i",
"=",
"np",
".",
"sin",
"(",
"(",
"s",
"+",
".5... | This is taken from the ogg vorbis spec
(http://xiph.org/vorbis/doc/Vorbis_I_spec.html)
:param s: the total length of the window, in samples | [
"This",
"is",
"taken",
"from",
"the",
"ogg",
"vorbis",
"spec",
"(",
"http",
":",
"//",
"xiph",
".",
"org",
"/",
"vorbis",
"/",
"doc",
"/",
"Vorbis_I_spec",
".",
"html",
")"
] | train | https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/sliding_window.py#L7-L21 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/focus.py | FocusCalculator.convert_source_location | def convert_source_location(self, source_reading, reference_reading):
"""
Converts the source (x, y) location from reading into the coordinate
system of reference_reading.
"""
offset_x, offset_y = reference_reading.get_coordinate_offset(source_reading)
focus = source_read... | python | def convert_source_location(self, source_reading, reference_reading):
"""
Converts the source (x, y) location from reading into the coordinate
system of reference_reading.
"""
offset_x, offset_y = reference_reading.get_coordinate_offset(source_reading)
focus = source_read... | [
"def",
"convert_source_location",
"(",
"self",
",",
"source_reading",
",",
"reference_reading",
")",
":",
"offset_x",
",",
"offset_y",
"=",
"reference_reading",
".",
"get_coordinate_offset",
"(",
"source_reading",
")",
"focus",
"=",
"source_reading",
".",
"x",
"+",
... | Converts the source (x, y) location from reading into the coordinate
system of reference_reading. | [
"Converts",
"the",
"source",
"(",
"x",
"y",
")",
"location",
"from",
"reading",
"into",
"the",
"coordinate",
"system",
"of",
"reference_reading",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/focus.py#L5-L12 |
OSSOS/MOP | src/ossos/core/ossos/downloads/cutouts/focus.py | SingletFocusCalculator.calculate_focus | def calculate_focus(self, reading):
"""
Determines what the focal point of the downloaded image should be.
Returns:
focal_point: (x, y)
The location of the source in the middle observation, in the
coordinate system of the current source reading.
"""
... | python | def calculate_focus(self, reading):
"""
Determines what the focal point of the downloaded image should be.
Returns:
focal_point: (x, y)
The location of the source in the middle observation, in the
coordinate system of the current source reading.
"""
... | [
"def",
"calculate_focus",
"(",
"self",
",",
"reading",
")",
":",
"middle_index",
"=",
"len",
"(",
"self",
".",
"source",
".",
"get_readings",
"(",
")",
")",
"//",
"2",
"middle_reading",
"=",
"self",
".",
"source",
".",
"get_reading",
"(",
"middle_index",
... | Determines what the focal point of the downloaded image should be.
Returns:
focal_point: (x, y)
The location of the source in the middle observation, in the
coordinate system of the current source reading. | [
"Determines",
"what",
"the",
"focal",
"point",
"of",
"the",
"downloaded",
"image",
"should",
"be",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/downloads/cutouts/focus.py#L24-L35 |
OSSOS/MOP | src/ossos/plotting/scripts/rose_topdown.py | top_down_SolarSystem | def top_down_SolarSystem(discoveries,
inner_limit=6, # truncate at 8 AU to show that we don't have sensitivity in close
extent=83, # extend to 83 AU as indicative only, sensitivity is to ~300 AU
plot_discoveries=None,
... | python | def top_down_SolarSystem(discoveries,
inner_limit=6, # truncate at 8 AU to show that we don't have sensitivity in close
extent=83, # extend to 83 AU as indicative only, sensitivity is to ~300 AU
plot_discoveries=None,
... | [
"def",
"top_down_SolarSystem",
"(",
"discoveries",
",",
"inner_limit",
"=",
"6",
",",
"# truncate at 8 AU to show that we don't have sensitivity in close",
"extent",
"=",
"83",
",",
"# extend to 83 AU as indicative only, sensitivity is to ~300 AU",
"plot_discoveries",
"=",
"None",
... | Plot the OSSOS discoveries on a top-down Solar System showing the position of Neptune and model TNOs.
Discoveries are plotted each at their time of discovery according to the value in the Version Release.
Coordinates should be polar to account for RA hours, radial axis is in AU.
:return: a saved plot
T... | [
"Plot",
"the",
"OSSOS",
"discoveries",
"on",
"a",
"top",
"-",
"down",
"Solar",
"System",
"showing",
"the",
"position",
"of",
"Neptune",
"and",
"model",
"TNOs",
".",
"Discoveries",
"are",
"plotted",
"each",
"at",
"their",
"time",
"of",
"discovery",
"according... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/plotting/scripts/rose_topdown.py#L22-L129 |
OSSOS/MOP | src/ossos/plotting/scripts/rose_topdown.py | plot_ossos_discoveries | def plot_ossos_discoveries(ax, discoveries, plot_discoveries,
plot_colossos=False, split_plutinos=False):
"""
plotted at their discovery locations, provided by the Version Releases in decimal degrees.
"""
fc = ['b', '#E47833', 'k']
alpha = [0.85, 0.6, 1.]
marker = ['o'... | python | def plot_ossos_discoveries(ax, discoveries, plot_discoveries,
plot_colossos=False, split_plutinos=False):
"""
plotted at their discovery locations, provided by the Version Releases in decimal degrees.
"""
fc = ['b', '#E47833', 'k']
alpha = [0.85, 0.6, 1.]
marker = ['o'... | [
"def",
"plot_ossos_discoveries",
"(",
"ax",
",",
"discoveries",
",",
"plot_discoveries",
",",
"plot_colossos",
"=",
"False",
",",
"split_plutinos",
"=",
"False",
")",
":",
"fc",
"=",
"[",
"'b'",
",",
"'#E47833'",
",",
"'k'",
"]",
"alpha",
"=",
"[",
"0.85",... | plotted at their discovery locations, provided by the Version Releases in decimal degrees. | [
"plotted",
"at",
"their",
"discovery",
"locations",
"provided",
"by",
"the",
"Version",
"Releases",
"in",
"decimal",
"degrees",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/plotting/scripts/rose_topdown.py#L165-L205 |
OSSOS/MOP | src/ossos/plotting/scripts/rose_topdown.py | orbit_fit_residuals | def orbit_fit_residuals(discoveries, blockID='O13AE'):
"""Brett: What are relevant and stunning are the actual orbit fit residuals
for orbits with d(a)/a<1%. I would be happy with a simple histogram of all those numbers,
although the 'tail' (probably blended and not yet completely flagged) should
perhap... | python | def orbit_fit_residuals(discoveries, blockID='O13AE'):
"""Brett: What are relevant and stunning are the actual orbit fit residuals
for orbits with d(a)/a<1%. I would be happy with a simple histogram of all those numbers,
although the 'tail' (probably blended and not yet completely flagged) should
perhap... | [
"def",
"orbit_fit_residuals",
"(",
"discoveries",
",",
"blockID",
"=",
"'O13AE'",
")",
":",
"ra_residuals",
"=",
"[",
"]",
"dec_residuals",
"=",
"[",
"]",
"ressum",
"=",
"[",
"]",
"for",
"i",
",",
"orbit",
"in",
"enumerate",
"(",
"discoveries",
")",
":",... | Brett: What are relevant and stunning are the actual orbit fit residuals
for orbits with d(a)/a<1%. I would be happy with a simple histogram of all those numbers,
although the 'tail' (probably blended and not yet completely flagged) should
perhaps be excluded. There will be a pretty clear gaussian I would ... | [
"Brett",
":",
"What",
"are",
"relevant",
"and",
"stunning",
"are",
"the",
"actual",
"orbit",
"fit",
"residuals",
"for",
"orbits",
"with",
"d",
"(",
"a",
")",
"/",
"a<1%",
".",
"I",
"would",
"be",
"happy",
"with",
"a",
"simple",
"histogram",
"of",
"all"... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/plotting/scripts/rose_topdown.py#L247-L286 |
openstack/python-scciclient | scciclient/irmc/snmp.py | get_irmc_firmware_version | def get_irmc_firmware_version(snmp_client):
"""Get irmc firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bmc name and irmc firmware version.
"""
try:
bmc_name = snmp_client.get(BMC_NAME_OID)
... | python | def get_irmc_firmware_version(snmp_client):
"""Get irmc firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bmc name and irmc firmware version.
"""
try:
bmc_name = snmp_client.get(BMC_NAME_OID)
... | [
"def",
"get_irmc_firmware_version",
"(",
"snmp_client",
")",
":",
"try",
":",
"bmc_name",
"=",
"snmp_client",
".",
"get",
"(",
"BMC_NAME_OID",
")",
"irmc_firm_ver",
"=",
"snmp_client",
".",
"get",
"(",
"IRMC_FW_VERSION_OID",
")",
"return",
"(",
"'%(bmc)s%(sep)s%(f... | Get irmc firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bmc name and irmc firmware version. | [
"Get",
"irmc",
"firmware",
"version",
"of",
"the",
"node",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/snmp.py#L69-L86 |
openstack/python-scciclient | scciclient/irmc/snmp.py | get_bios_firmware_version | def get_bios_firmware_version(snmp_client):
"""Get bios firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bios firmware version.
"""
try:
bios_firmware_version = snmp_client.get(BIOS_FW_VERSION_... | python | def get_bios_firmware_version(snmp_client):
"""Get bios firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bios firmware version.
"""
try:
bios_firmware_version = snmp_client.get(BIOS_FW_VERSION_... | [
"def",
"get_bios_firmware_version",
"(",
"snmp_client",
")",
":",
"try",
":",
"bios_firmware_version",
"=",
"snmp_client",
".",
"get",
"(",
"BIOS_FW_VERSION_OID",
")",
"return",
"six",
".",
"text_type",
"(",
"bios_firmware_version",
")",
"except",
"SNMPFailure",
"as... | Get bios firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bios firmware version. | [
"Get",
"bios",
"firmware",
"version",
"of",
"the",
"node",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/snmp.py#L89-L102 |
openstack/python-scciclient | scciclient/irmc/snmp.py | get_server_model | def get_server_model(snmp_client):
"""Get server model of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of server model.
"""
try:
server_model = snmp_client.get(SERVER_MODEL_OID)
return six.text_type(serve... | python | def get_server_model(snmp_client):
"""Get server model of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of server model.
"""
try:
server_model = snmp_client.get(SERVER_MODEL_OID)
return six.text_type(serve... | [
"def",
"get_server_model",
"(",
"snmp_client",
")",
":",
"try",
":",
"server_model",
"=",
"snmp_client",
".",
"get",
"(",
"SERVER_MODEL_OID",
")",
"return",
"six",
".",
"text_type",
"(",
"server_model",
")",
"except",
"SNMPFailure",
"as",
"e",
":",
"raise",
... | Get server model of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of server model. | [
"Get",
"server",
"model",
"of",
"the",
"node",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/snmp.py#L105-L118 |
openstack/python-scciclient | scciclient/irmc/snmp.py | SNMPClient._get_auth | def _get_auth(self):
"""Return the authorization data for an SNMP request.
:returns: A
:class:`pysnmp.entity.rfc3413.oneliner.cmdgen.CommunityData`
object.
"""
if self.version == SNMP_V3:
# Handling auth/encryption credentials is not (yet) supported.
... | python | def _get_auth(self):
"""Return the authorization data for an SNMP request.
:returns: A
:class:`pysnmp.entity.rfc3413.oneliner.cmdgen.CommunityData`
object.
"""
if self.version == SNMP_V3:
# Handling auth/encryption credentials is not (yet) supported.
... | [
"def",
"_get_auth",
"(",
"self",
")",
":",
"if",
"self",
".",
"version",
"==",
"SNMP_V3",
":",
"# Handling auth/encryption credentials is not (yet) supported.",
"# This version supports a security name analogous to community.",
"return",
"cmdgen",
".",
"UsmUserData",
"(",
"se... | Return the authorization data for an SNMP request.
:returns: A
:class:`pysnmp.entity.rfc3413.oneliner.cmdgen.CommunityData`
object. | [
"Return",
"the",
"authorization",
"data",
"for",
"an",
"SNMP",
"request",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/snmp.py#L138-L151 |
openstack/python-scciclient | scciclient/irmc/snmp.py | SNMPClient.get | def get(self, oid):
"""Use PySNMP to perform an SNMP GET operation on a single object.
:param oid: The OID of the object to get.
:raises: SNMPFailure if an SNMP request fails.
:returns: The value of the requested object.
"""
try:
results = self.cmd_gen.getCmd... | python | def get(self, oid):
"""Use PySNMP to perform an SNMP GET operation on a single object.
:param oid: The OID of the object to get.
:raises: SNMPFailure if an SNMP request fails.
:returns: The value of the requested object.
"""
try:
results = self.cmd_gen.getCmd... | [
"def",
"get",
"(",
"self",
",",
"oid",
")",
":",
"try",
":",
"results",
"=",
"self",
".",
"cmd_gen",
".",
"getCmd",
"(",
"self",
".",
"_get_auth",
"(",
")",
",",
"self",
".",
"_get_transport",
"(",
")",
",",
"oid",
")",
"except",
"snmp_error",
".",... | Use PySNMP to perform an SNMP GET operation on a single object.
:param oid: The OID of the object to get.
:raises: SNMPFailure if an SNMP request fails.
:returns: The value of the requested object. | [
"Use",
"PySNMP",
"to",
"perform",
"an",
"SNMP",
"GET",
"operation",
"on",
"a",
"single",
"object",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/snmp.py#L165-L197 |
openstack/python-scciclient | scciclient/irmc/snmp.py | SNMPClient.get_next | def get_next(self, oid):
"""Use PySNMP to perform an SNMP GET NEXT operation on a table object.
:param oid: The OID of the object to get.
:raises: SNMPFailure if an SNMP request fails.
:returns: A list of values of the requested table object.
"""
try:
results... | python | def get_next(self, oid):
"""Use PySNMP to perform an SNMP GET NEXT operation on a table object.
:param oid: The OID of the object to get.
:raises: SNMPFailure if an SNMP request fails.
:returns: A list of values of the requested table object.
"""
try:
results... | [
"def",
"get_next",
"(",
"self",
",",
"oid",
")",
":",
"try",
":",
"results",
"=",
"self",
".",
"cmd_gen",
".",
"nextCmd",
"(",
"self",
".",
"_get_auth",
"(",
")",
",",
"self",
".",
"_get_transport",
"(",
")",
",",
"oid",
")",
"except",
"snmp_error",
... | Use PySNMP to perform an SNMP GET NEXT operation on a table object.
:param oid: The OID of the object to get.
:raises: SNMPFailure if an SNMP request fails.
:returns: A list of values of the requested table object. | [
"Use",
"PySNMP",
"to",
"perform",
"an",
"SNMP",
"GET",
"NEXT",
"operation",
"on",
"a",
"table",
"object",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/snmp.py#L199-L230 |
openstack/python-scciclient | scciclient/irmc/snmp.py | SNMPClient.set | def set(self, oid, value):
"""Use PySNMP to perform an SNMP SET operation on a single object.
:param oid: The OID of the object to set.
:param value: The value of the object to set.
:raises: SNMPFailure if an SNMP request fails.
"""
try:
results = self.cmd_ge... | python | def set(self, oid, value):
"""Use PySNMP to perform an SNMP SET operation on a single object.
:param oid: The OID of the object to set.
:param value: The value of the object to set.
:raises: SNMPFailure if an SNMP request fails.
"""
try:
results = self.cmd_ge... | [
"def",
"set",
"(",
"self",
",",
"oid",
",",
"value",
")",
":",
"try",
":",
"results",
"=",
"self",
".",
"cmd_gen",
".",
"setCmd",
"(",
"self",
".",
"_get_auth",
"(",
")",
",",
"self",
".",
"_get_transport",
"(",
")",
",",
"(",
"oid",
",",
"value"... | Use PySNMP to perform an SNMP SET operation on a single object.
:param oid: The OID of the object to set.
:param value: The value of the object to set.
:raises: SNMPFailure if an SNMP request fails. | [
"Use",
"PySNMP",
"to",
"perform",
"an",
"SNMP",
"SET",
"operation",
"on",
"a",
"single",
"object",
"."
] | train | https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/snmp.py#L232-L260 |
OSSOS/MOP | src/ossos/core/ossos/mop_file.py | MOPFile.filename | def filename(self):
"""
Name if the MOP formatted file to parse.
@rtype: basestring
@return: filename
"""
if self._filename is None:
self._filename = storage.get_file(self.basename,
self.ccd,
... | python | def filename(self):
"""
Name if the MOP formatted file to parse.
@rtype: basestring
@return: filename
"""
if self._filename is None:
self._filename = storage.get_file(self.basename,
self.ccd,
... | [
"def",
"filename",
"(",
"self",
")",
":",
"if",
"self",
".",
"_filename",
"is",
"None",
":",
"self",
".",
"_filename",
"=",
"storage",
".",
"get_file",
"(",
"self",
".",
"basename",
",",
"self",
".",
"ccd",
",",
"ext",
"=",
"self",
".",
"extension",
... | Name if the MOP formatted file to parse.
@rtype: basestring
@return: filename | [
"Name",
"if",
"the",
"MOP",
"formatted",
"file",
"to",
"parse",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mop_file.py#L28-L40 |
OSSOS/MOP | src/ossos/core/ossos/mop_file.py | MOPFile._parse | def _parse(self):
"""read in a file and return a MOPFile object."""
with open(self.filename, 'r') as fobj:
lines = fobj.read().split('\n')
# Create a header object with content at start of file
self.header = MOPHeader(self.subfmt).parser(lines)
# Create a data attri... | python | def _parse(self):
"""read in a file and return a MOPFile object."""
with open(self.filename, 'r') as fobj:
lines = fobj.read().split('\n')
# Create a header object with content at start of file
self.header = MOPHeader(self.subfmt).parser(lines)
# Create a data attri... | [
"def",
"_parse",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"filename",
",",
"'r'",
")",
"as",
"fobj",
":",
"lines",
"=",
"fobj",
".",
"read",
"(",
")",
".",
"split",
"(",
"'\\n'",
")",
"# Create a header object with content at start of file"... | read in a file and return a MOPFile object. | [
"read",
"in",
"a",
"file",
"and",
"return",
"a",
"MOPFile",
"object",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mop_file.py#L56-L65 |
OSSOS/MOP | src/ossos/core/ossos/mop_file.py | MOPDataParser.table | def table(self):
"""
The astropy.table.Table object that will contain the data result
@rtype: Table
@return: data table
"""
if self._table is None:
column_names = []
for fileid in self.header.file_ids:
for column_name in self.header... | python | def table(self):
"""
The astropy.table.Table object that will contain the data result
@rtype: Table
@return: data table
"""
if self._table is None:
column_names = []
for fileid in self.header.file_ids:
for column_name in self.header... | [
"def",
"table",
"(",
"self",
")",
":",
"if",
"self",
".",
"_table",
"is",
"None",
":",
"column_names",
"=",
"[",
"]",
"for",
"fileid",
"in",
"self",
".",
"header",
".",
"file_ids",
":",
"for",
"column_name",
"in",
"self",
".",
"header",
".",
"column_... | The astropy.table.Table object that will contain the data result
@rtype: Table
@return: data table | [
"The",
"astropy",
".",
"table",
".",
"Table",
"object",
"that",
"will",
"contain",
"the",
"data",
"result"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mop_file.py#L80-L96 |
OSSOS/MOP | src/ossos/core/ossos/mop_file.py | MOPHeader.parser | def parser(self, lines):
"""Given a set of lines parse the into a MOP Header"""
while len(lines) > 0:
if lines[0].startswith('##') and lines[1].startswith('# '):
# A two-line keyword/value line starts here.
self._header_append(lines.pop(0), lines.pop(0))
... | python | def parser(self, lines):
"""Given a set of lines parse the into a MOP Header"""
while len(lines) > 0:
if lines[0].startswith('##') and lines[1].startswith('# '):
# A two-line keyword/value line starts here.
self._header_append(lines.pop(0), lines.pop(0))
... | [
"def",
"parser",
"(",
"self",
",",
"lines",
")",
":",
"while",
"len",
"(",
"lines",
")",
">",
"0",
":",
"if",
"lines",
"[",
"0",
"]",
".",
"startswith",
"(",
"'##'",
")",
"and",
"lines",
"[",
"1",
"]",
".",
"startswith",
"(",
"'# '",
")",
":",
... | Given a set of lines parse the into a MOP Header | [
"Given",
"a",
"set",
"of",
"lines",
"parse",
"the",
"into",
"a",
"MOP",
"Header"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mop_file.py#L147-L162 |
OSSOS/MOP | src/ossos/core/ossos/mop_file.py | MOPHeader._compute_mjd | def _compute_mjd(self, kw, val):
"""
Sometimes that MJD-OBS-CENTER keyword maps to a three component string, instead of a single value.
@param kw: a list of keywords
@param val: a list of matching values
@return: the MJD-OBS-CENTER as a julian date.
"""
try:
... | python | def _compute_mjd(self, kw, val):
"""
Sometimes that MJD-OBS-CENTER keyword maps to a three component string, instead of a single value.
@param kw: a list of keywords
@param val: a list of matching values
@return: the MJD-OBS-CENTER as a julian date.
"""
try:
... | [
"def",
"_compute_mjd",
"(",
"self",
",",
"kw",
",",
"val",
")",
":",
"try",
":",
"idx",
"=",
"kw",
".",
"index",
"(",
"'MJD-OBS-CENTER'",
")",
"except",
"ValueError",
":",
"return",
"if",
"len",
"(",
"val",
")",
"==",
"len",
"(",
"kw",
")",
":",
... | Sometimes that MJD-OBS-CENTER keyword maps to a three component string, instead of a single value.
@param kw: a list of keywords
@param val: a list of matching values
@return: the MJD-OBS-CENTER as a julian date. | [
"Sometimes",
"that",
"MJD",
"-",
"OBS",
"-",
"CENTER",
"keyword",
"maps",
"to",
"a",
"three",
"component",
"string",
"instead",
"of",
"a",
"single",
"value",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mop_file.py#L164-L182 |
OSSOS/MOP | src/jjk/preproc/findTriplets.py | getExpInfo | def getExpInfo(expnum):
"""Return a dictionary of information about a particular exposure"""
col_names=['object',
'e.expnum',
'mjdate',
'uttime',
'filter',
'elongation',
'obs_iq_refccd',
'triple', 'qso_stat... | python | def getExpInfo(expnum):
"""Return a dictionary of information about a particular exposure"""
col_names=['object',
'e.expnum',
'mjdate',
'uttime',
'filter',
'elongation',
'obs_iq_refccd',
'triple', 'qso_stat... | [
"def",
"getExpInfo",
"(",
"expnum",
")",
":",
"col_names",
"=",
"[",
"'object'",
",",
"'e.expnum'",
",",
"'mjdate'",
",",
"'uttime'",
",",
"'filter'",
",",
"'elongation'",
",",
"'obs_iq_refccd'",
",",
"'triple'",
",",
"'qso_status'",
"]",
"sql",
"=",
"\"SELE... | Return a dictionary of information about a particular exposure | [
"Return",
"a",
"dictionary",
"of",
"information",
"about",
"a",
"particular",
"exposure"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/findTriplets.py#L79-L109 |
OSSOS/MOP | src/jjk/preproc/findTriplets.py | getTripInfo | def getTripInfo(triple):
"""Return a dictionary of information about a particular triple"""
col_names=['mjdate', 'filter', 'elongation', 'discovery','checkup', 'recovery', 'iq','block' ]
sql="SELECT mjdate md,"
sql=sql+" filter, avg(elongation), d.id, checkup.checkup, recovery.recovery , avg(obs_iq_ref... | python | def getTripInfo(triple):
"""Return a dictionary of information about a particular triple"""
col_names=['mjdate', 'filter', 'elongation', 'discovery','checkup', 'recovery', 'iq','block' ]
sql="SELECT mjdate md,"
sql=sql+" filter, avg(elongation), d.id, checkup.checkup, recovery.recovery , avg(obs_iq_ref... | [
"def",
"getTripInfo",
"(",
"triple",
")",
":",
"col_names",
"=",
"[",
"'mjdate'",
",",
"'filter'",
",",
"'elongation'",
",",
"'discovery'",
",",
"'checkup'",
",",
"'recovery'",
",",
"'iq'",
",",
"'block'",
"]",
"sql",
"=",
"\"SELECT mjdate md,\"",
"sql",
"="... | Return a dictionary of information about a particular triple | [
"Return",
"a",
"dictionary",
"of",
"information",
"about",
"a",
"particular",
"triple"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/findTriplets.py#L111-L132 |
OSSOS/MOP | src/jjk/preproc/findTriplets.py | getExpnums | def getExpnums(pointing,night=None):
"""Get all exposures of specified pointing ID.
Default is to return a list of all exposure numbers"""
if night:
night=" floor(e.mjdate-0.0833)=%d " % ( night )
else:
night=''
sql="SELECT e.expnum "
sql=sql+"FROM bucket.exposure e "
... | python | def getExpnums(pointing,night=None):
"""Get all exposures of specified pointing ID.
Default is to return a list of all exposure numbers"""
if night:
night=" floor(e.mjdate-0.0833)=%d " % ( night )
else:
night=''
sql="SELECT e.expnum "
sql=sql+"FROM bucket.exposure e "
... | [
"def",
"getExpnums",
"(",
"pointing",
",",
"night",
"=",
"None",
")",
":",
"if",
"night",
":",
"night",
"=",
"\" floor(e.mjdate-0.0833)=%d \"",
"%",
"(",
"night",
")",
"else",
":",
"night",
"=",
"''",
"sql",
"=",
"\"SELECT e.expnum \"",
"sql",
"=",
"sql",
... | Get all exposures of specified pointing ID.
Default is to return a list of all exposure numbers | [
"Get",
"all",
"exposures",
"of",
"specified",
"pointing",
"ID",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/findTriplets.py#L134-L151 |
OSSOS/MOP | src/jjk/preproc/findTriplets.py | getTriples | def getTriples(pointing):
"""Get all triples of a specified pointing ID.
Defaults is to return a complete list triples."""
sql="SELECT id FROM triples t join triple_members m ON t.id=m.triple"
sql+=" join bucket.exposure e on e.expnum=m.expnum "
sql+=" WHERE pointing=%s group by id order by e.ex... | python | def getTriples(pointing):
"""Get all triples of a specified pointing ID.
Defaults is to return a complete list triples."""
sql="SELECT id FROM triples t join triple_members m ON t.id=m.triple"
sql+=" join bucket.exposure e on e.expnum=m.expnum "
sql+=" WHERE pointing=%s group by id order by e.ex... | [
"def",
"getTriples",
"(",
"pointing",
")",
":",
"sql",
"=",
"\"SELECT id FROM triples t join triple_members m ON t.id=m.triple\"",
"sql",
"+=",
"\" join bucket.exposure e on e.expnum=m.expnum \"",
"sql",
"+=",
"\" WHERE pointing=%s group by id order by e.expnum \"",
"cfeps",
".",
... | Get all triples of a specified pointing ID.
Defaults is to return a complete list triples. | [
"Get",
"all",
"triples",
"of",
"a",
"specified",
"pointing",
"ID",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/findTriplets.py#L153-L162 |
OSSOS/MOP | src/jjk/preproc/findTriplets.py | createNewTriples | def createNewTriples(Win):
"""Add entries to the triples tables based on new images in the db"""
win.help("Building list of exposures to look for triples")
cols=('e.expnum', 'object',
'mjdate',
'uttime',
'elongation',
'filter',
'obs_iq_refccd','qso_status' )
header='%6s %... | python | def createNewTriples(Win):
"""Add entries to the triples tables based on new images in the db"""
win.help("Building list of exposures to look for triples")
cols=('e.expnum', 'object',
'mjdate',
'uttime',
'elongation',
'filter',
'obs_iq_refccd','qso_status' )
header='%6s %... | [
"def",
"createNewTriples",
"(",
"Win",
")",
":",
"win",
".",
"help",
"(",
"\"Building list of exposures to look for triples\"",
")",
"cols",
"=",
"(",
"'e.expnum'",
",",
"'object'",
",",
"'mjdate'",
",",
"'uttime'",
",",
"'elongation'",
",",
"'filter'",
",",
"'o... | Add entries to the triples tables based on new images in the db | [
"Add",
"entries",
"to",
"the",
"triples",
"tables",
"based",
"on",
"new",
"images",
"in",
"the",
"db"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/findTriplets.py#L170-L255 |
OSSOS/MOP | src/jjk/preproc/findTriplets.py | setDiscoveryTriples | def setDiscoveryTriples(win,table="discovery"):
"""Provide user with a list of triples that could be discovery triples"""
win.help("Getting a list of pointings with triples from the CFEPS db")
pointings=getPointingsWithTriples()
win.help("Select the "+table+" triple form the list...")
import time
... | python | def setDiscoveryTriples(win,table="discovery"):
"""Provide user with a list of triples that could be discovery triples"""
win.help("Getting a list of pointings with triples from the CFEPS db")
pointings=getPointingsWithTriples()
win.help("Select the "+table+" triple form the list...")
import time
... | [
"def",
"setDiscoveryTriples",
"(",
"win",
",",
"table",
"=",
"\"discovery\"",
")",
":",
"win",
".",
"help",
"(",
"\"Getting a list of pointings with triples from the CFEPS db\"",
")",
"pointings",
"=",
"getPointingsWithTriples",
"(",
")",
"win",
".",
"help",
"(",
"\... | Provide user with a list of triples that could be discovery triples | [
"Provide",
"user",
"with",
"a",
"list",
"of",
"triples",
"that",
"could",
"be",
"discovery",
"triples"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/findTriplets.py#L257-L312 |
OSSOS/MOP | src/ossos/core/ossos/pipeline/step1.py | run | def run(expnum,
ccd,
prefix='',
version='p',
sex_thresh=_SEX_THRESHOLD,
wave_thresh=_WAVE_THRESHOLD,
maxcount=_MAX_COUNT,
dry_run=False,
force=True):
"""run the actual step1jmp/matt codes.
expnum: the CFHT expousre to process
ccd: which ccd i... | python | def run(expnum,
ccd,
prefix='',
version='p',
sex_thresh=_SEX_THRESHOLD,
wave_thresh=_WAVE_THRESHOLD,
maxcount=_MAX_COUNT,
dry_run=False,
force=True):
"""run the actual step1jmp/matt codes.
expnum: the CFHT expousre to process
ccd: which ccd i... | [
"def",
"run",
"(",
"expnum",
",",
"ccd",
",",
"prefix",
"=",
"''",
",",
"version",
"=",
"'p'",
",",
"sex_thresh",
"=",
"_SEX_THRESHOLD",
",",
"wave_thresh",
"=",
"_WAVE_THRESHOLD",
",",
"maxcount",
"=",
"_MAX_COUNT",
",",
"dry_run",
"=",
"False",
",",
"f... | run the actual step1jmp/matt codes.
expnum: the CFHT expousre to process
ccd: which ccd in the mosaic to process
fwhm: the image quality, FWHM, of the image. In pixels.
sex_thresh: the detection threhold to run sExtractor at
wave_thresh: the detection threshold for wavelet
maxcount: saturation... | [
"run",
"the",
"actual",
"step1jmp",
"/",
"matt",
"codes",
"."
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/pipeline/step1.py#L73-L149 |
OSSOS/MOP | src/ossos/utils/2MASS_Vizier.py | query | def query(ra ,dec, rad=0.1, query=None):
"""Query the CADC TAP service to determine the list of images for the
NewHorizons Search. Things to determine:
a- Images to have the reference subtracted from.
b- Image to use as the 'REFERENCE' image.
c- Images to be used for input into the reference image
L... | python | def query(ra ,dec, rad=0.1, query=None):
"""Query the CADC TAP service to determine the list of images for the
NewHorizons Search. Things to determine:
a- Images to have the reference subtracted from.
b- Image to use as the 'REFERENCE' image.
c- Images to be used for input into the reference image
L... | [
"def",
"query",
"(",
"ra",
",",
"dec",
",",
"rad",
"=",
"0.1",
",",
"query",
"=",
"None",
")",
":",
"if",
"query",
"is",
"None",
":",
"query",
"=",
"(",
"\"\"\" SELECT \"\"\"",
"\"\"\" \"II/246/out\".raj2000 as ra, \"II/246/out\".dej2000 as dec, \"II/246/out\".jmag ... | Query the CADC TAP service to determine the list of images for the
NewHorizons Search. Things to determine:
a- Images to have the reference subtracted from.
b- Image to use as the 'REFERENCE' image.
c- Images to be used for input into the reference image
Logic: Given a particular Image/CCD find all the ... | [
"Query",
"the",
"CADC",
"TAP",
"service",
"to",
"determine",
"the",
"list",
"of",
"images",
"for",
"the",
"NewHorizons",
"Search",
".",
"Things",
"to",
"determine",
":"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/2MASS_Vizier.py#L6-L42 |
OSSOS/MOP | src/jjk/preproc/objIngest.py | objIngest | def objIngest(obj_file):
import sys,os,math,re
import pyfits
import MOPfiles
obj=MOPfiles.read(obj_file)
"""
The SQL description of the source table
+-------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra ... | python | def objIngest(obj_file):
import sys,os,math,re
import pyfits
import MOPfiles
obj=MOPfiles.read(obj_file)
"""
The SQL description of the source table
+-------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra ... | [
"def",
"objIngest",
"(",
"obj_file",
")",
":",
"import",
"sys",
",",
"os",
",",
"math",
",",
"re",
"import",
"pyfits",
"import",
"MOPfiles",
"obj",
"=",
"MOPfiles",
".",
"read",
"(",
"obj_file",
")",
"\"\"\"\n Columns in the SOURCE table...\n ## X ... | The SQL description of the source table
+-------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------+------+-----+---------+----------------+
| sourceID | int(11) | | PRI | NULL | auto_increment |
... | [
"The",
"SQL",
"description",
"of",
"the",
"source",
"table",
"+",
"-------------",
"+",
"---------",
"+",
"------",
"+",
"-----",
"+",
"---------",
"+",
"----------------",
"+",
"|",
"Field",
"|",
"Type",
"|",
"Null",
"|",
"Key",
"|",
"Default",
"|",
"Ex... | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/objIngest.py#L7-L74 |
OSSOS/MOP | src/jjk/preproc/MOPplot.py | load_edbfile | def load_edbfile(file=None):
"""Load the targets from a file"""
import ephem,string,math
if file is None:
import tkFileDialog
try:
file=tkFileDialog.askopenfilename()
except:
return
if file is None or file == '':
return
f=open(file)
lines=f.readl... | python | def load_edbfile(file=None):
"""Load the targets from a file"""
import ephem,string,math
if file is None:
import tkFileDialog
try:
file=tkFileDialog.askopenfilename()
except:
return
if file is None or file == '':
return
f=open(file)
lines=f.readl... | [
"def",
"load_edbfile",
"(",
"file",
"=",
"None",
")",
":",
"import",
"ephem",
",",
"string",
",",
"math",
"if",
"file",
"is",
"None",
":",
"import",
"tkFileDialog",
"try",
":",
"file",
"=",
"tkFileDialog",
".",
"askopenfilename",
"(",
")",
"except",
":",... | Load the targets from a file | [
"Load",
"the",
"targets",
"from",
"a",
"file"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPplot.py#L14-L38 |
OSSOS/MOP | src/jjk/preproc/MOPplot.py | load_abgfiles | def load_abgfiles(dir=None):
"""Load the targets from a file"""
import ephem,string
if dir is None:
import tkFileDialog
try:
dir=tkFileDialog.askdirectory()
except:
return
if dir is None:
return None
from glob import glob
files=glob(dir+"/*.abg")... | python | def load_abgfiles(dir=None):
"""Load the targets from a file"""
import ephem,string
if dir is None:
import tkFileDialog
try:
dir=tkFileDialog.askdirectory()
except:
return
if dir is None:
return None
from glob import glob
files=glob(dir+"/*.abg")... | [
"def",
"load_abgfiles",
"(",
"dir",
"=",
"None",
")",
":",
"import",
"ephem",
",",
"string",
"if",
"dir",
"is",
"None",
":",
"import",
"tkFileDialog",
"try",
":",
"dir",
"=",
"tkFileDialog",
".",
"askdirectory",
"(",
")",
"except",
":",
"return",
"if",
... | Load the targets from a file | [
"Load",
"the",
"targets",
"from",
"a",
"file"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPplot.py#L43-L133 |
OSSOS/MOP | src/jjk/preproc/MOPplot.py | fits_list | def fits_list(filter,root,fnames):
"""Get a list of files matching filter in directory root"""
import re, pyfits, wcsutil
for file in fnames:
if re.match(filter,file):
fh=pyfits.open(file)
for ext in fh:
obj=ext.header.get('OBJECT',file)
dx=ext... | python | def fits_list(filter,root,fnames):
"""Get a list of files matching filter in directory root"""
import re, pyfits, wcsutil
for file in fnames:
if re.match(filter,file):
fh=pyfits.open(file)
for ext in fh:
obj=ext.header.get('OBJECT',file)
dx=ext... | [
"def",
"fits_list",
"(",
"filter",
",",
"root",
",",
"fnames",
")",
":",
"import",
"re",
",",
"pyfits",
",",
"wcsutil",
"for",
"file",
"in",
"fnames",
":",
"if",
"re",
".",
"match",
"(",
"filter",
",",
"file",
")",
":",
"fh",
"=",
"pyfits",
".",
... | Get a list of files matching filter in directory root | [
"Get",
"a",
"list",
"of",
"files",
"matching",
"filter",
"in",
"directory",
"root"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPplot.py#L137-L152 |
OSSOS/MOP | src/jjk/preproc/MOPplot.py | load_fis | def load_fis(dir=None):
"""Load fits images in a directory"""
if dir is None:
import tkFileDialog
try:
dir=tkFileDialog.askdirectory()
except:
return
if dir is None:
return None
from os.path import walk
walk(dir,fits_list,"*.fits") | python | def load_fis(dir=None):
"""Load fits images in a directory"""
if dir is None:
import tkFileDialog
try:
dir=tkFileDialog.askdirectory()
except:
return
if dir is None:
return None
from os.path import walk
walk(dir,fits_list,"*.fits") | [
"def",
"load_fis",
"(",
"dir",
"=",
"None",
")",
":",
"if",
"dir",
"is",
"None",
":",
"import",
"tkFileDialog",
"try",
":",
"dir",
"=",
"tkFileDialog",
".",
"askdirectory",
"(",
")",
"except",
":",
"return",
"if",
"dir",
"is",
"None",
":",
"return",
... | Load fits images in a directory | [
"Load",
"fits",
"images",
"in",
"a",
"directory"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPplot.py#L155-L166 |
OSSOS/MOP | src/jjk/preproc/MOPplot.py | do_objs | def do_objs(kbos):
"""Draw the actual plot"""
import orbfit, ephem, math
import re
re_string=w.FilterVar.get()
vlist=[]
for name in kbos:
if not re.search(re_string,name):
continue
vlist.append(name)
if type(kbos[name])==type(ephem.EllipticalBody()):
kbo... | python | def do_objs(kbos):
"""Draw the actual plot"""
import orbfit, ephem, math
import re
re_string=w.FilterVar.get()
vlist=[]
for name in kbos:
if not re.search(re_string,name):
continue
vlist.append(name)
if type(kbos[name])==type(ephem.EllipticalBody()):
kbo... | [
"def",
"do_objs",
"(",
"kbos",
")",
":",
"import",
"orbfit",
",",
"ephem",
",",
"math",
"import",
"re",
"re_string",
"=",
"w",
".",
"FilterVar",
".",
"get",
"(",
")",
"vlist",
"=",
"[",
"]",
"for",
"name",
"in",
"kbos",
":",
"if",
"not",
"re",
".... | Draw the actual plot | [
"Draw",
"the",
"actual",
"plot"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPplot.py#L1201-L1251 |
OSSOS/MOP | src/jjk/preproc/MOPplot.py | plot.eps | def eps(self):
"""Print the canvas to a postscript file"""
import tkFileDialog,tkMessageBox
filename=tkFileDialog.asksaveasfilename(message="save postscript to file",filetypes=['eps','ps'])
if filename is None:
return
self.postscript(file=filename) | python | def eps(self):
"""Print the canvas to a postscript file"""
import tkFileDialog,tkMessageBox
filename=tkFileDialog.asksaveasfilename(message="save postscript to file",filetypes=['eps','ps'])
if filename is None:
return
self.postscript(file=filename) | [
"def",
"eps",
"(",
"self",
")",
":",
"import",
"tkFileDialog",
",",
"tkMessageBox",
"filename",
"=",
"tkFileDialog",
".",
"asksaveasfilename",
"(",
"message",
"=",
"\"save postscript to file\"",
",",
"filetypes",
"=",
"[",
"'eps'",
",",
"'ps'",
"]",
")",
"if",... | Print the canvas to a postscript file | [
"Print",
"the",
"canvas",
"to",
"a",
"postscript",
"file"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPplot.py#L208-L216 |
OSSOS/MOP | src/jjk/preproc/MOPplot.py | plot.c2s | def c2s(self,p=[0,0]):
"""Convert from canvas to screen coordinates"""
return((p[0]-self.canvasx(self.cx1),p[1]-self.canvasy(self.cy1))) | python | def c2s(self,p=[0,0]):
"""Convert from canvas to screen coordinates"""
return((p[0]-self.canvasx(self.cx1),p[1]-self.canvasy(self.cy1))) | [
"def",
"c2s",
"(",
"self",
",",
"p",
"=",
"[",
"0",
",",
"0",
"]",
")",
":",
"return",
"(",
"(",
"p",
"[",
"0",
"]",
"-",
"self",
".",
"canvasx",
"(",
"self",
".",
"cx1",
")",
",",
"p",
"[",
"1",
"]",
"-",
"self",
".",
"canvasy",
"(",
"... | Convert from canvas to screen coordinates | [
"Convert",
"from",
"canvas",
"to",
"screen",
"coordinates"
] | train | https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPplot.py#L250-L253 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.