hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
2a6dd12fe1983a1b5f53e4fe5bda3cbdfd058734
sdw95927/InstanceSegmentation-CycleGAN
segmentation_functions.py
[ "MIT" ]
Python
make_8UC3
<not_specific>
def make_8UC3(mat, normalized=True): """Convert the matrix to the equivalent matrix of the unsigned 8 bit integer datatype with 3 channels.""" mat_uint8 = make_8UC(mat, normalized) mat_uint8 = np.stack((mat_uint8,)*3, axis = -1) return mat_uint8
Convert the matrix to the equivalent matrix of the unsigned 8 bit integer datatype with 3 channels.
Convert the matrix to the equivalent matrix of the unsigned 8 bit integer datatype with 3 channels.
[ "Convert", "the", "matrix", "to", "the", "equivalent", "matrix", "of", "the", "unsigned", "8", "bit", "integer", "datatype", "with", "3", "channels", "." ]
def make_8UC3(mat, normalized=True): mat_uint8 = make_8UC(mat, normalized) mat_uint8 = np.stack((mat_uint8,)*3, axis = -1) return mat_uint8
[ "def", "make_8UC3", "(", "mat", ",", "normalized", "=", "True", ")", ":", "mat_uint8", "=", "make_8UC", "(", "mat", ",", "normalized", ")", "mat_uint8", "=", "np", ".", "stack", "(", "(", "mat_uint8", ",", ")", "*", "3", ",", "axis", "=", "-", "1",...
Convert the matrix to the equivalent matrix of the unsigned 8 bit integer datatype with 3 channels.
[ "Convert", "the", "matrix", "to", "the", "equivalent", "matrix", "of", "the", "unsigned", "8", "bit", "integer", "datatype", "with", "3", "channels", "." ]
[ "\"\"\"Convert the matrix to the equivalent matrix of the unsigned 8 bit integer datatype with 3 channels.\"\"\"" ]
[ { "param": "mat", "type": null }, { "param": "normalized", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mat", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "normalized", "type": null, "docstring": null, "docstring_token...
2a6dd12fe1983a1b5f53e4fe5bda3cbdfd058734
sdw95927/InstanceSegmentation-CycleGAN
segmentation_functions.py
[ "MIT" ]
Python
watershed
<not_specific>
def watershed(mask, img, plot_image=False, kernel_size=2): """Do watershed segmentation for input mask and image. Args: mask: A 0/255 matrix with 255 indicating objects. img: An 8UC3 matrix for watershed segmentation. plot_image: Set True if want to real-time display results. Defaul...
Do watershed segmentation for input mask and image. Args: mask: A 0/255 matrix with 255 indicating objects. img: An 8UC3 matrix for watershed segmentation. plot_image: Set True if want to real-time display results. Default is False. kernel_size: Kernal size for inner marker eros...
Do watershed segmentation for input mask and image.
[ "Do", "watershed", "segmentation", "for", "input", "mask", "and", "image", "." ]
def watershed(mask, img, plot_image=False, kernel_size=2): img_copy = img.copy() mask_copy = np.array(mask.copy(), dtype=np.uint8) mask_closed = closing(np.array(mask_copy, dtype=np.uint8)) mask_closed = closing(np.array(mask_closed, dtype=np.uint8)) kernel = np.ones((kernel_size, kernel_size), np.u...
[ "def", "watershed", "(", "mask", ",", "img", ",", "plot_image", "=", "False", ",", "kernel_size", "=", "2", ")", ":", "img_copy", "=", "img", ".", "copy", "(", ")", "mask_copy", "=", "np", ".", "array", "(", "mask", ".", "copy", "(", ")", ",", "d...
Do watershed segmentation for input mask and image.
[ "Do", "watershed", "segmentation", "for", "input", "mask", "and", "image", "." ]
[ "\"\"\"Do watershed segmentation for input mask and image.\n \n Args:\n mask: A 0/255 matrix with 255 indicating objects.\n img: An 8UC3 matrix for watershed segmentation.\n plot_image: Set True if want to real-time display results. Default is False.\n kernel_size: Kernal size for ...
[ { "param": "mask", "type": null }, { "param": "img", "type": null }, { "param": "plot_image", "type": null }, { "param": "kernel_size", "type": null } ]
{ "returns": [ { "docstring": "A uint8 mask same size as input image, with -1 indicating boundary, 1 indicating background,\nand numbers>1 indicating objects.", "docstring_tokens": [ "A", "uint8", "mask", "same", "size", "as", "input", "i...
2a6dd12fe1983a1b5f53e4fe5bda3cbdfd058734
sdw95927/InstanceSegmentation-CycleGAN
segmentation_functions.py
[ "MIT" ]
Python
generate_mask
<not_specific>
def generate_mask(channel, original_img=None, overlap_color=(0, 1, 0), plot_process=False, plot_result=False, title="", fill_hole=False, thresh=None, use_watershed=True, watershed_kernel_size=2, save_img=False, save_path=None): """Generate mas...
Generate mask for a gray-value image. Args: channel: Channel returned by function 'channel_deconvolution'. A gray-value image is also accepted. original_img: A image used for plotting overlapped segmentation result, optional. overlap_color: A 3-value tuple setting the color used to mark...
Generate mask for a gray-value image.
[ "Generate", "mask", "for", "a", "gray", "-", "value", "image", "." ]
def generate_mask(channel, original_img=None, overlap_color=(0, 1, 0), plot_process=False, plot_result=False, title="", fill_hole=False, thresh=None, use_watershed=True, watershed_kernel_size=2, save_img=False, save_path=None): if not check_ch...
[ "def", "generate_mask", "(", "channel", ",", "original_img", "=", "None", ",", "overlap_color", "=", "(", "0", ",", "1", ",", "0", ")", ",", "plot_process", "=", "False", ",", "plot_result", "=", "False", ",", "title", "=", "\"\"", ",", "fill_hole", "=...
Generate mask for a gray-value image.
[ "Generate", "mask", "for", "a", "gray", "-", "value", "image", "." ]
[ "\"\"\"Generate mask for a gray-value image.\n \n Args:\n channel: Channel returned by function 'channel_deconvolution'. A gray-value image is also accepted.\n original_img: A image used for plotting overlapped segmentation result, optional.\n overlap_color: A 3-value tuple setting the co...
[ { "param": "channel", "type": null }, { "param": "original_img", "type": null }, { "param": "overlap_color", "type": null }, { "param": "plot_process", "type": null }, { "param": "plot_result", "type": null }, { "param": "title", "type": null }, ...
{ "returns": [ { "docstring": "A binary mask with 1 indicating an object and 0 indicating background.", "docstring_tokens": [ "A", "binary", "mask", "with", "1", "indicating", "an", "object", "and", "0", "indicatin...
2a6dd12fe1983a1b5f53e4fe5bda3cbdfd058734
sdw95927/InstanceSegmentation-CycleGAN
segmentation_functions.py
[ "MIT" ]
Python
calculateRatio
<not_specific>
def calculateRatio(levelDims): """ Calculates the ratio between the highest resolution image and lowest resolution image. Returns the ratio as a tuple (Xratio, Yratio). """ highestReso = np.asarray(levelDims[0]) lowestReso = np.asarray(levelDims[-1]) Xratio, Yratio = highestReso/lowestReso ...
Calculates the ratio between the highest resolution image and lowest resolution image. Returns the ratio as a tuple (Xratio, Yratio).
Calculates the ratio between the highest resolution image and lowest resolution image. Returns the ratio as a tuple (Xratio, Yratio).
[ "Calculates", "the", "ratio", "between", "the", "highest", "resolution", "image", "and", "lowest", "resolution", "image", ".", "Returns", "the", "ratio", "as", "a", "tuple", "(", "Xratio", "Yratio", ")", "." ]
def calculateRatio(levelDims): highestReso = np.asarray(levelDims[0]) lowestReso = np.asarray(levelDims[-1]) Xratio, Yratio = highestReso/lowestReso return (Xratio, Yratio)
[ "def", "calculateRatio", "(", "levelDims", ")", ":", "highestReso", "=", "np", ".", "asarray", "(", "levelDims", "[", "0", "]", ")", "lowestReso", "=", "np", ".", "asarray", "(", "levelDims", "[", "-", "1", "]", ")", "Xratio", ",", "Yratio", "=", "hi...
Calculates the ratio between the highest resolution image and lowest resolution image.
[ "Calculates", "the", "ratio", "between", "the", "highest", "resolution", "image", "and", "lowest", "resolution", "image", "." ]
[ "\"\"\" Calculates the ratio between the highest resolution image and lowest resolution image.\n Returns the ratio as a tuple (Xratio, Yratio). \n \"\"\"" ]
[ { "param": "levelDims", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "levelDims", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2a6dd12fe1983a1b5f53e4fe5bda3cbdfd058734
sdw95927/InstanceSegmentation-CycleGAN
segmentation_functions.py
[ "MIT" ]
Python
createMask
<not_specific>
def createMask(levelDims, vertices, pattern): """ Input: levelDims (nested list): dimensions of each layer of the slide. vertices (dict object as describe above) Output: (tuple) mask numpy nd array of 0/1, where 1 indicates inside the region and 0 is outside the region ...
Input: levelDims (nested list): dimensions of each layer of the slide. vertices (dict object as describe above) Output: (tuple) mask numpy nd array of 0/1, where 1 indicates inside the region and 0 is outside the region
levelDims (nested list): dimensions of each layer of the slide. vertices (dict object as describe above) Output: (tuple) mask numpy nd array of 0/1, where 1 indicates inside the region and 0 is outside the region
[ "levelDims", "(", "nested", "list", ")", ":", "dimensions", "of", "each", "layer", "of", "the", "slide", ".", "vertices", "(", "dict", "object", "as", "describe", "above", ")", "Output", ":", "(", "tuple", ")", "mask", "numpy", "nd", "array", "of", "0"...
def createMask(levelDims, vertices, pattern): Xratio, Yratio = calculateRatio(levelDims) nRows, nCols = levelDims[-1] mask = np.zeros((nRows, nCols), dtype=np.uint8) for i in range(len(vertices[pattern])): lowX = np.array(vertices[pattern][i]['X'])/Xratio lowY = np.array(vertices[pattern...
[ "def", "createMask", "(", "levelDims", ",", "vertices", ",", "pattern", ")", ":", "Xratio", ",", "Yratio", "=", "calculateRatio", "(", "levelDims", ")", "nRows", ",", "nCols", "=", "levelDims", "[", "-", "1", "]", "mask", "=", "np", ".", "zeros", "(", ...
Input: levelDims (nested list): dimensions of each layer of the slide.
[ "Input", ":", "levelDims", "(", "nested", "list", ")", ":", "dimensions", "of", "each", "layer", "of", "the", "slide", "." ]
[ "\"\"\"\n Input: levelDims (nested list): dimensions of each layer of the slide.\n vertices (dict object as describe above)\n Output: (tuple) mask\n numpy nd array of 0/1, where 1 indicates inside the region\n and 0 is outside the region\n \"\"\"", "# Down scale the XML re...
[ { "param": "levelDims", "type": null }, { "param": "vertices", "type": null }, { "param": "pattern", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "levelDims", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vertices", "type": null, "docstring": null, "docstring_t...
2a6dd12fe1983a1b5f53e4fe5bda3cbdfd058734
sdw95927/InstanceSegmentation-CycleGAN
segmentation_functions.py
[ "MIT" ]
Python
RGB_to_index
<not_specific>
def RGB_to_index(RGB_img, RGB_markers=None, RGB_labels=None): """Change RGB to 2D index matrix; each RGB color corresponds to one index. Args: RGB_markers: start from background (marked as 0); Example format: [[255, 255, 255], [160, 255, 0]] RGB_...
Change RGB to 2D index matrix; each RGB color corresponds to one index. Args: RGB_markers: start from background (marked as 0); Example format: [[255, 255, 255], [160, 255, 0]] RGB_labels: a numeric vector corresponding to the labels of RGB_markers; ...
Change RGB to 2D index matrix; each RGB color corresponds to one index.
[ "Change", "RGB", "to", "2D", "index", "matrix", ";", "each", "RGB", "color", "corresponds", "to", "one", "index", "." ]
def RGB_to_index(RGB_img, RGB_markers=None, RGB_labels=None): if np.shape(RGB_img)[2] is not 3: print("Not an RGB image") return RGB_img else: if RGB_markers == None: RGB_markers = [[255, 255, 255]] if RGB_labels == None: RGB_labels = range(np.shape(RGB_ma...
[ "def", "RGB_to_index", "(", "RGB_img", ",", "RGB_markers", "=", "None", ",", "RGB_labels", "=", "None", ")", ":", "if", "np", ".", "shape", "(", "RGB_img", ")", "[", "2", "]", "is", "not", "3", ":", "print", "(", "\"Not an RGB image\"", ")", "return", ...
Change RGB to 2D index matrix; each RGB color corresponds to one index.
[ "Change", "RGB", "to", "2D", "index", "matrix", ";", "each", "RGB", "color", "corresponds", "to", "one", "index", "." ]
[ "\"\"\"Change RGB to 2D index matrix; each RGB color corresponds to one index.\n \n Args:\n RGB_markers: start from background (marked as 0); \n Example format:\n [[255, 255, 255],\n [160, 255, 0]]\n RGB_labels: a numeric vector corresponding to the label...
[ { "param": "RGB_img", "type": null }, { "param": "RGB_markers", "type": null }, { "param": "RGB_labels", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "RGB_img", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "RGB_markers", "type": null, "docstring": null, "docstring_...
2a6dd12fe1983a1b5f53e4fe5bda3cbdfd058734
sdw95927/InstanceSegmentation-CycleGAN
segmentation_functions.py
[ "MIT" ]
Python
index_to_RGB
<not_specific>
def index_to_RGB(mask_index, RGB_markers=None): """Change index to 2D image; each index corresponds to one color""" mask_index_copy = mask_index.copy() mask_index_copy = np.squeeze(mask_index_copy) # In case the mask shape is not [height, width] if RGB_markers == None: print("RGB_markers not pr...
Change index to 2D image; each index corresponds to one color
Change index to 2D image; each index corresponds to one color
[ "Change", "index", "to", "2D", "image", ";", "each", "index", "corresponds", "to", "one", "color" ]
def index_to_RGB(mask_index, RGB_markers=None): mask_index_copy = mask_index.copy() mask_index_copy = np.squeeze(mask_index_copy) if RGB_markers == None: print("RGB_markers not provided!") RGB_markers = [[255, 255, 255]] RGB_img = np.zeros((np.shape(mask_index_copy)[0], np.shape(mask_i...
[ "def", "index_to_RGB", "(", "mask_index", ",", "RGB_markers", "=", "None", ")", ":", "mask_index_copy", "=", "mask_index", ".", "copy", "(", ")", "mask_index_copy", "=", "np", ".", "squeeze", "(", "mask_index_copy", ")", "if", "RGB_markers", "==", "None", ":...
Change index to 2D image; each index corresponds to one color
[ "Change", "index", "to", "2D", "image", ";", "each", "index", "corresponds", "to", "one", "color" ]
[ "\"\"\"Change index to 2D image; each index corresponds to one color\"\"\"", "# In case the mask shape is not [height, width]", "# Background" ]
[ { "param": "mask_index", "type": null }, { "param": "RGB_markers", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mask_index", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "RGB_markers", "type": null, "docstring": null, "docstri...
2a6dd12fe1983a1b5f53e4fe5bda3cbdfd058734
sdw95927/InstanceSegmentation-CycleGAN
segmentation_functions.py
[ "MIT" ]
Python
shift_HSV
<not_specific>
def shift_HSV(img, amount=(0.9, 0.9, 0.9)): """Function to tune Hue, Saturation, and Value for image img""" img = Image.fromarray(img, 'RGB') hsv = img.convert('HSV') hsv = np.array(hsv) hsv[..., 0] = np.clip((hsv[..., 0] * amount[0]), a_max=255, a_min=0) hsv[..., 1] = np.clip((hsv[..., 1] * amo...
Function to tune Hue, Saturation, and Value for image img
Function to tune Hue, Saturation, and Value for image img
[ "Function", "to", "tune", "Hue", "Saturation", "and", "Value", "for", "image", "img" ]
def shift_HSV(img, amount=(0.9, 0.9, 0.9)): img = Image.fromarray(img, 'RGB') hsv = img.convert('HSV') hsv = np.array(hsv) hsv[..., 0] = np.clip((hsv[..., 0] * amount[0]), a_max=255, a_min=0) hsv[..., 1] = np.clip((hsv[..., 1] * amount[1]), a_max=255, a_min=0) hsv[..., 2] = np.clip((hsv[..., 2] ...
[ "def", "shift_HSV", "(", "img", ",", "amount", "=", "(", "0.9", ",", "0.9", ",", "0.9", ")", ")", ":", "img", "=", "Image", ".", "fromarray", "(", "img", ",", "'RGB'", ")", "hsv", "=", "img", ".", "convert", "(", "'HSV'", ")", "hsv", "=", "np",...
Function to tune Hue, Saturation, and Value for image img
[ "Function", "to", "tune", "Hue", "Saturation", "and", "Value", "for", "image", "img" ]
[ "\"\"\"Function to tune Hue, Saturation, and Value for image img\"\"\"" ]
[ { "param": "img", "type": null }, { "param": "amount", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "img", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "amount", "type": null, "docstring": null, "docstring_tokens": ...
b0357be31e9570f5b347f312902a2e76b4b0beb4
Mateaus/PersonalWebsite
personalwebsite/aboutme/admin.py
[ "MIT" ]
Python
has_add_permission
<not_specific>
def has_add_permission(self, request): """ Allows the admin to only add a single entry for Introduction. """ return Introduction.objects.all().count() == 0
Allows the admin to only add a single entry for Introduction.
Allows the admin to only add a single entry for Introduction.
[ "Allows", "the", "admin", "to", "only", "add", "a", "single", "entry", "for", "Introduction", "." ]
def has_add_permission(self, request): return Introduction.objects.all().count() == 0
[ "def", "has_add_permission", "(", "self", ",", "request", ")", ":", "return", "Introduction", ".", "objects", ".", "all", "(", ")", ".", "count", "(", ")", "==", "0" ]
Allows the admin to only add a single entry for Introduction.
[ "Allows", "the", "admin", "to", "only", "add", "a", "single", "entry", "for", "Introduction", "." ]
[ "\"\"\" \n Allows the admin to only add a single entry for Introduction.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request", "type": null, "docstring": null, "docstring_tokens"...
084bf5acdfe31ec1d0c4aa400f2983aa1aef667e
spacegal-spiff/AST341
Spring2020/PythonPhotometry/Sarah_DiffPhotometry.py
[ "MIT" ]
Python
construct_astrometry
<not_specific>
def construct_astrometry(hdr_wcs): ''' construct_astrometry make the pixel to RA/Dec conversion (and back) from the header of an astrometry.net return inputs ------------------------------ hdr_wcs : header with astrometry information, typically from astrometry.net returns ...
construct_astrometry make the pixel to RA/Dec conversion (and back) from the header of an astrometry.net return inputs ------------------------------ hdr_wcs : header with astrometry information, typically from astrometry.net returns ------------------------------ w ...
construct_astrometry make the pixel to RA/Dec conversion (and back) from the header of an astrometry.net return inputs hdr_wcs : header with astrometry information, typically from astrometry.net returns w : the WCS instance
[ "construct_astrometry", "make", "the", "pixel", "to", "RA", "/", "Dec", "conversion", "(", "and", "back", ")", "from", "the", "header", "of", "an", "astrometry", ".", "net", "return", "inputs", "hdr_wcs", ":", "header", "with", "astrometry", "information", "...
def construct_astrometry(hdr_wcs): w = WCS(naxis=2) w.wcs.ctype = ["RA---TAN", "DEC--TAN"] w.wcs.cd = np.array([[hdr_wcs['CD1_1'],hdr_wcs['CD1_2']],[hdr_wcs['CD2_1'],hdr_wcs['CD2_2']]]) w.wcs.crpix = [hdr_wcs['CRPIX1'], hdr_wcs['CRPIX2']] w.wcs.crval = [hdr_wcs['CRVAL1'],hdr_wcs['CRVAL2']] w.wcs...
[ "def", "construct_astrometry", "(", "hdr_wcs", ")", ":", "w", "=", "WCS", "(", "naxis", "=", "2", ")", "w", ".", "wcs", ".", "ctype", "=", "[", "\"RA---TAN\"", ",", "\"DEC--TAN\"", "]", "w", ".", "wcs", ".", "cd", "=", "np", ".", "array", "(", "[...
construct_astrometry make the pixel to RA/Dec conversion (and back) from the header of an astrometry.net return
[ "construct_astrometry", "make", "the", "pixel", "to", "RA", "/", "Dec", "conversion", "(", "and", "back", ")", "from", "the", "header", "of", "an", "astrometry", ".", "net", "return" ]
[ "'''\n construct_astrometry\n \n make the pixel to RA/Dec conversion (and back) from the header of an astrometry.net return\n \n inputs\n ------------------------------\n hdr_wcs : header with astrometry information, typically from astrometry.net\n \n returns\n ----------------------...
[ { "param": "hdr_wcs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "hdr_wcs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
084bf5acdfe31ec1d0c4aa400f2983aa1aef667e
spacegal-spiff/AST341
Spring2020/PythonPhotometry/Sarah_DiffPhotometry.py
[ "MIT" ]
Python
StarFind
<not_specific>
def StarFind(imname, FWHM, nsigma, aprad, skywidth, border_scale = 2): ''' StarFind* find all stars in a .fits image inputs ---------- imname: name of .fits image to open. FWHM: fwhm of stars in field nsigma: number of sigma above background above which to select sources. (~...
StarFind* find all stars in a .fits image inputs ---------- imname: name of .fits image to open. FWHM: fwhm of stars in field nsigma: number of sigma above background above which to select sources. (~3 to 4 is a good estimate) outputs -------- xpos: x positions...
StarFind find all stars in a .fits image inputs name of .fits image to open. FWHM: fwhm of stars in field nsigma: number of sigma above background above which to select sources. (~3 to 4 is a good estimate) outputs x positions of sources ypos: y positions of sources nstars: number of stars found in image
[ "StarFind", "find", "all", "stars", "in", "a", ".", "fits", "image", "inputs", "name", "of", ".", "fits", "image", "to", "open", ".", "FWHM", ":", "fwhm", "of", "stars", "in", "field", "nsigma", ":", "number", "of", "sigma", "above", "background", "abo...
def StarFind(imname, FWHM, nsigma, aprad, skywidth, border_scale = 2): im,hdr=fits.getdata(imname, header=True) im = np.array(im).astype('float') bkg_sigma = mad_std(im) print('begin: DAOStarFinder') daofind = DAOStarFinder(fwhm=FWHM, threshold=nsigma*bkg_sigma, exclude_border=True) sources = da...
[ "def", "StarFind", "(", "imname", ",", "FWHM", ",", "nsigma", ",", "aprad", ",", "skywidth", ",", "border_scale", "=", "2", ")", ":", "im", ",", "hdr", "=", "fits", ".", "getdata", "(", "imname", ",", "header", "=", "True", ")", "im", "=", "np", ...
StarFind find all stars in a .fits image
[ "StarFind", "find", "all", "stars", "in", "a", ".", "fits", "image" ]
[ "'''\n StarFind*\n \n find all stars in a .fits image\n \n inputs\n ----------\n imname: name of .fits image to open. \n FWHM: fwhm of stars in field\n nsigma: number of sigma above background above which to select sources. (~3 to 4 is a good estimate)\n \n outputs\n --------\n...
[ { "param": "imname", "type": null }, { "param": "FWHM", "type": null }, { "param": "nsigma", "type": null }, { "param": "aprad", "type": null }, { "param": "skywidth", "type": null }, { "param": "border_scale", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "imname", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "FWHM", "type": null, "docstring": null, "docstring_tokens":...
084bf5acdfe31ec1d0c4aa400f2983aa1aef667e
spacegal-spiff/AST341
Spring2020/PythonPhotometry/Sarah_DiffPhotometry.py
[ "MIT" ]
Python
makeApertures
<not_specific>
def makeApertures(xpos, ypos, aprad,skybuff, skywidth): ''' makeApertures makes a master list of apertures and the annuli inputs --------- xpos: list - x positions of stars in image ypos: list - y positions of stars in image aprad: float - aperture radius skybuff: float - ...
makeApertures makes a master list of apertures and the annuli inputs --------- xpos: list - x positions of stars in image ypos: list - y positions of stars in image aprad: float - aperture radius skybuff: float - sky annulus inner radius skywidth: float - sky annulus oute...
makeApertures makes a master list of apertures and the annuli inputs x positions of stars in image ypos: list - y positions of stars in image aprad: float - aperture radius skybuff: float - sky annulus inner radius skywidth: float - sky annulus outer radius outputs
[ "makeApertures", "makes", "a", "master", "list", "of", "apertures", "and", "the", "annuli", "inputs", "x", "positions", "of", "stars", "in", "image", "ypos", ":", "list", "-", "y", "positions", "of", "stars", "in", "image", "aprad", ":", "float", "-", "a...
def makeApertures(xpos, ypos, aprad,skybuff, skywidth): apertures = CircularAperture((xpos, ypos), r=aprad) annulus_apertures = CircularAnnulus((xpos, ypos), r_in=aprad+skybuff, r_out=aprad+skybuff+skywidth) apers = [apertures, annulus_apertures] return apertures, annulus_apertures
[ "def", "makeApertures", "(", "xpos", ",", "ypos", ",", "aprad", ",", "skybuff", ",", "skywidth", ")", ":", "apertures", "=", "CircularAperture", "(", "(", "xpos", ",", "ypos", ")", ",", "r", "=", "aprad", ")", "annulus_apertures", "=", "CircularAnnulus", ...
makeApertures makes a master list of apertures and the annuli
[ "makeApertures", "makes", "a", "master", "list", "of", "apertures", "and", "the", "annuli" ]
[ "'''\n makeApertures\n \n makes a master list of apertures and the annuli\n \n inputs\n ---------\n xpos: list - x positions of stars in image\n ypos: list - y positions of stars in image \n aprad: float - aperture radius\n skybuff: float - sky annulus inner radius\n skywidth: float...
[ { "param": "xpos", "type": null }, { "param": "ypos", "type": null }, { "param": "aprad", "type": null }, { "param": "skybuff", "type": null }, { "param": "skywidth", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "xpos", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ypos", "type": null, "docstring": null, "docstring_tokens": [...
084bf5acdfe31ec1d0c4aa400f2983aa1aef667e
spacegal-spiff/AST341
Spring2020/PythonPhotometry/Sarah_DiffPhotometry.py
[ "MIT" ]
Python
detrend
<not_specific>
def detrend(photometry, ephotometry, nstars): ''' detrend detrend the background for each night so we don't have to worry about changes in background noise levels inputs ------- photometry: list - list of flux values from aperture photometry ephotometry: list - list of flux errors ...
detrend detrend the background for each night so we don't have to worry about changes in background noise levels inputs ------- photometry: list - list of flux values from aperture photometry ephotometry: list - list of flux errors from aperture photometry nstars: float - number o...
detrend detrend the background for each night so we don't have to worry about changes in background noise levels inputs list of flux values from aperture photometry ephotometry: list - list of flux errors from aperture photometry nstars: float - number of stars in the field outputs final aperture photometry of sour...
[ "detrend", "detrend", "the", "background", "for", "each", "night", "so", "we", "don", "'", "t", "have", "to", "worry", "about", "changes", "in", "background", "noise", "levels", "inputs", "list", "of", "flux", "values", "from", "aperture", "photometry", "eph...
def detrend(photometry, ephotometry, nstars): photometry = np.array(photometry) photometry[photometry<=0] = np.nan cPhotometry = np.zeros_like(photometry) finalPhot = np.zeros_like(photometry) checkstars = np.linspace(0,nstars,10).astype(int) for star in np.arange(nstars): if star in che...
[ "def", "detrend", "(", "photometry", ",", "ephotometry", ",", "nstars", ")", ":", "photometry", "=", "np", ".", "array", "(", "photometry", ")", "photometry", "[", "photometry", "<=", "0", "]", "=", "np", ".", "nan", "cPhotometry", "=", "np", ".", "zer...
detrend detrend the background for each night so we don't have to worry about changes in background noise levels
[ "detrend", "detrend", "the", "background", "for", "each", "night", "so", "we", "don", "'", "t", "have", "to", "worry", "about", "changes", "in", "background", "noise", "levels" ]
[ "'''\n detrend\n \n detrend the background for each night so we don't have to worry about changes in background noise levels\n \n inputs\n -------\n photometry: list - list of flux values from aperture photometry\n ephotometry: list - list of flux errors from aperture photometry\n nstars:...
[ { "param": "photometry", "type": null }, { "param": "ephotometry", "type": null }, { "param": "nstars", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "photometry", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ephotometry", "type": null, "docstring": null, "docstri...
084bf5acdfe31ec1d0c4aa400f2983aa1aef667e
spacegal-spiff/AST341
Spring2020/PythonPhotometry/Sarah_DiffPhotometry.py
[ "MIT" ]
Python
CaliforniaCoast
<not_specific>
def CaliforniaCoast(Photometry,cPhotometry,comp_num=9,flux_bins=6): """ Find the least-variable stars as a function of star brightness* (it's called California Coast because the plot looks like California and we are looking for edge values: the coast) inputs -------------- Photometry ...
Find the least-variable stars as a function of star brightness* (it's called California Coast because the plot looks like California and we are looking for edge values: the coast) inputs -------------- Photometry : input Photometry catalog cPhotometry : input detrended Photometry ca...
Find the least-variable stars as a function of star brightness (it's called California Coast because the plot looks like California and we are looking for edge values: the coast) inputs Photometry : input Photometry catalog cPhotometry : input detrended Photometry catalog flux_bins : (default=10) maximum number of...
[ "Find", "the", "least", "-", "variable", "stars", "as", "a", "function", "of", "star", "brightness", "(", "it", "'", "s", "called", "California", "Coast", "because", "the", "plot", "looks", "like", "California", "and", "we", "are", "looking", "for", "edge"...
def CaliforniaCoast(Photometry,cPhotometry,comp_num=9,flux_bins=6): tmpX = np.nanmedian(Photometry,axis=0) tmpY = np.nanstd(cPhotometry, axis=0) xvals = tmpX[(np.isfinite(tmpX) & np.isfinite(tmpY))] yvals = tmpY[(np.isfinite(tmpX) & np.isfinite(tmpY))] kept_vals = np.where((np.isfinite(tmpX) & np.is...
[ "def", "CaliforniaCoast", "(", "Photometry", ",", "cPhotometry", ",", "comp_num", "=", "9", ",", "flux_bins", "=", "6", ")", ":", "tmpX", "=", "np", ".", "nanmedian", "(", "Photometry", ",", "axis", "=", "0", ")", "tmpY", "=", "np", ".", "nanstd", "(...
Find the least-variable stars as a function of star brightness (it's called California Coast because the plot looks like California and we are looking for edge values: the coast)
[ "Find", "the", "least", "-", "variable", "stars", "as", "a", "function", "of", "star", "brightness", "(", "it", "'", "s", "called", "California", "Coast", "because", "the", "plot", "looks", "like", "California", "and", "we", "are", "looking", "for", "edge"...
[ "\"\"\"\n Find the least-variable stars as a function of star brightness*\n\n (it's called California Coast because the plot looks like California and we are looking for edge values: the coast)\n \n \n inputs\n --------------\n Photometry : input Photometry catalog\n cPhotometry : input det...
[ { "param": "Photometry", "type": null }, { "param": "cPhotometry", "type": null }, { "param": "comp_num", "type": null }, { "param": "flux_bins", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "Photometry", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cPhotometry", "type": null, "docstring": null, "docstri...
084bf5acdfe31ec1d0c4aa400f2983aa1aef667e
spacegal-spiff/AST341
Spring2020/PythonPhotometry/Sarah_DiffPhotometry.py
[ "MIT" ]
Python
findComparisonStars
<not_specific>
def findComparisonStars(Photometry, cPhotometry, accuracy_threshold = 0.2, plot=True,comp_num=6): #0.025 ''' findComparisonStars* finds stars that are similar over the various nights to use as comparison stars inputs -------- Photometry: list - photometric values taken from detrend() f...
findComparisonStars* finds stars that are similar over the various nights to use as comparison stars inputs -------- Photometry: list - photometric values taken from detrend() function. cPhotometry: list - detrended photometric values from detrend() function accuracy_threshold: f...
findComparisonStars finds stars that are similar over the various nights to use as comparison stars inputs photometric values taken from detrend() function. cPhotometry: list - detrended photometric values from detrend() function accuracy_threshold: float - level of accuracy in fluxes between various nights plot: boo...
[ "findComparisonStars", "finds", "stars", "that", "are", "similar", "over", "the", "various", "nights", "to", "use", "as", "comparison", "stars", "inputs", "photometric", "values", "taken", "from", "detrend", "()", "function", ".", "cPhotometry", ":", "list", "-"...
def findComparisonStars(Photometry, cPhotometry, accuracy_threshold = 0.2, plot=True,comp_num=6): BinStars,LeastVariable = CaliforniaCoast(Photometry,cPhotometry,comp_num=comp_num) star_err = np.nanstd(cPhotometry, axis=0) if plot: xvals = np.log10(np.nanmedian(Photometry,axis=0)) yvals = n...
[ "def", "findComparisonStars", "(", "Photometry", ",", "cPhotometry", ",", "accuracy_threshold", "=", "0.2", ",", "plot", "=", "True", ",", "comp_num", "=", "6", ")", ":", "BinStars", ",", "LeastVariable", "=", "CaliforniaCoast", "(", "Photometry", ",", "cPhoto...
findComparisonStars finds stars that are similar over the various nights to use as comparison stars
[ "findComparisonStars", "finds", "stars", "that", "are", "similar", "over", "the", "various", "nights", "to", "use", "as", "comparison", "stars" ]
[ "#0.025", "'''\n findComparisonStars*\n \n finds stars that are similar over the various nights to use as comparison stars\n \n inputs\n --------\n Photometry: list - photometric values taken from detrend() function. \n cPhotometry: list - detrended photometric values from detrend() functi...
[ { "param": "Photometry", "type": null }, { "param": "cPhotometry", "type": null }, { "param": "accuracy_threshold", "type": null }, { "param": "plot", "type": null }, { "param": "comp_num", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "Photometry", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cPhotometry", "type": null, "docstring": null, "docstri...
084bf5acdfe31ec1d0c4aa400f2983aa1aef667e
spacegal-spiff/AST341
Spring2020/PythonPhotometry/Sarah_DiffPhotometry.py
[ "MIT" ]
Python
runDifferentialPhotometry
<not_specific>
def runDifferentialPhotometry(Photometry, ePhotometry, nstars, most_accurate): ''' runDifferentialPhotometry as the name says! inputs ---------- Photometry: list - list of photometric values from detrend() function ePhotometry: list - list of photometric error values nstars: f...
runDifferentialPhotometry as the name says! inputs ---------- Photometry: list - list of photometric values from detrend() function ePhotometry: list - list of photometric error values nstars: float - number of stars most_accurate: list - list of indices of non variable compa...
runDifferentialPhotometry as the name says! inputs list of photometric values from detrend() function ePhotometry: list - list of photometric error values nstars: float - number of stars most_accurate: list - list of indices of non variable comparison stars outputs differential photometry list edPhotometry: list - ...
[ "runDifferentialPhotometry", "as", "the", "name", "says!", "inputs", "list", "of", "photometric", "values", "from", "detrend", "()", "function", "ePhotometry", ":", "list", "-", "list", "of", "photometric", "error", "values", "nstars", ":", "float", "-", "number...
def runDifferentialPhotometry(Photometry, ePhotometry, nstars, most_accurate): nimages = len(Photometry) imgindex = np.arange(0,nimages,1) dPhotometry = np.zeros([nimages,len(Photometry[0])]) edPhotometry = np.zeros([nimages,len(Photometry[0])]) eedPhotometry = np.zeros([nimages,len(Photometry[0])])...
[ "def", "runDifferentialPhotometry", "(", "Photometry", ",", "ePhotometry", ",", "nstars", ",", "most_accurate", ")", ":", "nimages", "=", "len", "(", "Photometry", ")", "imgindex", "=", "np", ".", "arange", "(", "0", ",", "nimages", ",", "1", ")", "dPhotom...
runDifferentialPhotometry as the name says!
[ "runDifferentialPhotometry", "as", "the", "name", "says!" ]
[ "'''\n runDifferentialPhotometry\n \n as the name says!\n \n inputs\n ----------\n Photometry: list - list of photometric values from detrend() function\n ePhotometry: list - list of photometric error values\n nstars: float - number of stars \n most_accurate: list - list of indices of ...
[ { "param": "Photometry", "type": null }, { "param": "ePhotometry", "type": null }, { "param": "nstars", "type": null }, { "param": "most_accurate", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "Photometry", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ePhotometry", "type": null, "docstring": null, "docstri...
6db80bdc7fab60251a429cc8bc2ed60a193ee0dd
spacegal-spiff/AST341
shift_methods.py
[ "MIT" ]
Python
shift_image
<not_specific>
def shift_image(image,xshift,yshift): ''' shift_image ------------- wrapper for scipy's implementation that shifts images according to values from cross_image inputs ------------ image : (matrix of floats) image to be shifted xshift : (float) x-shift in pixels ...
shift_image ------------- wrapper for scipy's implementation that shifts images according to values from cross_image inputs ------------ image : (matrix of floats) image to be shifted xshift : (float) x-shift in pixels yshift : (float) y-shift in pixels ...
shift_image wrapper for scipy's implementation that shifts images according to values from cross_image inputs image : (matrix of floats) image to be shifted xshift : (float) x-shift in pixels yshift : (float) y-shift in pixels outputs shifted image : shifted, interpolated image. same s...
[ "shift_image", "wrapper", "for", "scipy", "'", "s", "implementation", "that", "shifts", "images", "according", "to", "values", "from", "cross_image", "inputs", "image", ":", "(", "matrix", "of", "floats", ")", "image", "to", "be", "shifted", "xshift", ":", "...
def shift_image(image,xshift,yshift): return scipy.ndimage.interpolation.shift(image,(xshift,yshift))
[ "def", "shift_image", "(", "image", ",", "xshift", ",", "yshift", ")", ":", "return", "scipy", ".", "ndimage", ".", "interpolation", ".", "shift", "(", "image", ",", "(", "xshift", ",", "yshift", ")", ")" ]
shift_image wrapper for scipy's implementation that shifts images according to values from cross_image
[ "shift_image", "wrapper", "for", "scipy", "'", "s", "implementation", "that", "shifts", "images", "according", "to", "values", "from", "cross_image" ]
[ "'''\n shift_image\n -------------\n wrapper for scipy's implementation that shifts images according to values from cross_image\n \n inputs\n ------------\n image : (matrix of floats) image to be shifted\n xshift : (float) x-shift in pixels\n yshift : (float) y...
[ { "param": "image", "type": null }, { "param": "xshift", "type": null }, { "param": "yshift", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "image", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "xshift", "type": null, "docstring": null, "docstring_tokens"...
e44bc84e93d525cf63376c10c4e4483cde8ea533
spacegal-spiff/AST341
HDI_io.py
[ "MIT" ]
Python
find_files
<not_specific>
def find_files(directory,img_type,filternum=-1): ''' # # definition to go through HDI headers and get the images desired of a particular type # and filter # # # limitations: # - not set up to sort by specific targets # - will not enforce one of the filter wheel slots be...
# # definition to go through HDI headers and get the images desired of a particular type # and filter # # # limitations: # - not set up to sort by specific targets # - will not enforce one of the filter wheel slots being empty #
definition to go through HDI headers and get the images desired of a particular type and filter - not set up to sort by specific targets - will not enforce one of the filter wheel slots being empty
[ "definition", "to", "go", "through", "HDI", "headers", "and", "get", "the", "images", "desired", "of", "a", "particular", "type", "and", "filter", "-", "not", "set", "up", "to", "sort", "by", "specific", "targets", "-", "will", "not", "enforce", "one", "...
def find_files(directory,img_type,filternum=-1): files = [infile for infile in glob.glob(directory+'c*t*fits') if not os.path.isdir(infile)] out_files = [] for f in files: phdr = fits.getheader(f,0) if (img_type == phdr['OBSTYPE']) \ & (img_type == 'BIAS'): out_fi...
[ "def", "find_files", "(", "directory", ",", "img_type", ",", "filternum", "=", "-", "1", ")", ":", "files", "=", "[", "infile", "for", "infile", "in", "glob", ".", "glob", "(", "directory", "+", "'c*t*fits'", ")", "if", "not", "os", ".", "path", ".",...
definition to go through HDI headers and get the images desired of a particular type and filter
[ "definition", "to", "go", "through", "HDI", "headers", "and", "get", "the", "images", "desired", "of", "a", "particular", "type", "and", "filter" ]
[ "'''\n #\n # definition to go through HDI headers and get the images desired of a particular type\n # and filter\n #\n \n #\n # limitations:\n # - not set up to sort by specific targets\n # - will not enforce one of the filter wheel slots being empty\n # \n '''", "# grab ...
[ { "param": "directory", "type": null }, { "param": "img_type", "type": null }, { "param": "filternum", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "directory", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "img_type", "type": null, "docstring": null, "docstring_t...
c9909e5ab2c84492a8104708c640293d90909f4d
spacegal-spiff/AST341
DifferentialPhotometry_functions_student.py
[ "MIT" ]
Python
StarFind
<not_specific>
def StarFind(imname, FWHM, nsigma): ''' StarFind find all stars in a .fits image inputs ---------- imname: name of .fits image to open. FWHM: fwhm of stars in field nsigma: number of sigma above background above which to select sources. (~3 to 4 is a good estimate) ...
StarFind find all stars in a .fits image inputs ---------- imname: name of .fits image to open. FWHM: fwhm of stars in field nsigma: number of sigma above background above which to select sources. (~3 to 4 is a good estimate) outputs -------- xpos: x positions ...
StarFind find all stars in a .fits image inputs name of .fits image to open. FWHM: fwhm of stars in field nsigma: number of sigma above background above which to select sources. (~3 to 4 is a good estimate) outputs x positions of sources ypos: y positions of sources nstars: number of stars found in image
[ "StarFind", "find", "all", "stars", "in", "a", ".", "fits", "image", "inputs", "name", "of", ".", "fits", "image", "to", "open", ".", "FWHM", ":", "fwhm", "of", "stars", "in", "field", "nsigma", ":", "number", "of", "sigma", "above", "background", "abo...
def StarFind(imname, FWHM, nsigma): im,hdr=fits.getdata(imname, header=True) im = np.array(im).astype('float') bkg_sigma = mad_std(im) print('begin: DAOStarFinder') daofind = DAOStarFinder(fwhm=FWHM, threshold=nsigma*bkg_sigma, exclude_border=True) sources = daofind(im) xpos = sources['xcent...
[ "def", "StarFind", "(", "imname", ",", "FWHM", ",", "nsigma", ")", ":", "im", ",", "hdr", "=", "fits", ".", "getdata", "(", "imname", ",", "header", "=", "True", ")", "im", "=", "np", ".", "array", "(", "im", ")", ".", "astype", "(", "'float'", ...
StarFind find all stars in a .fits image
[ "StarFind", "find", "all", "stars", "in", "a", ".", "fits", "image" ]
[ "'''\n StarFind\n \n find all stars in a .fits image\n \n inputs\n ----------\n imname: name of .fits image to open. \n FWHM: fwhm of stars in field\n nsigma: number of sigma above background above which to select sources. (~3 to 4 is a good estimate)\n \n outputs\n --------\n ...
[ { "param": "imname", "type": null }, { "param": "FWHM", "type": null }, { "param": "nsigma", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "imname", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "FWHM", "type": null, "docstring": null, "docstring_tokens":...
c9909e5ab2c84492a8104708c640293d90909f4d
spacegal-spiff/AST341
DifferentialPhotometry_functions_student.py
[ "MIT" ]
Python
doPhotometry
<not_specific>
def doPhotometry(imglist, xpos, ypos, aprad, skybuff, skywidth,timekey='MJD-OBS',verbose=1): ''' doPhotomoetry* determine the flux for each star from aperture photometry inputs ------- imglist: list - list of .fits images xpos, ypos: lists - lists of x and y positions of stars ...
doPhotomoetry* determine the flux for each star from aperture photometry inputs ------- imglist: list - list of .fits images xpos, ypos: lists - lists of x and y positions of stars aprad, skybuff, skywidth: floats - aperture, sky annuli inner, sky annuli outer radii outp...
doPhotomoetry determine the flux for each star from aperture photometry inputs list of .fits images xpos, ypos: lists - lists of x and y positions of stars aprad, skybuff, skywidth: floats - aperture, sky annuli inner, sky annuli outer radii outputs time stamps of each observation from the .fits header Photometry: ...
[ "doPhotomoetry", "determine", "the", "flux", "for", "each", "star", "from", "aperture", "photometry", "inputs", "list", "of", ".", "fits", "images", "xpos", "ypos", ":", "lists", "-", "lists", "of", "x", "and", "y", "positions", "of", "stars", "aprad", "sk...
def doPhotometry(imglist, xpos, ypos, aprad, skybuff, skywidth,timekey='MJD-OBS',verbose=1): nimages = len(imglist) nstars = len(xpos) print('Found {} images'.format(nimages)) Times = np.zeros(nimages) Photometry = np.zeros((nimages,nstars)) print('making apertures') apertures, annulus_aper...
[ "def", "doPhotometry", "(", "imglist", ",", "xpos", ",", "ypos", ",", "aprad", ",", "skybuff", ",", "skywidth", ",", "timekey", "=", "'MJD-OBS'", ",", "verbose", "=", "1", ")", ":", "nimages", "=", "len", "(", "imglist", ")", "nstars", "=", "len", "(...
doPhotomoetry determine the flux for each star from aperture photometry
[ "doPhotomoetry", "determine", "the", "flux", "for", "each", "star", "from", "aperture", "photometry" ]
[ "'''\n doPhotomoetry*\n \n determine the flux for each star from aperture photometry\n \n inputs\n -------\n imglist: list - list of .fits images\n xpos, ypos: lists - lists of x and y positions of stars\n aprad, skybuff, skywidth: floats - aperture, sky annuli inner, sky annuli outer rad...
[ { "param": "imglist", "type": null }, { "param": "xpos", "type": null }, { "param": "ypos", "type": null }, { "param": "aprad", "type": null }, { "param": "skybuff", "type": null }, { "param": "skywidth", "type": null }, { "param": "timekey...
{ "returns": [], "raises": [], "params": [ { "identifier": "imglist", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "xpos", "type": null, "docstring": null, "docstring_tokens"...
c9909e5ab2c84492a8104708c640293d90909f4d
spacegal-spiff/AST341
DifferentialPhotometry_functions_student.py
[ "MIT" ]
Python
doPhotometryError
<not_specific>
def doPhotometryError(imglist,xpos, ypos,aprad, skybuff, skywidth, flux0, GAIN=1.3, manual = False, **kwargs): ''' doPhotometryError determine error in photometry from background noise two options: - use sigma clipping and use whole background - manually input background box positions as k...
doPhotometryError determine error in photometry from background noise two options: - use sigma clipping and use whole background - manually input background box positions as kwargs inputs -------- imglist: list - list of .fits images xpos, ypos: lists - lists of x and y p...
doPhotometryError determine error in photometry from background noise two options: use sigma clipping and use whole background manually input background box positions as kwargs inputs
[ "doPhotometryError", "determine", "error", "in", "photometry", "from", "background", "noise", "two", "options", ":", "use", "sigma", "clipping", "and", "use", "whole", "background", "manually", "input", "background", "box", "positions", "as", "kwargs", "inputs" ]
def doPhotometryError(imglist,xpos, ypos,aprad, skybuff, skywidth, flux0, GAIN=1.3, manual = False, **kwargs): nimages = len(imglist) nstars = len(xpos) print('Found {} images'.format(nimages)) apertures, annulus_apertures = makeApertures(xpos, ypos, aprad, skybuff, skywidth) area_of_ap = apertureAr...
[ "def", "doPhotometryError", "(", "imglist", ",", "xpos", ",", "ypos", ",", "aprad", ",", "skybuff", ",", "skywidth", ",", "flux0", ",", "GAIN", "=", "1.3", ",", "manual", "=", "False", ",", "**", "kwargs", ")", ":", "nimages", "=", "len", "(", "imgli...
doPhotometryError determine error in photometry from background noise two options: use sigma clipping and use whole background manually input background box positions as kwargs
[ "doPhotometryError", "determine", "error", "in", "photometry", "from", "background", "noise", "two", "options", ":", "use", "sigma", "clipping", "and", "use", "whole", "background", "manually", "input", "background", "box", "positions", "as", "kwargs" ]
[ "'''\n doPhotometryError\n \n determine error in photometry from background noise \n two options:\n - use sigma clipping and use whole background\n - manually input background box positions as kwargs\n \n inputs\n --------\n imglist: list - list of .fits images\n xpos, ypos: lists -...
[ { "param": "imglist", "type": null }, { "param": "xpos", "type": null }, { "param": "ypos", "type": null }, { "param": "aprad", "type": null }, { "param": "skybuff", "type": null }, { "param": "skywidth", "type": null }, { "param": "flux0",...
{ "returns": [], "raises": [], "params": [ { "identifier": "imglist", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "xpos", "type": null, "docstring": null, "docstring_tokens"...
c9909e5ab2c84492a8104708c640293d90909f4d
spacegal-spiff/AST341
DifferentialPhotometry_functions_student.py
[ "MIT" ]
Python
detrend
<not_specific>
def detrend(idx, Photometry_initial, ePhotometry, nstars, sn_thresh): ''' detrend the background for each night to find least variable comparison stars inputs ------- idx : list - list of indices of target stars Photometry_initial : list - list of flux values from apert...
detrend the background for each night to find least variable comparison stars inputs ------- idx : list - list of indices of target stars Photometry_initial : list - list of flux values from aperture photometry ePhotometry : list - list of flux errors from ap...
detrend the background for each night to find least variable comparison stars inputs outputs Photometry_fin_mask : list - final aperture photometry of sources with bad sources masked out cPhotometry_mask : list - detrended aperture photometry with bad sources masked out
[ "detrend", "the", "background", "for", "each", "night", "to", "find", "least", "variable", "comparison", "stars", "inputs", "outputs", "Photometry_fin_mask", ":", "list", "-", "final", "aperture", "photometry", "of", "sources", "with", "bad", "sources", "masked", ...
def detrend(idx, Photometry_initial, ePhotometry, nstars, sn_thresh): sn = Photometry_initial / ePhotometry Photometry_mask1 = ma.masked_where(Photometry_initial <= 0, Photometry_initial) Photometry_mask2 = ma.masked_where(sn < sn_thresh, Photometry_mask1) m = np.zeros_like(Photometry_mask2) m[:,idx...
[ "def", "detrend", "(", "idx", ",", "Photometry_initial", ",", "ePhotometry", ",", "nstars", ",", "sn_thresh", ")", ":", "sn", "=", "Photometry_initial", "/", "ePhotometry", "Photometry_mask1", "=", "ma", ".", "masked_where", "(", "Photometry_initial", "<=", "0",...
detrend the background for each night to find least variable comparison stars inputs
[ "detrend", "the", "background", "for", "each", "night", "to", "find", "least", "variable", "comparison", "stars", "inputs" ]
[ "'''\n detrend the background for each night to find least variable comparison stars\n \n inputs\n -------\n idx : list - list of indices of target stars\n Photometry_initial : list - list of flux values from aperture photometry\n ePhotometry : list - list of flux...
[ { "param": "idx", "type": null }, { "param": "Photometry_initial", "type": null }, { "param": "ePhotometry", "type": null }, { "param": "nstars", "type": null }, { "param": "sn_thresh", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "idx", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Photometry_initial", "type": null, "docstring": null, "docstri...
c9909e5ab2c84492a8104708c640293d90909f4d
spacegal-spiff/AST341
DifferentialPhotometry_functions_student.py
[ "MIT" ]
Python
findComparisonStars
<not_specific>
def findComparisonStars(Photometry, cPhotometry, plot=True, comp_num=6): #0.025 ''' findComparisonStars* finds stars that are similar over the various nights to use as comparison stars inputs -------- Photometry: list - photometric values taken from detrend() function. cPhotometry...
findComparisonStars* finds stars that are similar over the various nights to use as comparison stars inputs -------- Photometry: list - photometric values taken from detrend() function. cPhotometry: list - detrended photometric values from detrend() function plot: boolean - True/...
findComparisonStars finds stars that are similar over the various nights to use as comparison stars inputs photometric values taken from detrend() function. cPhotometry: list - detrended photometric values from detrend() function plot: boolean - True/False plot various stars and highlight comparison stars comp_num: f...
[ "findComparisonStars", "finds", "stars", "that", "are", "similar", "over", "the", "various", "nights", "to", "use", "as", "comparison", "stars", "inputs", "photometric", "values", "taken", "from", "detrend", "()", "function", ".", "cPhotometry", ":", "list", "-"...
def findComparisonStars(Photometry, cPhotometry, plot=True, comp_num=6): BinStars,LeastVariable = CaliforniaCoast(Photometry,cPhotometry,comp_num=comp_num) star_err = ma.std(cPhotometry, axis=0) if plot: xvals = np.log10(ma.median(Photometry,axis=0)) yvals = np.log10(ma.std(cPhotometry, axi...
[ "def", "findComparisonStars", "(", "Photometry", ",", "cPhotometry", ",", "plot", "=", "True", ",", "comp_num", "=", "6", ")", ":", "BinStars", ",", "LeastVariable", "=", "CaliforniaCoast", "(", "Photometry", ",", "cPhotometry", ",", "comp_num", "=", "comp_num...
findComparisonStars finds stars that are similar over the various nights to use as comparison stars
[ "findComparisonStars", "finds", "stars", "that", "are", "similar", "over", "the", "various", "nights", "to", "use", "as", "comparison", "stars" ]
[ "#0.025", "'''\n findComparisonStars*\n \n finds stars that are similar over the various nights to use as comparison stars\n \n inputs\n --------\n Photometry: list - photometric values taken from detrend() function. \n cPhotometry: list - detrended photometric values from detrend() functi...
[ { "param": "Photometry", "type": null }, { "param": "cPhotometry", "type": null }, { "param": "plot", "type": null }, { "param": "comp_num", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "Photometry", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cPhotometry", "type": null, "docstring": null, "docstri...
c9909e5ab2c84492a8104708c640293d90909f4d
spacegal-spiff/AST341
DifferentialPhotometry_functions_student.py
[ "MIT" ]
Python
runDifferentialPhotometry
<not_specific>
def runDifferentialPhotometry(photometry, ephotometry, nstars, most_accurate): ''' runDifferentialPhotometry as the name says! inputs ---------- Photometry: list - list of photometric values from detrend() function ePhotometry: list - list of photometric error values nstars: fl...
runDifferentialPhotometry as the name says! inputs ---------- Photometry: list - list of photometric values from detrend() function ePhotometry: list - list of photometric error values nstars: float - number of stars most_accurate: list - list of indices of non variable compa...
runDifferentialPhotometry as the name says! inputs list of photometric values from detrend() function ePhotometry: list - list of photometric error values nstars: float - number of stars most_accurate: list - list of indices of non variable comparison stars outputs differential photometry list edPhotometry: list - ...
[ "runDifferentialPhotometry", "as", "the", "name", "says!", "inputs", "list", "of", "photometric", "values", "from", "detrend", "()", "function", "ePhotometry", ":", "list", "-", "list", "of", "photometric", "error", "values", "nstars", ":", "float", "-", "number...
def runDifferentialPhotometry(photometry, ephotometry, nstars, most_accurate): Photometry = ma.masked_where(photometry <= 0, photometry) ePhotometry = ma.masked_where(photometry <= 0, ephotometry) nimages = len(Photometry) imgindex = np.arange(0,nimages,1) dPhotometry = ma.ones([nimages, len(Photome...
[ "def", "runDifferentialPhotometry", "(", "photometry", ",", "ephotometry", ",", "nstars", ",", "most_accurate", ")", ":", "Photometry", "=", "ma", ".", "masked_where", "(", "photometry", "<=", "0", ",", "photometry", ")", "ePhotometry", "=", "ma", ".", "masked...
runDifferentialPhotometry as the name says!
[ "runDifferentialPhotometry", "as", "the", "name", "says!" ]
[ "'''\n runDifferentialPhotometry\n \n as the name says!\n \n inputs\n ----------\n Photometry: list - list of photometric values from detrend() function\n ePhotometry: list - list of photometric error values\n nstars: float - number of stars \n most_accurate: list - list of indices of ...
[ { "param": "photometry", "type": null }, { "param": "ephotometry", "type": null }, { "param": "nstars", "type": null }, { "param": "most_accurate", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "photometry", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ephotometry", "type": null, "docstring": null, "docstri...
c9909e5ab2c84492a8104708c640293d90909f4d
spacegal-spiff/AST341
DifferentialPhotometry_functions_student.py
[ "MIT" ]
Python
target_list
<not_specific>
def target_list(memberlist, ra_all, dec_all): ''' finds the index, ra, dec of target star(s) from another catalogue (e.g. DAOstarfinder) either from inputted tuple or region file. ''' #checks to see if memberlist is a tuple or region file if isinstance(memberlist, tuple): ra_mem = [memberlist[0]] ...
finds the index, ra, dec of target star(s) from another catalogue (e.g. DAOstarfinder) either from inputted tuple or region file.
finds the index, ra, dec of target star(s) from another catalogue either from inputted tuple or region file.
[ "finds", "the", "index", "ra", "dec", "of", "target", "star", "(", "s", ")", "from", "another", "catalogue", "either", "from", "inputted", "tuple", "or", "region", "file", "." ]
def target_list(memberlist, ra_all, dec_all): if isinstance(memberlist, tuple): ra_mem = [memberlist[0]] dec_mem = [memberlist[1]] elif isinstance(memberlist, str): try: regions = read_ds9(memberlist) ra_mem = [i.center.ra.deg for i in regions] dec_mem...
[ "def", "target_list", "(", "memberlist", ",", "ra_all", ",", "dec_all", ")", ":", "if", "isinstance", "(", "memberlist", ",", "tuple", ")", ":", "ra_mem", "=", "[", "memberlist", "[", "0", "]", "]", "dec_mem", "=", "[", "memberlist", "[", "1", "]", "...
finds the index, ra, dec of target star(s) from another catalogue (e.g.
[ "finds", "the", "index", "ra", "dec", "of", "target", "star", "(", "s", ")", "from", "another", "catalogue", "(", "e", ".", "g", "." ]
[ "''' finds the index, ra, dec of target star(s) from another catalogue (e.g. DAOstarfinder) either from inputted tuple or region file. '''", "#checks to see if memberlist is a tuple or region file", "#finds your target star index in the catalog found with DAOStarFinder", "#finds matches within 20\" of the tar...
[ { "param": "memberlist", "type": null }, { "param": "ra_all", "type": null }, { "param": "dec_all", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "memberlist", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ra_all", "type": null, "docstring": null, "docstring_to...
b44245825537bcd75b75c7b8de6d26f5a9cc3807
xyh888/vnpy
vnpy/trader/krutility.py
[ "MIT" ]
Python
update_bar
null
def update_bar(self, bar): """ Update new bar data into array manager. """ self.count += 1 if not self.inited and self.count >= self.size: self.inited = True self.datetime_array[:-1] = self.datetime_array[1:] self.open_array[:-1] = self.open_array[1:]...
Update new bar data into array manager.
Update new bar data into array manager.
[ "Update", "new", "bar", "data", "into", "array", "manager", "." ]
def update_bar(self, bar): self.count += 1 if not self.inited and self.count >= self.size: self.inited = True self.datetime_array[:-1] = self.datetime_array[1:] self.open_array[:-1] = self.open_array[1:] self.high_array[:-1] = self.high_array[1:] self.low_arra...
[ "def", "update_bar", "(", "self", ",", "bar", ")", ":", "self", ".", "count", "+=", "1", "if", "not", "self", ".", "inited", "and", "self", ".", "count", ">=", "self", ".", "size", ":", "self", ".", "inited", "=", "True", "self", ".", "datetime_arr...
Update new bar data into array manager.
[ "Update", "new", "bar", "data", "into", "array", "manager", "." ]
[ "\"\"\"\n Update new bar data into array manager.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "bar", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bar", "type": null, "docstring": null, "docstring_tokens": []...
46df2c7fc6d4aad38c6a860c843f7fe12f0d1d9c
akaminetzkyp/pyJoules
tests/unit/handler/test_CSVHandler.py
[ "MIT" ]
Python
non_writable_folder
<not_specific>
def non_writable_folder(fs): """ A filesystem with a /dir directory that is not writable """ fs.create_dir('/dir', perm_bits=000) return fs
A filesystem with a /dir directory that is not writable
A filesystem with a /dir directory that is not writable
[ "A", "filesystem", "with", "a", "/", "dir", "directory", "that", "is", "not", "writable" ]
def non_writable_folder(fs): fs.create_dir('/dir', perm_bits=000) return fs
[ "def", "non_writable_folder", "(", "fs", ")", ":", "fs", ".", "create_dir", "(", "'/dir'", ",", "perm_bits", "=", "000", ")", "return", "fs" ]
A filesystem with a /dir directory that is not writable
[ "A", "filesystem", "with", "a", "/", "dir", "directory", "that", "is", "not", "writable" ]
[ "\"\"\"\n A filesystem with a /dir directory that is not writable\n \"\"\"" ]
[ { "param": "fs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
635c85cd19ff7ef20d08d71f639bfb5eaee4afd6
akaminetzkyp/pyJoules
pyJoules/handler/print_handler.py
[ "MIT" ]
Python
process
null
def process(self, trace: EnergyTrace): """ Print the given sample on the standard output """ for sample in trace: begin_string = f'begin timestamp : {sample.timestamp}; tag : {sample.tag}; duration : {sample.duration}' energy_strings = [f'; {domain} : {value}' for...
Print the given sample on the standard output
Print the given sample on the standard output
[ "Print", "the", "given", "sample", "on", "the", "standard", "output" ]
def process(self, trace: EnergyTrace): for sample in trace: begin_string = f'begin timestamp : {sample.timestamp}; tag : {sample.tag}; duration : {sample.duration}' energy_strings = [f'; {domain} : {value}' for domain, value in sample.energy.items()] print(reduce(add, energy_...
[ "def", "process", "(", "self", ",", "trace", ":", "EnergyTrace", ")", ":", "for", "sample", "in", "trace", ":", "begin_string", "=", "f'begin timestamp : {sample.timestamp}; tag : {sample.tag}; duration : {sample.duration}'", "energy_strings", "=", "[", "f'; {domain} : {val...
Print the given sample on the standard output
[ "Print", "the", "given", "sample", "on", "the", "standard", "output" ]
[ "\"\"\"\n Print the given sample on the standard output\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "trace", "type": "EnergyTrace" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "trace", "type": "EnergyTrace", "docstring": null, "docstring_...
5a51ea46c82fb431dca54dacb2ad5bc0c361e0b9
akaminetzkyp/pyJoules
tests/utils/rapl_fs.py
[ "MIT" ]
Python
empty_fs
<not_specific>
def empty_fs(fs): """ filesystem describing a machine with one CPU but no RAPL API """ return RaplFS(fs)
filesystem describing a machine with one CPU but no RAPL API
filesystem describing a machine with one CPU but no RAPL API
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "but", "no", "RAPL", "API" ]
def empty_fs(fs): return RaplFS(fs)
[ "def", "empty_fs", "(", "fs", ")", ":", "return", "RaplFS", "(", "fs", ")" ]
filesystem describing a machine with one CPU but no RAPL API
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "but", "no", "RAPL", "API" ]
[ "\"\"\"\n filesystem describing a machine with one CPU but no RAPL API\n \"\"\"" ]
[ { "param": "fs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5a51ea46c82fb431dca54dacb2ad5bc0c361e0b9
akaminetzkyp/pyJoules
tests/utils/rapl_fs.py
[ "MIT" ]
Python
fs_pkg_one_socket
<not_specific>
def fs_pkg_one_socket(fs): """ filesystem describing a machine with one CPU and RAPL API for package """ rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.reset_values() return rapl_fs
filesystem describing a machine with one CPU and RAPL API for package
filesystem describing a machine with one CPU and RAPL API for package
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "and", "RAPL", "API", "for", "package" ]
def fs_pkg_one_socket(fs): rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.reset_values() return rapl_fs
[ "def", "fs_pkg_one_socket", "(", "fs", ")", ":", "rapl_fs", "=", "RaplFS", "(", "fs", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_0_DIR_NAME", ",", "'package-0'", ",", "'package_0'", ")", "rapl_fs", ".", "reset_values", "(", ")", "return", "rapl_fs" ]
filesystem describing a machine with one CPU and RAPL API for package
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "and", "RAPL", "API", "for", "package" ]
[ "\"\"\"\n filesystem describing a machine with one CPU and RAPL API for package\n \"\"\"" ]
[ { "param": "fs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5a51ea46c82fb431dca54dacb2ad5bc0c361e0b9
akaminetzkyp/pyJoules
tests/utils/rapl_fs.py
[ "MIT" ]
Python
fs_pkg_dram_one_socket
<not_specific>
def fs_pkg_dram_one_socket(fs): """ filesystem describing a machine with one CPU and RAPL API for package and dram """ rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(DRAM_0_DIR_NAME, 'dram', 'dram_0') rapl_fs.reset_values() return ...
filesystem describing a machine with one CPU and RAPL API for package and dram
filesystem describing a machine with one CPU and RAPL API for package and dram
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "and", "RAPL", "API", "for", "package", "and", "dram" ]
def fs_pkg_dram_one_socket(fs): rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(DRAM_0_DIR_NAME, 'dram', 'dram_0') rapl_fs.reset_values() return rapl_fs
[ "def", "fs_pkg_dram_one_socket", "(", "fs", ")", ":", "rapl_fs", "=", "RaplFS", "(", "fs", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_0_DIR_NAME", ",", "'package-0'", ",", "'package_0'", ")", "rapl_fs", ".", "add_domain", "(", "DRAM_0_DIR_NAME", ",", "'dr...
filesystem describing a machine with one CPU and RAPL API for package and dram
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "and", "RAPL", "API", "for", "package", "and", "dram" ]
[ "\"\"\"\n filesystem describing a machine with one CPU and RAPL API for package and dram\n \"\"\"" ]
[ { "param": "fs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5a51ea46c82fb431dca54dacb2ad5bc0c361e0b9
akaminetzkyp/pyJoules
tests/utils/rapl_fs.py
[ "MIT" ]
Python
fs_pkg_psys_one_socket
<not_specific>
def fs_pkg_psys_one_socket(fs): """ filesystem describing a machine with one CPU and RAPL API for package and psys """ rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain('/sys/class/powercap/intel-rapl/intel-rapl:1', 'psys', 'psys') rapl_f...
filesystem describing a machine with one CPU and RAPL API for package and psys
filesystem describing a machine with one CPU and RAPL API for package and psys
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "and", "RAPL", "API", "for", "package", "and", "psys" ]
def fs_pkg_psys_one_socket(fs): rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain('/sys/class/powercap/intel-rapl/intel-rapl:1', 'psys', 'psys') rapl_fs.reset_values() return rapl_fs
[ "def", "fs_pkg_psys_one_socket", "(", "fs", ")", ":", "rapl_fs", "=", "RaplFS", "(", "fs", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_0_DIR_NAME", ",", "'package-0'", ",", "'package_0'", ")", "rapl_fs", ".", "add_domain", "(", "'/sys/class/powercap/intel-rapl...
filesystem describing a machine with one CPU and RAPL API for package and psys
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "and", "RAPL", "API", "for", "package", "and", "psys" ]
[ "\"\"\"\n filesystem describing a machine with one CPU and RAPL API for package and psys\n \"\"\"" ]
[ { "param": "fs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5a51ea46c82fb431dca54dacb2ad5bc0c361e0b9
akaminetzkyp/pyJoules
tests/utils/rapl_fs.py
[ "MIT" ]
Python
fs_pkg_dram_core_one_socket
<not_specific>
def fs_pkg_dram_core_one_socket(fs): """ filesystem describing a machine with one CPU and RAPL API for package dram and core """ rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(DRAM_0_DIR_NAME, 'dram', 'dram_0') rapl_fs.add_domain(CORE_...
filesystem describing a machine with one CPU and RAPL API for package dram and core
filesystem describing a machine with one CPU and RAPL API for package dram and core
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "and", "RAPL", "API", "for", "package", "dram", "and", "core" ]
def fs_pkg_dram_core_one_socket(fs): rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(DRAM_0_DIR_NAME, 'dram', 'dram_0') rapl_fs.add_domain(CORE_0_DIR_NAME, 'core', 'core_0') rapl_fs.reset_values() return rapl_fs
[ "def", "fs_pkg_dram_core_one_socket", "(", "fs", ")", ":", "rapl_fs", "=", "RaplFS", "(", "fs", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_0_DIR_NAME", ",", "'package-0'", ",", "'package_0'", ")", "rapl_fs", ".", "add_domain", "(", "DRAM_0_DIR_NAME", ",", ...
filesystem describing a machine with one CPU and RAPL API for package dram and core
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "and", "RAPL", "API", "for", "package", "dram", "and", "core" ]
[ "\"\"\"\n filesystem describing a machine with one CPU and RAPL API for package dram and core\n \"\"\"" ]
[ { "param": "fs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5a51ea46c82fb431dca54dacb2ad5bc0c361e0b9
akaminetzkyp/pyJoules
tests/utils/rapl_fs.py
[ "MIT" ]
Python
fs_pkg_dram_uncore_one_socket
<not_specific>
def fs_pkg_dram_uncore_one_socket(fs): """ filesystem describing a machine with one CPU and RAPL API for package dram and core """ rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(DRAM_0_DIR_NAME, 'dram', 'dram_0') rapl_fs.add_domain(COR...
filesystem describing a machine with one CPU and RAPL API for package dram and core
filesystem describing a machine with one CPU and RAPL API for package dram and core
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "and", "RAPL", "API", "for", "package", "dram", "and", "core" ]
def fs_pkg_dram_uncore_one_socket(fs): rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(DRAM_0_DIR_NAME, 'dram', 'dram_0') rapl_fs.add_domain(CORE_0_DIR_NAME, 'uncore', 'uncore_0') rapl_fs.reset_values() return rapl_fs
[ "def", "fs_pkg_dram_uncore_one_socket", "(", "fs", ")", ":", "rapl_fs", "=", "RaplFS", "(", "fs", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_0_DIR_NAME", ",", "'package-0'", ",", "'package_0'", ")", "rapl_fs", ".", "add_domain", "(", "DRAM_0_DIR_NAME", ",",...
filesystem describing a machine with one CPU and RAPL API for package dram and core
[ "filesystem", "describing", "a", "machine", "with", "one", "CPU", "and", "RAPL", "API", "for", "package", "dram", "and", "core" ]
[ "\"\"\"\n filesystem describing a machine with one CPU and RAPL API for package dram and core\n \"\"\"" ]
[ { "param": "fs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5a51ea46c82fb431dca54dacb2ad5bc0c361e0b9
akaminetzkyp/pyJoules
tests/utils/rapl_fs.py
[ "MIT" ]
Python
fs_pkg_two_socket
<not_specific>
def fs_pkg_two_socket(fs): """ filesystem describing a machine with two CPU and RAPL API for package """ rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(SOCKET_1_DIR_NAME, 'package-1', 'package_1') rapl_fs.reset_values() return rapl...
filesystem describing a machine with two CPU and RAPL API for package
filesystem describing a machine with two CPU and RAPL API for package
[ "filesystem", "describing", "a", "machine", "with", "two", "CPU", "and", "RAPL", "API", "for", "package" ]
def fs_pkg_two_socket(fs): rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(SOCKET_1_DIR_NAME, 'package-1', 'package_1') rapl_fs.reset_values() return rapl_fs
[ "def", "fs_pkg_two_socket", "(", "fs", ")", ":", "rapl_fs", "=", "RaplFS", "(", "fs", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_0_DIR_NAME", ",", "'package-0'", ",", "'package_0'", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_1_DIR_NAME", ",", "'packa...
filesystem describing a machine with two CPU and RAPL API for package
[ "filesystem", "describing", "a", "machine", "with", "two", "CPU", "and", "RAPL", "API", "for", "package" ]
[ "\"\"\"\n filesystem describing a machine with two CPU and RAPL API for package\n \"\"\"" ]
[ { "param": "fs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5a51ea46c82fb431dca54dacb2ad5bc0c361e0b9
akaminetzkyp/pyJoules
tests/utils/rapl_fs.py
[ "MIT" ]
Python
fs_pkg_dram_two_socket
<not_specific>
def fs_pkg_dram_two_socket(fs): """ filesystem describing a machine with two CPU and RAPL API for package and dram """ rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(SOCKET_1_DIR_NAME, 'package-1', 'package_1') rapl_fs.add_domain(DRAM_...
filesystem describing a machine with two CPU and RAPL API for package and dram
filesystem describing a machine with two CPU and RAPL API for package and dram
[ "filesystem", "describing", "a", "machine", "with", "two", "CPU", "and", "RAPL", "API", "for", "package", "and", "dram" ]
def fs_pkg_dram_two_socket(fs): rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(SOCKET_1_DIR_NAME, 'package-1', 'package_1') rapl_fs.add_domain(DRAM_0_DIR_NAME, 'dram', 'dram_0') rapl_fs.add_domain(DRAM_1_DIR_NAME, 'dram', 'dram_1') rapl_fs...
[ "def", "fs_pkg_dram_two_socket", "(", "fs", ")", ":", "rapl_fs", "=", "RaplFS", "(", "fs", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_0_DIR_NAME", ",", "'package-0'", ",", "'package_0'", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_1_DIR_NAME", ",", "'...
filesystem describing a machine with two CPU and RAPL API for package and dram
[ "filesystem", "describing", "a", "machine", "with", "two", "CPU", "and", "RAPL", "API", "for", "package", "and", "dram" ]
[ "\"\"\"\n filesystem describing a machine with two CPU and RAPL API for package and dram\n \"\"\"" ]
[ { "param": "fs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5a51ea46c82fb431dca54dacb2ad5bc0c361e0b9
akaminetzkyp/pyJoules
tests/utils/rapl_fs.py
[ "MIT" ]
Python
fs_pkg_psys_two_socket
<not_specific>
def fs_pkg_psys_two_socket(fs): """ filesystem describing a machine with two CPU and RAPL API for package """ rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(SOCKET_1_DIR_NAME, 'package-1', 'package_1') rapl_fs.add_domain('/sys/class/p...
filesystem describing a machine with two CPU and RAPL API for package
filesystem describing a machine with two CPU and RAPL API for package
[ "filesystem", "describing", "a", "machine", "with", "two", "CPU", "and", "RAPL", "API", "for", "package" ]
def fs_pkg_psys_two_socket(fs): rapl_fs = RaplFS(fs) rapl_fs.add_domain(SOCKET_0_DIR_NAME, 'package-0', 'package_0') rapl_fs.add_domain(SOCKET_1_DIR_NAME, 'package-1', 'package_1') rapl_fs.add_domain('/sys/class/powercap/intel-rapl/intel-rapl:2/name', 'psys', 'psys') rapl_fs.reset_values() retur...
[ "def", "fs_pkg_psys_two_socket", "(", "fs", ")", ":", "rapl_fs", "=", "RaplFS", "(", "fs", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_0_DIR_NAME", ",", "'package-0'", ",", "'package_0'", ")", "rapl_fs", ".", "add_domain", "(", "SOCKET_1_DIR_NAME", ",", "'...
filesystem describing a machine with two CPU and RAPL API for package
[ "filesystem", "describing", "a", "machine", "with", "two", "CPU", "and", "RAPL", "API", "for", "package" ]
[ "\"\"\"\n filesystem describing a machine with two CPU and RAPL API for package\n \"\"\"" ]
[ { "param": "fs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b3fb4b7c3e9a3afb361c7d6cb91602df03f42cda
akaminetzkyp/pyJoules
pyJoules/device/rapl_device.py
[ "MIT" ]
Python
available_domains
List[RaplDomain]
def available_domains() -> List[RaplDomain]: """ return a the list of the available energy domains """ if not RaplDevice._rapl_api_available(): raise NoSuchDeviceError() return (RaplDevice.available_package_domains() + RaplDevice.available_dram_domains() + ...
return a the list of the available energy domains
return a the list of the available energy domains
[ "return", "a", "the", "list", "of", "the", "available", "energy", "domains" ]
def available_domains() -> List[RaplDomain]: if not RaplDevice._rapl_api_available(): raise NoSuchDeviceError() return (RaplDevice.available_package_domains() + RaplDevice.available_dram_domains() + RaplDevice.available_core_domains() + RaplDevice.available_uncore_domains())
[ "def", "available_domains", "(", ")", "->", "List", "[", "RaplDomain", "]", ":", "if", "not", "RaplDevice", ".", "_rapl_api_available", "(", ")", ":", "raise", "NoSuchDeviceError", "(", ")", "return", "(", "RaplDevice", ".", "available_package_domains", "(", "...
return a the list of the available energy domains
[ "return", "a", "the", "list", "of", "the", "available", "energy", "domains" ]
[ "\"\"\"\n return a the list of the available energy domains\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b3fb4b7c3e9a3afb361c7d6cb91602df03f42cda
akaminetzkyp/pyJoules
pyJoules/device/rapl_device.py
[ "MIT" ]
Python
available_package_domains
List[RaplPackageDomain]
def available_package_domains() -> List[RaplPackageDomain]: """ return a the list of the available energy Package domains """ package_domains = [] for socket_id in RaplDevice._get_socket_id_list(): domain_name_file_str = RAPL_API_DIR + '/intel-rapl:' + str(socket_id)...
return a the list of the available energy Package domains
return a the list of the available energy Package domains
[ "return", "a", "the", "list", "of", "the", "available", "energy", "Package", "domains" ]
def available_package_domains() -> List[RaplPackageDomain]: package_domains = [] for socket_id in RaplDevice._get_socket_id_list(): domain_name_file_str = RAPL_API_DIR + '/intel-rapl:' + str(socket_id) + '/name' if os.path.exists(domain_name_file_str): with open(...
[ "def", "available_package_domains", "(", ")", "->", "List", "[", "RaplPackageDomain", "]", ":", "package_domains", "=", "[", "]", "for", "socket_id", "in", "RaplDevice", ".", "_get_socket_id_list", "(", ")", ":", "domain_name_file_str", "=", "RAPL_API_DIR", "+", ...
return a the list of the available energy Package domains
[ "return", "a", "the", "list", "of", "the", "available", "energy", "Package", "domains" ]
[ "\"\"\"\n return a the list of the available energy Package domains\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b3fb4b7c3e9a3afb361c7d6cb91602df03f42cda
akaminetzkyp/pyJoules
pyJoules/device/rapl_device.py
[ "MIT" ]
Python
available_dram_domains
List[RaplDramDomain]
def available_dram_domains() -> List[RaplDramDomain]: """ return a the list of the available energy Dram domains """ dram_domains = [] for socket_id in RaplDevice._get_socket_id_list(): if RaplDevice._domain_exist_on_socket(socket_id, 'dram'): dram_dom...
return a the list of the available energy Dram domains
return a the list of the available energy Dram domains
[ "return", "a", "the", "list", "of", "the", "available", "energy", "Dram", "domains" ]
def available_dram_domains() -> List[RaplDramDomain]: dram_domains = [] for socket_id in RaplDevice._get_socket_id_list(): if RaplDevice._domain_exist_on_socket(socket_id, 'dram'): dram_domains.append(RaplDramDomain(socket_id)) return dram_domains
[ "def", "available_dram_domains", "(", ")", "->", "List", "[", "RaplDramDomain", "]", ":", "dram_domains", "=", "[", "]", "for", "socket_id", "in", "RaplDevice", ".", "_get_socket_id_list", "(", ")", ":", "if", "RaplDevice", ".", "_domain_exist_on_socket", "(", ...
return a the list of the available energy Dram domains
[ "return", "a", "the", "list", "of", "the", "available", "energy", "Dram", "domains" ]
[ "\"\"\"\n return a the list of the available energy Dram domains\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b3fb4b7c3e9a3afb361c7d6cb91602df03f42cda
akaminetzkyp/pyJoules
pyJoules/device/rapl_device.py
[ "MIT" ]
Python
available_core_domains
List[RaplCoreDomain]
def available_core_domains() -> List[RaplCoreDomain]: """ return a the list of the available energy Core domains """ core_domains = [] for socket_id in RaplDevice._get_socket_id_list(): if RaplDevice._domain_exist_on_socket(socket_id, 'core'): core_dom...
return a the list of the available energy Core domains
return a the list of the available energy Core domains
[ "return", "a", "the", "list", "of", "the", "available", "energy", "Core", "domains" ]
def available_core_domains() -> List[RaplCoreDomain]: core_domains = [] for socket_id in RaplDevice._get_socket_id_list(): if RaplDevice._domain_exist_on_socket(socket_id, 'core'): core_domains.append(RaplCoreDomain(socket_id)) return core_domains
[ "def", "available_core_domains", "(", ")", "->", "List", "[", "RaplCoreDomain", "]", ":", "core_domains", "=", "[", "]", "for", "socket_id", "in", "RaplDevice", ".", "_get_socket_id_list", "(", ")", ":", "if", "RaplDevice", ".", "_domain_exist_on_socket", "(", ...
return a the list of the available energy Core domains
[ "return", "a", "the", "list", "of", "the", "available", "energy", "Core", "domains" ]
[ "\"\"\"\n return a the list of the available energy Core domains\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b3fb4b7c3e9a3afb361c7d6cb91602df03f42cda
akaminetzkyp/pyJoules
pyJoules/device/rapl_device.py
[ "MIT" ]
Python
available_uncore_domains
List[RaplUncoreDomain]
def available_uncore_domains() -> List[RaplUncoreDomain]: """ return a the list of the available energy Uncore domains """ uncore_domains = [] for socket_id in RaplDevice._get_socket_id_list(): if RaplDevice._domain_exist_on_socket(socket_id, 'uncore'): ...
return a the list of the available energy Uncore domains
return a the list of the available energy Uncore domains
[ "return", "a", "the", "list", "of", "the", "available", "energy", "Uncore", "domains" ]
def available_uncore_domains() -> List[RaplUncoreDomain]: uncore_domains = [] for socket_id in RaplDevice._get_socket_id_list(): if RaplDevice._domain_exist_on_socket(socket_id, 'uncore'): uncore_domains.append(RaplUncoreDomain(socket_id)) return uncore_domains
[ "def", "available_uncore_domains", "(", ")", "->", "List", "[", "RaplUncoreDomain", "]", ":", "uncore_domains", "=", "[", "]", "for", "socket_id", "in", "RaplDevice", ".", "_get_socket_id_list", "(", ")", ":", "if", "RaplDevice", ".", "_domain_exist_on_socket", ...
return a the list of the available energy Uncore domains
[ "return", "a", "the", "list", "of", "the", "available", "energy", "Uncore", "domains" ]
[ "\"\"\"\n return a the list of the available energy Uncore domains\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
aae0299836669c6c1fd2c8eb462b60bbdbf51e94
akaminetzkyp/pyJoules
pyJoules/energy_trace.py
[ "MIT" ]
Python
append
null
def append(self, sample: EnergySample): """ append a new sample to the trace """ self._samples.append(sample)
append a new sample to the trace
append a new sample to the trace
[ "append", "a", "new", "sample", "to", "the", "trace" ]
def append(self, sample: EnergySample): self._samples.append(sample)
[ "def", "append", "(", "self", ",", "sample", ":", "EnergySample", ")", ":", "self", ".", "_samples", ".", "append", "(", "sample", ")" ]
append a new sample to the trace
[ "append", "a", "new", "sample", "to", "the", "trace" ]
[ "\"\"\"\n append a new sample to the trace\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "sample", "type": "EnergySample" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sample", "type": "EnergySample", "docstring": null, "docstrin...
aae0299836669c6c1fd2c8eb462b60bbdbf51e94
akaminetzkyp/pyJoules
pyJoules/energy_trace.py
[ "MIT" ]
Python
remove_idle
null
def remove_idle(self, idle: List[Dict[str, float]]): """ substract idle energy values from the current trace :param idle: list of idle consumption values to substract to current trace idle consumption values must be grouped in a dictionary with their domain as key :...
substract idle energy values from the current trace :param idle: list of idle consumption values to substract to current trace idle consumption values must be grouped in a dictionary with their domain as key :raise ValueError: if the number of values in the list doesn't ma...
substract idle energy values from the current trace
[ "substract", "idle", "energy", "values", "from", "the", "current", "trace" ]
def remove_idle(self, idle: List[Dict[str, float]]): if len(idle) != len(self._samples): raise ValueError('idle list havn\'t the same length than the trace') for idle_energy, sample in zip(idle, self._samples): for domain in sample.energy: if domain not in idle_en...
[ "def", "remove_idle", "(", "self", ",", "idle", ":", "List", "[", "Dict", "[", "str", ",", "float", "]", "]", ")", ":", "if", "len", "(", "idle", ")", "!=", "len", "(", "self", ".", "_samples", ")", ":", "raise", "ValueError", "(", "'idle list havn...
substract idle energy values from the current trace
[ "substract", "idle", "energy", "values", "from", "the", "current", "trace" ]
[ "\"\"\"\n substract idle energy values from the current trace\n\n :param idle: list of idle consumption values to substract to current trace\n idle consumption values must be grouped in a dictionary with their domain as key\n :raise ValueError: if the number of values in the...
[ { "param": "self", "type": null }, { "param": "idle", "type": "List[Dict[str, float]]" } ]
{ "returns": [], "raises": [ { "docstring": "if the number of values in the list doesn't match the number of sample in the trace\nor if a domain of the trace is not in the idle values", "docstring_tokens": [ "if", "the", "number", "of", "values", "in",...
aae0299836669c6c1fd2c8eb462b60bbdbf51e94
akaminetzkyp/pyJoules
pyJoules/energy_trace.py
[ "MIT" ]
Python
clean_data
null
def clean_data(self, guards: List[Callable[[EnergySample], bool]] = []): """ Remove sample with negative energy values from the trace Guards can be added to specify rules to remove sample :param guards: list of function that is used as rules to remove samples. A guard is a function that...
Remove sample with negative energy values from the trace Guards can be added to specify rules to remove sample :param guards: list of function that is used as rules to remove samples. A guard is a function that take a sample as parameter and return True if it must be kee...
Remove sample with negative energy values from the trace Guards can be added to specify rules to remove sample
[ "Remove", "sample", "with", "negative", "energy", "values", "from", "the", "trace", "Guards", "can", "be", "added", "to", "specify", "rules", "to", "remove", "sample" ]
def clean_data(self, guards: List[Callable[[EnergySample], bool]] = []): extended_guards = [lambda s: self._sample_havnt_negative_values(s)] + guards valid_samples = [] for sample in self._samples: validity_list = [guard(sample) for guard in extended_guards] if reduce(and...
[ "def", "clean_data", "(", "self", ",", "guards", ":", "List", "[", "Callable", "[", "[", "EnergySample", "]", ",", "bool", "]", "]", "=", "[", "]", ")", ":", "extended_guards", "=", "[", "lambda", "s", ":", "self", ".", "_sample_havnt_negative_values", ...
Remove sample with negative energy values from the trace Guards can be added to specify rules to remove sample
[ "Remove", "sample", "with", "negative", "energy", "values", "from", "the", "trace", "Guards", "can", "be", "added", "to", "specify", "rules", "to", "remove", "sample" ]
[ "\"\"\"\n Remove sample with negative energy values from the trace\n Guards can be added to specify rules to remove sample\n\n :param guards: list of function that is used as rules to remove samples. A guard is a function that take a\n sample as parameter and return True i...
[ { "param": "self", "type": null }, { "param": "guards", "type": "List[Callable[[EnergySample], bool]]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "guards", "type": "List[Callable[[EnergySample], bool]]", "docstring...
cfeb0ba5e7679d3f9161f59a06b9405eb5dc5be4
akaminetzkyp/pyJoules
pyJoules/handler/pandas_handler.py
[ "MIT" ]
Python
trace_to_dataframe
pandas.DataFrame
def trace_to_dataframe(trace: Iterable[EnergySample]) -> pandas.DataFrame: """ convert an energy trace into a pandas DataFrame """ if len(trace) == 0: return pandas.DataFrame() return pandas.DataFrame(columns=_gen_column_names(trace), data=_gen_data(trace))
convert an energy trace into a pandas DataFrame
convert an energy trace into a pandas DataFrame
[ "convert", "an", "energy", "trace", "into", "a", "pandas", "DataFrame" ]
def trace_to_dataframe(trace: Iterable[EnergySample]) -> pandas.DataFrame: if len(trace) == 0: return pandas.DataFrame() return pandas.DataFrame(columns=_gen_column_names(trace), data=_gen_data(trace))
[ "def", "trace_to_dataframe", "(", "trace", ":", "Iterable", "[", "EnergySample", "]", ")", "->", "pandas", ".", "DataFrame", ":", "if", "len", "(", "trace", ")", "==", "0", ":", "return", "pandas", ".", "DataFrame", "(", ")", "return", "pandas", ".", "...
convert an energy trace into a pandas DataFrame
[ "convert", "an", "energy", "trace", "into", "a", "pandas", "DataFrame" ]
[ "\"\"\"\n convert an energy trace into a pandas DataFrame\n \"\"\"" ]
[ { "param": "trace", "type": "Iterable[EnergySample]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "trace", "type": "Iterable[EnergySample]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e39dc002a54952793beb00d31290a5208fb6fcd3
akaminetzkyp/pyJoules
pyJoules/handler/csv_handler.py
[ "MIT" ]
Python
save_data
null
def save_data(self): """ append processed trace to the file """ flatened_trace = self._flaten_trace() first_sample = flatened_trace[0] domain_names = first_sample.energy.keys() csv_file = self._init_file(first_sample) for sample in flatened_trace: ...
append processed trace to the file
append processed trace to the file
[ "append", "processed", "trace", "to", "the", "file" ]
def save_data(self): flatened_trace = self._flaten_trace() first_sample = flatened_trace[0] domain_names = first_sample.energy.keys() csv_file = self._init_file(first_sample) for sample in flatened_trace: csv_file.write(self._gen_sample_line(sample, domain_names) + '\...
[ "def", "save_data", "(", "self", ")", ":", "flatened_trace", "=", "self", ".", "_flaten_trace", "(", ")", "first_sample", "=", "flatened_trace", "[", "0", "]", "domain_names", "=", "first_sample", ".", "energy", ".", "keys", "(", ")", "csv_file", "=", "sel...
append processed trace to the file
[ "append", "processed", "trace", "to", "the", "file" ]
[ "\"\"\"\n append processed trace to the file\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
99c8400936d5688eccb642d3e669351fc6ad4a9f
akaminetzkyp/pyJoules
pyJoules/handler/mongo_handler.py
[ "MIT" ]
Python
sample_to_dict
Dict
def sample_to_dict(sample: EnergySample) -> Dict: """ convert a sample to a dictionary that could be inserted in a mongodb database """ return { 'timestamp': sample.timestamp, 'tag': sample.tag, 'duration': sample.duration, 'energy': sample.energy, }
convert a sample to a dictionary that could be inserted in a mongodb database
convert a sample to a dictionary that could be inserted in a mongodb database
[ "convert", "a", "sample", "to", "a", "dictionary", "that", "could", "be", "inserted", "in", "a", "mongodb", "database" ]
def sample_to_dict(sample: EnergySample) -> Dict: return { 'timestamp': sample.timestamp, 'tag': sample.tag, 'duration': sample.duration, 'energy': sample.energy, }
[ "def", "sample_to_dict", "(", "sample", ":", "EnergySample", ")", "->", "Dict", ":", "return", "{", "'timestamp'", ":", "sample", ".", "timestamp", ",", "'tag'", ":", "sample", ".", "tag", ",", "'duration'", ":", "sample", ".", "duration", ",", "'energy'",...
convert a sample to a dictionary that could be inserted in a mongodb database
[ "convert", "a", "sample", "to", "a", "dictionary", "that", "could", "be", "inserted", "in", "a", "mongodb", "database" ]
[ "\"\"\"\n convert a sample to a dictionary that could be inserted in a mongodb database\n \"\"\"" ]
[ { "param": "sample", "type": "EnergySample" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sample", "type": "EnergySample", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
99c8400936d5688eccb642d3e669351fc6ad4a9f
akaminetzkyp/pyJoules
pyJoules/handler/mongo_handler.py
[ "MIT" ]
Python
trace_to_dict
Dict
def trace_to_dict(trace: Iterable[EnergySample], trace_name: str) -> Dict: """ convert a trace to a dictionary that could be inserted in a mongodb database """ return { 'name': trace_name, 'trace': list(map(sample_to_dict, trace)) }
convert a trace to a dictionary that could be inserted in a mongodb database
convert a trace to a dictionary that could be inserted in a mongodb database
[ "convert", "a", "trace", "to", "a", "dictionary", "that", "could", "be", "inserted", "in", "a", "mongodb", "database" ]
def trace_to_dict(trace: Iterable[EnergySample], trace_name: str) -> Dict: return { 'name': trace_name, 'trace': list(map(sample_to_dict, trace)) }
[ "def", "trace_to_dict", "(", "trace", ":", "Iterable", "[", "EnergySample", "]", ",", "trace_name", ":", "str", ")", "->", "Dict", ":", "return", "{", "'name'", ":", "trace_name", ",", "'trace'", ":", "list", "(", "map", "(", "sample_to_dict", ",", "trac...
convert a trace to a dictionary that could be inserted in a mongodb database
[ "convert", "a", "trace", "to", "a", "dictionary", "that", "could", "be", "inserted", "in", "a", "mongodb", "database" ]
[ "\"\"\"\n convert a trace to a dictionary that could be inserted in a mongodb database\n \"\"\"" ]
[ { "param": "trace", "type": "Iterable[EnergySample]" }, { "param": "trace_name", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "trace", "type": "Iterable[EnergySample]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "trace_name", "type": "str", "docstring": null,...
99c8400936d5688eccb642d3e669351fc6ad4a9f
akaminetzkyp/pyJoules
pyJoules/handler/mongo_handler.py
[ "MIT" ]
Python
save_data
null
def save_data(self): """ Save processed trace on the database """ documents = [] for trace in self.traces: documents.append(trace_to_dict(trace, self.trace_name_prefix + str(self.trace_id))) self.trace_id += 1 self._collection.insert_many(documents...
Save processed trace on the database
Save processed trace on the database
[ "Save", "processed", "trace", "on", "the", "database" ]
def save_data(self): documents = [] for trace in self.traces: documents.append(trace_to_dict(trace, self.trace_name_prefix + str(self.trace_id))) self.trace_id += 1 self._collection.insert_many(documents) self.traces = []
[ "def", "save_data", "(", "self", ")", ":", "documents", "=", "[", "]", "for", "trace", "in", "self", ".", "traces", ":", "documents", ".", "append", "(", "trace_to_dict", "(", "trace", ",", "self", ".", "trace_name_prefix", "+", "str", "(", "self", "."...
Save processed trace on the database
[ "Save", "processed", "trace", "on", "the", "database" ]
[ "\"\"\"\n Save processed trace on the database\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b78199a3751444bbf67991e837a720cf6e8f1af5
akaminetzkyp/pyJoules
pyJoules/device/device_factory.py
[ "MIT" ]
Python
create_devices
List[Device]
def create_devices(domains: Optional[Domain] = None) -> List[Device]: """ Create and configure the Device instance with the given Domains :param domains: a list of Domain instance that as to be monitored (if None, return a list of all monitorable devices) :return...
Create and configure the Device instance with the given Domains :param domains: a list of Domain instance that as to be monitored (if None, return a list of all monitorable devices) :return: a list of device configured with the given Domains :raise NoSuchDeviceE...
Create and configure the Device instance with the given Domains
[ "Create", "and", "configure", "the", "Device", "instance", "with", "the", "given", "Domains" ]
def create_devices(domains: Optional[Domain] = None) -> List[Device]: if domains is None: domains = DeviceFactory._gen_all_available_domains() grouped_domains = {} for device_type, domain in map(lambda d: (d.get_device_type(), d), domains): if device_type in grouped_domai...
[ "def", "create_devices", "(", "domains", ":", "Optional", "[", "Domain", "]", "=", "None", ")", "->", "List", "[", "Device", "]", ":", "if", "domains", "is", "None", ":", "domains", "=", "DeviceFactory", ".", "_gen_all_available_domains", "(", ")", "groupe...
Create and configure the Device instance with the given Domains
[ "Create", "and", "configure", "the", "Device", "instance", "with", "the", "given", "Domains" ]
[ "\"\"\"\n Create and configure the Device instance with the given Domains\n\n :param domains: a list of Domain instance that as to be monitored (if None, return a list of all\n monitorable devices)\n :return: a list of device configured with the given Domains\n :ra...
[ { "param": "domains", "type": "Optional[Domain]" } ]
{ "returns": [ { "docstring": "a list of device configured with the given Domains", "docstring_tokens": [ "a", "list", "of", "device", "configured", "with", "the", "given", "Domains" ], "type": null } ], "raise...
cf2433688004e16e7864eef105ef03666438fc6f
akaminetzkyp/pyJoules
pyJoules/device/device.py
[ "MIT" ]
Python
available_domains
List[Domain]
def available_domains() -> List[Domain]: """ Returns names of the domain that could be monitored on the Device :return: a list of domain names :raise NoSuchDeviceError: if the device is not available on this machine """ raise NotImplementedError()
Returns names of the domain that could be monitored on the Device :return: a list of domain names :raise NoSuchDeviceError: if the device is not available on this machine
Returns names of the domain that could be monitored on the Device
[ "Returns", "names", "of", "the", "domain", "that", "could", "be", "monitored", "on", "the", "Device" ]
def available_domains() -> List[Domain]: raise NotImplementedError()
[ "def", "available_domains", "(", ")", "->", "List", "[", "Domain", "]", ":", "raise", "NotImplementedError", "(", ")" ]
Returns names of the domain that could be monitored on the Device
[ "Returns", "names", "of", "the", "domain", "that", "could", "be", "monitored", "on", "the", "Device" ]
[ "\"\"\"\n Returns names of the domain that could be monitored on the Device\n :return: a list of domain names\n :raise NoSuchDeviceError: if the device is not available on this machine\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "a list of domain names", "docstring_tokens": [ "a", "list", "of", "domain", "names" ], "type": null } ], "raises": [ { "docstring": "if the device is not available on this machine", "docstring_to...
cf2433688004e16e7864eef105ef03666438fc6f
akaminetzkyp/pyJoules
pyJoules/device/device.py
[ "MIT" ]
Python
configure
null
def configure(self, domains: List[Domain] = None): """ configure the device to return only the energy consumption of the given energy domain when calling the :py:meth:`pyJoules.device.Device.get_energy` method :param domains: domains to be monitored by the device, if None, all the avail...
configure the device to return only the energy consumption of the given energy domain when calling the :py:meth:`pyJoules.device.Device.get_energy` method :param domains: domains to be monitored by the device, if None, all the available domain will be monitored :raise NoSuchDomainError...
configure the device to return only the energy consumption of the given energy domain when calling the
[ "configure", "the", "device", "to", "return", "only", "the", "energy", "consumption", "of", "the", "given", "energy", "domain", "when", "calling", "the" ]
def configure(self, domains: List[Domain] = None): if domains is None: domains = self._available_domains else: for domain in domains: if domain not in self._available_domains: raise NoSuchDomainError(domain) self._configured_domains = d...
[ "def", "configure", "(", "self", ",", "domains", ":", "List", "[", "Domain", "]", "=", "None", ")", ":", "if", "domains", "is", "None", ":", "domains", "=", "self", ".", "_available_domains", "else", ":", "for", "domain", "in", "domains", ":", "if", ...
configure the device to return only the energy consumption of the given energy domain when calling the
[ "configure", "the", "device", "to", "return", "only", "the", "energy", "consumption", "of", "the", "given", "energy", "domain", "when", "calling", "the" ]
[ "\"\"\"\n configure the device to return only the energy consumption of the given energy domain when calling the\n :py:meth:`pyJoules.device.Device.get_energy` method\n\n :param domains: domains to be monitored by the device, if None, all the available domain will be monitored\n :raise N...
[ { "param": "self", "type": null }, { "param": "domains", "type": "List[Domain]" } ]
{ "returns": [], "raises": [ { "docstring": "if one given domain could not be monitored on this machine", "docstring_tokens": [ "if", "one", "given", "domain", "could", "not", "be", "monitored", "on", "this", "ma...
356f876c35e9fd6e563d5cf849614cf815c67c11
matplotlib/ipympl
ipympl/backend_nbagg.py
[ "BSD-3-Clause" ]
Python
connection_info
<not_specific>
def connection_info(): """ Return a string showing the figure and connection status for the backend. This is intended as a diagnostic tool, and not for general use. """ result = [] for manager in Gcf.get_all_fig_managers(): fig = manager.canvas.figure result.append( ...
Return a string showing the figure and connection status for the backend. This is intended as a diagnostic tool, and not for general use.
Return a string showing the figure and connection status for the backend. This is intended as a diagnostic tool, and not for general use.
[ "Return", "a", "string", "showing", "the", "figure", "and", "connection", "status", "for", "the", "backend", ".", "This", "is", "intended", "as", "a", "diagnostic", "tool", "and", "not", "for", "general", "use", "." ]
def connection_info(): result = [] for manager in Gcf.get_all_fig_managers(): fig = manager.canvas.figure result.append( '{} - {}'.format( (fig.get_label() or f"Figure {manager.num}"), manager.web_sockets, ) ) if not is_interact...
[ "def", "connection_info", "(", ")", ":", "result", "=", "[", "]", "for", "manager", "in", "Gcf", ".", "get_all_fig_managers", "(", ")", ":", "fig", "=", "manager", ".", "canvas", ".", "figure", "result", ".", "append", "(", "'{} - {}'", ".", "format", ...
Return a string showing the figure and connection status for the backend.
[ "Return", "a", "string", "showing", "the", "figure", "and", "connection", "status", "for", "the", "backend", "." ]
[ "\"\"\"\n Return a string showing the figure and connection status for\n the backend. This is intended as a diagnostic tool, and not for general\n use.\n\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
925d5bc9939d0b7d41aa831f7a60638c311ef0f8
federicoruggeri/argscichat_project
collection_tool/utility/json_utils.py
[ "Apache-2.0" ]
Python
load_json
<not_specific>
def load_json(file_path): """ Loads JSON data from file. Special python objects are handled by custom serializers. :param file_path: path of .json file from which to load data :return: JSON loaded data """ with open(file_path, mode='r') as f: data = simplejson.load(f, obj...
Loads JSON data from file. Special python objects are handled by custom serializers. :param file_path: path of .json file from which to load data :return: JSON loaded data
Loads JSON data from file. Special python objects are handled by custom serializers.
[ "Loads", "JSON", "data", "from", "file", ".", "Special", "python", "objects", "are", "handled", "by", "custom", "serializers", "." ]
def load_json(file_path): with open(file_path, mode='r') as f: data = simplejson.load(f, object_hook=_from_json) return data
[ "def", "load_json", "(", "file_path", ")", ":", "with", "open", "(", "file_path", ",", "mode", "=", "'r'", ")", "as", "f", ":", "data", "=", "simplejson", ".", "load", "(", "f", ",", "object_hook", "=", "_from_json", ")", "return", "data" ]
Loads JSON data from file.
[ "Loads", "JSON", "data", "from", "file", "." ]
[ "\"\"\"\r\n Loads JSON data from file. Special python objects are\r\n handled by custom serializers.\r\n\r\n :param file_path: path of .json file from which to load data\r\n :return: JSON loaded data\r\n \"\"\"" ]
[ { "param": "file_path", "type": null } ]
{ "returns": [ { "docstring": "JSON loaded data", "docstring_tokens": [ "JSON", "loaded", "data" ], "type": null } ], "raises": [], "params": [ { "identifier": "file_path", "type": null, "docstring": "path of .json file from which to ...
925d5bc9939d0b7d41aa831f7a60638c311ef0f8
federicoruggeri/argscichat_project
collection_tool/utility/json_utils.py
[ "Apache-2.0" ]
Python
save_json
null
def save_json(filepath, data): """ Saves data in JSON format to file. Special python objects are handled by custom serializers. :param filepath: path of .json file in which to save data :param data: data to save """ with open(filepath, mode='w') as f: simplejson.dump(data...
Saves data in JSON format to file. Special python objects are handled by custom serializers. :param filepath: path of .json file in which to save data :param data: data to save
Saves data in JSON format to file. Special python objects are handled by custom serializers.
[ "Saves", "data", "in", "JSON", "format", "to", "file", ".", "Special", "python", "objects", "are", "handled", "by", "custom", "serializers", "." ]
def save_json(filepath, data): with open(filepath, mode='w') as f: simplejson.dump(data, f, default=_to_json, tuple_as_array=False, indent=4)
[ "def", "save_json", "(", "filepath", ",", "data", ")", ":", "with", "open", "(", "filepath", ",", "mode", "=", "'w'", ")", "as", "f", ":", "simplejson", ".", "dump", "(", "data", ",", "f", ",", "default", "=", "_to_json", ",", "tuple_as_array", "=", ...
Saves data in JSON format to file.
[ "Saves", "data", "in", "JSON", "format", "to", "file", "." ]
[ "\"\"\"\r\n Saves data in JSON format to file. Special python objects are\r\n handled by custom serializers.\r\n\r\n :param filepath: path of .json file in which to save data\r\n :param data: data to save\r\n \"\"\"" ]
[ { "param": "filepath", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filepath", "type": null, "docstring": "path of .json file in which to save data", "docstring_tokens": [ "path", "of", ".", "json", "file", "in", "which", "to", ...
112d1fdf49d0bd77d757b81f89c41788f0448613
federicoruggeri/argscichat_project
argscichat_allennlp/scripts/fact_selection_baselines.py
[ "Apache-2.0" ]
Python
punctuation_filtering
<not_specific>
def punctuation_filtering(line): """ Filters given sentences by removing punctuation """ table = str.maketrans('', '', string.punctuation) trans = [w.translate(table) for w in line.split()] return ''.join([w for w in trans if w != ''])
Filters given sentences by removing punctuation
Filters given sentences by removing punctuation
[ "Filters", "given", "sentences", "by", "removing", "punctuation" ]
def punctuation_filtering(line): table = str.maketrans('', '', string.punctuation) trans = [w.translate(table) for w in line.split()] return ''.join([w for w in trans if w != ''])
[ "def", "punctuation_filtering", "(", "line", ")", ":", "table", "=", "str", ".", "maketrans", "(", "''", ",", "''", ",", "string", ".", "punctuation", ")", "trans", "=", "[", "w", ".", "translate", "(", "table", ")", "for", "w", "in", "line", ".", ...
Filters given sentences by removing punctuation
[ "Filters", "given", "sentences", "by", "removing", "punctuation" ]
[ "\"\"\"\n Filters given sentences by removing punctuation\n \"\"\"" ]
[ { "param": "line", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "line", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ff9d43e56ff692097b30ad596beb13078ada7524
federicoruggeri/argscichat_project
argscichat_allennlp/utility/json_utils.py
[ "Apache-2.0" ]
Python
dump_jsonl
null
def dump_jsonl(data, output_path, append=False): """ Write list of objects to a JSON lines file. """ mode = 'a+' if append else 'w' with open(output_path, mode, encoding='utf-8') as f: for line in data: json_record = simplejson.dumps(line, ensure_ascii=False) ...
Write list of objects to a JSON lines file.
Write list of objects to a JSON lines file.
[ "Write", "list", "of", "objects", "to", "a", "JSON", "lines", "file", "." ]
def dump_jsonl(data, output_path, append=False): mode = 'a+' if append else 'w' with open(output_path, mode, encoding='utf-8') as f: for line in data: json_record = simplejson.dumps(line, ensure_ascii=False) f.write(json_record + '\n') print('Wrote {} records to {}'.format(le...
[ "def", "dump_jsonl", "(", "data", ",", "output_path", ",", "append", "=", "False", ")", ":", "mode", "=", "'a+'", "if", "append", "else", "'w'", "with", "open", "(", "output_path", ",", "mode", ",", "encoding", "=", "'utf-8'", ")", "as", "f", ":", "f...
Write list of objects to a JSON lines file.
[ "Write", "list", "of", "objects", "to", "a", "JSON", "lines", "file", "." ]
[ "\"\"\"\r\n Write list of objects to a JSON lines file.\r\n \"\"\"" ]
[ { "param": "data", "type": null }, { "param": "output_path", "type": null }, { "param": "append", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "output_path", "type": null, "docstring": null, "docstring_tok...
ff9d43e56ff692097b30ad596beb13078ada7524
federicoruggeri/argscichat_project
argscichat_allennlp/utility/json_utils.py
[ "Apache-2.0" ]
Python
load_jsonl
list
def load_jsonl(input_path) -> list: """ Read list of objects from a JSON lines file. """ data = [] with open(input_path, 'r', encoding='utf-8') as f: for line in f: data.append(simplejson.loads(line.rstrip('\n|\r'))) print('Loaded {} records from {}'.format(len(data),...
Read list of objects from a JSON lines file.
Read list of objects from a JSON lines file.
[ "Read", "list", "of", "objects", "from", "a", "JSON", "lines", "file", "." ]
def load_jsonl(input_path) -> list: data = [] with open(input_path, 'r', encoding='utf-8') as f: for line in f: data.append(simplejson.loads(line.rstrip('\n|\r'))) print('Loaded {} records from {}'.format(len(data), input_path)) return data
[ "def", "load_jsonl", "(", "input_path", ")", "->", "list", ":", "data", "=", "[", "]", "with", "open", "(", "input_path", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "f", ":", "for", "line", "in", "f", ":", "data", ".", "append", "(", ...
Read list of objects from a JSON lines file.
[ "Read", "list", "of", "objects", "from", "a", "JSON", "lines", "file", "." ]
[ "\"\"\"\r\n Read list of objects from a JSON lines file.\r\n \"\"\"" ]
[ { "param": "input_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0906f11fa1a7a01afe084ce68ea5be45b133291c
federicoruggeri/argscichat_project
argscichat_allennlp/argscichat_baselines/dataset_reader.py
[ "Apache-2.0" ]
Python
_punctuation_filtering
<not_specific>
def _punctuation_filtering(line): """ Filters given sentences by removing punctuation """ line = line.lower().strip() table = str.maketrans('', '', string.punctuation) trans = [w.translate(table) for w in line.split()] return ''.join([w for w in trans if w != ''...
Filters given sentences by removing punctuation
Filters given sentences by removing punctuation
[ "Filters", "given", "sentences", "by", "removing", "punctuation" ]
def _punctuation_filtering(line): line = line.lower().strip() table = str.maketrans('', '', string.punctuation) trans = [w.translate(table) for w in line.split()] return ''.join([w for w in trans if w != ''])
[ "def", "_punctuation_filtering", "(", "line", ")", ":", "line", "=", "line", ".", "lower", "(", ")", ".", "strip", "(", ")", "table", "=", "str", ".", "maketrans", "(", "''", ",", "''", ",", "string", ".", "punctuation", ")", "trans", "=", "[", "w"...
Filters given sentences by removing punctuation
[ "Filters", "given", "sentences", "by", "removing", "punctuation" ]
[ "\"\"\"\n Filters given sentences by removing punctuation\n \"\"\"" ]
[ { "param": "line", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "line", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0906f11fa1a7a01afe084ce68ea5be45b133291c
federicoruggeri/argscichat_project
argscichat_allennlp/argscichat_baselines/dataset_reader.py
[ "Apache-2.0" ]
Python
_get_facts_mask
List[int]
def _get_facts_mask(facts: List[str], paragraphs: List[str], has_article) -> List[int]: """ Takes a list of evidence snippets, and the list of all the paragraphs from the paper, and returns a list of indices of the paragraphs that contain the evidence. """ if not len(paragraphs)...
Takes a list of evidence snippets, and the list of all the paragraphs from the paper, and returns a list of indices of the paragraphs that contain the evidence.
Takes a list of evidence snippets, and the list of all the paragraphs from the paper, and returns a list of indices of the paragraphs that contain the evidence.
[ "Takes", "a", "list", "of", "evidence", "snippets", "and", "the", "list", "of", "all", "the", "paragraphs", "from", "the", "paper", "and", "returns", "a", "list", "of", "indices", "of", "the", "paragraphs", "that", "contain", "the", "evidence", "." ]
def _get_facts_mask(facts: List[str], paragraphs: List[str], has_article) -> List[int]: if not len(paragraphs) or not has_article: return [0] * len(paragraphs) facts_mask = [0] * len(paragraphs) total_found = 0 for fact in facts: filtered_fact = ArgSciChatReader._...
[ "def", "_get_facts_mask", "(", "facts", ":", "List", "[", "str", "]", ",", "paragraphs", ":", "List", "[", "str", "]", ",", "has_article", ")", "->", "List", "[", "int", "]", ":", "if", "not", "len", "(", "paragraphs", ")", "or", "not", "has_article"...
Takes a list of evidence snippets, and the list of all the paragraphs from the paper, and returns a list of indices of the paragraphs that contain the evidence.
[ "Takes", "a", "list", "of", "evidence", "snippets", "and", "the", "list", "of", "all", "the", "paragraphs", "from", "the", "paper", "and", "returns", "a", "list", "of", "indices", "of", "the", "paragraphs", "that", "contain", "the", "evidence", "." ]
[ "\"\"\"\n Takes a list of evidence snippets, and the list of all the paragraphs from the\n paper, and returns a list of indices of the paragraphs that contain the evidence.\n \"\"\"" ]
[ { "param": "facts", "type": "List[str]" }, { "param": "paragraphs", "type": "List[str]" }, { "param": "has_article", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "facts", "type": "List[str]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "paragraphs", "type": "List[str]", "docstring": null, ...
4d30a400bee58afdccac4ff4ab0ff28ae05327bd
tww-software/word-list-aggregator
wordlistagg.py
[ "Unlicense" ]
Python
open_wordlist
<not_specific>
def open_wordlist(path): """ open a wordlist Note: a wordlist should be a text document with one word per line Args: path(str): full path to the wordlist Returns: passwordlist(list): list of all the words (as strings) in the wordlist """ with open(path, 'r', errors...
open a wordlist Note: a wordlist should be a text document with one word per line Args: path(str): full path to the wordlist Returns: passwordlist(list): list of all the words (as strings) in the wordlist
open a wordlist Note: a wordlist should be a text document with one word per line
[ "open", "a", "wordlist", "Note", ":", "a", "wordlist", "should", "be", "a", "text", "document", "with", "one", "word", "per", "line" ]
def open_wordlist(path): with open(path, 'r', errors='ignore') as wordf: passwordlist = [] for line in wordf: passwordlist.append(line) return passwordlist
[ "def", "open_wordlist", "(", "path", ")", ":", "with", "open", "(", "path", ",", "'r'", ",", "errors", "=", "'ignore'", ")", "as", "wordf", ":", "passwordlist", "=", "[", "]", "for", "line", "in", "wordf", ":", "passwordlist", ".", "append", "(", "li...
open a wordlist Note: a wordlist should be a text document with one word per line
[ "open", "a", "wordlist", "Note", ":", "a", "wordlist", "should", "be", "a", "text", "document", "with", "one", "word", "per", "line" ]
[ "\"\"\"\n open a wordlist\n\n Note:\n a wordlist should be a text document with one word per line\n\n Args:\n path(str): full path to the wordlist\n\n Returns:\n passwordlist(list): list of all the words (as strings) in the wordlist\n \"\"\"" ]
[ { "param": "path", "type": null } ]
{ "returns": [ { "docstring": "list of all the words (as strings) in the wordlist", "docstring_tokens": [ "list", "of", "all", "the", "words", "(", "as", "strings", ")", "in", "the", "wordlist" ], ...
4d30a400bee58afdccac4ff4ab0ff28ae05327bd
tww-software/word-list-aggregator
wordlistagg.py
[ "Unlicense" ]
Python
create_wordlist
null
def create_wordlist(wordlist, outpath): """ create our own wordlist write each word on a new line in a text file Args: wordlist(list): list of strings (words) to write to file outpath(str): full path to write wordlist to """ with open(outpath, 'w') as wordout: for line i...
create our own wordlist write each word on a new line in a text file Args: wordlist(list): list of strings (words) to write to file outpath(str): full path to write wordlist to
create our own wordlist write each word on a new line in a text file
[ "create", "our", "own", "wordlist", "write", "each", "word", "on", "a", "new", "line", "in", "a", "text", "file" ]
def create_wordlist(wordlist, outpath): with open(outpath, 'w') as wordout: for line in wordlist: wordout.write(line)
[ "def", "create_wordlist", "(", "wordlist", ",", "outpath", ")", ":", "with", "open", "(", "outpath", ",", "'w'", ")", "as", "wordout", ":", "for", "line", "in", "wordlist", ":", "wordout", ".", "write", "(", "line", ")" ]
create our own wordlist write each word on a new line in a text file
[ "create", "our", "own", "wordlist", "write", "each", "word", "on", "a", "new", "line", "in", "a", "text", "file" ]
[ "\"\"\"\n create our own wordlist\n write each word on a new line in a text file\n\n Args:\n wordlist(list): list of strings (words) to write to file\n outpath(str): full path to write wordlist to\n \"\"\"" ]
[ { "param": "wordlist", "type": null }, { "param": "outpath", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "wordlist", "type": null, "docstring": "list of strings (words) to write to file", "docstring_tokens": [ "list", "of", "strings", "(", "words", ")", "to", "write",...
4d30a400bee58afdccac4ff4ab0ff28ae05327bd
tww-software/word-list-aggregator
wordlistagg.py
[ "Unlicense" ]
Python
parse_cli_args
<not_specific>
def parse_cli_args(): """ parse arguments off the command line Returns: args(argparse.Namespace): the CLI arguments """ parser = argparse.ArgumentParser( 'combine all the unique passwords of several password lists into one') parser.add_argument('inputdir', help='directory contai...
parse arguments off the command line Returns: args(argparse.Namespace): the CLI arguments
parse arguments off the command line
[ "parse", "arguments", "off", "the", "command", "line" ]
def parse_cli_args(): parser = argparse.ArgumentParser( 'combine all the unique passwords of several password lists into one') parser.add_argument('inputdir', help='directory containing wordlists') parser.add_argument('outputfile', help='file to output passwords') args = parser.parse_args() ...
[ "def", "parse_cli_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "'combine all the unique passwords of several password lists into one'", ")", "parser", ".", "add_argument", "(", "'inputdir'", ",", "help", "=", "'directory containing wordlists'...
parse arguments off the command line
[ "parse", "arguments", "off", "the", "command", "line" ]
[ "\"\"\"\n parse arguments off the command line\n\n Returns:\n args(argparse.Namespace): the CLI arguments\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "the CLI arguments", "docstring_tokens": [ "the", "CLI", "arguments" ], "type": "args(argparse.Namespace)" } ], "raises": [], "params": [], "outlier_params": [], "others": [] }
a9dbd06f056c0b4d7cf25d138fa459db5e483c8d
zurek11/django-project-template
{{cookiecutter.directory_name}}/apps/api/decorators.py
[ "MIT" ]
Python
require_apikey
<not_specific>
def require_apikey(view_func): """ Require valid signature for specified endpoint :param view_func: :return: """ def wrapped_view(*args, **kwargs): return view_func(*args, **kwargs) wrapped_view.require_apikey = True return wraps(view_func)(wrapped_view)
Require valid signature for specified endpoint :param view_func: :return:
Require valid signature for specified endpoint
[ "Require", "valid", "signature", "for", "specified", "endpoint" ]
def require_apikey(view_func): def wrapped_view(*args, **kwargs): return view_func(*args, **kwargs) wrapped_view.require_apikey = True return wraps(view_func)(wrapped_view)
[ "def", "require_apikey", "(", "view_func", ")", ":", "def", "wrapped_view", "(", "*", "args", ",", "**", "kwargs", ")", ":", "return", "view_func", "(", "*", "args", ",", "**", "kwargs", ")", "wrapped_view", ".", "require_apikey", "=", "True", "return", ...
Require valid signature for specified endpoint
[ "Require", "valid", "signature", "for", "specified", "endpoint" ]
[ "\"\"\"\n Require valid signature for specified endpoint\n :param view_func:\n :return:\n \"\"\"" ]
[ { "param": "view_func", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "view_func", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
a80f436b09a934fff8646ae24d26056e4cee2e08
marksmall/upload-file
quickstart.py
[ "MIT" ]
Python
main
null
def main(): """Shows basic usage of the Drive v3 API. Prints the names and ids of the first 10 files the user has access to. """ """Generate service to interact with Google Drive.""" store = file.Storage('token.json') creds = store.get() if not creds or creds.invalid: flow = client.f...
Shows basic usage of the Drive v3 API. Prints the names and ids of the first 10 files the user has access to.
Shows basic usage of the Drive v3 API. Prints the names and ids of the first 10 files the user has access to.
[ "Shows", "basic", "usage", "of", "the", "Drive", "v3", "API", ".", "Prints", "the", "names", "and", "ids", "of", "the", "first", "10", "files", "the", "user", "has", "access", "to", "." ]
def main(): store = file.Storage('token.json') creds = store.get() if not creds or creds.invalid: flow = client.flow_from_clientsecrets('credentials.json', SCOPES) creds = tools.run_flow(flow, store) drive_service = build('drive', 'v3', http=creds.authorize(Http())) today = datetime....
[ "def", "main", "(", ")", ":", "\"\"\"Generate service to interact with Google Drive.\"\"\"", "store", "=", "file", ".", "Storage", "(", "'token.json'", ")", "creds", "=", "store", ".", "get", "(", ")", "if", "not", "creds", "or", "creds", ".", "invalid", ":", ...
Shows basic usage of the Drive v3 API.
[ "Shows", "basic", "usage", "of", "the", "Drive", "v3", "API", "." ]
[ "\"\"\"Shows basic usage of the Drive v3 API.\n Prints the names and ids of the first 10 files the user has access to.\n \"\"\"", "\"\"\"Generate service to interact with Google Drive.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a083f93c230228f629d4153049e136f7d73d62cf
jinbeizame007/planet_pybullet
planet/networks/conv_ha.py
[ "Apache-2.0" ]
Python
encoder
<not_specific>
def encoder(obs): """Extract deterministic features from an observation.""" obs = obs['image'] hidden = tf.layers.dense(obs, 1024, tf.nn.relu)#keras.layers.Dense(500, activation='relu')(obs) hidden = tf.layers.dense(hidden, 1024, tf.nn.relu)#keras.layers.Dense(500, activation='relu')(hidden) hidden = tf.layer...
Extract deterministic features from an observation.
Extract deterministic features from an observation.
[ "Extract", "deterministic", "features", "from", "an", "observation", "." ]
def encoder(obs): obs = obs['image'] hidden = tf.layers.dense(obs, 1024, tf.nn.relu) hidden = tf.layers.dense(hidden, 1024, tf.nn.relu) hidden = tf.layers.dense(hidden, 1024, None) return hidden
[ "def", "encoder", "(", "obs", ")", ":", "obs", "=", "obs", "[", "'image'", "]", "hidden", "=", "tf", ".", "layers", ".", "dense", "(", "obs", ",", "1024", ",", "tf", ".", "nn", ".", "relu", ")", "hidden", "=", "tf", ".", "layers", ".", "dense",...
Extract deterministic features from an observation.
[ "Extract", "deterministic", "features", "from", "an", "observation", "." ]
[ "\"\"\"Extract deterministic features from an observation.\"\"\"", "#keras.layers.Dense(500, activation='relu')(obs)", "#keras.layers.Dense(500, activation='relu')(hidden)", "#keras.layers.Dense(1024)(hidden)" ]
[ { "param": "obs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "obs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a083f93c230228f629d4153049e136f7d73d62cf
jinbeizame007/planet_pybullet
planet/networks/conv_ha.py
[ "Apache-2.0" ]
Python
decoder
<not_specific>
def decoder(state, data_shape): """Compute the data distribution of an observation from its state.""" #hidden = keras.layers.Dense(500, activation='relu')(state) #hidden = keras.layers.Dense(500, activation='relu')(hidden) #hidden = keras.layers.Dense(26)(hidden) hidden = tf.layers.dense(state, 500, tf.nn.rel...
Compute the data distribution of an observation from its state.
Compute the data distribution of an observation from its state.
[ "Compute", "the", "data", "distribution", "of", "an", "observation", "from", "its", "state", "." ]
def decoder(state, data_shape): hidden = tf.layers.dense(state, 500, tf.nn.relu) hidden = tf.layers.dense(hidden, 500, tf.nn.relu) hidden = tf.layers.dense(hidden, 26, None) mean = hidden mean = tf.reshape(mean, tools.shape(state)[:-1] + data_shape) dist = tools.MSEDistribution(mean) dist = tfd.Independen...
[ "def", "decoder", "(", "state", ",", "data_shape", ")", ":", "hidden", "=", "tf", ".", "layers", ".", "dense", "(", "state", ",", "500", ",", "tf", ".", "nn", ".", "relu", ")", "hidden", "=", "tf", ".", "layers", ".", "dense", "(", "hidden", ",",...
Compute the data distribution of an observation from its state.
[ "Compute", "the", "data", "distribution", "of", "an", "observation", "from", "its", "state", "." ]
[ "\"\"\"Compute the data distribution of an observation from its state.\"\"\"", "#hidden = keras.layers.Dense(500, activation='relu')(state)", "#hidden = keras.layers.Dense(500, activation='relu')(hidden)", "#hidden = keras.layers.Dense(26)(hidden)" ]
[ { "param": "state", "type": null }, { "param": "data_shape", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "state", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data_shape", "type": null, "docstring": null, "docstring_tok...
4438a0dadd8ec5c09e6dc666dc434c22f3bba5ea
jinbeizame007/planet_pybullet
planet/networks/basic.py
[ "Apache-2.0" ]
Python
feed_forward
<not_specific>
def feed_forward( state, data_shape, num_layers=2, activation=None, cut_gradient=False): """Create a model returning unnormalized MSE distribution.""" hidden = state if cut_gradient: hidden = tf.stop_gradient(hidden) for _ in range(num_layers): hidden = tf.layers.dense(hidden, 100, tf.nn.relu) mea...
Create a model returning unnormalized MSE distribution.
Create a model returning unnormalized MSE distribution.
[ "Create", "a", "model", "returning", "unnormalized", "MSE", "distribution", "." ]
def feed_forward( state, data_shape, num_layers=2, activation=None, cut_gradient=False): hidden = state if cut_gradient: hidden = tf.stop_gradient(hidden) for _ in range(num_layers): hidden = tf.layers.dense(hidden, 100, tf.nn.relu) mean = tf.layers.dense(hidden, int(np.prod(data_shape)), activation...
[ "def", "feed_forward", "(", "state", ",", "data_shape", ",", "num_layers", "=", "2", ",", "activation", "=", "None", ",", "cut_gradient", "=", "False", ")", ":", "hidden", "=", "state", "if", "cut_gradient", ":", "hidden", "=", "tf", ".", "stop_gradient", ...
Create a model returning unnormalized MSE distribution.
[ "Create", "a", "model", "returning", "unnormalized", "MSE", "distribution", "." ]
[ "\"\"\"Create a model returning unnormalized MSE distribution.\"\"\"" ]
[ { "param": "state", "type": null }, { "param": "data_shape", "type": null }, { "param": "num_layers", "type": null }, { "param": "activation", "type": null }, { "param": "cut_gradient", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "state", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data_shape", "type": null, "docstring": null, "docstring_tok...
2f49c0dd780bcf4c5e4aca2d76db5c351ad2abb4
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/electronic_structure_driver_result.py
[ "Apache-2.0" ]
Python
second_q_ops
List[FermionicOp]
def second_q_ops(self) -> List[FermionicOp]: """Returns the list of `FermioncOp`s given by the properties contained in this one.""" ops: List[FermionicOp] = [] # TODO: make aux_ops a Dict? Then we don't need to hard-code the order of these properties. # NOTE: this will also get rid of th...
Returns the list of `FermioncOp`s given by the properties contained in this one.
Returns the list of `FermioncOp`s given by the properties contained in this one.
[ "Returns", "the", "list", "of", "`", "FermioncOp", "`", "s", "given", "by", "the", "properties", "contained", "in", "this", "one", "." ]
def second_q_ops(self) -> List[FermionicOp]: ops: List[FermionicOp] = [] for cls in [ ElectronicEnergy, ParticleNumber, AngularMomentum, Magnetization, ElectronicDipoleMoment, ]: prop = self.get_property(cls) i...
[ "def", "second_q_ops", "(", "self", ")", "->", "List", "[", "FermionicOp", "]", ":", "ops", ":", "List", "[", "FermionicOp", "]", "=", "[", "]", "for", "cls", "in", "[", "ElectronicEnergy", ",", "ParticleNumber", ",", "AngularMomentum", ",", "Magnetization...
Returns the list of `FermioncOp`s given by the properties contained in this one.
[ "Returns", "the", "list", "of", "`", "FermioncOp", "`", "s", "given", "by", "the", "properties", "contained", "in", "this", "one", "." ]
[ "\"\"\"Returns the list of `FermioncOp`s given by the properties contained in this one.\"\"\"", "# TODO: make aux_ops a Dict? Then we don't need to hard-code the order of these properties.", "# NOTE: this will also get rid of the hard-coded aux_operator eigenvalue indices in the", "# `interpret` methods of al...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7b014b17dda45df1973b882dc801b2878653af01
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/integrals/electronic_integrals.py
[ "Apache-2.0" ]
Python
_fill_matrices
None
def _fill_matrices(self) -> None: """Fills the internal matrices where `None` placeholders were inserted. This method iterates the internal list of matrices and replaces any occurrences of `None` with the first matrix of the list. In case, more symmetry arguments need to be considered a ...
Fills the internal matrices where `None` placeholders were inserted. This method iterates the internal list of matrices and replaces any occurrences of `None` with the first matrix of the list. In case, more symmetry arguments need to be considered a subclass should overwrite this method. ...
Fills the internal matrices where `None` placeholders were inserted. This method iterates the internal list of matrices and replaces any occurrences of `None` with the first matrix of the list. In case, more symmetry arguments need to be considered a subclass should overwrite this method.
[ "Fills", "the", "internal", "matrices", "where", "`", "None", "`", "placeholders", "were", "inserted", ".", "This", "method", "iterates", "the", "internal", "list", "of", "matrices", "and", "replaces", "any", "occurrences", "of", "`", "None", "`", "with", "t...
def _fill_matrices(self) -> None: filled_matrices = [] for mat in self._matrices: if mat is not None: filled_matrices.append(mat) else: filled_matrices.append(self._matrices[0]) self._matrices = tuple(filled_matrices)
[ "def", "_fill_matrices", "(", "self", ")", "->", "None", ":", "filled_matrices", "=", "[", "]", "for", "mat", "in", "self", ".", "_matrices", ":", "if", "mat", "is", "not", "None", ":", "filled_matrices", ".", "append", "(", "mat", ")", "else", ":", ...
Fills the internal matrices where `None` placeholders were inserted.
[ "Fills", "the", "internal", "matrices", "where", "`", "None", "`", "placeholders", "were", "inserted", "." ]
[ "\"\"\"Fills the internal matrices where `None` placeholders were inserted.\n\n This method iterates the internal list of matrices and replaces any occurrences of `None`\n with the first matrix of the list. In case, more symmetry arguments need to be considered a\n subclass should overwrite thi...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
17577122a94682dd94d556e3187a7a9ba4e394a7
mtreinish/qiskit-nature
qiskit_nature/properties/grouped_property.py
[ "Apache-2.0" ]
Python
add_property
None
def add_property(self, prop: Optional[T]) -> None: """Adds a property to the group. Args: prop: the property to be added. """ if prop is not None: self._properties[prop.name] = prop
Adds a property to the group. Args: prop: the property to be added.
Adds a property to the group.
[ "Adds", "a", "property", "to", "the", "group", "." ]
def add_property(self, prop: Optional[T]) -> None: if prop is not None: self._properties[prop.name] = prop
[ "def", "add_property", "(", "self", ",", "prop", ":", "Optional", "[", "T", "]", ")", "->", "None", ":", "if", "prop", "is", "not", "None", ":", "self", ".", "_properties", "[", "prop", ".", "name", "]", "=", "prop" ]
Adds a property to the group.
[ "Adds", "a", "property", "to", "the", "group", "." ]
[ "\"\"\"Adds a property to the group.\n\n Args:\n prop: the property to be added.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "prop", "type": "Optional[T]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "prop", "type": "Optional[T]", "docstring": "the property to be adde...
17577122a94682dd94d556e3187a7a9ba4e394a7
mtreinish/qiskit-nature
qiskit_nature/properties/grouped_property.py
[ "Apache-2.0" ]
Python
_generator
Generator[T, T, None]
def _generator(self) -> Generator[T, T, None]: """A generator-iterator method [1] iterating over all internal properties. `PseudoProperty` objects are automatically excluded. [1]: https://docs.python.org/3/reference/expressions.html#generator-iterator-methods """ for prop in se...
A generator-iterator method [1] iterating over all internal properties. `PseudoProperty` objects are automatically excluded. [1]: https://docs.python.org/3/reference/expressions.html#generator-iterator-methods
A generator-iterator method [1] iterating over all internal properties. `PseudoProperty` objects are automatically excluded.
[ "A", "generator", "-", "iterator", "method", "[", "1", "]", "iterating", "over", "all", "internal", "properties", ".", "`", "PseudoProperty", "`", "objects", "are", "automatically", "excluded", "." ]
def _generator(self) -> Generator[T, T, None]: for prop in self._properties.values(): if isinstance(prop, PseudoProperty): continue new_property = yield prop if new_property is not None: self.add_property(new_property)
[ "def", "_generator", "(", "self", ")", "->", "Generator", "[", "T", ",", "T", ",", "None", "]", ":", "for", "prop", "in", "self", ".", "_properties", ".", "values", "(", ")", ":", "if", "isinstance", "(", "prop", ",", "PseudoProperty", ")", ":", "c...
A generator-iterator method [1] iterating over all internal properties.
[ "A", "generator", "-", "iterator", "method", "[", "1", "]", "iterating", "over", "all", "internal", "properties", "." ]
[ "\"\"\"A generator-iterator method [1] iterating over all internal properties.\n\n `PseudoProperty` objects are automatically excluded.\n\n [1]: https://docs.python.org/3/reference/expressions.html#generator-iterator-methods\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
17577122a94682dd94d556e3187a7a9ba4e394a7
mtreinish/qiskit-nature
qiskit_nature/properties/grouped_property.py
[ "Apache-2.0" ]
Python
interpret
None
def interpret(self, result: EigenstateResult) -> None: """Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context. Args: result: the result to add meaning to. """ for prop in self._properties.values(): prop.interpret(result)
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context. Args: result: the result to add meaning to.
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.
[ "Interprets", "an", ":", "class", ":", "~qiskit_nature", ".", "result", ".", "EigenstateResult", "in", "this", "property", "'", "s", "context", "." ]
def interpret(self, result: EigenstateResult) -> None: for prop in self._properties.values(): prop.interpret(result)
[ "def", "interpret", "(", "self", ",", "result", ":", "EigenstateResult", ")", "->", "None", ":", "for", "prop", "in", "self", ".", "_properties", ".", "values", "(", ")", ":", "prop", ".", "interpret", "(", "result", ")" ]
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.
[ "Interprets", "an", ":", "class", ":", "~qiskit_nature", ".", "result", ".", "EigenstateResult", "in", "this", "property", "'", "s", "context", "." ]
[ "\"\"\"Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.\n\n Args:\n result: the result to add meaning to.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "result", "type": "EigenstateResult" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "EigenstateResult", "docstring": "the result to ad...
af1d5d8b65e5043e7b12538b5c52987d7d631b70
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/integrals/two_body_electronic_integrals.py
[ "Apache-2.0" ]
Python
_fill_matrices
None
def _fill_matrices(self) -> None: """Fills the internal matrices where `None` placeholders were inserted. This method iterates the internal list of matrices and replaces any occurrences of `None` according to the following rules: 1. If the Alpha-Beta matrix (third index) is `None` a...
Fills the internal matrices where `None` placeholders were inserted. This method iterates the internal list of matrices and replaces any occurrences of `None` according to the following rules: 1. If the Alpha-Beta matrix (third index) is `None` and the Beta-Alpha matrix was not ...
Fills the internal matrices where `None` placeholders were inserted. This method iterates the internal list of matrices and replaces any occurrences of `None` according to the following rules: 1. If the Alpha-Beta matrix (third index) is `None` and the Beta-Alpha matrix was not `None`, its transpose will be used. 2. If...
[ "Fills", "the", "internal", "matrices", "where", "`", "None", "`", "placeholders", "were", "inserted", ".", "This", "method", "iterates", "the", "internal", "list", "of", "matrices", "and", "replaces", "any", "occurrences", "of", "`", "None", "`", "according",...
def _fill_matrices(self) -> None: filled_matrices = [] alpha_beta_spin_idx = 3 for idx, mat in enumerate(self._matrices): if mat is not None: filled_matrices.append(mat) elif idx == alpha_beta_spin_idx: if self._matrices[1] is None: ...
[ "def", "_fill_matrices", "(", "self", ")", "->", "None", ":", "filled_matrices", "=", "[", "]", "alpha_beta_spin_idx", "=", "3", "for", "idx", ",", "mat", "in", "enumerate", "(", "self", ".", "_matrices", ")", ":", "if", "mat", "is", "not", "None", ":"...
Fills the internal matrices where `None` placeholders were inserted.
[ "Fills", "the", "internal", "matrices", "where", "`", "None", "`", "placeholders", "were", "inserted", "." ]
[ "\"\"\"Fills the internal matrices where `None` placeholders were inserted.\n\n This method iterates the internal list of matrices and replaces any occurrences of `None`\n according to the following rules:\n 1. If the Alpha-Beta matrix (third index) is `None` and the Beta-Alpha matrix was n...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
af1d5d8b65e5043e7b12538b5c52987d7d631b70
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/integrals/two_body_electronic_integrals.py
[ "Apache-2.0" ]
Python
transform_basis
"TwoBodyElectronicIntegrals"
def transform_basis(self, transform: ElectronicBasisTransform) -> "TwoBodyElectronicIntegrals": """Transforms the integrals according to the given transform object. If the integrals are already in the correct basis, ``self`` is returned. Args: transform: the transformation object w...
Transforms the integrals according to the given transform object. If the integrals are already in the correct basis, ``self`` is returned. Args: transform: the transformation object with the integral coefficients. Returns: The transformed ``ElectronicIntegrals``. ...
Transforms the integrals according to the given transform object. If the integrals are already in the correct basis, ``self`` is returned.
[ "Transforms", "the", "integrals", "according", "to", "the", "given", "transform", "object", ".", "If", "the", "integrals", "are", "already", "in", "the", "correct", "basis", "`", "`", "self", "`", "`", "is", "returned", "." ]
def transform_basis(self, transform: ElectronicBasisTransform) -> "TwoBodyElectronicIntegrals": if self._basis == transform.final_basis: return self if self._basis != transform.initial_basis: raise QiskitNatureError( f"The integrals' basis, {self._basis}, does not...
[ "def", "transform_basis", "(", "self", ",", "transform", ":", "ElectronicBasisTransform", ")", "->", "\"TwoBodyElectronicIntegrals\"", ":", "if", "self", ".", "_basis", "==", "transform", ".", "final_basis", ":", "return", "self", "if", "self", ".", "_basis", "!...
Transforms the integrals according to the given transform object.
[ "Transforms", "the", "integrals", "according", "to", "the", "given", "transform", "object", "." ]
[ "\"\"\"Transforms the integrals according to the given transform object.\n\n If the integrals are already in the correct basis, ``self`` is returned.\n\n Args:\n transform: the transformation object with the integral coefficients.\n\n Returns:\n The transformed ``Electroni...
[ { "param": "self", "type": null }, { "param": "transform", "type": "ElectronicBasisTransform" } ]
{ "returns": [ { "docstring": "The transformed ``ElectronicIntegrals``.", "docstring_tokens": [ "The", "transformed", "`", "`", "ElectronicIntegrals", "`", "`", "." ], "type": null } ], "raises": [ { "docstri...
af1d5d8b65e5043e7b12538b5c52987d7d631b70
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/integrals/two_body_electronic_integrals.py
[ "Apache-2.0" ]
Python
to_spin
np.ndarray
def to_spin(self) -> np.ndarray: """Transforms the integrals into the special ``ElectronicBasis.SO`` basis. Returns: A single matrix containing the ``n-body`` integrals in the spin orbital basis. """ if self._basis == ElectronicBasis.SO: return self._matrices # ...
Transforms the integrals into the special ``ElectronicBasis.SO`` basis. Returns: A single matrix containing the ``n-body`` integrals in the spin orbital basis.
Transforms the integrals into the special ``ElectronicBasis.SO`` basis.
[ "Transforms", "the", "integrals", "into", "the", "special", "`", "`", "ElectronicBasis", ".", "SO", "`", "`", "basis", "." ]
def to_spin(self) -> np.ndarray: if self._basis == ElectronicBasis.SO: return self._matrices so_matrix = np.zeros([2 * s for s in self._matrices[0].shape]) one_indices = ( (0, 0, 0, 0), (0, 1, 1, 0), (1, 1, 1, 1), (1, 0, 0, 1), ...
[ "def", "to_spin", "(", "self", ")", "->", "np", ".", "ndarray", ":", "if", "self", ".", "_basis", "==", "ElectronicBasis", ".", "SO", ":", "return", "self", ".", "_matrices", "so_matrix", "=", "np", ".", "zeros", "(", "[", "2", "*", "s", "for", "s"...
Transforms the integrals into the special ``ElectronicBasis.SO`` basis.
[ "Transforms", "the", "integrals", "into", "the", "special", "`", "`", "ElectronicBasis", ".", "SO", "`", "`", "basis", "." ]
[ "\"\"\"Transforms the integrals into the special ``ElectronicBasis.SO`` basis.\n\n Returns:\n A single matrix containing the ``n-body`` integrals in the spin orbital basis.\n \"\"\"", "# type: ignore", "# alpha-alpha-spin", "# beta-alpha-spin", "# beta-beta-spin", "# alpha-beta-sp...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "A single matrix containing the ``n-body`` integrals in the spin orbital basis.", "docstring_tokens": [ "A", "single", "matrix", "containing", "the", "`", "`", "n", "-", "body", "`", ...
af1d5d8b65e5043e7b12538b5c52987d7d631b70
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/integrals/two_body_electronic_integrals.py
[ "Apache-2.0" ]
Python
compose
OneBodyElectronicIntegrals
def compose( self, other: ElectronicIntegrals, einsum_subscript: Optional[str] = None ) -> OneBodyElectronicIntegrals: """Composes these TwoBodyElectronicIntegrals with an instance of OneBodyElectronicIntegrals. This method requires an `einsum_subscript` subscript and produces a new instanc...
Composes these TwoBodyElectronicIntegrals with an instance of OneBodyElectronicIntegrals. This method requires an `einsum_subscript` subscript and produces a new instance of OneBodyElectronicIntegrals. Args: other: an instance of OneBodyElectronicIntegrals. einsum_subsc...
Composes these TwoBodyElectronicIntegrals with an instance of OneBodyElectronicIntegrals. This method requires an `einsum_subscript` subscript and produces a new instance of OneBodyElectronicIntegrals.
[ "Composes", "these", "TwoBodyElectronicIntegrals", "with", "an", "instance", "of", "OneBodyElectronicIntegrals", ".", "This", "method", "requires", "an", "`", "einsum_subscript", "`", "subscript", "and", "produces", "a", "new", "instance", "of", "OneBodyElectronicIntegr...
def compose( self, other: ElectronicIntegrals, einsum_subscript: Optional[str] = None ) -> OneBodyElectronicIntegrals: if einsum_subscript is None: raise ValueError( "TwoBodyElectronicIntegrals.compose requires an Einsum summation convention " "(`einsum_su...
[ "def", "compose", "(", "self", ",", "other", ":", "ElectronicIntegrals", ",", "einsum_subscript", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "OneBodyElectronicIntegrals", ":", "if", "einsum_subscript", "is", "None", ":", "raise", "ValueError", "...
Composes these TwoBodyElectronicIntegrals with an instance of OneBodyElectronicIntegrals.
[ "Composes", "these", "TwoBodyElectronicIntegrals", "with", "an", "instance", "of", "OneBodyElectronicIntegrals", "." ]
[ "\"\"\"Composes these TwoBodyElectronicIntegrals with an instance of OneBodyElectronicIntegrals.\n\n This method requires an `einsum_subscript` subscript and produces a new instance of\n OneBodyElectronicIntegrals.\n\n Args:\n other: an instance of OneBodyElectronicIntegrals.\n ...
[ { "param": "self", "type": null }, { "param": "other", "type": "ElectronicIntegrals" }, { "param": "einsum_subscript", "type": "Optional[str]" } ]
{ "returns": [ { "docstring": "The resulting OneBodyElectronicIntegrals.", "docstring_tokens": [ "The", "resulting", "OneBodyElectronicIntegrals", "." ], "type": null } ], "raises": [ { "docstring": "if `other` is not an `OneBodyElectronicI...
5ddd01b52263df46236e72ffc0073a818a2dda1f
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/electronic_energy.py
[ "Apache-2.0" ]
Python
orbital_energies
np.ndarray
def orbital_energies(self) -> np.ndarray: """Returns the orbital energies. If no spin-distinction is made, this is a 1-D array, otherwise it is a 2-D array. """ return self._orbital_energies
Returns the orbital energies. If no spin-distinction is made, this is a 1-D array, otherwise it is a 2-D array.
Returns the orbital energies. If no spin-distinction is made, this is a 1-D array, otherwise it is a 2-D array.
[ "Returns", "the", "orbital", "energies", ".", "If", "no", "spin", "-", "distinction", "is", "made", "this", "is", "a", "1", "-", "D", "array", "otherwise", "it", "is", "a", "2", "-", "D", "array", "." ]
def orbital_energies(self) -> np.ndarray: return self._orbital_energies
[ "def", "orbital_energies", "(", "self", ")", "->", "np", ".", "ndarray", ":", "return", "self", ".", "_orbital_energies" ]
Returns the orbital energies.
[ "Returns", "the", "orbital", "energies", "." ]
[ "\"\"\"Returns the orbital energies.\n\n If no spin-distinction is made, this is a 1-D array, otherwise it is a 2-D array.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5ddd01b52263df46236e72ffc0073a818a2dda1f
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/electronic_energy.py
[ "Apache-2.0" ]
Python
from_legacy_driver_result
"ElectronicEnergy"
def from_legacy_driver_result(cls, result: LegacyDriverResult) -> "ElectronicEnergy": """Construct an ElectronicEnergy instance from a QMolecule. Args: result: the driver result from which to extract the raw data. For this property, a QMolecule is required! Returns:...
Construct an ElectronicEnergy instance from a QMolecule. Args: result: the driver result from which to extract the raw data. For this property, a QMolecule is required! Returns: An instance of this property. Raises: QiskitNatureError: if a W...
Construct an ElectronicEnergy instance from a QMolecule.
[ "Construct", "an", "ElectronicEnergy", "instance", "from", "a", "QMolecule", "." ]
def from_legacy_driver_result(cls, result: LegacyDriverResult) -> "ElectronicEnergy": cls._validate_input_type(result, LegacyElectronicStructureDriverResult) qmol = cast(QMolecule, result) energy_shift = qmol.energy_shift.copy() integrals: List[ElectronicIntegrals] = [] if qmol.h...
[ "def", "from_legacy_driver_result", "(", "cls", ",", "result", ":", "LegacyDriverResult", ")", "->", "\"ElectronicEnergy\"", ":", "cls", ".", "_validate_input_type", "(", "result", ",", "LegacyElectronicStructureDriverResult", ")", "qmol", "=", "cast", "(", "QMolecule...
Construct an ElectronicEnergy instance from a QMolecule.
[ "Construct", "an", "ElectronicEnergy", "instance", "from", "a", "QMolecule", "." ]
[ "\"\"\"Construct an ElectronicEnergy instance from a QMolecule.\n\n Args:\n result: the driver result from which to extract the raw data. For this property, a\n QMolecule is required!\n\n Returns:\n An instance of this property.\n\n Raises:\n Qisk...
[ { "param": "cls", "type": null }, { "param": "result", "type": "LegacyDriverResult" } ]
{ "returns": [ { "docstring": "An instance of this property.", "docstring_tokens": [ "An", "instance", "of", "this", "property", "." ], "type": null } ], "raises": [ { "docstring": "if a WatsonHamiltonian is provided.", ...
5ddd01b52263df46236e72ffc0073a818a2dda1f
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/electronic_energy.py
[ "Apache-2.0" ]
Python
integral_operator
OneBodyElectronicIntegrals
def integral_operator(self, density: OneBodyElectronicIntegrals) -> OneBodyElectronicIntegrals: """Constructs the Fock operator resulting from this `ElectronicEnergy`. Args: density: the electronic density at which to compute the operator. Returns: OneBodyElectronicInte...
Constructs the Fock operator resulting from this `ElectronicEnergy`. Args: density: the electronic density at which to compute the operator. Returns: OneBodyElectronicIntegrals: the operator stored as ElectronicIntegrals. Raises: NotImplementedError: if no ...
Constructs the Fock operator resulting from this `ElectronicEnergy`.
[ "Constructs", "the", "Fock", "operator", "resulting", "from", "this", "`", "ElectronicEnergy", "`", "." ]
def integral_operator(self, density: OneBodyElectronicIntegrals) -> OneBodyElectronicIntegrals: if ElectronicBasis.AO not in self._electronic_integrals.keys(): raise NotImplementedError( "Construction of the Fock operator outside of the AO basis is not yet implemented." )...
[ "def", "integral_operator", "(", "self", ",", "density", ":", "OneBodyElectronicIntegrals", ")", "->", "OneBodyElectronicIntegrals", ":", "if", "ElectronicBasis", ".", "AO", "not", "in", "self", ".", "_electronic_integrals", ".", "keys", "(", ")", ":", "raise", ...
Constructs the Fock operator resulting from this `ElectronicEnergy`.
[ "Constructs", "the", "Fock", "operator", "resulting", "from", "this", "`", "ElectronicEnergy", "`", "." ]
[ "\"\"\"Constructs the Fock operator resulting from this `ElectronicEnergy`.\n\n Args:\n density: the electronic density at which to compute the operator.\n\n Returns:\n OneBodyElectronicIntegrals: the operator stored as ElectronicIntegrals.\n\n Raises:\n NotImpl...
[ { "param": "self", "type": null }, { "param": "density", "type": "OneBodyElectronicIntegrals" } ]
{ "returns": [ { "docstring": "the operator stored as ElectronicIntegrals.", "docstring_tokens": [ "the", "operator", "stored", "as", "ElectronicIntegrals", "." ], "type": "OneBodyElectronicIntegrals" } ], "raises": [ { "doc...
5ddd01b52263df46236e72ffc0073a818a2dda1f
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/electronic_energy.py
[ "Apache-2.0" ]
Python
interpret
None
def interpret(self, result: EigenstateResult) -> None: """Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context. Args: result: the result to add meaning to. """ result.hartree_fock_energy = self._reference_energy result.nuclear_repuls...
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context. Args: result: the result to add meaning to.
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.
[ "Interprets", "an", ":", "class", ":", "~qiskit_nature", ".", "result", ".", "EigenstateResult", "in", "this", "property", "'", "s", "context", "." ]
def interpret(self, result: EigenstateResult) -> None: result.hartree_fock_energy = self._reference_energy result.nuclear_repulsion_energy = self._nuclear_repulsion_energy result.extracted_transformer_energies = self._shift.copy()
[ "def", "interpret", "(", "self", ",", "result", ":", "EigenstateResult", ")", "->", "None", ":", "result", ".", "hartree_fock_energy", "=", "self", ".", "_reference_energy", "result", ".", "nuclear_repulsion_energy", "=", "self", ".", "_nuclear_repulsion_energy", ...
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.
[ "Interprets", "an", ":", "class", ":", "~qiskit_nature", ".", "result", ".", "EigenstateResult", "in", "this", "property", "'", "s", "context", "." ]
[ "\"\"\"Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.\n\n Args:\n result: the result to add meaning to.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "result", "type": "EigenstateResult" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "EigenstateResult", "docstring": "the result to ad...
996bedc43ec07fe0b2b6859cea58e34e5f669b3b
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/particle_number.py
[ "Apache-2.0" ]
Python
from_legacy_driver_result
"ParticleNumber"
def from_legacy_driver_result(cls, result: LegacyDriverResult) -> "ParticleNumber": """Construct a ParticleNumber instance from a QMolecule. Args: result: the driver result from which to extract the raw data. For this property, a QMolecule is required! Returns: ...
Construct a ParticleNumber instance from a QMolecule. Args: result: the driver result from which to extract the raw data. For this property, a QMolecule is required! Returns: An instance of this property. Raises: QiskitNatureError: if a Wats...
Construct a ParticleNumber instance from a QMolecule.
[ "Construct", "a", "ParticleNumber", "instance", "from", "a", "QMolecule", "." ]
def from_legacy_driver_result(cls, result: LegacyDriverResult) -> "ParticleNumber": cls._validate_input_type(result, LegacyElectronicStructureDriverResult) qmol = cast(QMolecule, result) return cls( qmol.num_molecular_orbitals * 2, (qmol.num_alpha, qmol.num_beta), ...
[ "def", "from_legacy_driver_result", "(", "cls", ",", "result", ":", "LegacyDriverResult", ")", "->", "\"ParticleNumber\"", ":", "cls", ".", "_validate_input_type", "(", "result", ",", "LegacyElectronicStructureDriverResult", ")", "qmol", "=", "cast", "(", "QMolecule",...
Construct a ParticleNumber instance from a QMolecule.
[ "Construct", "a", "ParticleNumber", "instance", "from", "a", "QMolecule", "." ]
[ "\"\"\"Construct a ParticleNumber instance from a QMolecule.\n\n Args:\n result: the driver result from which to extract the raw data. For this property, a\n QMolecule is required!\n\n Returns:\n An instance of this property.\n\n Raises:\n QiskitN...
[ { "param": "cls", "type": null }, { "param": "result", "type": "LegacyDriverResult" } ]
{ "returns": [ { "docstring": "An instance of this property.", "docstring_tokens": [ "An", "instance", "of", "this", "property", "." ], "type": null } ], "raises": [ { "docstring": "if a WatsonHamiltonian is provided.", ...
996bedc43ec07fe0b2b6859cea58e34e5f669b3b
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/particle_number.py
[ "Apache-2.0" ]
Python
second_q_ops
List[FermionicOp]
def second_q_ops(self) -> List[FermionicOp]: """Returns a list containing the particle number operator.""" op = FermionicOp( [(f"N_{o}", 1.0) for o in range(self._num_spin_orbitals)], register_length=self._num_spin_orbitals, ) return [op]
Returns a list containing the particle number operator.
Returns a list containing the particle number operator.
[ "Returns", "a", "list", "containing", "the", "particle", "number", "operator", "." ]
def second_q_ops(self) -> List[FermionicOp]: op = FermionicOp( [(f"N_{o}", 1.0) for o in range(self._num_spin_orbitals)], register_length=self._num_spin_orbitals, ) return [op]
[ "def", "second_q_ops", "(", "self", ")", "->", "List", "[", "FermionicOp", "]", ":", "op", "=", "FermionicOp", "(", "[", "(", "f\"N_{o}\"", ",", "1.0", ")", "for", "o", "in", "range", "(", "self", ".", "_num_spin_orbitals", ")", "]", ",", "register_len...
Returns a list containing the particle number operator.
[ "Returns", "a", "list", "containing", "the", "particle", "number", "operator", "." ]
[ "\"\"\"Returns a list containing the particle number operator.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
996bedc43ec07fe0b2b6859cea58e34e5f669b3b
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/particle_number.py
[ "Apache-2.0" ]
Python
interpret
None
def interpret(self, result: EigenstateResult) -> None: """Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context. Args: result: the result to add meaning to. """ expected = self.num_alpha + self.num_beta result.num_particles = [] ...
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context. Args: result: the result to add meaning to.
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.
[ "Interprets", "an", ":", "class", ":", "~qiskit_nature", ".", "result", ".", "EigenstateResult", "in", "this", "property", "'", "s", "context", "." ]
def interpret(self, result: EigenstateResult) -> None: expected = self.num_alpha + self.num_beta result.num_particles = [] if not isinstance(result.aux_operator_eigenvalues, list): aux_operator_eigenvalues = [result.aux_operator_eigenvalues] else: aux_operator_eig...
[ "def", "interpret", "(", "self", ",", "result", ":", "EigenstateResult", ")", "->", "None", ":", "expected", "=", "self", ".", "num_alpha", "+", "self", ".", "num_beta", "result", ".", "num_particles", "=", "[", "]", "if", "not", "isinstance", "(", "resu...
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.
[ "Interprets", "an", ":", "class", ":", "~qiskit_nature", ".", "result", ".", "EigenstateResult", "in", "this", "property", "'", "s", "context", "." ]
[ "\"\"\"Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.\n\n Args:\n result: the result to add meaning to.\n \"\"\"", "# type: ignore", "# type: ignore" ]
[ { "param": "self", "type": null }, { "param": "result", "type": "EigenstateResult" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "EigenstateResult", "docstring": "the result to ad...
10e74c15653497ba4d2b8370de280581d0cf314a
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/angular_momentum.py
[ "Apache-2.0" ]
Python
from_legacy_driver_result
"AngularMomentum"
def from_legacy_driver_result(cls, result: LegacyDriverResult) -> "AngularMomentum": """Construct an AngularMomentum instance from a QMolecule. Args: result: the driver result from which to extract the raw data. For this property, a QMolecule is required! Returns: ...
Construct an AngularMomentum instance from a QMolecule. Args: result: the driver result from which to extract the raw data. For this property, a QMolecule is required! Returns: An instance of this property. Raises: QiskitNatureError: if a Wa...
Construct an AngularMomentum instance from a QMolecule.
[ "Construct", "an", "AngularMomentum", "instance", "from", "a", "QMolecule", "." ]
def from_legacy_driver_result(cls, result: LegacyDriverResult) -> "AngularMomentum": cls._validate_input_type(result, LegacyElectronicStructureDriverResult) qmol = cast(QMolecule, result) return cls( qmol.num_molecular_orbitals * 2, )
[ "def", "from_legacy_driver_result", "(", "cls", ",", "result", ":", "LegacyDriverResult", ")", "->", "\"AngularMomentum\"", ":", "cls", ".", "_validate_input_type", "(", "result", ",", "LegacyElectronicStructureDriverResult", ")", "qmol", "=", "cast", "(", "QMolecule"...
Construct an AngularMomentum instance from a QMolecule.
[ "Construct", "an", "AngularMomentum", "instance", "from", "a", "QMolecule", "." ]
[ "\"\"\"Construct an AngularMomentum instance from a QMolecule.\n\n Args:\n result: the driver result from which to extract the raw data. For this property, a\n QMolecule is required!\n\n Returns:\n An instance of this property.\n\n Raises:\n Qiski...
[ { "param": "cls", "type": null }, { "param": "result", "type": "LegacyDriverResult" } ]
{ "returns": [ { "docstring": "An instance of this property.", "docstring_tokens": [ "An", "instance", "of", "this", "property", "." ], "type": null } ], "raises": [ { "docstring": "if a WatsonHamiltonian is provided.", ...
10e74c15653497ba4d2b8370de280581d0cf314a
mtreinish/qiskit-nature
qiskit_nature/properties/second_quantization/electronic/angular_momentum.py
[ "Apache-2.0" ]
Python
interpret
None
def interpret(self, result: EigenstateResult) -> None: """Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context. Args: result: the result to add meaning to. """ result.total_angular_momentum = [] if not isinstance(result.aux_operator...
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context. Args: result: the result to add meaning to.
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.
[ "Interprets", "an", ":", "class", ":", "~qiskit_nature", ".", "result", ".", "EigenstateResult", "in", "this", "property", "'", "s", "context", "." ]
def interpret(self, result: EigenstateResult) -> None: result.total_angular_momentum = [] if not isinstance(result.aux_operator_eigenvalues, list): aux_operator_eigenvalues = [result.aux_operator_eigenvalues] else: aux_operator_eigenvalues = result.aux_operator_eigenvalue...
[ "def", "interpret", "(", "self", ",", "result", ":", "EigenstateResult", ")", "->", "None", ":", "result", ".", "total_angular_momentum", "=", "[", "]", "if", "not", "isinstance", "(", "result", ".", "aux_operator_eigenvalues", ",", "list", ")", ":", "aux_op...
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.
[ "Interprets", "an", ":", "class", ":", "~qiskit_nature", ".", "result", ".", "EigenstateResult", "in", "this", "property", "'", "s", "context", "." ]
[ "\"\"\"Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.\n\n Args:\n result: the result to add meaning to.\n \"\"\"", "# type: ignore", "# type: ignore" ]
[ { "param": "self", "type": null }, { "param": "result", "type": "EigenstateResult" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "EigenstateResult", "docstring": "the result to ad...
ef7dbe98a8041758fda8604af5ab597cf703f4fb
faisalnawazmir/Copulas
copulas/univariate/truncnorm.py
[ "MIT" ]
Python
fit
null
def fit(self, X): """Prepare necessary params and call super().fit.""" min_ = X.min() - EPSILON max_ = X.max() + EPSILON self.mean = X.mean() self.std = X.std() super().fit(X, min_, max_)
Prepare necessary params and call super().fit.
Prepare necessary params and call super().fit.
[ "Prepare", "necessary", "params", "and", "call", "super", "()", ".", "fit", "." ]
def fit(self, X): min_ = X.min() - EPSILON max_ = X.max() + EPSILON self.mean = X.mean() self.std = X.std() super().fit(X, min_, max_)
[ "def", "fit", "(", "self", ",", "X", ")", ":", "min_", "=", "X", ".", "min", "(", ")", "-", "EPSILON", "max_", "=", "X", ".", "max", "(", ")", "+", "EPSILON", "self", ".", "mean", "=", "X", ".", "mean", "(", ")", "self", ".", "std", "=", ...
Prepare necessary params and call super().fit.
[ "Prepare", "necessary", "params", "and", "call", "super", "()", ".", "fit", "." ]
[ "\"\"\"Prepare necessary params and call super().fit.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "X", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "X", "type": null, "docstring": null, "docstring_tokens": [], ...
ef7dbe98a8041758fda8604af5ab597cf703f4fb
faisalnawazmir/Copulas
copulas/univariate/truncnorm.py
[ "MIT" ]
Python
_fit_params
<not_specific>
def _fit_params(self): """Return attributes from self.model to serialize. Returns: dict: Parameters to recreate self.model in its current fit status. """ return { 'a': self.model.a, 'b': self.model.b }
Return attributes from self.model to serialize. Returns: dict: Parameters to recreate self.model in its current fit status.
Return attributes from self.model to serialize.
[ "Return", "attributes", "from", "self", ".", "model", "to", "serialize", "." ]
def _fit_params(self): return { 'a': self.model.a, 'b': self.model.b }
[ "def", "_fit_params", "(", "self", ")", ":", "return", "{", "'a'", ":", "self", ".", "model", ".", "a", ",", "'b'", ":", "self", ".", "model", ".", "b", "}" ]
Return attributes from self.model to serialize.
[ "Return", "attributes", "from", "self", ".", "model", "to", "serialize", "." ]
[ "\"\"\"Return attributes from self.model to serialize.\n\n Returns:\n dict: Parameters to recreate self.model in its current fit status.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Parameters to recreate self.model in its current fit status.", "docstring_tokens": [ "Parameters", "to", "recreate", "self", ".", "model", "in", "its", "current", "fit", "status", ...
5c0e6461c97c2980b16a92bc6332ccb39e57f198
faisalnawazmir/Copulas
copulas/univariate/gaussian.py
[ "MIT" ]
Python
cumulative_distribution
<not_specific>
def cumulative_distribution(self, X): """Cumulative distribution function for gaussian distribution. Arguments: X: `np.ndarray` of shape (n, 1). Returns: np.ndarray: Cumulative density for X. """ self.check_fit() return norm.cdf(X, loc=self.mean,...
Cumulative distribution function for gaussian distribution. Arguments: X: `np.ndarray` of shape (n, 1). Returns: np.ndarray: Cumulative density for X.
Cumulative distribution function for gaussian distribution.
[ "Cumulative", "distribution", "function", "for", "gaussian", "distribution", "." ]
def cumulative_distribution(self, X): self.check_fit() return norm.cdf(X, loc=self.mean, scale=self.std)
[ "def", "cumulative_distribution", "(", "self", ",", "X", ")", ":", "self", ".", "check_fit", "(", ")", "return", "norm", ".", "cdf", "(", "X", ",", "loc", "=", "self", ".", "mean", ",", "scale", "=", "self", ".", "std", ")" ]
Cumulative distribution function for gaussian distribution.
[ "Cumulative", "distribution", "function", "for", "gaussian", "distribution", "." ]
[ "\"\"\"Cumulative distribution function for gaussian distribution.\n\n Arguments:\n X: `np.ndarray` of shape (n, 1).\n\n Returns:\n np.ndarray: Cumulative density for X.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "X", "type": null } ]
{ "returns": [ { "docstring": "Cumulative density for X.", "docstring_tokens": [ "Cumulative", "density", "for", "X", "." ], "type": "np.ndarray" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "do...
5c0e6461c97c2980b16a92bc6332ccb39e57f198
faisalnawazmir/Copulas
copulas/univariate/gaussian.py
[ "MIT" ]
Python
percent_point
<not_specific>
def percent_point(self, U): """Given a cumulated distribution value, returns a value in original space. Arguments: U: `np.ndarray` of shape (n, 1) and values in [0,1] Returns: `np.ndarray`: Estimated values in original space. """ self.check_fit() ...
Given a cumulated distribution value, returns a value in original space. Arguments: U: `np.ndarray` of shape (n, 1) and values in [0,1] Returns: `np.ndarray`: Estimated values in original space.
Given a cumulated distribution value, returns a value in original space.
[ "Given", "a", "cumulated", "distribution", "value", "returns", "a", "value", "in", "original", "space", "." ]
def percent_point(self, U): self.check_fit() return norm.ppf(U, loc=self.mean, scale=self.std)
[ "def", "percent_point", "(", "self", ",", "U", ")", ":", "self", ".", "check_fit", "(", ")", "return", "norm", ".", "ppf", "(", "U", ",", "loc", "=", "self", ".", "mean", ",", "scale", "=", "self", ".", "std", ")" ]
Given a cumulated distribution value, returns a value in original space.
[ "Given", "a", "cumulated", "distribution", "value", "returns", "a", "value", "in", "original", "space", "." ]
[ "\"\"\"Given a cumulated distribution value, returns a value in original space.\n\n Arguments:\n U: `np.ndarray` of shape (n, 1) and values in [0,1]\n\n Returns:\n `np.ndarray`: Estimated values in original space.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "U", "type": null } ]
{ "returns": [ { "docstring": "Estimated values in original space.", "docstring_tokens": [ "Estimated", "values", "in", "original", "space", "." ], "type": "`np.ndarray`" } ], "raises": [], "params": [ { "identifier": "sel...
5c0e6461c97c2980b16a92bc6332ccb39e57f198
faisalnawazmir/Copulas
copulas/univariate/gaussian.py
[ "MIT" ]
Python
sample
<not_specific>
def sample(self, num_samples=1): """Returns new data point based on model. Arguments: n_samples: `int` Returns: np.ndarray: Generated samples """ self.check_fit() return np.random.normal(self.mean, self.std, num_samples)
Returns new data point based on model. Arguments: n_samples: `int` Returns: np.ndarray: Generated samples
Returns new data point based on model.
[ "Returns", "new", "data", "point", "based", "on", "model", "." ]
def sample(self, num_samples=1): self.check_fit() return np.random.normal(self.mean, self.std, num_samples)
[ "def", "sample", "(", "self", ",", "num_samples", "=", "1", ")", ":", "self", ".", "check_fit", "(", ")", "return", "np", ".", "random", ".", "normal", "(", "self", ".", "mean", ",", "self", ".", "std", ",", "num_samples", ")" ]
Returns new data point based on model.
[ "Returns", "new", "data", "point", "based", "on", "model", "." ]
[ "\"\"\"Returns new data point based on model.\n\n Arguments:\n n_samples: `int`\n\n Returns:\n np.ndarray: Generated samples\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "num_samples", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "np.ndarray" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional":...
5c0e6461c97c2980b16a92bc6332ccb39e57f198
faisalnawazmir/Copulas
copulas/univariate/gaussian.py
[ "MIT" ]
Python
from_dict
<not_specific>
def from_dict(cls, copula_dict): """Set attributes with provided values.""" instance = cls() instance.fitted = copula_dict['fitted'] instance.constant_value = copula_dict['constant_value'] if instance.fitted and instance.constant_value is None: instance.mean = copula...
Set attributes with provided values.
Set attributes with provided values.
[ "Set", "attributes", "with", "provided", "values", "." ]
def from_dict(cls, copula_dict): instance = cls() instance.fitted = copula_dict['fitted'] instance.constant_value = copula_dict['constant_value'] if instance.fitted and instance.constant_value is None: instance.mean = copula_dict['mean'] instance.std = copula_dict...
[ "def", "from_dict", "(", "cls", ",", "copula_dict", ")", ":", "instance", "=", "cls", "(", ")", "instance", ".", "fitted", "=", "copula_dict", "[", "'fitted'", "]", "instance", ".", "constant_value", "=", "copula_dict", "[", "'constant_value'", "]", "if", ...
Set attributes with provided values.
[ "Set", "attributes", "with", "provided", "values", "." ]
[ "\"\"\"Set attributes with provided values.\"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "copula_dict", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "copula_dict", "type": null, "docstring": null, "docstring_toke...
c7d3c831adaf9a6a4071066ba3dce2ae8097df0c
faisalnawazmir/Copulas
copulas/multivariate/tree.py
[ "MIT" ]
Python
_check_contraint
<not_specific>
def _check_contraint(self, edge1, edge2): """Check if two edges satisfy vine constraint. Args: :param edge1: edge object representing edge1 :param edge2: edge object representing edge2 :type edge1: Edge object :type edge2: Edge object Returns: ...
Check if two edges satisfy vine constraint. Args: :param edge1: edge object representing edge1 :param edge2: edge object representing edge2 :type edge1: Edge object :type edge2: Edge object Returns: Boolean True if the two edges satisfy vine ...
Check if two edges satisfy vine constraint.
[ "Check", "if", "two", "edges", "satisfy", "vine", "constraint", "." ]
def _check_contraint(self, edge1, edge2): full_node = set([edge1.L, edge1.R, edge2.L, edge2.R]) full_node.update(edge1.D) full_node.update(edge2.D) return len(full_node) == (self.level + 1)
[ "def", "_check_contraint", "(", "self", ",", "edge1", ",", "edge2", ")", ":", "full_node", "=", "set", "(", "[", "edge1", ".", "L", ",", "edge1", ".", "R", ",", "edge2", ".", "L", ",", "edge2", ".", "R", "]", ")", "full_node", ".", "update", "(",...
Check if two edges satisfy vine constraint.
[ "Check", "if", "two", "edges", "satisfy", "vine", "constraint", "." ]
[ "\"\"\"Check if two edges satisfy vine constraint.\n\n Args:\n :param edge1: edge object representing edge1\n :param edge2: edge object representing edge2\n :type edge1: Edge object\n :type edge2: Edge object\n\n Returns:\n Boolean True if the two...
[ { "param": "self", "type": null }, { "param": "edge1", "type": null }, { "param": "edge2", "type": null } ]
{ "returns": [ { "docstring": "Boolean True if the two edges satisfy vine constraints", "docstring_tokens": [ "Boolean", "True", "if", "the", "two", "edges", "satisfy", "vine", "constraints" ], "type": null } ], ...
c7d3c831adaf9a6a4071066ba3dce2ae8097df0c
faisalnawazmir/Copulas
copulas/multivariate/tree.py
[ "MIT" ]
Python
prepare_next_tree
null
def prepare_next_tree(self): """Prepare conditional U matrix for next tree.""" for edge in self.edges: copula_theta = edge.theta if self.level == 1: left_u = self.u_matrix[:, edge.L] right_u = self.u_matrix[:, edge.R] else: ...
Prepare conditional U matrix for next tree.
Prepare conditional U matrix for next tree.
[ "Prepare", "conditional", "U", "matrix", "for", "next", "tree", "." ]
def prepare_next_tree(self): for edge in self.edges: copula_theta = edge.theta if self.level == 1: left_u = self.u_matrix[:, edge.L] right_u = self.u_matrix[:, edge.R] else: left_parent, right_parent = edge.parents ...
[ "def", "prepare_next_tree", "(", "self", ")", ":", "for", "edge", "in", "self", ".", "edges", ":", "copula_theta", "=", "edge", ".", "theta", "if", "self", ".", "level", "==", "1", ":", "left_u", "=", "self", ".", "u_matrix", "[", ":", ",", "edge", ...
Prepare conditional U matrix for next tree.
[ "Prepare", "conditional", "U", "matrix", "for", "next", "tree", "." ]
[ "\"\"\"Prepare conditional U matrix for next tree.\"\"\"", "# compute conditional cdfs C(i|j) = dC(i,j)/duj and dC(i,j)/du", "# correction of 0 or 1" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c7d3c831adaf9a6a4071066ba3dce2ae8097df0c
faisalnawazmir/Copulas
copulas/multivariate/tree.py
[ "MIT" ]
Python
from_dict
<not_specific>
def from_dict(cls, tree_dict, previous=None): """Create a new instance from a dictionary.""" instance = cls(tree_dict['tree_type']) fitted = tree_dict['fitted'] instance.fitted = fitted if fitted: instance.level = tree_dict['level'] instance.n_nodes = tre...
Create a new instance from a dictionary.
Create a new instance from a dictionary.
[ "Create", "a", "new", "instance", "from", "a", "dictionary", "." ]
def from_dict(cls, tree_dict, previous=None): instance = cls(tree_dict['tree_type']) fitted = tree_dict['fitted'] instance.fitted = fitted if fitted: instance.level = tree_dict['level'] instance.n_nodes = tree_dict['n_nodes'] instance.tau_matrix = np.a...
[ "def", "from_dict", "(", "cls", ",", "tree_dict", ",", "previous", "=", "None", ")", ":", "instance", "=", "cls", "(", "tree_dict", "[", "'tree_type'", "]", ")", "fitted", "=", "tree_dict", "[", "'fitted'", "]", "instance", ".", "fitted", "=", "fitted", ...
Create a new instance from a dictionary.
[ "Create", "a", "new", "instance", "from", "a", "dictionary", "." ]
[ "\"\"\"Create a new instance from a dictionary.\"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "tree_dict", "type": null }, { "param": "previous", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tree_dict", "type": null, "docstring": null, "docstring_tokens...
c7d3c831adaf9a6a4071066ba3dce2ae8097df0c
faisalnawazmir/Copulas
copulas/multivariate/tree.py
[ "MIT" ]
Python
load
<not_specific>
def load(cls, tree_path): """Create a new instance from a file.""" with open(tree_path) as f: tree_dict = json.load(f) return cls.from_dict(tree_dict)
Create a new instance from a file.
Create a new instance from a file.
[ "Create", "a", "new", "instance", "from", "a", "file", "." ]
def load(cls, tree_path): with open(tree_path) as f: tree_dict = json.load(f) return cls.from_dict(tree_dict)
[ "def", "load", "(", "cls", ",", "tree_path", ")", ":", "with", "open", "(", "tree_path", ")", "as", "f", ":", "tree_dict", "=", "json", ".", "load", "(", "f", ")", "return", "cls", ".", "from_dict", "(", "tree_dict", ")" ]
Create a new instance from a file.
[ "Create", "a", "new", "instance", "from", "a", "file", "." ]
[ "\"\"\"Create a new instance from a file.\"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "tree_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tree_path", "type": null, "docstring": null, "docstring_tokens...
c7d3c831adaf9a6a4071066ba3dce2ae8097df0c
faisalnawazmir/Copulas
copulas/multivariate/tree.py
[ "MIT" ]
Python
_build_first_tree
null
def _build_first_tree(self): """Build the first tree with n-1 variable.""" # Prim's algorithm neg_tau = -1.0 * abs(self.tau_matrix) X = {0} while len(X) != self.n_nodes: adj_set = set() for x in X: for k in range(self.n_nodes): ...
Build the first tree with n-1 variable.
Build the first tree with n-1 variable.
[ "Build", "the", "first", "tree", "with", "n", "-", "1", "variable", "." ]
def _build_first_tree(self): neg_tau = -1.0 * abs(self.tau_matrix) X = {0} while len(X) != self.n_nodes: adj_set = set() for x in X: for k in range(self.n_nodes): if k not in X and k != x: adj_set.add((x, k)) ...
[ "def", "_build_first_tree", "(", "self", ")", ":", "neg_tau", "=", "-", "1.0", "*", "abs", "(", "self", ".", "tau_matrix", ")", "X", "=", "{", "0", "}", "while", "len", "(", "X", ")", "!=", "self", ".", "n_nodes", ":", "adj_set", "=", "set", "(",...
Build the first tree with n-1 variable.
[ "Build", "the", "first", "tree", "with", "n", "-", "1", "variable", "." ]
[ "\"\"\"Build the first tree with n-1 variable.\"\"\"", "# Prim's algorithm", "# find edge with maximum" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c7d3c831adaf9a6a4071066ba3dce2ae8097df0c
faisalnawazmir/Copulas
copulas/multivariate/tree.py
[ "MIT" ]
Python
_build_kth_tree
null
def _build_kth_tree(self): """Build tree for level k.""" neg_tau = -1.0 * abs(self.tau_matrix) edges = self.previous_tree.edges visited = set([0]) unvisited = set(range(self.n_nodes)) while len(visited) != self.n_nodes: adj_set = set() for x in vi...
Build tree for level k.
Build tree for level k.
[ "Build", "tree", "for", "level", "k", "." ]
def _build_kth_tree(self): neg_tau = -1.0 * abs(self.tau_matrix) edges = self.previous_tree.edges visited = set([0]) unvisited = set(range(self.n_nodes)) while len(visited) != self.n_nodes: adj_set = set() for x in visited: for k in range(s...
[ "def", "_build_kth_tree", "(", "self", ")", ":", "neg_tau", "=", "-", "1.0", "*", "abs", "(", "self", ".", "tau_matrix", ")", "edges", "=", "self", ".", "previous_tree", ".", "edges", "visited", "=", "set", "(", "[", "0", "]", ")", "unvisited", "=", ...
Build tree for level k.
[ "Build", "tree", "for", "level", "k", "." ]
[ "\"\"\"Build tree for level k.\"\"\"", "# check if (x,k) is a valid edge in the vine", "# find edge with maximum tau" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0a9fca65f2e8773643ce81cde182085ec4d28c90
faisalnawazmir/Copulas
copulas/univariate/kde.py
[ "MIT" ]
Python
fit
null
def fit(self, X): """Fit Kernel density estimation to an list of values. Args: X: 1-d `np.ndarray` or `pd.Series` or `list` datapoints to be estimated from. This function will fit a gaussian_kde model to a list of datapoints and store it as a class attribute. """ ...
Fit Kernel density estimation to an list of values. Args: X: 1-d `np.ndarray` or `pd.Series` or `list` datapoints to be estimated from. This function will fit a gaussian_kde model to a list of datapoints and store it as a class attribute.
Fit Kernel density estimation to an list of values.
[ "Fit", "Kernel", "density", "estimation", "to", "an", "list", "of", "values", "." ]
def fit(self, X): self.constant_value = self._get_constant_value(X) if self.constant_value is None: self.model = scipy.stats.gaussian_kde(X) else: self._replace_constant_methods() self.fitted = True
[ "def", "fit", "(", "self", ",", "X", ")", ":", "self", ".", "constant_value", "=", "self", ".", "_get_constant_value", "(", "X", ")", "if", "self", ".", "constant_value", "is", "None", ":", "self", ".", "model", "=", "scipy", ".", "stats", ".", "gaus...
Fit Kernel density estimation to an list of values.
[ "Fit", "Kernel", "density", "estimation", "to", "an", "list", "of", "values", "." ]
[ "\"\"\"Fit Kernel density estimation to an list of values.\n\n Args:\n X: 1-d `np.ndarray` or `pd.Series` or `list` datapoints to be estimated from.\n\n This function will fit a gaussian_kde model to a list of datapoints\n and store it as a class attribute.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "X", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "X", "type": null, "docstring": "1-d `np.ndarray` or `pd.Series` or ...