repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.ossos_pointings
def ossos_pointings(self): """ plot an OSSOS observation on the OSSOS plot. """ match = re.match('(\d+)\D(\d+)', self.expnum.get()) if match is not None: expnum = int(match.group(1)) ccd = int(match.group(2)) x = 2112 / 2.0 y = 4644...
python
def ossos_pointings(self): """ plot an OSSOS observation on the OSSOS plot. """ match = re.match('(\d+)\D(\d+)', self.expnum.get()) if match is not None: expnum = int(match.group(1)) ccd = int(match.group(2)) x = 2112 / 2.0 y = 4644...
[ "def", "ossos_pointings", "(", "self", ")", ":", "match", "=", "re", ".", "match", "(", "'(\\d+)\\D(\\d+)'", ",", "self", ".", "expnum", ".", "get", "(", ")", ")", "if", "match", "is", "not", "None", ":", "expnum", "=", "int", "(", "match", ".", "g...
plot an OSSOS observation on the OSSOS plot.
[ "plot", "an", "OSSOS", "observation", "on", "the", "OSSOS", "plot", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L831-L864
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.get_pointings
def get_pointings(self): """ Retrieve the MEGACAM pointings that overlap with the current FOV and plot. @return: None """ self.camera.set("MEGACAM_40") (ra1, dec1) = self.c2p((self.canvasx(1), self.canvasy(1))) (ra2, dec2) = self.c2p((self.canvasx(480 * 2), self....
python
def get_pointings(self): """ Retrieve the MEGACAM pointings that overlap with the current FOV and plot. @return: None """ self.camera.set("MEGACAM_40") (ra1, dec1) = self.c2p((self.canvasx(1), self.canvasy(1))) (ra2, dec2) = self.c2p((self.canvasx(480 * 2), self....
[ "def", "get_pointings", "(", "self", ")", ":", "self", ".", "camera", ".", "set", "(", "\"MEGACAM_40\"", ")", "(", "ra1", ",", "dec1", ")", "=", "self", ".", "c2p", "(", "(", "self", ".", "canvasx", "(", "1", ")", ",", "self", ".", "canvasy", "("...
Retrieve the MEGACAM pointings that overlap with the current FOV and plot. @return: None
[ "Retrieve", "the", "MEGACAM", "pointings", "that", "overlap", "with", "the", "current", "FOV", "and", "plot", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L867-L891
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.save_pointings
def save_pointings(self): """Print the currently defined FOVs""" i = 0 if self.pointing_format.get() in ['GEMINI ET', 'CFHT ET', 'CFHT API']: logging.info('Beginning table pointing save.') for pointing in self.pointings: name = pointing["label"]["text"] ...
python
def save_pointings(self): """Print the currently defined FOVs""" i = 0 if self.pointing_format.get() in ['GEMINI ET', 'CFHT ET', 'CFHT API']: logging.info('Beginning table pointing save.') for pointing in self.pointings: name = pointing["label"]["text"] ...
[ "def", "save_pointings", "(", "self", ")", ":", "i", "=", "0", "if", "self", ".", "pointing_format", ".", "get", "(", ")", "in", "[", "'GEMINI ET'", ",", "'CFHT ET'", ",", "'CFHT API'", "]", ":", "logging", ".", "info", "(", "'Beginning table pointing save...
Print the currently defined FOVs
[ "Print", "the", "currently", "defined", "FOVs" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L893-L1058
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot.doplot
def doplot(self): """ Clear the plot and then redraw it. """ w = self w.delete(ALL) w.coord_grid() w.objList.delete(0, END) self._plot()
python
def doplot(self): """ Clear the plot and then redraw it. """ w = self w.delete(ALL) w.coord_grid() w.objList.delete(0, END) self._plot()
[ "def", "doplot", "(", "self", ")", ":", "w", "=", "self", "w", ".", "delete", "(", "ALL", ")", "w", ".", "coord_grid", "(", ")", "w", ".", "objList", ".", "delete", "(", "0", ",", "END", ")", "self", ".", "_plot", "(", ")" ]
Clear the plot and then redraw it.
[ "Clear", "the", "plot", "and", "then", "redraw", "it", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L1060-L1069
OSSOS/MOP
src/ossos/core/ossos/planning/obs_planner.py
Plot._plot
def _plot(self): """Draw the actual plot. """ w = self kbos = self.kbos re_string = w.FilterVar.get() vlist = [] for name in kbos: if not re.search(re_string, name): continue vlist.append(name) fill = None ...
python
def _plot(self): """Draw the actual plot. """ w = self kbos = self.kbos re_string = w.FilterVar.get() vlist = [] for name in kbos: if not re.search(re_string, name): continue vlist.append(name) fill = None ...
[ "def", "_plot", "(", "self", ")", ":", "w", "=", "self", "kbos", "=", "self", ".", "kbos", "re_string", "=", "w", ".", "FilterVar", ".", "get", "(", ")", "vlist", "=", "[", "]", "for", "name", "in", "kbos", ":", "if", "not", "re", ".", "search"...
Draw the actual plot.
[ "Draw", "the", "actual", "plot", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/obs_planner.py#L1071-L1159
OSSOS/MOP
src/ossos/utils/match.py
planted
def planted(fk_candidate_observations, planted_objects, tolerance=10): """ Using the fk_candidate_observations as input get the Object.planted file from VOSpace and match planted sources with found sources. The Object.planted list is pulled from VOSpace based on the standard file-layout and name of the...
python
def planted(fk_candidate_observations, planted_objects, tolerance=10): """ Using the fk_candidate_observations as input get the Object.planted file from VOSpace and match planted sources with found sources. The Object.planted list is pulled from VOSpace based on the standard file-layout and name of the...
[ "def", "planted", "(", "fk_candidate_observations", ",", "planted_objects", ",", "tolerance", "=", "10", ")", ":", "found_pos", "=", "[", "]", "detections", "=", "fk_candidate_observations", ".", "get_sources", "(", ")", "for", "detection", "in", "detections", "...
Using the fk_candidate_observations as input get the Object.planted file from VOSpace and match planted sources with found sources. The Object.planted list is pulled from VOSpace based on the standard file-layout and name of the first exposure as read from the .astrom file. :param fk_candidate_observa...
[ "Using", "the", "fk_candidate_observations", "as", "input", "get", "the", "Object", ".", "planted", "file", "from", "VOSpace", "and", "match", "planted", "sources", "with", "found", "sources", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/match.py#L36-L63
OSSOS/MOP
src/jjk/preproc/MOPcoord.py
mjd2gmst
def mjd2gmst(mjd): """Convert Modfied Juian Date (JD = 2400000.5) to GMST Take from P.T. Walace routines""" D2PI= 6.2831853071795864769252867665590057683943387987502 DS2R= 7.2722052166430399038487115353692196393452995355905e-5 tu = (mjd-51544.5)/36525.0; st = fmod(mjd,1.0) * ...
python
def mjd2gmst(mjd): """Convert Modfied Juian Date (JD = 2400000.5) to GMST Take from P.T. Walace routines""" D2PI= 6.2831853071795864769252867665590057683943387987502 DS2R= 7.2722052166430399038487115353692196393452995355905e-5 tu = (mjd-51544.5)/36525.0; st = fmod(mjd,1.0) * ...
[ "def", "mjd2gmst", "(", "mjd", ")", ":", "D2PI", "=", "6.2831853071795864769252867665590057683943387987502", "DS2R", "=", "7.2722052166430399038487115353692196393452995355905e-5", "tu", "=", "(", "mjd", "-", "51544.5", ")", "/", "36525.0", "st", "=", "fmod", "(", "m...
Convert Modfied Juian Date (JD = 2400000.5) to GMST Take from P.T. Walace routines
[ "Convert", "Modfied", "Juian", "Date", "(", "JD", "=", "2400000", ".", "5", ")", "to", "GMST", "Take", "from", "P", ".", "T", ".", "Walace", "routines" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPcoord.py#L3-L19
OSSOS/MOP
src/jjk/preproc/MOPcoord.py
coord.ec2eq
def ec2eq(self): """Convert ecliptic coordinates to equatorial coordinates""" import math #from numpy.matlib import sin, cos, arcsin, arctan2 from math import sin, cos from math import asin as arcsin from math import atan2 as arctan2 from math import acos as arcc...
python
def ec2eq(self): """Convert ecliptic coordinates to equatorial coordinates""" import math #from numpy.matlib import sin, cos, arcsin, arctan2 from math import sin, cos from math import asin as arcsin from math import atan2 as arctan2 from math import acos as arcc...
[ "def", "ec2eq", "(", "self", ")", ":", "import", "math", "#from numpy.matlib import sin, cos, arcsin, arctan2", "from", "math", "import", "sin", ",", "cos", "from", "math", "import", "asin", "as", "arcsin", "from", "math", "import", "atan2", "as", "arctan2", "fr...
Convert ecliptic coordinates to equatorial coordinates
[ "Convert", "ecliptic", "coordinates", "to", "equatorial", "coordinates" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPcoord.py#L100-L134
OSSOS/MOP
src/ossos/core/ossos/planning/layout36.py
plot_line
def plot_line(axes, fname, ltype): """plot the ecliptic plane line on the given axes.""" x = np.genfromtxt(fname, unpack=True) axes.plot(x[0], x[1], ltype)
python
def plot_line(axes, fname, ltype): """plot the ecliptic plane line on the given axes.""" x = np.genfromtxt(fname, unpack=True) axes.plot(x[0], x[1], ltype)
[ "def", "plot_line", "(", "axes", ",", "fname", ",", "ltype", ")", ":", "x", "=", "np", ".", "genfromtxt", "(", "fname", ",", "unpack", "=", "True", ")", "axes", ".", "plot", "(", "x", "[", "0", "]", ",", "x", "[", "1", "]", ",", "ltype", ")" ...
plot the ecliptic plane line on the given axes.
[ "plot", "the", "ecliptic", "plane", "line", "on", "the", "given", "axes", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/layout36.py#L28-L31
OSSOS/MOP
src/ossos/core/ossos/parameters.py
apmag_at_absmag
def apmag_at_absmag(H, d, phi=1): """ Calculate the apparent magnitude of a TNO given its absolute magnitude H, for a given distance. :param H: TNO absolute magnitude (unitless) :param d: barycentric distance (AU) :param phi: phase angle (0-1, always v close to 1 for TNOs) :return: apparent mag...
python
def apmag_at_absmag(H, d, phi=1): """ Calculate the apparent magnitude of a TNO given its absolute magnitude H, for a given distance. :param H: TNO absolute magnitude (unitless) :param d: barycentric distance (AU) :param phi: phase angle (0-1, always v close to 1 for TNOs) :return: apparent mag...
[ "def", "apmag_at_absmag", "(", "H", ",", "d", ",", "phi", "=", "1", ")", ":", "d_observer", "=", "1.", "# 1 AU", "# approximate object's distance d_heliocentric and d_geocentric as the same, d, because TNO", "m_r", "=", "H", "+", "2.5", "*", "math", ".", "log10", ...
Calculate the apparent magnitude of a TNO given its absolute magnitude H, for a given distance. :param H: TNO absolute magnitude (unitless) :param d: barycentric distance (AU) :param phi: phase angle (0-1, always v close to 1 for TNOs) :return: apparent magnitude of TNO
[ "Calculate", "the", "apparent", "magnitude", "of", "a", "TNO", "given", "its", "absolute", "magnitude", "H", "for", "a", "given", "distance", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/parameters.py#L357-L371
OSSOS/MOP
src/ossos/core/ossos/parameters.py
tno.from_summary_line
def from_summary_line(cls, summaryLine, version=4, existing_object=None): ''' Summary format: object mag stdev dist ..E nobs time av_xres av_yres max_x max_y a ..E e ..E i ..E node ..E argperi ..E M ..E ra_dis dec_dis ''' if not summaryLi...
python
def from_summary_line(cls, summaryLine, version=4, existing_object=None): ''' Summary format: object mag stdev dist ..E nobs time av_xres av_yres max_x max_y a ..E e ..E i ..E node ..E argperi ..E M ..E ra_dis dec_dis ''' if not summaryLi...
[ "def", "from_summary_line", "(", "cls", ",", "summaryLine", ",", "version", "=", "4", ",", "existing_object", "=", "None", ")", ":", "if", "not", "summaryLine", ":", "raise", "ValueError", "(", "'No summary line given'", ")", "if", "version", "==", "4", ":",...
Summary format: object mag stdev dist ..E nobs time av_xres av_yres max_x max_y a ..E e ..E i ..E node ..E argperi ..E M ..E ra_dis dec_dis
[ "Summary", "format", ":", "object", "mag", "stdev", "dist", "..", "E", "nobs", "time", "av_xres", "av_yres", "max_x", "max_y", "a", "..", "E", "e", "..", "E", "i", "..", "E", "node", "..", "E", "argperi", "..", "E", "M", "..", "E", "ra_dis", "dec_d...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/parameters.py#L270-L296
OSSOS/MOP
src/ossos/core/ossos/parameters.py
tno.from_class_line
def from_class_line(cls, classLine, version=4, existing_object=None): ''' Class format: class wrt n m security object mag stdev F H_sur dist ..E nobs time av_xres av_yres max_x max_y a ..E e ..E i ..E node ..E argperi ..E time_peri ....
python
def from_class_line(cls, classLine, version=4, existing_object=None): ''' Class format: class wrt n m security object mag stdev F H_sur dist ..E nobs time av_xres av_yres max_x max_y a ..E e ..E i ..E node ..E argperi ..E time_peri ....
[ "def", "from_class_line", "(", "cls", ",", "classLine", ",", "version", "=", "4", ",", "existing_object", "=", "None", ")", ":", "if", "not", "classLine", ":", "raise", "ValueError", "(", "'No class file line given.'", ")", "if", "version", "==", "4", ":", ...
Class format: class wrt n m security object mag stdev F H_sur dist ..E nobs time av_xres av_yres max_x max_y a ..E e ..E i ..E node ..E argperi ..E time_peri ..E rate
[ "Class", "format", ":", "class", "wrt", "n", "m", "security", "object", "mag", "stdev", "F", "H_sur", "dist", "..", "E", "nobs", "time", "av_xres", "av_yres", "max_x", "max_y", "a", "..", "E", "e", "..", "E", "i", "..", "E", "node", "..", "E", "arg...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/parameters.py#L299-L338
openstack/python-scciclient
scciclient/irmc/scci.py
scci_cmd
def scci_cmd(host, userid, password, cmd, port=443, auth_method='basic', client_timeout=60, do_async=True, **kwargs): """execute SCCI command This function calls SCCI server modules :param host: hostname or IP of iRMC :param userid: userid for iRMC with administrator privileges :param ...
python
def scci_cmd(host, userid, password, cmd, port=443, auth_method='basic', client_timeout=60, do_async=True, **kwargs): """execute SCCI command This function calls SCCI server modules :param host: hostname or IP of iRMC :param userid: userid for iRMC with administrator privileges :param ...
[ "def", "scci_cmd", "(", "host", ",", "userid", ",", "password", ",", "cmd", ",", "port", "=", "443", ",", "auth_method", "=", "'basic'", ",", "client_timeout", "=", "60", ",", "do_async", "=", "True", ",", "*", "*", "kwargs", ")", ":", "auth_obj", "=...
execute SCCI command This function calls SCCI server modules :param host: hostname or IP of iRMC :param userid: userid for iRMC with administrator privileges :param password: password for userid :param cmd: SCCI command :param port: port number of iRMC :param auth_method: irmc_username ...
[ "execute", "SCCI", "command" ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/scci.py#L249-L333
openstack/python-scciclient
scciclient/irmc/scci.py
get_client
def get_client(host, userid, password, port=443, auth_method='basic', client_timeout=60, **kwargs): """get SCCI command partial function This function returns SCCI command partial function :param host: hostname or IP of iRMC :param userid: userid for iRMC with administrator privileges ...
python
def get_client(host, userid, password, port=443, auth_method='basic', client_timeout=60, **kwargs): """get SCCI command partial function This function returns SCCI command partial function :param host: hostname or IP of iRMC :param userid: userid for iRMC with administrator privileges ...
[ "def", "get_client", "(", "host", ",", "userid", ",", "password", ",", "port", "=", "443", ",", "auth_method", "=", "'basic'", ",", "client_timeout", "=", "60", ",", "*", "*", "kwargs", ")", ":", "return", "functools", ".", "partial", "(", "scci_cmd", ...
get SCCI command partial function This function returns SCCI command partial function :param host: hostname or IP of iRMC :param userid: userid for iRMC with administrator privileges :param password: password for userid :param port: port number of iRMC :param auth_method: irmc_username :par...
[ "get", "SCCI", "command", "partial", "function" ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/scci.py#L336-L352
openstack/python-scciclient
scciclient/irmc/scci.py
get_virtual_cd_set_params_cmd
def get_virtual_cd_set_params_cmd(remote_image_server, remote_image_user_domain, remote_image_share_type, remote_image_share_name, remote_image_deploy_iso, ...
python
def get_virtual_cd_set_params_cmd(remote_image_server, remote_image_user_domain, remote_image_share_type, remote_image_share_name, remote_image_deploy_iso, ...
[ "def", "get_virtual_cd_set_params_cmd", "(", "remote_image_server", ",", "remote_image_user_domain", ",", "remote_image_share_type", ",", "remote_image_share_name", ",", "remote_image_deploy_iso", ",", "remote_image_username", ",", "remote_image_user_password", ")", ":", "cmd", ...
get Virtual CD Media Set Parameters Command This function returns Virtual CD Media Set Parameters Command :param remote_image_server: remote image server name or IP :param remote_image_user_domain: domain name of remote image server :param remote_image_share_type: share type of ShareType :param rem...
[ "get", "Virtual", "CD", "Media", "Set", "Parameters", "Command" ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/scci.py#L355-L384
openstack/python-scciclient
scciclient/irmc/scci.py
get_virtual_fd_set_params_cmd
def get_virtual_fd_set_params_cmd(remote_image_server, remote_image_user_domain, remote_image_share_type, remote_image_share_name, remote_image_floppy_fat, ...
python
def get_virtual_fd_set_params_cmd(remote_image_server, remote_image_user_domain, remote_image_share_type, remote_image_share_name, remote_image_floppy_fat, ...
[ "def", "get_virtual_fd_set_params_cmd", "(", "remote_image_server", ",", "remote_image_user_domain", ",", "remote_image_share_type", ",", "remote_image_share_name", ",", "remote_image_floppy_fat", ",", "remote_image_username", ",", "remote_image_user_password", ")", ":", "cmd", ...
get Virtual FD Media Set Parameters Command This function returns Virtual FD Media Set Parameters Command :param remote_image_server: remote image server name or IP :param remote_image_user_domain: domain name of remote image server :param remote_image_share_type: share type of ShareType :param rem...
[ "get", "Virtual", "FD", "Media", "Set", "Parameters", "Command" ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/scci.py#L387-L415
openstack/python-scciclient
scciclient/irmc/scci.py
get_report
def get_report(host, userid, password, port=443, auth_method='basic', client_timeout=60): """get iRMC report This function returns iRMC report in XML format :param host: hostname or IP of iRMC :param userid: userid for iRMC with administrator privileges :param password: password for ...
python
def get_report(host, userid, password, port=443, auth_method='basic', client_timeout=60): """get iRMC report This function returns iRMC report in XML format :param host: hostname or IP of iRMC :param userid: userid for iRMC with administrator privileges :param password: password for ...
[ "def", "get_report", "(", "host", ",", "userid", ",", "password", ",", "port", "=", "443", ",", "auth_method", "=", "'basic'", ",", "client_timeout", "=", "60", ")", ":", "auth_obj", "=", "None", "try", ":", "protocol", "=", "{", "80", ":", "'http'", ...
get iRMC report This function returns iRMC report in XML format :param host: hostname or IP of iRMC :param userid: userid for iRMC with administrator privileges :param password: password for userid :param port: port number of iRMC :param auth_method: irmc_username :param client_timeout: tim...
[ "get", "iRMC", "report" ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/scci.py#L418-L468
openstack/python-scciclient
scciclient/irmc/scci.py
get_essential_properties
def get_essential_properties(report, prop_keys): """get essential properties This function returns a dictionary which contains keys as in prop_keys and its values from the report. :param report: SCCI report element :param prop_keys: a list of keys for essential properties :returns: a dictionar...
python
def get_essential_properties(report, prop_keys): """get essential properties This function returns a dictionary which contains keys as in prop_keys and its values from the report. :param report: SCCI report element :param prop_keys: a list of keys for essential properties :returns: a dictionar...
[ "def", "get_essential_properties", "(", "report", ",", "prop_keys", ")", ":", "v", "=", "{", "}", "v", "[", "'memory_mb'", "]", "=", "int", "(", "report", ".", "find", "(", "'./System/Memory/Installed'", ")", ".", "text", ")", "v", "[", "'local_gb'", "]"...
get essential properties This function returns a dictionary which contains keys as in prop_keys and its values from the report. :param report: SCCI report element :param prop_keys: a list of keys for essential properties :returns: a dictionary which contains keys as in prop_keys and ...
[ "get", "essential", "properties" ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/scci.py#L497-L520
openstack/python-scciclient
scciclient/irmc/scci.py
get_capabilities_properties
def get_capabilities_properties(d_info, capa_keys, gpu_ids, fpga_ids=None, **kwargs): """get capabilities properties This function returns a dictionary which contains keys and the...
python
def get_capabilities_properties(d_info, capa_keys, gpu_ids, fpga_ids=None, **kwargs): """get capabilities properties This function returns a dictionary which contains keys and the...
[ "def", "get_capabilities_properties", "(", "d_info", ",", "capa_keys", ",", "gpu_ids", ",", "fpga_ids", "=", "None", ",", "*", "*", "kwargs", ")", ":", "snmp_client", "=", "snmp", ".", "SNMPClient", "(", "d_info", "[", "'irmc_address'", "]", ",", "d_info", ...
get capabilities properties This function returns a dictionary which contains keys and their values from the report. :param d_info: the dictionary of ipmitool parameters for accessing a node. :param capa_keys: a list of keys for additional capabilities properties. :param gpu_ids: the list of stri...
[ "get", "capabilities", "properties" ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/scci.py#L523-L580
openstack/python-scciclient
scciclient/irmc/scci.py
process_session_status
def process_session_status(irmc_info, session_timeout, upgrade_type): """process session for Bios config backup/restore or RAID config operation :param irmc_info: node info :param session_timeout: session timeout :param upgrade_type: flag to check upgrade with bios or irmc :return: a dict with foll...
python
def process_session_status(irmc_info, session_timeout, upgrade_type): """process session for Bios config backup/restore or RAID config operation :param irmc_info: node info :param session_timeout: session timeout :param upgrade_type: flag to check upgrade with bios or irmc :return: a dict with foll...
[ "def", "process_session_status", "(", "irmc_info", ",", "session_timeout", ",", "upgrade_type", ")", ":", "session_expiration", "=", "time", ".", "time", "(", ")", "+", "session_timeout", "while", "time", ".", "time", "(", ")", "<", "session_expiration", ":", ...
process session for Bios config backup/restore or RAID config operation :param irmc_info: node info :param session_timeout: session timeout :param upgrade_type: flag to check upgrade with bios or irmc :return: a dict with following values: { 'upgrade_message': <Message of firmware u...
[ "process", "session", "for", "Bios", "config", "backup", "/", "restore", "or", "RAID", "config", "operation" ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/scci.py#L583-L628
openstack/python-scciclient
scciclient/irmc/scci.py
get_raid_fgi_status
def get_raid_fgi_status(report): """Gather fgi(foreground initialization) information of raid configuration This function returns a fgi status which contains activity status and its values from the report. :param report: SCCI report information :returns: dict of fgi status of logical_drives, such ...
python
def get_raid_fgi_status(report): """Gather fgi(foreground initialization) information of raid configuration This function returns a fgi status which contains activity status and its values from the report. :param report: SCCI report information :returns: dict of fgi status of logical_drives, such ...
[ "def", "get_raid_fgi_status", "(", "report", ")", ":", "fgi_status", "=", "{", "}", "raid_path", "=", "\"./Software/ServerView/ServerViewRaid\"", "if", "not", "report", ".", "find", "(", "raid_path", ")", ":", "raise", "SCCIInvalidInputError", "(", "\"ServerView RAI...
Gather fgi(foreground initialization) information of raid configuration This function returns a fgi status which contains activity status and its values from the report. :param report: SCCI report information :returns: dict of fgi status of logical_drives, such as Initializing (10%) or I...
[ "Gather", "fgi", "(", "foreground", "initialization", ")", "information", "of", "raid", "configuration" ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/scci.py#L631-L660
openstack/python-scciclient
scciclient/irmc/scci.py
get_firmware_upgrade_status
def get_firmware_upgrade_status(irmc_info, upgrade_type): """get firmware upgrade status of bios or irmc :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 o...
python
def get_firmware_upgrade_status(irmc_info, upgrade_type): """get firmware upgrade status of bios or irmc :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 o...
[ "def", "get_firmware_upgrade_status", "(", "irmc_info", ",", "upgrade_type", ")", ":", "host", "=", "irmc_info", ".", "get", "(", "'irmc_address'", ")", "userid", "=", "irmc_info", ".", "get", "(", "'irmc_username'", ")", "password", "=", "irmc_info", ".", "ge...
get firmware upgrade status of bios or irmc :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 '...
[ "get", "firmware", "upgrade", "status", "of", "bios", "or", "irmc" ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/scci.py#L663-L720
OSSOS/MOP
src/jjk/preproc/median.py
median
def median(ma): """ do it row by row, to save memory....""" _median = 0*ma[0].filled(fill_value=0) for i in range(ma.shape[-1]): t=xmedian(ma[:,:,i]) _median[:,i]=t t=None return _median
python
def median(ma): """ do it row by row, to save memory....""" _median = 0*ma[0].filled(fill_value=0) for i in range(ma.shape[-1]): t=xmedian(ma[:,:,i]) _median[:,i]=t t=None return _median
[ "def", "median", "(", "ma", ")", ":", "_median", "=", "0", "*", "ma", "[", "0", "]", ".", "filled", "(", "fill_value", "=", "0", ")", "for", "i", "in", "range", "(", "ma", ".", "shape", "[", "-", "1", "]", ")", ":", "t", "=", "xmedian", "("...
do it row by row, to save memory....
[ "do", "it", "row", "by", "row", "to", "save", "memory", "...." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/median.py#L3-L10
OSSOS/MOP
src/jjk/preproc/median.py
xmedian
def xmedian(ma): """ Given a masked numpy array (build using numpy.ma class) return the median value of the array.""" import numpy _medianIndex = numpy.floor(ma.count(axis=0)/2.0) _sortIndex = ma.argsort(kind='heapsort',axis=0) _median = ma[0].filled(fill_value=0)*0 for idx in range(len(_sor...
python
def xmedian(ma): """ Given a masked numpy array (build using numpy.ma class) return the median value of the array.""" import numpy _medianIndex = numpy.floor(ma.count(axis=0)/2.0) _sortIndex = ma.argsort(kind='heapsort',axis=0) _median = ma[0].filled(fill_value=0)*0 for idx in range(len(_sor...
[ "def", "xmedian", "(", "ma", ")", ":", "import", "numpy", "_medianIndex", "=", "numpy", ".", "floor", "(", "ma", ".", "count", "(", "axis", "=", "0", ")", "/", "2.0", ")", "_sortIndex", "=", "ma", ".", "argsort", "(", "kind", "=", "'heapsort'", ","...
Given a masked numpy array (build using numpy.ma class) return the median value of the array.
[ "Given", "a", "masked", "numpy", "array", "(", "build", "using", "numpy", ".", "ma", "class", ")", "return", "the", "median", "value", "of", "the", "array", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/median.py#L12-L27
OSSOS/MOP
src/ossos/core/ossos/naming.py
_generate_provisional_name
def _generate_provisional_name(q, astrom_header, fits_header): """ Generates a name for an object given the information in its astrom observation header and FITS header. :param q: a queue of provisional names to return. :type q: Queue :param astrom_header: :param fits_header: """ whi...
python
def _generate_provisional_name(q, astrom_header, fits_header): """ Generates a name for an object given the information in its astrom observation header and FITS header. :param q: a queue of provisional names to return. :type q: Queue :param astrom_header: :param fits_header: """ whi...
[ "def", "_generate_provisional_name", "(", "q", ",", "astrom_header", ",", "fits_header", ")", ":", "while", "True", ":", "ef", "=", "get_epoch_field", "(", "astrom_header", ",", "fits_header", ")", "epoch_field", "=", "ef", "[", "0", "]", "+", "ef", "[", "...
Generates a name for an object given the information in its astrom observation header and FITS header. :param q: a queue of provisional names to return. :type q: Queue :param astrom_header: :param fits_header:
[ "Generates", "a", "name", "for", "an", "object", "given", "the", "information", "in", "its", "astrom", "observation", "header", "and", "FITS", "header", ".", ":", "param", "q", ":", "a", "queue", "of", "provisional", "names", "to", "return", ".", ":", "t...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/naming.py#L9-L25
OSSOS/MOP
src/ossos/core/ossos/gui/controllers.py
AbstractController.on_toggle_autoplay_key
def on_toggle_autoplay_key(self): """ The user has pressed the keybind for toggling autoplay. """ if self.autoplay_manager.is_running(): self.autoplay_manager.stop_autoplay() self.view.set_autoplay(False) else: self.autoplay_manager.start_autop...
python
def on_toggle_autoplay_key(self): """ The user has pressed the keybind for toggling autoplay. """ if self.autoplay_manager.is_running(): self.autoplay_manager.stop_autoplay() self.view.set_autoplay(False) else: self.autoplay_manager.start_autop...
[ "def", "on_toggle_autoplay_key", "(", "self", ")", ":", "if", "self", ".", "autoplay_manager", ".", "is_running", "(", ")", ":", "self", ".", "autoplay_manager", ".", "stop_autoplay", "(", ")", "self", ".", "view", ".", "set_autoplay", "(", "False", ")", "...
The user has pressed the keybind for toggling autoplay.
[ "The", "user", "has", "pressed", "the", "keybind", "for", "toggling", "autoplay", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/controllers.py#L161-L170
OSSOS/MOP
src/ossos/core/ossos/gui/controllers.py
ProcessRealsController.on_accept
def on_accept(self, auto=False): """ Initiates acceptance procedure, gathering required data. @param auto: Set on_accept to automatic measure of source? """ if self.model.is_current_source_named(): provisional_name = self.model.get_current_source_name() else:...
python
def on_accept(self, auto=False): """ Initiates acceptance procedure, gathering required data. @param auto: Set on_accept to automatic measure of source? """ if self.model.is_current_source_named(): provisional_name = self.model.get_current_source_name() else:...
[ "def", "on_accept", "(", "self", ",", "auto", "=", "False", ")", ":", "if", "self", ".", "model", ".", "is_current_source_named", "(", ")", ":", "provisional_name", "=", "self", ".", "model", ".", "get_current_source_name", "(", ")", "else", ":", "provisio...
Initiates acceptance procedure, gathering required data. @param auto: Set on_accept to automatic measure of source?
[ "Initiates", "acceptance", "procedure", "gathering", "required", "data", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/controllers.py#L234-L392
OSSOS/MOP
src/ossos/core/ossos/gui/controllers.py
ProcessRealsController.on_do_accept
def on_do_accept(self, minor_planet_number, provisional_name, note1, note2, date_of_obs, ra, dec, obs_mag, obs_mag_err, ...
python
def on_do_accept(self, minor_planet_number, provisional_name, note1, note2, date_of_obs, ra, dec, obs_mag, obs_mag_err, ...
[ "def", "on_do_accept", "(", "self", ",", "minor_planet_number", ",", "provisional_name", ",", "note1", ",", "note2", ",", "date_of_obs", ",", "ra", ",", "dec", ",", "obs_mag", ",", "obs_mag_err", ",", "band", ",", "observatory_code", ",", "comment", ")", ":"...
After a source has been mark for acceptance create an MPC Observation record. @param minor_planet_number: The MPC Number associated with the object @param provisional_name: A provisional name associated with the object @param note1: The observational quality note @param note2: The obser...
[ "After", "a", "source", "has", "been", "mark", "for", "acceptance", "create", "an", "MPC", "Observation", "record", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/controllers.py#L394-L471
OSSOS/MOP
src/ossos/core/ossos/gui/controllers.py
ProcessVettingController.on_do_accept
def on_do_accept(self, comment): """ WARNING WARNING: THIS IS ACUTALLY on_do_accept BUT HACKED. TODO: Make it so that we have a short 'vetting' accept dialogue. Current accept dialogue too heavy for this part of process, thus the hack. Process the rejection of a vetting cand...
python
def on_do_accept(self, comment): """ WARNING WARNING: THIS IS ACUTALLY on_do_accept BUT HACKED. TODO: Make it so that we have a short 'vetting' accept dialogue. Current accept dialogue too heavy for this part of process, thus the hack. Process the rejection of a vetting cand...
[ "def", "on_do_accept", "(", "self", ",", "comment", ")", ":", "self", ".", "view", ".", "close_vetting_accept_source_dialog", "(", ")", "# Set to None if blank", "if", "len", "(", "comment", ".", "strip", "(", ")", ")", "==", "0", ":", "comment", "=", "Non...
WARNING WARNING: THIS IS ACUTALLY on_do_accept BUT HACKED. TODO: Make it so that we have a short 'vetting' accept dialogue. Current accept dialogue too heavy for this part of process, thus the hack. Process the rejection of a vetting candidate, includes writing a comment to file. @p...
[ "WARNING", "WARNING", ":", "THIS", "IS", "ACUTALLY", "on_do_accept", "BUT", "HACKED", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/controllers.py#L563-L585
OSSOS/MOP
src/ossos/core/ossos/gui/controllers.py
ProcessTracksController.on_load_comparison
def on_load_comparison(self, research=False): """ Display the comparison image @param research: find a new comparison image even if one already known? """ cutout = self.model.get_current_cutout() if research: cutout.comparison_image_index = None compa...
python
def on_load_comparison(self, research=False): """ Display the comparison image @param research: find a new comparison image even if one already known? """ cutout = self.model.get_current_cutout() if research: cutout.comparison_image_index = None compa...
[ "def", "on_load_comparison", "(", "self", ",", "research", "=", "False", ")", ":", "cutout", "=", "self", ".", "model", ".", "get_current_cutout", "(", ")", "if", "research", ":", "cutout", ".", "comparison_image_index", "=", "None", "comparison_image", "=", ...
Display the comparison image @param research: find a new comparison image even if one already known?
[ "Display", "the", "comparison", "image" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/controllers.py#L651-L669
OSSOS/MOP
src/ossos/core/scripts/step2.py
compute_trans
def compute_trans(expnums, ccd, version, prefix=None, default="WCS"): """ Pull the astrometric header for each image, compute an x/y transform and compare to trans.jmp this one overides trans.jmp if they are very different. @param expnums: @param ccd: @param version: @param prefix: @ret...
python
def compute_trans(expnums, ccd, version, prefix=None, default="WCS"): """ Pull the astrometric header for each image, compute an x/y transform and compare to trans.jmp this one overides trans.jmp if they are very different. @param expnums: @param ccd: @param version: @param prefix: @ret...
[ "def", "compute_trans", "(", "expnums", ",", "ccd", ",", "version", ",", "prefix", "=", "None", ",", "default", "=", "\"WCS\"", ")", ":", "wcs_dict", "=", "{", "}", "for", "expnum", "in", "expnums", ":", "try", ":", "# TODO This assumes that the image is alr...
Pull the astrometric header for each image, compute an x/y transform and compare to trans.jmp this one overides trans.jmp if they are very different. @param expnums: @param ccd: @param version: @param prefix: @return: None
[ "Pull", "the", "astrometric", "header", "for", "each", "image", "compute", "an", "x", "/", "y", "transform", "and", "compare", "to", "trans", ".", "jmp" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/step2.py#L40-L83
OSSOS/MOP
src/ossos/core/scripts/step2.py
step2
def step2(expnums, ccd, version, prefix=None, dry_run=False, default="WCS"): """run the actual step2 on the given exp/ccd combo""" jmp_trans = ['step2ajmp'] jmp_args = ['step2bjmp'] matt_args = ['step2matt_jmp'] idx = 0 for expnum in expnums: jmp_args.append( storage.get_f...
python
def step2(expnums, ccd, version, prefix=None, dry_run=False, default="WCS"): """run the actual step2 on the given exp/ccd combo""" jmp_trans = ['step2ajmp'] jmp_args = ['step2bjmp'] matt_args = ['step2matt_jmp'] idx = 0 for expnum in expnums: jmp_args.append( storage.get_f...
[ "def", "step2", "(", "expnums", ",", "ccd", ",", "version", ",", "prefix", "=", "None", ",", "dry_run", "=", "False", ",", "default", "=", "\"WCS\"", ")", ":", "jmp_trans", "=", "[", "'step2ajmp'", "]", "jmp_args", "=", "[", "'step2bjmp'", "]", "matt_a...
run the actual step2 on the given exp/ccd combo
[ "run", "the", "actual", "step2", "on", "the", "given", "exp", "/", "ccd", "combo" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/step2.py#L86-L152
OSSOS/MOP
src/ossos/plotting/scripts/plot_aq.py
parse_nate_sims
def parse_nate_sims(path): ''' parts0.dat) contains the id number, particle fraction (ignore) a, ecc, inc, long. asc., arg. per, and mean anomaly for every particle in the simulation at t=0. The second (parts3999.dat) contains the same info at t=3.999 Gyrs for these particles. :return: ''' ...
python
def parse_nate_sims(path): ''' parts0.dat) contains the id number, particle fraction (ignore) a, ecc, inc, long. asc., arg. per, and mean anomaly for every particle in the simulation at t=0. The second (parts3999.dat) contains the same info at t=3.999 Gyrs for these particles. :return: ''' ...
[ "def", "parse_nate_sims", "(", "path", ")", ":", "zerostate", "=", "pandas", ".", "read_table", "(", "path", "+", "'parts0.dat'", ",", "delim_whitespace", "=", "True", ")", "endstate", "=", "pandas", ".", "read_table", "(", "path", "+", "'parts3999.dat'", ",...
parts0.dat) contains the id number, particle fraction (ignore) a, ecc, inc, long. asc., arg. per, and mean anomaly for every particle in the simulation at t=0. The second (parts3999.dat) contains the same info at t=3.999 Gyrs for these particles. :return:
[ "parts0", ".", "dat", ")", "contains", "the", "id", "number", "particle", "fraction", "(", "ignore", ")", "a", "ecc", "inc", "long", ".", "asc", ".", "arg", ".", "per", "and", "mean", "anomaly", "for", "every", "particle", "in", "the", "simulation", "a...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/plotting/scripts/plot_aq.py#L17-L32
openstack/python-scciclient
scciclient/irmc/viom/client.py
_convert_netmask
def _convert_netmask(mask): """Convert netmask from CIDR format(integer) to doted decimal string.""" if mask not in range(0, 33): raise scci.SCCIInvalidInputError( 'Netmask value is invalid.') return socket.inet_ntoa(struct.pack( '!L', int('1' * mask + '0' * (32 - mask), 2)))
python
def _convert_netmask(mask): """Convert netmask from CIDR format(integer) to doted decimal string.""" if mask not in range(0, 33): raise scci.SCCIInvalidInputError( 'Netmask value is invalid.') return socket.inet_ntoa(struct.pack( '!L', int('1' * mask + '0' * (32 - mask), 2)))
[ "def", "_convert_netmask", "(", "mask", ")", ":", "if", "mask", "not", "in", "range", "(", "0", ",", "33", ")", ":", "raise", "scci", ".", "SCCIInvalidInputError", "(", "'Netmask value is invalid.'", ")", "return", "socket", ".", "inet_ntoa", "(", "struct", ...
Convert netmask from CIDR format(integer) to doted decimal string.
[ "Convert", "netmask", "from", "CIDR", "format", "(", "integer", ")", "to", "doted", "decimal", "string", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/client.py#L249-L256
openstack/python-scciclient
scciclient/irmc/viom/client.py
VIOMConfiguration.apply
def apply(self, reboot=False): """Apply the configuration to iRMC.""" self.root.use_virtual_addresses = True self.root.manage.manage = True self.root.mode = 'new' self.root.init_boot = reboot self.client.set_profile(self.root.get_json())
python
def apply(self, reboot=False): """Apply the configuration to iRMC.""" self.root.use_virtual_addresses = True self.root.manage.manage = True self.root.mode = 'new' self.root.init_boot = reboot self.client.set_profile(self.root.get_json())
[ "def", "apply", "(", "self", ",", "reboot", "=", "False", ")", ":", "self", ".", "root", ".", "use_virtual_addresses", "=", "True", "self", ".", "root", ".", "manage", ".", "manage", "=", "True", "self", ".", "root", ".", "mode", "=", "'new'", "self"...
Apply the configuration to iRMC.
[ "Apply", "the", "configuration", "to", "iRMC", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/client.py#L268-L275
openstack/python-scciclient
scciclient/irmc/viom/client.py
VIOMConfiguration.terminate
def terminate(self, reboot=False): """Delete VIOM configuration from iRMC.""" self.root.manage.manage = False self.root.mode = 'delete' self.root.init_boot = reboot self.client.set_profile(self.root.get_json())
python
def terminate(self, reboot=False): """Delete VIOM configuration from iRMC.""" self.root.manage.manage = False self.root.mode = 'delete' self.root.init_boot = reboot self.client.set_profile(self.root.get_json())
[ "def", "terminate", "(", "self", ",", "reboot", "=", "False", ")", ":", "self", ".", "root", ".", "manage", ".", "manage", "=", "False", "self", ".", "root", ".", "mode", "=", "'delete'", "self", ".", "root", ".", "init_boot", "=", "reboot", "self", ...
Delete VIOM configuration from iRMC.
[ "Delete", "VIOM", "configuration", "from", "iRMC", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/client.py#L277-L282
openstack/python-scciclient
scciclient/irmc/viom/client.py
VIOMConfiguration.set_lan_port
def set_lan_port(self, port_id, mac=None): """Set LAN port information to configuration. :param port_id: Physical port ID. :param mac: virtual MAC address if virtualization is necessary. """ port_handler = _parse_physical_port_id(port_id) port = self._find_port(port_hand...
python
def set_lan_port(self, port_id, mac=None): """Set LAN port information to configuration. :param port_id: Physical port ID. :param mac: virtual MAC address if virtualization is necessary. """ port_handler = _parse_physical_port_id(port_id) port = self._find_port(port_hand...
[ "def", "set_lan_port", "(", "self", ",", "port_id", ",", "mac", "=", "None", ")", ":", "port_handler", "=", "_parse_physical_port_id", "(", "port_id", ")", "port", "=", "self", ".", "_find_port", "(", "port_handler", ")", "if", "port", ":", "port_handler", ...
Set LAN port information to configuration. :param port_id: Physical port ID. :param mac: virtual MAC address if virtualization is necessary.
[ "Set", "LAN", "port", "information", "to", "configuration", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/client.py#L312-L323
openstack/python-scciclient
scciclient/irmc/viom/client.py
VIOMConfiguration.set_iscsi_volume
def set_iscsi_volume(self, port_id, initiator_iqn, initiator_dhcp=False, initiator_ip=None, initiator_netmask=None, target_dhcp=False, target_iqn=None, target_ip=None, target_port=3260, target_lun=0, boot_prio=1, ...
python
def set_iscsi_volume(self, port_id, initiator_iqn, initiator_dhcp=False, initiator_ip=None, initiator_netmask=None, target_dhcp=False, target_iqn=None, target_ip=None, target_port=3260, target_lun=0, boot_prio=1, ...
[ "def", "set_iscsi_volume", "(", "self", ",", "port_id", ",", "initiator_iqn", ",", "initiator_dhcp", "=", "False", ",", "initiator_ip", "=", "None", ",", "initiator_netmask", "=", "None", ",", "target_dhcp", "=", "False", ",", "target_iqn", "=", "None", ",", ...
Set iSCSI volume information to configuration. :param port_id: Physical port ID. :param initiator_iqn: IQN of initiator. :param initiator_dhcp: True if DHCP is used in the iSCSI network. :param initiator_ip: IP address of initiator. None if DHCP is used. :param initiator_netmask...
[ "Set", "iSCSI", "volume", "information", "to", "configuration", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/client.py#L325-L373
openstack/python-scciclient
scciclient/irmc/viom/client.py
VIOMConfiguration.set_fc_volume
def set_fc_volume(self, port_id, target_wwn, target_lun=0, boot_prio=1, initiator_wwnn=None, initiator_wwpn=None): """Set FibreChannel volume information to configuration. :param port_id: Physical port ID. :param target_wwn: WWN of target. :pa...
python
def set_fc_volume(self, port_id, target_wwn, target_lun=0, boot_prio=1, initiator_wwnn=None, initiator_wwpn=None): """Set FibreChannel volume information to configuration. :param port_id: Physical port ID. :param target_wwn: WWN of target. :pa...
[ "def", "set_fc_volume", "(", "self", ",", "port_id", ",", "target_wwn", ",", "target_lun", "=", "0", ",", "boot_prio", "=", "1", ",", "initiator_wwnn", "=", "None", ",", "initiator_wwpn", "=", "None", ")", ":", "port_handler", "=", "_parse_physical_port_id", ...
Set FibreChannel volume information to configuration. :param port_id: Physical port ID. :param target_wwn: WWN of target. :param target_lun: LUN number of target. :param boot_prio: Boot priority of the volume. 1 indicates the highest priority. :param initiator_wwn...
[ "Set", "FibreChannel", "volume", "information", "to", "configuration", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/client.py#L375-L401
openstack/python-scciclient
scciclient/irmc/viom/client.py
VIOMConfiguration._pad_former_ports
def _pad_former_ports(self, port_handler): """Create ports with former port index. :param port_handler: Port information to be registered. Depending on slot type and card type, it is necessary to register LAN ports with former index to VIOM table. """ if not port_handle...
python
def _pad_former_ports(self, port_handler): """Create ports with former port index. :param port_handler: Port information to be registered. Depending on slot type and card type, it is necessary to register LAN ports with former index to VIOM table. """ if not port_handle...
[ "def", "_pad_former_ports", "(", "self", ",", "port_handler", ")", ":", "if", "not", "port_handler", ".", "need_padding", "(", ")", ":", "return", "for", "port_idx", "in", "range", "(", "1", ",", "port_handler", ".", "port_idx", ")", ":", "pad_handler", "=...
Create ports with former port index. :param port_handler: Port information to be registered. Depending on slot type and card type, it is necessary to register LAN ports with former index to VIOM table.
[ "Create", "ports", "with", "former", "port", "index", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/client.py#L411-L430
JohnVinyard/zounds
zounds/soundfile/byte_depth.py
chunk_size_samples
def chunk_size_samples(sf, buf): """ Black magic to account for the fact that libsndfile's behavior varies depending on file format when using the virtual io api. If you ask for more samples from an ogg or flac file than are available at that moment, libsndfile will give you no more samples ever, e...
python
def chunk_size_samples(sf, buf): """ Black magic to account for the fact that libsndfile's behavior varies depending on file format when using the virtual io api. If you ask for more samples from an ogg or flac file than are available at that moment, libsndfile will give you no more samples ever, e...
[ "def", "chunk_size_samples", "(", "sf", ",", "buf", ")", ":", "byte_depth", "=", "_lookup", "[", "sf", ".", "subtype", "]", "channels", "=", "sf", ".", "channels", "bytes_per_second", "=", "byte_depth", "*", "sf", ".", "samplerate", "*", "channels", "secs"...
Black magic to account for the fact that libsndfile's behavior varies depending on file format when using the virtual io api. If you ask for more samples from an ogg or flac file than are available at that moment, libsndfile will give you no more samples ever, even if more bytes arrive in the buffer la...
[ "Black", "magic", "to", "account", "for", "the", "fact", "that", "libsndfile", "s", "behavior", "varies", "depending", "on", "file", "format", "when", "using", "the", "virtual", "io", "api", "." ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/soundfile/byte_depth.py#L19-L33
OSSOS/MOP
src/ossos/core/ossos/coding.py
encode
def encode(number, alphabet): """ Converts an integer to a base n string where n is the length of the provided alphabet. Modified from http://en.wikipedia.org/wiki/Base_36 """ if not isinstance(number, (int, long)): raise TypeError("Number must be an integer.") base_n = "" sign...
python
def encode(number, alphabet): """ Converts an integer to a base n string where n is the length of the provided alphabet. Modified from http://en.wikipedia.org/wiki/Base_36 """ if not isinstance(number, (int, long)): raise TypeError("Number must be an integer.") base_n = "" sign...
[ "def", "encode", "(", "number", ",", "alphabet", ")", ":", "if", "not", "isinstance", "(", "number", ",", "(", "int", ",", "long", ")", ")", ":", "raise", "TypeError", "(", "\"Number must be an integer.\"", ")", "base_n", "=", "\"\"", "sign", "=", "\"\""...
Converts an integer to a base n string where n is the length of the provided alphabet. Modified from http://en.wikipedia.org/wiki/Base_36
[ "Converts", "an", "integer", "to", "a", "base", "n", "string", "where", "n", "is", "the", "length", "of", "the", "provided", "alphabet", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/coding.py#L17-L41
JohnVinyard/zounds
zounds/timeseries/functional.py
categorical
def categorical(x, mu=255, normalize=True): """ Mu-law compress a block of audio samples, and convert them into a categorical distribution """ if normalize: # normalize the signal mx = x.max() x = np.divide(x, mx, where=mx != 0) # mu law compression x = mu_law(x) ...
python
def categorical(x, mu=255, normalize=True): """ Mu-law compress a block of audio samples, and convert them into a categorical distribution """ if normalize: # normalize the signal mx = x.max() x = np.divide(x, mx, where=mx != 0) # mu law compression x = mu_law(x) ...
[ "def", "categorical", "(", "x", ",", "mu", "=", "255", ",", "normalize", "=", "True", ")", ":", "if", "normalize", ":", "# normalize the signal", "mx", "=", "x", ".", "max", "(", ")", "x", "=", "np", ".", "divide", "(", "x", ",", "mx", ",", "wher...
Mu-law compress a block of audio samples, and convert them into a categorical distribution
[ "Mu", "-", "law", "compress", "a", "block", "of", "audio", "samples", "and", "convert", "them", "into", "a", "categorical", "distribution" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/timeseries/functional.py#L7-L33
JohnVinyard/zounds
zounds/timeseries/functional.py
inverse_categorical
def inverse_categorical(x, mu=255): """ Invert categorical samples """ flat = x.reshape((-1, x.shape[-1])) indices = np.argmax(flat, axis=1).astype(np.float32) indices = (indices / mu) - 0.5 inverted = inverse_mu_law(indices, mu=mu).reshape(x.shape[:-1]) return ArrayWithUnits(inverted, x...
python
def inverse_categorical(x, mu=255): """ Invert categorical samples """ flat = x.reshape((-1, x.shape[-1])) indices = np.argmax(flat, axis=1).astype(np.float32) indices = (indices / mu) - 0.5 inverted = inverse_mu_law(indices, mu=mu).reshape(x.shape[:-1]) return ArrayWithUnits(inverted, x...
[ "def", "inverse_categorical", "(", "x", ",", "mu", "=", "255", ")", ":", "flat", "=", "x", ".", "reshape", "(", "(", "-", "1", ",", "x", ".", "shape", "[", "-", "1", "]", ")", ")", "indices", "=", "np", ".", "argmax", "(", "flat", ",", "axis"...
Invert categorical samples
[ "Invert", "categorical", "samples" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/timeseries/functional.py#L37-L45
JohnVinyard/zounds
zounds/synthesize/synthesize.py
SineSynthesizer.synthesize
def synthesize(self, duration, freqs_in_hz=[440.]): """ Synthesize one or more sine waves Args: duration (numpy.timdelta64): The duration of the sound to be synthesized freqs_in_hz (list of float): Numbers representing the frequencies in h...
python
def synthesize(self, duration, freqs_in_hz=[440.]): """ Synthesize one or more sine waves Args: duration (numpy.timdelta64): The duration of the sound to be synthesized freqs_in_hz (list of float): Numbers representing the frequencies in h...
[ "def", "synthesize", "(", "self", ",", "duration", ",", "freqs_in_hz", "=", "[", "440.", "]", ")", ":", "freqs", "=", "np", ".", "array", "(", "freqs_in_hz", ")", "scaling", "=", "1", "/", "len", "(", "freqs", ")", "sr", "=", "int", "(", "self", ...
Synthesize one or more sine waves Args: duration (numpy.timdelta64): The duration of the sound to be synthesized freqs_in_hz (list of float): Numbers representing the frequencies in hz that should be synthesized
[ "Synthesize", "one", "or", "more", "sine", "waves" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/synthesize/synthesize.py#L546-L563
JohnVinyard/zounds
zounds/synthesize/synthesize.py
TickSynthesizer.synthesize
def synthesize(self, duration, tick_frequency): """ Synthesize periodic "ticks", generated from white noise and an envelope Args: duration (numpy.timedelta64): The total duration of the sound to be synthesized tick_frequency (numpy.timedelta64): The frequ...
python
def synthesize(self, duration, tick_frequency): """ Synthesize periodic "ticks", generated from white noise and an envelope Args: duration (numpy.timedelta64): The total duration of the sound to be synthesized tick_frequency (numpy.timedelta64): The frequ...
[ "def", "synthesize", "(", "self", ",", "duration", ",", "tick_frequency", ")", ":", "sr", "=", "self", ".", "samplerate", ".", "samples_per_second", "# create a short, tick sound", "tick", "=", "np", ".", "random", ".", "uniform", "(", "low", "=", "-", "1.",...
Synthesize periodic "ticks", generated from white noise and an envelope Args: duration (numpy.timedelta64): The total duration of the sound to be synthesized tick_frequency (numpy.timedelta64): The frequency of the ticking sound
[ "Synthesize", "periodic", "ticks", "generated", "from", "white", "noise", "and", "an", "envelope" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/synthesize/synthesize.py#L593-L615
JohnVinyard/zounds
zounds/synthesize/synthesize.py
NoiseSynthesizer.synthesize
def synthesize(self, duration): """ Synthesize white noise Args: duration (numpy.timedelta64): The duration of the synthesized sound """ sr = self.samplerate.samples_per_second seconds = duration / Seconds(1) samples = np.random.uniform(low=-1., high=...
python
def synthesize(self, duration): """ Synthesize white noise Args: duration (numpy.timedelta64): The duration of the synthesized sound """ sr = self.samplerate.samples_per_second seconds = duration / Seconds(1) samples = np.random.uniform(low=-1., high=...
[ "def", "synthesize", "(", "self", ",", "duration", ")", ":", "sr", "=", "self", ".", "samplerate", ".", "samples_per_second", "seconds", "=", "duration", "/", "Seconds", "(", "1", ")", "samples", "=", "np", ".", "random", ".", "uniform", "(", "low", "=...
Synthesize white noise Args: duration (numpy.timedelta64): The duration of the synthesized sound
[ "Synthesize", "white", "noise" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/synthesize/synthesize.py#L644-L654
OSSOS/MOP
src/ossos/core/ossos/gui/models/workload.py
TracksWorkUnit.query_ssos
def query_ssos(self): """ Use the MPC file that has been built up in processing this work unit to generate another workunit. """ self._ssos_queried = True mpc_filename = self.save() return self.builder.build_workunit(mpc_filename)
python
def query_ssos(self): """ Use the MPC file that has been built up in processing this work unit to generate another workunit. """ self._ssos_queried = True mpc_filename = self.save() return self.builder.build_workunit(mpc_filename)
[ "def", "query_ssos", "(", "self", ")", ":", "self", ".", "_ssos_queried", "=", "True", "mpc_filename", "=", "self", ".", "save", "(", ")", "return", "self", ".", "builder", ".", "build_workunit", "(", "mpc_filename", ")" ]
Use the MPC file that has been built up in processing this work unit to generate another workunit.
[ "Use", "the", "MPC", "file", "that", "has", "been", "built", "up", "in", "processing", "this", "work", "unit", "to", "generate", "another", "workunit", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/models/workload.py#L410-L417
OSSOS/MOP
src/ossos/core/ossos/gui/models/workload.py
TracksWorkUnit.save
def save(self): """ Update the SouceReading information for the currently recorded observations and then flush those to a file. @return: mpc_filename of the resulting save. """ self.get_writer().flush() mpc_filename = self.get_writer().get_filename() self.get_writ...
python
def save(self): """ Update the SouceReading information for the currently recorded observations and then flush those to a file. @return: mpc_filename of the resulting save. """ self.get_writer().flush() mpc_filename = self.get_writer().get_filename() self.get_writ...
[ "def", "save", "(", "self", ")", ":", "self", ".", "get_writer", "(", ")", ".", "flush", "(", ")", "mpc_filename", "=", "self", ".", "get_writer", "(", ")", ".", "get_filename", "(", ")", "self", ".", "get_writer", "(", ")", ".", "close", "(", ")",...
Update the SouceReading information for the currently recorded observations and then flush those to a file. @return: mpc_filename of the resulting save.
[ "Update", "the", "SouceReading", "information", "for", "the", "currently", "recorded", "observations", "and", "then", "flush", "those", "to", "a", "file", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/models/workload.py#L419-L428
OSSOS/MOP
src/ossos/core/ossos/gui/models/workload.py
TracksWorkUnit.get_writer
def get_writer(self): """ Get a writer. This method also makes the output filename be the same as the .track file but with .mpc. (Currently only works on local filesystem) :rtype MPCWriter """ if self._writer is None: suffix = tasks.get_suffix(tasks.T...
python
def get_writer(self): """ Get a writer. This method also makes the output filename be the same as the .track file but with .mpc. (Currently only works on local filesystem) :rtype MPCWriter """ if self._writer is None: suffix = tasks.get_suffix(tasks.T...
[ "def", "get_writer", "(", "self", ")", ":", "if", "self", ".", "_writer", "is", "None", ":", "suffix", "=", "tasks", ".", "get_suffix", "(", "tasks", ".", "TRACK_TASK", ")", "try", ":", "base_name", "=", "re", ".", "search", "(", "\"(?P<base_name>.*?)\\....
Get a writer. This method also makes the output filename be the same as the .track file but with .mpc. (Currently only works on local filesystem) :rtype MPCWriter
[ "Get", "a", "writer", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/models/workload.py#L466-L486
OSSOS/MOP
src/ossos/core/ossos/gui/models/workload.py
WorkUnitProvider._filter
def _filter(self, filename): """ return 'true' if filename doesn't match name_filter regex and should be filtered out of the list. @param filename: @return: """ return self.name_filter is not None and re.search(self.name_filter, filename) is None
python
def _filter(self, filename): """ return 'true' if filename doesn't match name_filter regex and should be filtered out of the list. @param filename: @return: """ return self.name_filter is not None and re.search(self.name_filter, filename) is None
[ "def", "_filter", "(", "self", ",", "filename", ")", ":", "return", "self", ".", "name_filter", "is", "not", "None", "and", "re", ".", "search", "(", "self", ".", "name_filter", ",", "filename", ")", "is", "None" ]
return 'true' if filename doesn't match name_filter regex and should be filtered out of the list. @param filename: @return:
[ "return", "true", "if", "filename", "doesn", "t", "match", "name_filter", "regex", "and", "should", "be", "filtered", "out", "of", "the", "list", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/models/workload.py#L571-L577
OSSOS/MOP
src/ossos/core/ossos/gui/models/workload.py
WorkUnitProvider.get_workunit
def get_workunit(self, ignore_list=None): """ Gets a new unit of work. Args: ignore_list: list(str) A list of filenames which should be ignored. Defaults to None. Returns: new_workunit: WorkUnit A new unit of work that has not yet been proce...
python
def get_workunit(self, ignore_list=None): """ Gets a new unit of work. Args: ignore_list: list(str) A list of filenames which should be ignored. Defaults to None. Returns: new_workunit: WorkUnit A new unit of work that has not yet been proce...
[ "def", "get_workunit", "(", "self", ",", "ignore_list", "=", "None", ")", ":", "if", "ignore_list", "is", "None", ":", "ignore_list", "=", "[", "]", "potential_files", "=", "self", ".", "get_potential_files", "(", "ignore_list", ")", "while", "len", "(", "...
Gets a new unit of work. Args: ignore_list: list(str) A list of filenames which should be ignored. Defaults to None. Returns: new_workunit: WorkUnit A new unit of work that has not yet been processed. A lock on it has been acquired. Ra...
[ "Gets", "a", "new", "unit", "of", "work", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/models/workload.py#L579-L625
OSSOS/MOP
src/ossos/core/ossos/gui/models/workload.py
WorkUnitProvider.get_potential_files
def get_potential_files(self, ignore_list): """ Get a listing of files for the appropriate task which may or may not be locked and/or done. """ exclude_prefix = self.taskid == tasks.suffixes.get(tasks.REALS_TASK, '') and 'fk' or None filenames = [filename for filename in ...
python
def get_potential_files(self, ignore_list): """ Get a listing of files for the appropriate task which may or may not be locked and/or done. """ exclude_prefix = self.taskid == tasks.suffixes.get(tasks.REALS_TASK, '') and 'fk' or None filenames = [filename for filename in ...
[ "def", "get_potential_files", "(", "self", ",", "ignore_list", ")", ":", "exclude_prefix", "=", "self", ".", "taskid", "==", "tasks", ".", "suffixes", ".", "get", "(", "tasks", ".", "REALS_TASK", ",", "''", ")", "and", "'fk'", "or", "None", "filenames", ...
Get a listing of files for the appropriate task which may or may not be locked and/or done.
[ "Get", "a", "listing", "of", "files", "for", "the", "appropriate", "task", "which", "may", "or", "may", "not", "be", "locked", "and", "/", "or", "done", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/models/workload.py#L627-L663
OSSOS/MOP
src/ossos/core/ossos/gui/models/workload.py
TracksWorkUnitBuilder.move_discovery_to_front
def move_discovery_to_front(self, data): """ Moves the discovery triplet to the front of the reading list. Leaves everything else in the same order. """ readings = self.get_readings(data) discovery_index = self.get_discovery_index(data) reordered_readings = (read...
python
def move_discovery_to_front(self, data): """ Moves the discovery triplet to the front of the reading list. Leaves everything else in the same order. """ readings = self.get_readings(data) discovery_index = self.get_discovery_index(data) reordered_readings = (read...
[ "def", "move_discovery_to_front", "(", "self", ",", "data", ")", ":", "readings", "=", "self", ".", "get_readings", "(", "data", ")", "discovery_index", "=", "self", ".", "get_discovery_index", "(", "data", ")", "reordered_readings", "=", "(", "readings", "[",...
Moves the discovery triplet to the front of the reading list. Leaves everything else in the same order.
[ "Moves", "the", "discovery", "triplet", "to", "the", "front", "of", "the", "reading", "list", ".", "Leaves", "everything", "else", "in", "the", "same", "order", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/models/workload.py#L832-L844
OSSOS/MOP
src/ossos/core/ossos/planning/megacam.py
TAPQuery
def TAPQuery(RAdeg=180.0, DECdeg=0.0, width=1, height=1): """Do a query of the CADC Megacam table. Get all observations insize the box. Returns a file-like object""" QUERY =( """ SELECT """ """ COORD1(CENTROID(Plane.position_bounds)) AS "RAJ2000", COORD2(CENTROID(Plane.position_bounds)) AS "DEJ...
python
def TAPQuery(RAdeg=180.0, DECdeg=0.0, width=1, height=1): """Do a query of the CADC Megacam table. Get all observations insize the box. Returns a file-like object""" QUERY =( """ SELECT """ """ COORD1(CENTROID(Plane.position_bounds)) AS "RAJ2000", COORD2(CENTROID(Plane.position_bounds)) AS "DEJ...
[ "def", "TAPQuery", "(", "RAdeg", "=", "180.0", ",", "DECdeg", "=", "0.0", ",", "width", "=", "1", ",", "height", "=", "1", ")", ":", "QUERY", "=", "(", "\"\"\" SELECT \"\"\"", "\"\"\" COORD1(CENTROID(Plane.position_bounds)) AS \"RAJ2000\", COORD2(CENTROID(Plane.positi...
Do a query of the CADC Megacam table. Get all observations insize the box. Returns a file-like object
[ "Do", "a", "query", "of", "the", "CADC", "Megacam", "table", ".", "Get", "all", "observations", "insize", "the", "box", ".", "Returns", "a", "file", "-", "like", "object" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/megacam.py#L5-L32
OSSOS/MOP
src/ossos/utils/check_mkpsf.py
check_tags
def check_tags(my_expnum, ops_set, my_ccds, dry_run=True): """ check the tags for the given expnum/ccd set. @param ops: @param my_expnum: @return: """ tags = storage.get_tags(my_expnum) count = 0 outcount = 0 fails = [] for ccd in my_ccds: success = True count += ...
python
def check_tags(my_expnum, ops_set, my_ccds, dry_run=True): """ check the tags for the given expnum/ccd set. @param ops: @param my_expnum: @return: """ tags = storage.get_tags(my_expnum) count = 0 outcount = 0 fails = [] for ccd in my_ccds: success = True count += ...
[ "def", "check_tags", "(", "my_expnum", ",", "ops_set", ",", "my_ccds", ",", "dry_run", "=", "True", ")", ":", "tags", "=", "storage", ".", "get_tags", "(", "my_expnum", ")", "count", "=", "0", "outcount", "=", "0", "fails", "=", "[", "]", "for", "ccd...
check the tags for the given expnum/ccd set. @param ops: @param my_expnum: @return:
[ "check", "the", "tags", "for", "the", "given", "expnum", "/", "ccd", "set", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/check_mkpsf.py#L28-L57
OSSOS/MOP
src/jjk/preproc/verifyDetection.py
get_flipped_ext
def get_flipped_ext(file_id,ccd): """Given a list of exposure numbers and CCD, get them from the DB""" import MOPfits import os, shutil filename=MOPfits.adGet(file_id,extno=int(ccd)) if int(ccd)<18: tfname=filename+"F" shutil.move(filename, tfname) os.system("imcopy %s[-*,...
python
def get_flipped_ext(file_id,ccd): """Given a list of exposure numbers and CCD, get them from the DB""" import MOPfits import os, shutil filename=MOPfits.adGet(file_id,extno=int(ccd)) if int(ccd)<18: tfname=filename+"F" shutil.move(filename, tfname) os.system("imcopy %s[-*,...
[ "def", "get_flipped_ext", "(", "file_id", ",", "ccd", ")", ":", "import", "MOPfits", "import", "os", ",", "shutil", "filename", "=", "MOPfits", ".", "adGet", "(", "file_id", ",", "extno", "=", "int", "(", "ccd", ")", ")", "if", "int", "(", "ccd", ")"...
Given a list of exposure numbers and CCD, get them from the DB
[ "Given", "a", "list", "of", "exposure", "numbers", "and", "CCD", "get", "them", "from", "the", "DB" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/verifyDetection.py#L17-L31
OSSOS/MOP
src/jjk/preproc/verifyDetection.py
get_file_ids
def get_file_ids(object): """Get the exposure for a particular line in the meausre table""" import MOPdbaccess mysql = MOPdbaccess.connect('cfeps','cfhls',dbSystem='MYSQL') cfeps=mysql.cursor() sql="SELECT file_id FROM measure WHERE provisional LIKE %s" cfeps.execute(sql,(object, )) file_ids...
python
def get_file_ids(object): """Get the exposure for a particular line in the meausre table""" import MOPdbaccess mysql = MOPdbaccess.connect('cfeps','cfhls',dbSystem='MYSQL') cfeps=mysql.cursor() sql="SELECT file_id FROM measure WHERE provisional LIKE %s" cfeps.execute(sql,(object, )) file_ids...
[ "def", "get_file_ids", "(", "object", ")", ":", "import", "MOPdbaccess", "mysql", "=", "MOPdbaccess", ".", "connect", "(", "'cfeps'", ",", "'cfhls'", ",", "dbSystem", "=", "'MYSQL'", ")", "cfeps", "=", "mysql", ".", "cursor", "(", ")", "sql", "=", "\"SEL...
Get the exposure for a particular line in the meausre table
[ "Get", "the", "exposure", "for", "a", "particular", "line", "in", "the", "meausre", "table" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/verifyDetection.py#L34-L43
OSSOS/MOP
src/ossos/core/scripts/update_header.py
main
def main(): """Do the script.""" parser = argparse.ArgumentParser( description='replace image header') parser.add_argument('--extname', help='name of extension to in header') parser.add_argument('expnum', type=str, help='exposure to update') pa...
python
def main(): """Do the script.""" parser = argparse.ArgumentParser( description='replace image header') parser.add_argument('--extname', help='name of extension to in header') parser.add_argument('expnum', type=str, help='exposure to update') pa...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'replace image header'", ")", "parser", ".", "add_argument", "(", "'--extname'", ",", "help", "=", "'name of extension to in header'", ")", "parser", ".", "...
Do the script.
[ "Do", "the", "script", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/update_header.py#L48-L108
eelregit/mcfit
mcfit/kernels.py
_deriv
def _deriv(UK, deriv): """Real deriv is to :math:`t`, complex deriv is to :math:`\ln t`""" if deriv == 0: return UK if isinstance(deriv, complex): def UKderiv(z): return (-z) ** deriv.imag * UK(z) return UKderiv def UKderiv(z): poly = arange(deriv) + 1 ...
python
def _deriv(UK, deriv): """Real deriv is to :math:`t`, complex deriv is to :math:`\ln t`""" if deriv == 0: return UK if isinstance(deriv, complex): def UKderiv(z): return (-z) ** deriv.imag * UK(z) return UKderiv def UKderiv(z): poly = arange(deriv) + 1 ...
[ "def", "_deriv", "(", "UK", ",", "deriv", ")", ":", "if", "deriv", "==", "0", ":", "return", "UK", "if", "isinstance", "(", "deriv", ",", "complex", ")", ":", "def", "UKderiv", "(", "z", ")", ":", "return", "(", "-", "z", ")", "**", "deriv", "....
Real deriv is to :math:`t`, complex deriv is to :math:`\ln t`
[ "Real", "deriv", "is", "to", ":", "math", ":", "t", "complex", "deriv", "is", "to", ":", "math", ":", "\\", "ln", "t" ]
train
https://github.com/eelregit/mcfit/blob/ef04b92df929425c44c62743c1ce7e0b81a26815/mcfit/kernels.py#L9-L24
OSSOS/MOP
src/ossos/core/ossos/planning/invariable.py
convert
def convert(lat, lon): """convert lat/lon from the ecliptic to the invariable plane.""" x = numpy.cos(lon) * numpy.cos(lat) y = numpy.sin(lon) * numpy.cos(lat) z = numpy.sin(lat) # Invariable plane: values in arcseconds. epsilon = 5713.86 omega = 387390.8 coseps = numpy.cos(epsilon * ...
python
def convert(lat, lon): """convert lat/lon from the ecliptic to the invariable plane.""" x = numpy.cos(lon) * numpy.cos(lat) y = numpy.sin(lon) * numpy.cos(lat) z = numpy.sin(lat) # Invariable plane: values in arcseconds. epsilon = 5713.86 omega = 387390.8 coseps = numpy.cos(epsilon * ...
[ "def", "convert", "(", "lat", ",", "lon", ")", ":", "x", "=", "numpy", ".", "cos", "(", "lon", ")", "*", "numpy", ".", "cos", "(", "lat", ")", "y", "=", "numpy", ".", "sin", "(", "lon", ")", "*", "numpy", ".", "cos", "(", "lat", ")", "z", ...
convert lat/lon from the ecliptic to the invariable plane.
[ "convert", "lat", "/", "lon", "from", "the", "ecliptic", "to", "the", "invariable", "plane", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/invariable.py#L6-L28
OSSOS/MOP
src/jjk/preproc/s1.py
searchTriples
def searchTriples(expnums,ccd): """Given a list of exposure numbers, find all the KBOs in that set of exposures""" import MOPfits,os import MOPdbaccess if len(expnums)!=3: return(-1) mysql=MOPdbaccess.connect('bucket','cfhls','MYSQL') bucket=mysql.cursor() ### Some pro...
python
def searchTriples(expnums,ccd): """Given a list of exposure numbers, find all the KBOs in that set of exposures""" import MOPfits,os import MOPdbaccess if len(expnums)!=3: return(-1) mysql=MOPdbaccess.connect('bucket','cfhls','MYSQL') bucket=mysql.cursor() ### Some pro...
[ "def", "searchTriples", "(", "expnums", ",", "ccd", ")", ":", "import", "MOPfits", ",", "os", "import", "MOPdbaccess", "if", "len", "(", "expnums", ")", "!=", "3", ":", "return", "(", "-", "1", ")", "mysql", "=", "MOPdbaccess", ".", "connect", "(", "...
Given a list of exposure numbers, find all the KBOs in that set of exposures
[ "Given", "a", "list", "of", "exposure", "numbers", "find", "all", "the", "KBOs", "in", "that", "set", "of", "exposures" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/s1.py#L17-L97
OSSOS/MOP
src/ossos/core/ossos/gui/errorhandling.py
DownloadErrorHandler.handle_error
def handle_error(self, error, download_request): """ Checks what error occured and looks for an appropriate solution. Args: error: Exception The error that has occured. download_request: The request which resulted in the error. """ if ...
python
def handle_error(self, error, download_request): """ Checks what error occured and looks for an appropriate solution. Args: error: Exception The error that has occured. download_request: The request which resulted in the error. """ if ...
[ "def", "handle_error", "(", "self", ",", "error", ",", "download_request", ")", ":", "if", "hasattr", "(", "error", ",", "\"errno\"", ")", "and", "error", ".", "errno", "==", "errno", ".", "EACCES", ":", "self", ".", "handle_certificate_problem", "(", "str...
Checks what error occured and looks for an appropriate solution. Args: error: Exception The error that has occured. download_request: The request which resulted in the error.
[ "Checks", "what", "error", "occured", "and", "looks", "for", "an", "appropriate", "solution", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/errorhandling.py#L19-L32
OSSOS/MOP
src/ossos/core/ossos/gui/models/validation.py
ValidationModel.get_current_observation_date
def get_current_observation_date(self): """ Get the date of the current observation by looking in the header of the observation for the DATE and EXPTIME keywords. The 'DATE AT MIDDLE OF OBSERVATION' of the observation is returned @return: Time """ # All HDU eleme...
python
def get_current_observation_date(self): """ Get the date of the current observation by looking in the header of the observation for the DATE and EXPTIME keywords. The 'DATE AT MIDDLE OF OBSERVATION' of the observation is returned @return: Time """ # All HDU eleme...
[ "def", "get_current_observation_date", "(", "self", ")", ":", "# All HDU elements have the same date and time so just use", "# last one, sometimes the first one is missing the header, in MEF", "header", "=", "self", ".", "get_current_cutout", "(", ")", ".", "hdulist", "[", "-", ...
Get the date of the current observation by looking in the header of the observation for the DATE and EXPTIME keywords. The 'DATE AT MIDDLE OF OBSERVATION' of the observation is returned @return: Time
[ "Get", "the", "date", "of", "the", "current", "observation", "by", "looking", "in", "the", "header", "of", "the", "observation", "for", "the", "DATE", "and", "EXPTIME", "keywords", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/models/validation.py#L222-L241
OSSOS/MOP
src/ossos/utils/effunction.py
square
def square(m, eff_max,c,m0,sigma,m1=21): """ eff_max: Maximum of the efficiency function (peak efficiency) c: shape of the drop-off in the efficiency at bright end m0: transition to tappering at faint magnitudes sigma: width of the transition in efficeincy m1: magnitude at which peak efficeincy...
python
def square(m, eff_max,c,m0,sigma,m1=21): """ eff_max: Maximum of the efficiency function (peak efficiency) c: shape of the drop-off in the efficiency at bright end m0: transition to tappering at faint magnitudes sigma: width of the transition in efficeincy m1: magnitude at which peak efficeincy...
[ "def", "square", "(", "m", ",", "eff_max", ",", "c", ",", "m0", ",", "sigma", ",", "m1", "=", "21", ")", ":", "return", "(", "eff_max", "-", "c", "*", "(", "m", "-", "21", ")", "**", "2", ")", "/", "(", "1", "+", "numpy", ".", "exp", "(",...
eff_max: Maximum of the efficiency function (peak efficiency) c: shape of the drop-off in the efficiency at bright end m0: transition to tappering at faint magnitudes sigma: width of the transition in efficeincy m1: magnitude at which peak efficeincy occurs square(m) = (eff_max-c*(m-21)**2)/(1+exp...
[ "eff_max", ":", "Maximum", "of", "the", "efficiency", "function", "(", "peak", "efficiency", ")", "c", ":", "shape", "of", "the", "drop", "-", "off", "in", "the", "efficiency", "at", "bright", "end", "m0", ":", "transition", "to", "tappering", "at", "fai...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/effunction.py#L6-L17
OSSOS/MOP
src/ossos/utils/effunction.py
parse_square_param
def parse_square_param(line): """ Parse the line from the .eff file that contains the efficiency function parameters for a 'square' function line : the line containt the parameters, must start with 'square_param' """ if not line.startswith("square_param="): raise ValueError("Not a valid ...
python
def parse_square_param(line): """ Parse the line from the .eff file that contains the efficiency function parameters for a 'square' function line : the line containt the parameters, must start with 'square_param' """ if not line.startswith("square_param="): raise ValueError("Not a valid ...
[ "def", "parse_square_param", "(", "line", ")", ":", "if", "not", "line", ".", "startswith", "(", "\"square_param=\"", ")", ":", "raise", "ValueError", "(", "\"Not a valid square_param line\"", ")", "values", "=", "line", ".", "split", "(", ")", "params", "=", ...
Parse the line from the .eff file that contains the efficiency function parameters for a 'square' function line : the line containt the parameters, must start with 'square_param'
[ "Parse", "the", "line", "from", "the", ".", "eff", "file", "that", "contains", "the", "efficiency", "function", "parameters", "for", "a", "square", "function", "line", ":", "the", "line", "containt", "the", "parameters", "must", "start", "with", "square_param"...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/effunction.py#L19-L33
OSSOS/MOP
src/ossos/utils/effunction.py
parse_eff
def parse_eff(filename): """ Parse through Jean-Marcs OSSSO .eff files. The efficiency files comes in 'chunks' meant to be used at different 'rates' of motion. """ blocks = [] block = {} with open(filename) as efile: for line in efile.readlines(): if line.lstrip()....
python
def parse_eff(filename): """ Parse through Jean-Marcs OSSSO .eff files. The efficiency files comes in 'chunks' meant to be used at different 'rates' of motion. """ blocks = [] block = {} with open(filename) as efile: for line in efile.readlines(): if line.lstrip()....
[ "def", "parse_eff", "(", "filename", ")", ":", "blocks", "=", "[", "]", "block", "=", "{", "}", "with", "open", "(", "filename", ")", "as", "efile", ":", "for", "line", "in", "efile", ".", "readlines", "(", ")", ":", "if", "line", ".", "lstrip", ...
Parse through Jean-Marcs OSSSO .eff files. The efficiency files comes in 'chunks' meant to be used at different 'rates' of motion.
[ "Parse", "through", "Jean", "-", "Marcs", "OSSSO", ".", "eff", "files", ".", "The", "efficiency", "files", "comes", "in", "chunks", "meant", "to", "be", "used", "at", "different", "rates", "of", "motion", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/effunction.py#L57-L79
OSSOS/MOP
src/ossos/core/ossos/gui/config.py
read
def read(keypath, configfile=None): """ Reads a value from the configuration file. Args: keypath: str Specifies the key for which the value is desired. It can be a hierarchical path. Example: "section1.subsection.key1" configfile: str Path to the config file to read. ...
python
def read(keypath, configfile=None): """ Reads a value from the configuration file. Args: keypath: str Specifies the key for which the value is desired. It can be a hierarchical path. Example: "section1.subsection.key1" configfile: str Path to the config file to read. ...
[ "def", "read", "(", "keypath", ",", "configfile", "=", "None", ")", ":", "if", "configfile", "in", "_configs", ":", "appconfig", "=", "_configs", "[", "configfile", "]", "else", ":", "appconfig", "=", "AppConfig", "(", "configfile", "=", "configfile", ")",...
Reads a value from the configuration file. Args: keypath: str Specifies the key for which the value is desired. It can be a hierarchical path. Example: "section1.subsection.key1" configfile: str Path to the config file to read. Defaults to None, in which case the appl...
[ "Reads", "a", "value", "from", "the", "configuration", "file", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/gui/config.py#L10-L31
OSSOS/MOP
src/ossos/core/ossos/ephem_target.py
EphemTarget._cdata_header
def _cdata_header(self, colsep="|"): """ Create a header for the CDATA section, as a visual guide. """ fields = self.fields header_lines = [] line = "" for fieldName in self.field_names: width = int(fields[fieldName]['attr']['width']) line ...
python
def _cdata_header(self, colsep="|"): """ Create a header for the CDATA section, as a visual guide. """ fields = self.fields header_lines = [] line = "" for fieldName in self.field_names: width = int(fields[fieldName]['attr']['width']) line ...
[ "def", "_cdata_header", "(", "self", ",", "colsep", "=", "\"|\"", ")", ":", "fields", "=", "self", ".", "fields", "header_lines", "=", "[", "]", "line", "=", "\"\"", "for", "fieldName", "in", "self", ".", "field_names", ":", "width", "=", "int", "(", ...
Create a header for the CDATA section, as a visual guide.
[ "Create", "a", "header", "for", "the", "CDATA", "section", "as", "a", "visual", "guide", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/ephem_target.py#L103-L139
OSSOS/MOP
src/ossos/core/ossos/ephem_target.py
EphemTarget._append_cdata
def _append_cdata(self, coordinate): """ Append an target location to the ephemeris listing. """ fields = self.fields sra = coordinate.ra.to_string(units.hour, sep=':', precision=2, pad=True) sdec = coordinate.dec.to_string(units.degree, sep=':', precision=1, alwayssign=T...
python
def _append_cdata(self, coordinate): """ Append an target location to the ephemeris listing. """ fields = self.fields sra = coordinate.ra.to_string(units.hour, sep=':', precision=2, pad=True) sdec = coordinate.dec.to_string(units.degree, sep=':', precision=1, alwayssign=T...
[ "def", "_append_cdata", "(", "self", ",", "coordinate", ")", ":", "fields", "=", "self", ".", "fields", "sra", "=", "coordinate", ".", "ra", ".", "to_string", "(", "units", ".", "hour", ",", "sep", "=", "':'", ",", "precision", "=", "2", ",", "pad", ...
Append an target location to the ephemeris listing.
[ "Append", "an", "target", "location", "to", "the", "ephemeris", "listing", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/ephem_target.py#L144-L158
OSSOS/MOP
src/ossos/core/ossos/ephem_target.py
EphemTarget.gemini_writer
def gemini_writer(self, f_handle): """ Write out a GEMINI formated OT ephemeris. This is just a hack of SSD Horizons output. """ f_handle.write(GEMINI_HEADER) # Date__(UT)__HR:MN Date_________JDUT R.A.___(ICRF/J2000.0)___DEC dRA*cosD d(DEC)/dt # 1 2 ...
python
def gemini_writer(self, f_handle): """ Write out a GEMINI formated OT ephemeris. This is just a hack of SSD Horizons output. """ f_handle.write(GEMINI_HEADER) # Date__(UT)__HR:MN Date_________JDUT R.A.___(ICRF/J2000.0)___DEC dRA*cosD d(DEC)/dt # 1 2 ...
[ "def", "gemini_writer", "(", "self", ",", "f_handle", ")", ":", "f_handle", ".", "write", "(", "GEMINI_HEADER", ")", "# Date__(UT)__HR:MN Date_________JDUT R.A.___(ICRF/J2000.0)___DEC dRA*cosD d(DEC)/dt", "# 1 2 3 4 5 6 7 ...
Write out a GEMINI formated OT ephemeris. This is just a hack of SSD Horizons output.
[ "Write", "out", "a", "GEMINI", "formated", "OT", "ephemeris", ".", "This", "is", "just", "a", "hack", "of", "SSD", "Horizons", "output", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/ephem_target.py#L175-L197
OSSOS/MOP
src/ossos/utils/proc_status.py
mkpsf_failures
def mkpsf_failures(): """A simple script to loop over the standard tags for the mkpsf and step1 processing steps. If exposure/ccd combo isn't marked as 'success' then report the failure. This example uses the vos client directly. """ for expnum in storage.list_dbimages(): for ccd i...
python
def mkpsf_failures(): """A simple script to loop over the standard tags for the mkpsf and step1 processing steps. If exposure/ccd combo isn't marked as 'success' then report the failure. This example uses the vos client directly. """ for expnum in storage.list_dbimages(): for ccd i...
[ "def", "mkpsf_failures", "(", ")", ":", "for", "expnum", "in", "storage", ".", "list_dbimages", "(", ")", ":", "for", "ccd", "in", "range", "(", "36", ")", ":", "if", "not", "storage", ".", "get_status", "(", "MKPSF", ",", "\"\"", ",", "expnum", ",",...
A simple script to loop over the standard tags for the mkpsf and step1 processing steps. If exposure/ccd combo isn't marked as 'success' then report the failure. This example uses the vos client directly.
[ "A", "simple", "script", "to", "loop", "over", "the", "standard", "tags", "for", "the", "mkpsf", "and", "step1", "processing", "steps", ".", "If", "exposure", "/", "ccd", "combo", "isn", "t", "marked", "as", "success", "then", "report", "the", "failure", ...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/utils/proc_status.py#L7-L20
OSSOS/MOP
src/jjk/preproc/search2.py
searchTriples
def searchTriples(expnums,ccd,plant=False): """Given a list of exposure numbers, find all the KBOs in that set of exposures""" import MOPfits,os import MOPdbaccess if len(expnums)!=3: raise TaskError, "got %d exposures"%(len(expnums)) ### Some program Constants proc_these_files=[...
python
def searchTriples(expnums,ccd,plant=False): """Given a list of exposure numbers, find all the KBOs in that set of exposures""" import MOPfits,os import MOPdbaccess if len(expnums)!=3: raise TaskError, "got %d exposures"%(len(expnums)) ### Some program Constants proc_these_files=[...
[ "def", "searchTriples", "(", "expnums", ",", "ccd", ",", "plant", "=", "False", ")", ":", "import", "MOPfits", ",", "os", "import", "MOPdbaccess", "if", "len", "(", "expnums", ")", "!=", "3", ":", "raise", "TaskError", ",", "\"got %d exposures\"", "%", "...
Given a list of exposure numbers, find all the KBOs in that set of exposures
[ "Given", "a", "list", "of", "exposure", "numbers", "find", "all", "the", "KBOs", "in", "that", "set", "of", "exposures" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/search2.py#L22-L185
OSSOS/MOP
src/jjk/preproc/search2.py
get_nailing
def get_nailing(expnum,ccd): """Get the 'nailing' images associated with expnum""" sql=""" SELECT e.expnum, (e.mjdate - f.mjdate) dt FROM bucket.exposure e JOIN bucket.exposure f JOIN bucket.association b ON b.expnum=f.expnum JOIN bucket.association a ON a.pointing=b.pointing AND a.expnum=e....
python
def get_nailing(expnum,ccd): """Get the 'nailing' images associated with expnum""" sql=""" SELECT e.expnum, (e.mjdate - f.mjdate) dt FROM bucket.exposure e JOIN bucket.exposure f JOIN bucket.association b ON b.expnum=f.expnum JOIN bucket.association a ON a.pointing=b.pointing AND a.expnum=e....
[ "def", "get_nailing", "(", "expnum", ",", "ccd", ")", ":", "sql", "=", "\"\"\"\n SELECT e.expnum, (e.mjdate - f.mjdate) dt\n FROM bucket.exposure e\n JOIN bucket.exposure f\n JOIN bucket.association b ON b.expnum=f.expnum\n JOIN bucket.association a ON a.pointing=b.pointing AND a....
Get the 'nailing' images associated with expnum
[ "Get", "the", "nailing", "images", "associated", "with", "expnum" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/search2.py#L188-L216
JohnVinyard/zounds
zounds/spectral/frequencyscale.py
FrequencyBand.intersect
def intersect(self, other): """ Return the intersection between this frequency band and another. Args: other (FrequencyBand): the instance to intersect with Examples:: >>> import zounds >>> b1 = zounds.FrequencyBand(500, 1000) >>> b2 = zo...
python
def intersect(self, other): """ Return the intersection between this frequency band and another. Args: other (FrequencyBand): the instance to intersect with Examples:: >>> import zounds >>> b1 = zounds.FrequencyBand(500, 1000) >>> b2 = zo...
[ "def", "intersect", "(", "self", ",", "other", ")", ":", "lowest_stop", "=", "min", "(", "self", ".", "stop_hz", ",", "other", ".", "stop_hz", ")", "highest_start", "=", "max", "(", "self", ".", "start_hz", ",", "other", ".", "start_hz", ")", "return",...
Return the intersection between this frequency band and another. Args: other (FrequencyBand): the instance to intersect with Examples:: >>> import zounds >>> b1 = zounds.FrequencyBand(500, 1000) >>> b2 = zounds.FrequencyBand(900, 2000) >>> in...
[ "Return", "the", "intersection", "between", "this", "frequency", "band", "and", "another", "." ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/frequencyscale.py#L66-L83
JohnVinyard/zounds
zounds/spectral/frequencyscale.py
FrequencyScale.bands
def bands(self): """ An iterable of all bands in this scale """ if self._bands is None: self._bands = self._compute_bands() return self._bands
python
def bands(self): """ An iterable of all bands in this scale """ if self._bands is None: self._bands = self._compute_bands() return self._bands
[ "def", "bands", "(", "self", ")", ":", "if", "self", ".", "_bands", "is", "None", ":", "self", ".", "_bands", "=", "self", ".", "_compute_bands", "(", ")", "return", "self", ".", "_bands" ]
An iterable of all bands in this scale
[ "An", "iterable", "of", "all", "bands", "in", "this", "scale" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/frequencyscale.py#L167-L173
JohnVinyard/zounds
zounds/spectral/frequencyscale.py
FrequencyScale.ensure_overlap_ratio
def ensure_overlap_ratio(self, required_ratio=0.5): """ Ensure that every adjacent pair of frequency bands meets the overlap ratio criteria. This can be helpful in scenarios where a scale is being used in an invertible transform, and something like the `constant overlap add cons...
python
def ensure_overlap_ratio(self, required_ratio=0.5): """ Ensure that every adjacent pair of frequency bands meets the overlap ratio criteria. This can be helpful in scenarios where a scale is being used in an invertible transform, and something like the `constant overlap add cons...
[ "def", "ensure_overlap_ratio", "(", "self", ",", "required_ratio", "=", "0.5", ")", ":", "msg", "=", "'band {i}: ratio must be at least {required_ratio} but was {ratio}'", "for", "i", "in", "range", "(", "0", ",", "len", "(", "self", ")", "-", "1", ")", ":", "...
Ensure that every adjacent pair of frequency bands meets the overlap ratio criteria. This can be helpful in scenarios where a scale is being used in an invertible transform, and something like the `constant overlap add constraint <https://ccrma.stanford.edu/~jos/sasp/Constant_Overlap_Ad...
[ "Ensure", "that", "every", "adjacent", "pair", "of", "frequency", "bands", "meets", "the", "overlap", "ratio", "criteria", ".", "This", "can", "be", "helpful", "in", "scenarios", "where", "a", "scale", "is", "being", "used", "in", "an", "invertible", "transf...
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/frequencyscale.py#L207-L238
JohnVinyard/zounds
zounds/spectral/frequencyscale.py
FrequencyScale.Q
def Q(self): """ The quality factor of the scale, or, the ratio of center frequencies to bandwidths """ return np.array(list(self.center_frequencies)) \ / np.array(list(self.bandwidths))
python
def Q(self): """ The quality factor of the scale, or, the ratio of center frequencies to bandwidths """ return np.array(list(self.center_frequencies)) \ / np.array(list(self.bandwidths))
[ "def", "Q", "(", "self", ")", ":", "return", "np", ".", "array", "(", "list", "(", "self", ".", "center_frequencies", ")", ")", "/", "np", ".", "array", "(", "list", "(", "self", ".", "bandwidths", ")", ")" ]
The quality factor of the scale, or, the ratio of center frequencies to bandwidths
[ "The", "quality", "factor", "of", "the", "scale", "or", "the", "ratio", "of", "center", "frequencies", "to", "bandwidths" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/frequencyscale.py#L241-L247
JohnVinyard/zounds
zounds/spectral/frequencyscale.py
FrequencyScale.get_slice
def get_slice(self, frequency_band): """ Given a frequency band, and a frequency dimension comprised of n_samples, return a slice using integer indices that may be used to extract only the frequency samples that intersect with the frequency band """ index = freque...
python
def get_slice(self, frequency_band): """ Given a frequency band, and a frequency dimension comprised of n_samples, return a slice using integer indices that may be used to extract only the frequency samples that intersect with the frequency band """ index = freque...
[ "def", "get_slice", "(", "self", ",", "frequency_band", ")", ":", "index", "=", "frequency_band", "if", "isinstance", "(", "index", ",", "slice", ")", ":", "types", "=", "{", "index", ".", "start", ".", "__class__", ",", "index", ".", "stop", ".", "__c...
Given a frequency band, and a frequency dimension comprised of n_samples, return a slice using integer indices that may be used to extract only the frequency samples that intersect with the frequency band
[ "Given", "a", "frequency", "band", "and", "a", "frequency", "dimension", "comprised", "of", "n_samples", "return", "a", "slice", "using", "integer", "indices", "that", "may", "be", "used", "to", "extract", "only", "the", "frequency", "samples", "that", "inters...
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/frequencyscale.py#L289-L329
JohnVinyard/zounds
zounds/spectral/frequencyscale.py
LinearScale.from_sample_rate
def from_sample_rate(sample_rate, n_bands, always_even=False): """ Return a :class:`~zounds.spectral.LinearScale` instance whose upper frequency bound is informed by the nyquist frequency of the sample rate. Args: sample_rate (SamplingRate): the sample rate whose nyquist fre...
python
def from_sample_rate(sample_rate, n_bands, always_even=False): """ Return a :class:`~zounds.spectral.LinearScale` instance whose upper frequency bound is informed by the nyquist frequency of the sample rate. Args: sample_rate (SamplingRate): the sample rate whose nyquist fre...
[ "def", "from_sample_rate", "(", "sample_rate", ",", "n_bands", ",", "always_even", "=", "False", ")", ":", "fb", "=", "FrequencyBand", "(", "0", ",", "sample_rate", ".", "nyquist", ")", "return", "LinearScale", "(", "fb", ",", "n_bands", ",", "always_even", ...
Return a :class:`~zounds.spectral.LinearScale` instance whose upper frequency bound is informed by the nyquist frequency of the sample rate. Args: sample_rate (SamplingRate): the sample rate whose nyquist frequency will serve as the upper frequency bound of this scale ...
[ "Return", "a", ":", "class", ":", "~zounds", ".", "spectral", ".", "LinearScale", "instance", "whose", "upper", "frequency", "bound", "is", "informed", "by", "the", "nyquist", "frequency", "of", "the", "sample", "rate", "." ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/frequencyscale.py#L387-L398
JohnVinyard/zounds
zounds/spectral/frequencyscale.py
ChromaScale._hz_to_semitones
def _hz_to_semitones(self, hz): """ Convert hertz into a number of semitones above or below some reference value, in this case, A440 """ return np.log(hz / self._a440) / np.log(self._a)
python
def _hz_to_semitones(self, hz): """ Convert hertz into a number of semitones above or below some reference value, in this case, A440 """ return np.log(hz / self._a440) / np.log(self._a)
[ "def", "_hz_to_semitones", "(", "self", ",", "hz", ")", ":", "return", "np", ".", "log", "(", "hz", "/", "self", ".", "_a440", ")", "/", "np", ".", "log", "(", "self", ".", "_a", ")" ]
Convert hertz into a number of semitones above or below some reference value, in this case, A440
[ "Convert", "hertz", "into", "a", "number", "of", "semitones", "above", "or", "below", "some", "reference", "value", "in", "this", "case", "A440" ]
train
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/frequencyscale.py#L592-L597
OSSOS/MOP
src/jjk/preproc/cfhtCutout.py
resolve
def resolve(object): """Look up the name of a source using a resolver""" import re sesame_cmd = 'curl -s http://cdsweb.u-strasbg.fr/viz-bin/nph-sesame/-oI?'+string.replace(object,' ','') f = os.popen(sesame_cmd) lines = f.readlines() f.close() for line in lines: if re.searc...
python
def resolve(object): """Look up the name of a source using a resolver""" import re sesame_cmd = 'curl -s http://cdsweb.u-strasbg.fr/viz-bin/nph-sesame/-oI?'+string.replace(object,' ','') f = os.popen(sesame_cmd) lines = f.readlines() f.close() for line in lines: if re.searc...
[ "def", "resolve", "(", "object", ")", ":", "import", "re", "sesame_cmd", "=", "'curl -s http://cdsweb.u-strasbg.fr/viz-bin/nph-sesame/-oI?'", "+", "string", ".", "replace", "(", "object", ",", "' '", ",", "''", ")", "f", "=", "os", ".", "popen", "(", "sesame_c...
Look up the name of a source using a resolver
[ "Look", "up", "the", "name", "of", "a", "source", "using", "a", "resolver" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/cfhtCutout.py#L74-L90
OSSOS/MOP
src/ossos/core/ossos/planning/plotting/plot_fanciness.py
remove_border
def remove_border(axes=None, keep=('left', 'bottom'), remove=('right', 'top'), labelcol=ALMOST_BLACK): """ Minimize chart junk by stripping out unnecessary plot borders and axis ticks. The top/right/left/bottom keywords toggle whether the corresponding plot border is drawn """ ax = axes or plt.gca()...
python
def remove_border(axes=None, keep=('left', 'bottom'), remove=('right', 'top'), labelcol=ALMOST_BLACK): """ Minimize chart junk by stripping out unnecessary plot borders and axis ticks. The top/right/left/bottom keywords toggle whether the corresponding plot border is drawn """ ax = axes or plt.gca()...
[ "def", "remove_border", "(", "axes", "=", "None", ",", "keep", "=", "(", "'left'", ",", "'bottom'", ")", ",", "remove", "=", "(", "'right'", ",", "'top'", ")", ",", "labelcol", "=", "ALMOST_BLACK", ")", ":", "ax", "=", "axes", "or", "plt", ".", "gc...
Minimize chart junk by stripping out unnecessary plot borders and axis ticks. The top/right/left/bottom keywords toggle whether the corresponding plot border is drawn
[ "Minimize", "chart", "junk", "by", "stripping", "out", "unnecessary", "plot", "borders", "and", "axis", "ticks", ".", "The", "top", "/", "right", "/", "left", "/", "bottom", "keywords", "toggle", "whether", "the", "corresponding", "plot", "border", "is", "dr...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/plotting/plot_fanciness.py#L32-L66
OSSOS/MOP
src/jjk/preproc/demo.py
handle_exit_code
def handle_exit_code(d, code): """Sample function showing how to interpret the dialog exit codes. This function is not used after every call to dialog in this demo for two reasons: 1. For some boxes, unfortunately, dialog returns the code for ERROR when the user presses ESC (instead of th...
python
def handle_exit_code(d, code): """Sample function showing how to interpret the dialog exit codes. This function is not used after every call to dialog in this demo for two reasons: 1. For some boxes, unfortunately, dialog returns the code for ERROR when the user presses ESC (instead of th...
[ "def", "handle_exit_code", "(", "d", ",", "code", ")", ":", "# d is supposed to be a Dialog instance", "if", "code", "in", "(", "d", ".", "DIALOG_CANCEL", ",", "d", ".", "DIALOG_ESC", ")", ":", "if", "code", "==", "d", ".", "DIALOG_CANCEL", ":", "msg", "="...
Sample function showing how to interpret the dialog exit codes. This function is not used after every call to dialog in this demo for two reasons: 1. For some boxes, unfortunately, dialog returns the code for ERROR when the user presses ESC (instead of the one chosen for ESC). As th...
[ "Sample", "function", "showing", "how", "to", "interpret", "the", "dialog", "exit", "codes", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/demo.py#L28-L63
OSSOS/MOP
src/jjk/preproc/demo.py
main
def main(): """This demo shows the main features of the pythondialog Dialog class. """ try: demo() except dialog.error, exc_instance: sys.stderr.write("Error:\n\n%s\n" % exc_instance.complete_message()) sys.exit(1) sys.exit(0)
python
def main(): """This demo shows the main features of the pythondialog Dialog class. """ try: demo() except dialog.error, exc_instance: sys.stderr.write("Error:\n\n%s\n" % exc_instance.complete_message()) sys.exit(1) sys.exit(0)
[ "def", "main", "(", ")", ":", "try", ":", "demo", "(", ")", "except", "dialog", ".", "error", ",", "exc_instance", ":", "sys", ".", "stderr", ".", "write", "(", "\"Error:\\n\\n%s\\n\"", "%", "exc_instance", ".", "complete_message", "(", ")", ")", "sys", ...
This demo shows the main features of the pythondialog Dialog class.
[ "This", "demo", "shows", "the", "main", "features", "of", "the", "pythondialog", "Dialog", "class", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/demo.py#L307-L317
OSSOS/MOP
src/jjk/preproc/s2.py
searchTriples
def searchTriples(expnums,ccd): """Given a list of exposure numbers, find all the KBOs in that set of exposures""" import MOPfits,os import MOPdbaccess if len(expnums)!=3: return(-1) ### Some program Constants proc_file = open("proc-these-files","w") proc_file.write("# Files...
python
def searchTriples(expnums,ccd): """Given a list of exposure numbers, find all the KBOs in that set of exposures""" import MOPfits,os import MOPdbaccess if len(expnums)!=3: return(-1) ### Some program Constants proc_file = open("proc-these-files","w") proc_file.write("# Files...
[ "def", "searchTriples", "(", "expnums", ",", "ccd", ")", ":", "import", "MOPfits", ",", "os", "import", "MOPdbaccess", "if", "len", "(", "expnums", ")", "!=", "3", ":", "return", "(", "-", "1", ")", "### Some program Constants", "proc_file", "=", "open", ...
Given a list of exposure numbers, find all the KBOs in that set of exposures
[ "Given", "a", "list", "of", "exposure", "numbers", "find", "all", "the", "KBOs", "in", "that", "set", "of", "exposures" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/s2.py#L19-L90
OSSOS/MOP
src/jjk/preproc/MOPconf.py
discands
def discands(record): """Display the candidates contained in a candidate record list""" import pyfits pyraf.iraf.images() pyraf.iraf.images.tv() display = pyraf.iraf.images.tv.display width=128 cands = record['cands'] exps= record['fileId'] comments= record['comments'] ...
python
def discands(record): """Display the candidates contained in a candidate record list""" import pyfits pyraf.iraf.images() pyraf.iraf.images.tv() display = pyraf.iraf.images.tv.display width=128 cands = record['cands'] exps= record['fileId'] comments= record['comments'] ...
[ "def", "discands", "(", "record", ")", ":", "import", "pyfits", "pyraf", ".", "iraf", ".", "images", "(", ")", "pyraf", ".", "iraf", ".", "images", ".", "tv", "(", ")", "display", "=", "pyraf", ".", "iraf", ".", "images", ".", "tv", ".", "display",...
Display the candidates contained in a candidate record list
[ "Display", "the", "candidates", "contained", "in", "a", "candidate", "record", "list" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPconf.py#L49-L176
OSSOS/MOP
src/ossos/core/ossos/planning/optimize_pointings.py
is_up
def is_up(coordinate, current_time): """ Given the position and time determin if the given target is up. @param coordinate: the J2000 location of the source @param current_time: The time of the observations @return: True/False """ cfht.date = current_time.iso.replace('-', '/') cfht.hori...
python
def is_up(coordinate, current_time): """ Given the position and time determin if the given target is up. @param coordinate: the J2000 location of the source @param current_time: The time of the observations @return: True/False """ cfht.date = current_time.iso.replace('-', '/') cfht.hori...
[ "def", "is_up", "(", "coordinate", ",", "current_time", ")", ":", "cfht", ".", "date", "=", "current_time", ".", "iso", ".", "replace", "(", "'-'", ",", "'/'", ")", "cfht", ".", "horizon", "=", "math", ".", "radians", "(", "-", "7", ")", "sun", "."...
Given the position and time determin if the given target is up. @param coordinate: the J2000 location of the source @param current_time: The time of the observations @return: True/False
[ "Given", "the", "position", "and", "time", "determin", "if", "the", "given", "target", "is", "up", "." ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/planning/optimize_pointings.py#L27-L54
OSSOS/MOP
src/jjk/www_scripts/TapQuery.py
TAPQuery
def TAPQuery(query): """The __main__ part of the script""" tapURL = "http://cadc-ccda.hia-iha.nrc-cnrc.gc.ca/tap/sync" ## Some default parameters for that TAP service queries. tapParams={'REQUEST': 'doQuery', 'LANG': 'ADQL', 'FORMAT': 'votable', 'QUERY...
python
def TAPQuery(query): """The __main__ part of the script""" tapURL = "http://cadc-ccda.hia-iha.nrc-cnrc.gc.ca/tap/sync" ## Some default parameters for that TAP service queries. tapParams={'REQUEST': 'doQuery', 'LANG': 'ADQL', 'FORMAT': 'votable', 'QUERY...
[ "def", "TAPQuery", "(", "query", ")", ":", "tapURL", "=", "\"http://cadc-ccda.hia-iha.nrc-cnrc.gc.ca/tap/sync\"", "## Some default parameters for that TAP service queries.", "tapParams", "=", "{", "'REQUEST'", ":", "'doQuery'", ",", "'LANG'", ":", "'ADQL'", ",", "'FORMAT'",...
The __main__ part of the script
[ "The", "__main__", "part", "of", "the", "script" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/www_scripts/TapQuery.py#L28-L51
OSSOS/MOP
src/ossos/core/scripts/step1.py
step1
def step1(expnum, ccd, prefix='', version='p', sex_thresh=_SEX_THRESHOLD, wave_thresh=_WAVE_THRESHOLD, maxcount=_MAX_COUNT, dry_run=False): """run the actual step1jmp/matt codes. expnum: the CFHT expousre to process ccd: which ccd in the...
python
def step1(expnum, ccd, prefix='', version='p', sex_thresh=_SEX_THRESHOLD, wave_thresh=_WAVE_THRESHOLD, maxcount=_MAX_COUNT, dry_run=False): """run the actual step1jmp/matt codes. expnum: the CFHT expousre to process ccd: which ccd in the...
[ "def", "step1", "(", "expnum", ",", "ccd", ",", "prefix", "=", "''", ",", "version", "=", "'p'", ",", "sex_thresh", "=", "_SEX_THRESHOLD", ",", "wave_thresh", "=", "_WAVE_THRESHOLD", ",", "maxcount", "=", "_MAX_COUNT", ",", "dry_run", "=", "False", ")", ...
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/scripts/step1.py#L45-L117
openstack/python-scciclient
scciclient/irmc/viom/elcm.py
VIOMTable.get_json
def get_json(self): """Create JSON data for AdapterConfig. :returns: JSON data as follows: { "VIOMManage":{ }, "InitBoot":{ }, "UseVirtualAddresses":{ }, "BootMenuEnable":{ ...
python
def get_json(self): """Create JSON data for AdapterConfig. :returns: JSON data as follows: { "VIOMManage":{ }, "InitBoot":{ }, "UseVirtualAddresses":{ }, "BootMenuEnable":{ ...
[ "def", "get_json", "(", "self", ")", ":", "viom_table", "=", "self", ".", "get_basic_json", "(", ")", "if", "self", ".", "slots", ":", "viom_table", "[", "'Slots'", "]", "=", "{", "'Slot'", ":", "[", "s", ".", "get_json", "(", ")", "for", "s", "in"...
Create JSON data for AdapterConfig. :returns: JSON data as follows: { "VIOMManage":{ }, "InitBoot":{ }, "UseVirtualAddresses":{ }, "BootMenuEnable":{ }, "...
[ "Create", "JSON", "data", "for", "AdapterConfig", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/elcm.py#L171-L198
openstack/python-scciclient
scciclient/irmc/viom/elcm.py
Slot.get_json
def get_json(self): """Create JSON data for slot. :returns: JSON data for slot as follows: { "@SlotIdx":0, "OnboardControllers":{ "OnboardController": [ ] }, "AddOnCards":{ ...
python
def get_json(self): """Create JSON data for slot. :returns: JSON data for slot as follows: { "@SlotIdx":0, "OnboardControllers":{ "OnboardController": [ ] }, "AddOnCards":{ ...
[ "def", "get_json", "(", "self", ")", ":", "json", "=", "self", ".", "get_basic_json", "(", ")", "if", "self", ".", "onboard_cards", ":", "json", "[", "'OnboardControllers'", "]", "=", "{", "'OnboardController'", ":", "[", "c", ".", "get_json", "(", ")", ...
Create JSON data for slot. :returns: JSON data for slot as follows: { "@SlotIdx":0, "OnboardControllers":{ "OnboardController": [ ] }, "AddOnCards":{ "AddOnCard": [ ...
[ "Create", "JSON", "data", "for", "slot", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/elcm.py#L260-L287
openstack/python-scciclient
scciclient/irmc/viom/elcm.py
LANPort.get_json
def get_json(self): """Create JSON data for LANPort. :returns: JSON data as follows: { "@PortIdx":1, "PortEnable":{ }, "UseVirtualAddresses":{ }, "BootProtocol":{ }, "VirtualAddr...
python
def get_json(self): """Create JSON data for LANPort. :returns: JSON data as follows: { "@PortIdx":1, "PortEnable":{ }, "UseVirtualAddresses":{ }, "BootProtocol":{ }, "VirtualAddr...
[ "def", "get_json", "(", "self", ")", ":", "port", "=", "self", ".", "get_basic_json", "(", ")", "port", ".", "update", "(", "{", "'BootProtocol'", ":", "self", ".", "boot", ".", "BOOT_PROTOCOL", ",", "'BootPriority'", ":", "self", ".", "boot", ".", "bo...
Create JSON data for LANPort. :returns: JSON data as follows: { "@PortIdx":1, "PortEnable":{ }, "UseVirtualAddresses":{ }, "BootProtocol":{ }, "VirtualAddress":{ "MAC":{ ...
[ "Create", "JSON", "data", "for", "LANPort", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/elcm.py#L422-L456
openstack/python-scciclient
scciclient/irmc/viom/elcm.py
FCPort.get_json
def get_json(self): """Create FC port. :returns: JSON for FC port as follows: { "@PortIdx":1, "PortEnable":{ }, "UseVirtualAddresses":{ }, "VirtualAddress":{ "WWNN":{ ...
python
def get_json(self): """Create FC port. :returns: JSON for FC port as follows: { "@PortIdx":1, "PortEnable":{ }, "UseVirtualAddresses":{ }, "VirtualAddress":{ "WWNN":{ ...
[ "def", "get_json", "(", "self", ")", ":", "port", "=", "self", ".", "get_basic_json", "(", ")", "port", ".", "update", "(", "{", "'BootProtocol'", ":", "self", ".", "boot", ".", "BOOT_PROTOCOL", ",", "'BootPriority'", ":", "self", ".", "boot", ".", "bo...
Create FC port. :returns: JSON for FC port as follows: { "@PortIdx":1, "PortEnable":{ }, "UseVirtualAddresses":{ }, "VirtualAddress":{ "WWNN":{ }, ...
[ "Create", "FC", "port", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/elcm.py#L476-L519
openstack/python-scciclient
scciclient/irmc/viom/elcm.py
CNAPort.get_json
def get_json(self): """Create JSON for CNA port. :returns: JSON for CNA port as follows: { "@PortIdx":1, "PortEnable":{ }, "Functions":{ } } """ port = self.get_basic_json() p...
python
def get_json(self): """Create JSON for CNA port. :returns: JSON for CNA port as follows: { "@PortIdx":1, "PortEnable":{ }, "Functions":{ } } """ port = self.get_basic_json() p...
[ "def", "get_json", "(", "self", ")", ":", "port", "=", "self", ".", "get_basic_json", "(", ")", "port", "[", "'Functions'", "]", "=", "{", "'Function'", ":", "[", "f", ".", "get_json", "(", ")", "for", "f", "in", "self", ".", "functions", ".", "val...
Create JSON for CNA port. :returns: JSON for CNA port as follows: { "@PortIdx":1, "PortEnable":{ }, "Functions":{ } }
[ "Create", "JSON", "for", "CNA", "port", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/elcm.py#L539-L555
openstack/python-scciclient
scciclient/irmc/viom/elcm.py
FCBoot.get_json
def get_json(self): """Create JSON for FCBootEnvironment. :returns: JSON for FCBootEnvironment as follows: { "FCBootEnvironment":{ "FCTargets":{ "FCTarget":[ ] }, "FC...
python
def get_json(self): """Create JSON for FCBootEnvironment. :returns: JSON for FCBootEnvironment as follows: { "FCBootEnvironment":{ "FCTargets":{ "FCTarget":[ ] }, "FC...
[ "def", "get_json", "(", "self", ")", ":", "json", "=", "self", ".", "get_basic_json", "(", ")", "for", "i", "in", "range", "(", "len", "(", "self", ".", "targets", ")", ")", ":", "# @FCTargetIdx starts from 1.", "self", ".", "targets", "[", "i", "]", ...
Create JSON for FCBootEnvironment. :returns: JSON for FCBootEnvironment as follows: { "FCBootEnvironment":{ "FCTargets":{ "FCTarget":[ ] }, "FCLinkSpeed":{ ...
[ "Create", "JSON", "for", "FCBootEnvironment", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/elcm.py#L772-L799
openstack/python-scciclient
scciclient/irmc/viom/elcm.py
ISCSIInitiator.get_json
def get_json(self): """Create JSON data for iSCSI initiator. :returns: JSON data for iSCSI initiator as follows: { "DHCPUsage":{ }, "Name":{ }, "IPv4Address":{ }, "SubnetMask":{ ...
python
def get_json(self): """Create JSON data for iSCSI initiator. :returns: JSON data for iSCSI initiator as follows: { "DHCPUsage":{ }, "Name":{ }, "IPv4Address":{ }, "SubnetMask":{ ...
[ "def", "get_json", "(", "self", ")", ":", "if", "self", ".", "dhcp_usage", ":", "return", "{", "'DHCPUsage'", ":", "self", ".", "dhcp_usage", ",", "'Name'", ":", "self", ".", "iqn", "}", "else", ":", "return", "self", ".", "get_basic_json", "(", ")" ]
Create JSON data for iSCSI initiator. :returns: JSON data for iSCSI initiator as follows: { "DHCPUsage":{ }, "Name":{ }, "IPv4Address":{ }, "SubnetMask":{ }, ...
[ "Create", "JSON", "data", "for", "iSCSI", "initiator", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/elcm.py#L875-L899
openstack/python-scciclient
scciclient/irmc/viom/elcm.py
ISCSITarget.get_json
def get_json(self): """Create JSON data for iSCSI target. :returns: JSON data for iSCSI target as follows: { "DHCPUsage":{ }, "Name":{ }, "IPv4Address":{ }, "PortNumber":{ ...
python
def get_json(self): """Create JSON data for iSCSI target. :returns: JSON data for iSCSI target as follows: { "DHCPUsage":{ }, "Name":{ }, "IPv4Address":{ }, "PortNumber":{ ...
[ "def", "get_json", "(", "self", ")", ":", "json", "=", "{", "'DHCPUsage'", ":", "self", ".", "dhcp_usage", ",", "'AuthenticationMethod'", ":", "self", ".", "auth_method", ",", "}", "if", "not", "self", ".", "dhcp_usage", ":", "json", "[", "'Name'", "]", ...
Create JSON data for iSCSI target. :returns: JSON data for iSCSI target as follows: { "DHCPUsage":{ }, "Name":{ }, "IPv4Address":{ }, "PortNumber":{ }, "B...
[ "Create", "JSON", "data", "for", "iSCSI", "target", "." ]
train
https://github.com/openstack/python-scciclient/blob/4585ce2f76853b9773fb190ca0cfff0aa04a7cf8/scciclient/irmc/viom/elcm.py#L919-L960
OSSOS/MOP
src/jjk/preproc/plot.py
zscale
def zscale(data,contrast,min=100,max=60000): """Scale the data cube into the range 0-255""" ## pic 100 random elements along each dimension ## use zscale (see the IRAF display man page or ## http://iraf.net/article.php/20051205162333315 import random x=[] for i in random.sample(xrange(data.shape[0]),50): ...
python
def zscale(data,contrast,min=100,max=60000): """Scale the data cube into the range 0-255""" ## pic 100 random elements along each dimension ## use zscale (see the IRAF display man page or ## http://iraf.net/article.php/20051205162333315 import random x=[] for i in random.sample(xrange(data.shape[0]),50): ...
[ "def", "zscale", "(", "data", ",", "contrast", ",", "min", "=", "100", ",", "max", "=", "60000", ")", ":", "## pic 100 random elements along each dimension", "## use zscale (see the IRAF display man page or", "## http://iraf.net/article.php/20051205162333315", "import", "rand...
Scale the data cube into the range 0-255
[ "Scale", "the", "data", "cube", "into", "the", "range", "0", "-", "255" ]
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/plot.py#L12-L52
OSSOS/MOP
src/ossos/web/web/initiate/populate_ossuary.py
update_values
def update_values(ims, image_id, iq_zeropt=True, comment=False, snr=False, commdict=None): """ Update a row in ossuary with :param ims: an ImageQuery, contains image table and a connector :param image_id: the primary key of the row to be updated :param iq_zeropt: Keyword set if iq and zeropoint are ...
python
def update_values(ims, image_id, iq_zeropt=True, comment=False, snr=False, commdict=None): """ Update a row in ossuary with :param ims: an ImageQuery, contains image table and a connector :param image_id: the primary key of the row to be updated :param iq_zeropt: Keyword set if iq and zeropoint are ...
[ "def", "update_values", "(", "ims", ",", "image_id", ",", "iq_zeropt", "=", "True", ",", "comment", "=", "False", ",", "snr", "=", "False", ",", "commdict", "=", "None", ")", ":", "updating_params", "=", "{", "}", "if", "iq_zeropt", ":", "updating_params...
Update a row in ossuary with :param ims: an ImageQuery, contains image table and a connector :param image_id: the primary key of the row to be updated :param iq_zeropt: Keyword set if iq and zeropoint are to be checked for updating :param comment: Keyword set if image is to have a comment of Stephen's a...
[ "Update", "a", "row", "in", "ossuary", "with", ":", "param", "ims", ":", "an", "ImageQuery", "contains", "image", "table", "and", "a", "connector", ":", "param", "image_id", ":", "the", "primary", "key", "of", "the", "row", "to", "be", "updated", ":", ...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/web/web/initiate/populate_ossuary.py#L234-L254