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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6b3934ad826855dff168d0197fe9075473c458c0 | olmozavala/eoas-pyutils | viz_utils/eoa_viz.py | [
"MIT"
] | Python | _close_figure | null | def _close_figure(self):
"""Depending on what is disp_images, the figures are displayed or just closed"""
if self._disp_images:
plt.show()
else:
plt.close() | Depending on what is disp_images, the figures are displayed or just closed | Depending on what is disp_images, the figures are displayed or just closed | [
"Depending",
"on",
"what",
"is",
"disp_images",
"the",
"figures",
"are",
"displayed",
"or",
"just",
"closed"
] | def _close_figure(self):
if self._disp_images:
plt.show()
else:
plt.close() | [
"def",
"_close_figure",
"(",
"self",
")",
":",
"if",
"self",
".",
"_disp_images",
":",
"plt",
".",
"show",
"(",
")",
"else",
":",
"plt",
".",
"close",
"(",
")"
] | Depending on what is disp_images, the figures are displayed or just closed | [
"Depending",
"on",
"what",
"is",
"disp_images",
"the",
"figures",
"are",
"displayed",
"or",
"just",
"closed"
] | [
"\"\"\"Depending on what is disp_images, the figures are displayed or just closed\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6b3934ad826855dff168d0197fe9075473c458c0 | olmozavala/eoas-pyutils | viz_utils/eoa_viz.py | [
"MIT"
] | Python | xr_summary | null | def xr_summary(self, ds):
""" Prints a summary of the netcdf (global attributes, variables, etc)
:param ds:
:return:
"""
print("\n========== Global attributes =========")
for name in ds.attrs:
print(F"{name} = {getattr(ds, name)}")
print("\n==========... | Prints a summary of the netcdf (global attributes, variables, etc)
:param ds:
:return:
| Prints a summary of the netcdf (global attributes, variables, etc) | [
"Prints",
"a",
"summary",
"of",
"the",
"netcdf",
"(",
"global",
"attributes",
"variables",
"etc",
")"
] | def xr_summary(self, ds):
print("\n========== Global attributes =========")
for name in ds.attrs:
print(F"{name} = {getattr(ds, name)}")
print("\n========== Dimensions =========")
for name in ds.dims:
print(F"{name}: {ds[name].shape}")
print("\n========== ... | [
"def",
"xr_summary",
"(",
"self",
",",
"ds",
")",
":",
"print",
"(",
"\"\\n========== Global attributes =========\"",
")",
"for",
"name",
"in",
"ds",
".",
"attrs",
":",
"print",
"(",
"F\"{name} = {getattr(ds, name)}\"",
")",
"print",
"(",
"\"\\n========== Dimensions... | Prints a summary of the netcdf (global attributes, variables, etc) | [
"Prints",
"a",
"summary",
"of",
"the",
"netcdf",
"(",
"global",
"attributes",
"variables",
"etc",
")"
] | [
"\"\"\" Prints a summary of the netcdf (global attributes, variables, etc)\n :param ds:\n :return:\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "ds",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
6b3934ad826855dff168d0197fe9075473c458c0 | olmozavala/eoas-pyutils | viz_utils/eoa_viz.py | [
"MIT"
] | Python | nc_summary | null | def nc_summary(self, ds):
""" Prints a summary of the netcdf (global attributes, variables, etc)
:param ds:
:return:
"""
print("\n========== Global attributes =========")
for name in ds.ncattrs():
print(F"{name} = {getattr(ds, name)}")
print("\n====... | Prints a summary of the netcdf (global attributes, variables, etc)
:param ds:
:return:
| Prints a summary of the netcdf (global attributes, variables, etc) | [
"Prints",
"a",
"summary",
"of",
"the",
"netcdf",
"(",
"global",
"attributes",
"variables",
"etc",
")"
] | def nc_summary(self, ds):
print("\n========== Global attributes =========")
for name in ds.ncattrs():
print(F"{name} = {getattr(ds, name)}")
print("\n========== Variables =========")
netCDFvars = ds.variables
for cur_variable_name in netCDFvars.keys():
cur... | [
"def",
"nc_summary",
"(",
"self",
",",
"ds",
")",
":",
"print",
"(",
"\"\\n========== Global attributes =========\"",
")",
"for",
"name",
"in",
"ds",
".",
"ncattrs",
"(",
")",
":",
"print",
"(",
"F\"{name} = {getattr(ds, name)}\"",
")",
"print",
"(",
"\"\\n=====... | Prints a summary of the netcdf (global attributes, variables, etc) | [
"Prints",
"a",
"summary",
"of",
"the",
"netcdf",
"(",
"global",
"attributes",
"variables",
"etc",
")"
] | [
"\"\"\" Prints a summary of the netcdf (global attributes, variables, etc)\n :param ds: \n :return: \n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "ds",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
6b3934ad826855dff168d0197fe9075473c458c0 | olmozavala/eoas-pyutils | viz_utils/eoa_viz.py | [
"MIT"
] | Python | plot_scatter_data | null | def plot_scatter_data(self, lats=None, lons=None, bbox=None, s=1, c='blue', cmap='plasma', title=''):
'''
This function plots points in a map
:param bbox:
:return:
'''
if bbox is None:
bbox = (-180, 180, -90, 90)
if lats is None:
lats = sel... |
This function plots points in a map
:param bbox:
:return:
| This function plots points in a map | [
"This",
"function",
"plots",
"points",
"in",
"a",
"map"
] | def plot_scatter_data(self, lats=None, lons=None, bbox=None, s=1, c='blue', cmap='plasma', title=''):
if bbox is None:
bbox = (-180, 180, -90, 90)
if lats is None:
lats = self.lats
if lons is None:
lons = self.lons
fig, ax = plt.subplots(1, 1, figsize=... | [
"def",
"plot_scatter_data",
"(",
"self",
",",
"lats",
"=",
"None",
",",
"lons",
"=",
"None",
",",
"bbox",
"=",
"None",
",",
"s",
"=",
"1",
",",
"c",
"=",
"'blue'",
",",
"cmap",
"=",
"'plasma'",
",",
"title",
"=",
"''",
")",
":",
"if",
"bbox",
"... | This function plots points in a map | [
"This",
"function",
"plots",
"points",
"in",
"a",
"map"
] | [
"'''\n This function plots points in a map\n :param bbox:\n :return:\n '''",
"# If we do not set this, it will cropp it to the limits of the locations"
] | [
{
"param": "self",
"type": null
},
{
"param": "lats",
"type": null
},
{
"param": "lons",
"type": null
},
{
"param": "bbox",
"type": null
},
{
"param": "s",
"type": null
},
{
"param": "c",
"type": null
},
{
"param": "cmap",
"type": null
... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
6b3934ad826855dff168d0197fe9075473c458c0 | olmozavala/eoas-pyutils | viz_utils/eoa_viz.py | [
"MIT"
] | Python | plot_3d_data_npdict | null | def plot_3d_data_npdict(self, np_variables:list, var_names:list, z_levels= [], title='',
file_name_prefix='', cmap=None, z_names = [],
show_color_bar=True, plot_mode=PlotMode.RASTER, mincbar=np.nan, maxcbar=np.nan):
"""
Plots multiple z_levels for mult... |
Plots multiple z_levels for multiple fields.
It uses rows for each depth, and columns for each variable
| Plots multiple z_levels for multiple fields.
It uses rows for each depth, and columns for each variable | [
"Plots",
"multiple",
"z_levels",
"for",
"multiple",
"fields",
".",
"It",
"uses",
"rows",
"for",
"each",
"depth",
"and",
"columns",
"for",
"each",
"variable"
] | def plot_3d_data_npdict(self, np_variables:list, var_names:list, z_levels= [], title='',
file_name_prefix='', cmap=None, z_names = [],
show_color_bar=True, plot_mode=PlotMode.RASTER, mincbar=np.nan, maxcbar=np.nan):
create_folder(self._output_folder)
o... | [
"def",
"plot_3d_data_npdict",
"(",
"self",
",",
"np_variables",
":",
"list",
",",
"var_names",
":",
"list",
",",
"z_levels",
"=",
"[",
"]",
",",
"title",
"=",
"''",
",",
"file_name_prefix",
"=",
"''",
",",
"cmap",
"=",
"None",
",",
"z_names",
"=",
"[",... | Plots multiple z_levels for multiple fields. | [
"Plots",
"multiple",
"z_levels",
"for",
"multiple",
"fields",
"."
] | [
"\"\"\"\n Plots multiple z_levels for multiple fields.\n It uses rows for each depth, and columns for each variable\n \"\"\"",
"# If the user do not requires any z-leve, then all are plotted",
"# Iterates over the z-levels",
"# Verify the index of the z_levels are the original ones.",
"... | [
{
"param": "self",
"type": null
},
{
"param": "np_variables",
"type": "list"
},
{
"param": "var_names",
"type": "list"
},
{
"param": "z_levels",
"type": null
},
{
"param": "title",
"type": null
},
{
"param": "file_name_prefix",
"type": null
},
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "np_variables",
"type": "list",
"docstring": null,
"docstring_... |
6b3934ad826855dff168d0197fe9075473c458c0 | olmozavala/eoas-pyutils | viz_utils/eoa_viz.py | [
"MIT"
] | Python | plot_2d_data_xr | null | def plot_2d_data_xr(self, np_variables:list, var_names:list, title='',
file_name_prefix='', cmap='viridis', show_color_bar=True, plot_mode=PlotMode.RASTER, mincbar=np.nan, maxcbar=np.nan):
'''
Wrapper function to receive raw 2D numpy data. It calls the 'main' function for 3D... |
Wrapper function to receive raw 2D numpy data. It calls the 'main' function for 3D plotting
:param np_variables:
:param var_names:
:param title:
:param file_name_prefix:
:param cmap:
:param flip_data:
:param rot_90:
:param show_color_bar:
... | Wrapper function to receive raw 2D numpy data. It calls the 'main' function for 3D plotting | [
"Wrapper",
"function",
"to",
"receive",
"raw",
"2D",
"numpy",
"data",
".",
"It",
"calls",
"the",
"'",
"main",
"'",
"function",
"for",
"3D",
"plotting"
] | def plot_2d_data_xr(self, np_variables:list, var_names:list, title='',
file_name_prefix='', cmap='viridis', show_color_bar=True, plot_mode=PlotMode.RASTER, mincbar=np.nan, maxcbar=np.nan):
npdict_3d = {}
for i, field_name in enumerate(var_names):
npdict_3d[field_... | [
"def",
"plot_2d_data_xr",
"(",
"self",
",",
"np_variables",
":",
"list",
",",
"var_names",
":",
"list",
",",
"title",
"=",
"''",
",",
"file_name_prefix",
"=",
"''",
",",
"cmap",
"=",
"'viridis'",
",",
"show_color_bar",
"=",
"True",
",",
"plot_mode",
"=",
... | Wrapper function to receive raw 2D numpy data. | [
"Wrapper",
"function",
"to",
"receive",
"raw",
"2D",
"numpy",
"data",
"."
] | [
"'''\n Wrapper function to receive raw 2D numpy data. It calls the 'main' function for 3D plotting\n :param np_variables:\n :param var_names:\n :param title:\n :param file_name_prefix:\n :param cmap:\n :param flip_data:\n :param rot_90:\n :param show_co... | [
{
"param": "self",
"type": null
},
{
"param": "np_variables",
"type": "list"
},
{
"param": "var_names",
"type": "list"
},
{
"param": "title",
"type": null
},
{
"param": "file_name_prefix",
"type": null
},
{
"param": "cmap",
"type": null
},
{
... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
6b3934ad826855dff168d0197fe9075473c458c0 | olmozavala/eoas-pyutils | viz_utils/eoa_viz.py | [
"MIT"
] | Python | plot_2d_data_np | null | def plot_2d_data_np(self, np_variables:list, var_names:list, title='',
file_name_prefix='', cmap=None, flip_data=False,
rot_90=False, show_color_bar=True, plot_mode=PlotMode.RASTER, mincbar=np.nan, maxcbar=np.nan):
'''
Wrapper function to receive ... |
Wrapper function to receive raw 2D numpy data. It calls the 'main' function for 3D plotting
:param np_variables: Numpy variables. They can be with shape [fields, x, y] or just a single field with shape [x,y]
:param var_names:
:param title:
:param file_name_prefix:
:para... | Wrapper function to receive raw 2D numpy data. It calls the 'main' function for 3D plotting | [
"Wrapper",
"function",
"to",
"receive",
"raw",
"2D",
"numpy",
"data",
".",
"It",
"calls",
"the",
"'",
"main",
"'",
"function",
"for",
"3D",
"plotting"
] | def plot_2d_data_np(self, np_variables:list, var_names:list, title='',
file_name_prefix='', cmap=None, flip_data=False,
rot_90=False, show_color_bar=True, plot_mode=PlotMode.RASTER, mincbar=np.nan, maxcbar=np.nan):
npdict_3d = {}
for i, field_name... | [
"def",
"plot_2d_data_np",
"(",
"self",
",",
"np_variables",
":",
"list",
",",
"var_names",
":",
"list",
",",
"title",
"=",
"''",
",",
"file_name_prefix",
"=",
"''",
",",
"cmap",
"=",
"None",
",",
"flip_data",
"=",
"False",
",",
"rot_90",
"=",
"False",
... | Wrapper function to receive raw 2D numpy data. | [
"Wrapper",
"function",
"to",
"receive",
"raw",
"2D",
"numpy",
"data",
"."
] | [
"'''\n Wrapper function to receive raw 2D numpy data. It calls the 'main' function for 3D plotting\n :param np_variables: Numpy variables. They can be with shape [fields, x, y] or just a single field with shape [x,y]\n :param var_names:\n :param title:\n :param file_name_prefix:\... | [
{
"param": "self",
"type": null
},
{
"param": "np_variables",
"type": "list"
},
{
"param": "var_names",
"type": "list"
},
{
"param": "title",
"type": null
},
{
"param": "file_name_prefix",
"type": null
},
{
"param": "cmap",
"type": null
},
{
... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
3aa9fb3e04c94c0f7f64980510b11a77dbfc0ae8 | olmozavala/eoas-pyutils | proc_utils/proj.py | [
"MIT"
] | Python | haversine | <not_specific> | def haversine(p1, p2):
"""
Calculate the great circle distance between two points
on the earth (specified in decimal degrees)
All args must be of equal length.
# Points in lat lon order
"""
p1, p2 = map(np.radians, [p1, p2])
dlat = p1[0] - p2[0]
dlon = p1[1] - p2[1]
a = np.sin... |
Calculate the great circle distance between two points
on the earth (specified in decimal degrees)
All args must be of equal length.
# Points in lat lon order
| Calculate the great circle distance between two points
on the earth (specified in decimal degrees)
All args must be of equal length.
Points in lat lon order | [
"Calculate",
"the",
"great",
"circle",
"distance",
"between",
"two",
"points",
"on",
"the",
"earth",
"(",
"specified",
"in",
"decimal",
"degrees",
")",
"All",
"args",
"must",
"be",
"of",
"equal",
"length",
".",
"Points",
"in",
"lat",
"lon",
"order"
] | def haversine(p1, p2):
p1, p2 = map(np.radians, [p1, p2])
dlat = p1[0] - p2[0]
dlon = p1[1] - p2[1]
a = np.sin(dlat/2.0)**2 + np.cos(p1[0]) * np.cos(p2[0]) * np.sin(dlon/2.0)**2
c = 2 * np.arcsin(np.sqrt(a))
dist = 6371000 * c
return dist | [
"def",
"haversine",
"(",
"p1",
",",
"p2",
")",
":",
"p1",
",",
"p2",
"=",
"map",
"(",
"np",
".",
"radians",
",",
"[",
"p1",
",",
"p2",
"]",
")",
"dlat",
"=",
"p1",
"[",
"0",
"]",
"-",
"p2",
"[",
"0",
"]",
"dlon",
"=",
"p1",
"[",
"1",
"]... | Calculate the great circle distance between two points
on the earth (specified in decimal degrees) | [
"Calculate",
"the",
"great",
"circle",
"distance",
"between",
"two",
"points",
"on",
"the",
"earth",
"(",
"specified",
"in",
"decimal",
"degrees",
")"
] | [
"\"\"\"\n Calculate the great circle distance between two points\n on the earth (specified in decimal degrees)\n\n All args must be of equal length.\n # Points in lat lon order\n \"\"\"",
"# [m]"
] | [
{
"param": "p1",
"type": null
},
{
"param": "p2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p2",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
3aa9fb3e04c94c0f7f64980510b11a77dbfc0ae8 | olmozavala/eoas-pyutils | proc_utils/proj.py | [
"MIT"
] | Python | haversineForGrid | <not_specific> | def haversineForGrid(grid):
"""
This function is used to obtain vertical and horizontal distances inside a grid
:param grid:
:return:
"""
grid_rad = list(map(np.radians, grid))
lat_rad = grid_rad[1]
lon_rad = grid_rad[0]
dlat = lat_rad[1:,:] - lat_rad[:-1,:]
dlon = lon_rad[:,1:]... |
This function is used to obtain vertical and horizontal distances inside a grid
:param grid:
:return:
| This function is used to obtain vertical and horizontal distances inside a grid | [
"This",
"function",
"is",
"used",
"to",
"obtain",
"vertical",
"and",
"horizontal",
"distances",
"inside",
"a",
"grid"
] | def haversineForGrid(grid):
grid_rad = list(map(np.radians, grid))
lat_rad = grid_rad[1]
lon_rad = grid_rad[0]
dlat = lat_rad[1:,:] - lat_rad[:-1,:]
dlon = lon_rad[:,1:] - lon_rad[:,:-1]
out_dims = (2, grid[0].shape[0]-1,grid[0].shape[1]-1)
output = np.zeros(out_dims)
for c_col in range(... | [
"def",
"haversineForGrid",
"(",
"grid",
")",
":",
"grid_rad",
"=",
"list",
"(",
"map",
"(",
"np",
".",
"radians",
",",
"grid",
")",
")",
"lat_rad",
"=",
"grid_rad",
"[",
"1",
"]",
"lon_rad",
"=",
"grid_rad",
"[",
"0",
"]",
"dlat",
"=",
"lat_rad",
"... | This function is used to obtain vertical and horizontal distances inside a grid | [
"This",
"function",
"is",
"used",
"to",
"obtain",
"vertical",
"and",
"horizontal",
"distances",
"inside",
"a",
"grid"
] | [
"\"\"\"\n This function is used to obtain vertical and horizontal distances inside a grid\n :param grid:\n :return:\n \"\"\"",
"# We are creating horizontal and vertical distances",
"# Filling by cols",
"# [m]"
] | [
{
"param": "grid",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "grid",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
685383f7a7bccb5a9227a5025cafb267305caed4 | Rhcsky/cifar100-classification | utils.py | [
"MIT"
] | Python | accuracy | <not_specific> | def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.reshape(1, -1).expand_as(pred))
res = []
for k in topk:... | Computes the precision@k for the specified values of k | Computes the precision@k for the specified values of k | [
"Computes",
"the",
"precision@k",
"for",
"the",
"specified",
"values",
"of",
"k"
] | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.reshape(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].reshape(-1).float().sum(0, keepdim... | [
"def",
"accuracy",
"(",
"output",
",",
"target",
",",
"topk",
"=",
"(",
"1",
",",
")",
")",
":",
"maxk",
"=",
"max",
"(",
"topk",
")",
"batch_size",
"=",
"target",
".",
"size",
"(",
"0",
")",
"_",
",",
"pred",
"=",
"output",
".",
"topk",
"(",
... | Computes the precision@k for the specified values of k | [
"Computes",
"the",
"precision@k",
"for",
"the",
"specified",
"values",
"of",
"k"
] | [
"\"\"\"Computes the precision@k for the specified values of k\"\"\""
] | [
{
"param": "output",
"type": null
},
{
"param": "target",
"type": null
},
{
"param": "topk",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_tokens... |
6a8ad8a181620a70ff97488bb9288ffece004233 | skrepkaq/Battleships | server/game/board.py | [
"MIT"
] | Python | shot | <not_specific> | def shot(self, num):
'''
Shot
Returns False if it's imposible to shot
Or board and change_turn=True in case of miss
'''
change_turn = False
x = num % 10
y = int(num/10)
brd = self.board
if brd[y][x] in (Cell.DEAD, Cell.MISS, Cell.HIT): retu... |
Shot
Returns False if it's imposible to shot
Or board and change_turn=True in case of miss
| Shot
Returns False if it's imposible to shot
Or board and change_turn=True in case of miss | [
"Shot",
"Returns",
"False",
"if",
"it",
"'",
"s",
"imposible",
"to",
"shot",
"Or",
"board",
"and",
"change_turn",
"=",
"True",
"in",
"case",
"of",
"miss"
] | def shot(self, num):
change_turn = False
x = num % 10
y = int(num/10)
brd = self.board
if brd[y][x] in (Cell.DEAD, Cell.MISS, Cell.HIT): return False
if brd[y][x] == Cell.EMPTY:
brd[y][x] = Cell.MISS
change_turn = True
else:
brd... | [
"def",
"shot",
"(",
"self",
",",
"num",
")",
":",
"change_turn",
"=",
"False",
"x",
"=",
"num",
"%",
"10",
"y",
"=",
"int",
"(",
"num",
"/",
"10",
")",
"brd",
"=",
"self",
".",
"board",
"if",
"brd",
"[",
"y",
"]",
"[",
"x",
"]",
"in",
"(",
... | Shot
Returns False if it's imposible to shot
Or board and change_turn=True in case of miss | [
"Shot",
"Returns",
"False",
"if",
"it",
"'",
"s",
"imposible",
"to",
"shot",
"Or",
"board",
"and",
"change_turn",
"=",
"True",
"in",
"case",
"of",
"miss"
] | [
"'''\n Shot\n Returns False if it's imposible to shot\n Or board and change_turn=True in case of miss\n '''",
"# copy board but hide alive ships"
] | [
{
"param": "self",
"type": null
},
{
"param": "num",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num",
"type": null,
"docstring": null,
"docstring_tokens": []... |
6a8ad8a181620a70ff97488bb9288ffece004233 | skrepkaq/Battleships | server/game/board.py | [
"MIT"
] | Python | count_ships | set | def count_ships(self) -> set:
'''
Returns set of cells with errors in placing
'''
def check_ship_vertical(x, y):
# returns True if ship is vertical
if 0 <= y-1 < 10:
if self.board[y-1][x] == Cell.SHIP: return True
if 0 <= y+1 < 10:
... |
Returns set of cells with errors in placing
| Returns set of cells with errors in placing | [
"Returns",
"set",
"of",
"cells",
"with",
"errors",
"in",
"placing"
] | def count_ships(self) -> set:
def check_ship_vertical(x, y):
if 0 <= y-1 < 10:
if self.board[y-1][x] == Cell.SHIP: return True
if 0 <= y+1 < 10:
if self.board[y+1][x] == Cell.SHIP: return True
return False
def check_ship_end(x, y, swap)... | [
"def",
"count_ships",
"(",
"self",
")",
"->",
"set",
":",
"def",
"check_ship_vertical",
"(",
"x",
",",
"y",
")",
":",
"if",
"0",
"<=",
"y",
"-",
"1",
"<",
"10",
":",
"if",
"self",
".",
"board",
"[",
"y",
"-",
"1",
"]",
"[",
"x",
"]",
"==",
... | Returns set of cells with errors in placing | [
"Returns",
"set",
"of",
"cells",
"with",
"errors",
"in",
"placing"
] | [
"'''\n Returns set of cells with errors in placing\n '''",
"# returns True if ship is vertical",
"# checks if next cell is empty or border",
"# checks if ships are touching corners",
"# set of cells with errors",
"# swap 0-count horisontal ships 1-vertical ships",
"# swap x and y to count ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f1fbf506d4dd3a169f085fcfc458bb5088e961ef | ondrejdyck/sidpy | sidpy/viz/plot_utils/curve.py | [
"MIT"
] | Python | cbar_for_line_plot | <not_specific> | def cbar_for_line_plot(axis, num_steps, discrete_ticks=True, **kwargs):
"""
Adds a colorbar next to a line plot axis
Parameters
----------
axis : matplotlib.axes.Axes
Axis with multiple line objects
num_steps : uint
Number of steps in the colorbar
discrete_ticks : (optional)... |
Adds a colorbar next to a line plot axis
Parameters
----------
axis : matplotlib.axes.Axes
Axis with multiple line objects
num_steps : uint
Number of steps in the colorbar
discrete_ticks : (optional) bool
Whether or not to have the ticks match the number of number of st... | Adds a colorbar next to a line plot axis
Parameters
axis : matplotlib.axes.Axes
Axis with multiple line objects
num_steps : uint
Number of steps in the colorbar
discrete_ticks : (optional) bool
Whether or not to have the ticks match the number of number of steps. Default = True | [
"Adds",
"a",
"colorbar",
"next",
"to",
"a",
"line",
"plot",
"axis",
"Parameters",
"axis",
":",
"matplotlib",
".",
"axes",
".",
"Axes",
"Axis",
"with",
"multiple",
"line",
"objects",
"num_steps",
":",
"uint",
"Number",
"of",
"steps",
"in",
"the",
"colorbar"... | def cbar_for_line_plot(axis, num_steps, discrete_ticks=True, **kwargs):
if not isinstance(axis, mpl.axes.Axes):
raise TypeError('axis must be a matplotlib.axes.Axes object')
if not isinstance(num_steps, int) and num_steps > 0:
raise TypeError('num_steps must be a whole number')
assert isinst... | [
"def",
"cbar_for_line_plot",
"(",
"axis",
",",
"num_steps",
",",
"discrete_ticks",
"=",
"True",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"axis",
",",
"mpl",
".",
"axes",
".",
"Axes",
")",
":",
"raise",
"TypeError",
"(",
"'axis must ... | Adds a colorbar next to a line plot axis
Parameters | [
"Adds",
"a",
"colorbar",
"next",
"to",
"a",
"line",
"plot",
"axis",
"Parameters"
] | [
"\"\"\"\n Adds a colorbar next to a line plot axis\n\n Parameters\n ----------\n axis : matplotlib.axes.Axes\n Axis with multiple line objects\n num_steps : uint\n Number of steps in the colorbar\n discrete_ticks : (optional) bool\n Whether or not to have the ticks match the n... | [
{
"param": "axis",
"type": null
},
{
"param": "num_steps",
"type": null
},
{
"param": "discrete_ticks",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "axis",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_steps",
"type": null,
"docstring": null,
"docstring_token... |
f1fbf506d4dd3a169f085fcfc458bb5088e961ef | ondrejdyck/sidpy | sidpy/viz/plot_utils/curve.py | [
"MIT"
] | Python | rainbow_plot | null | def rainbow_plot(axis, x_vec, y_vec, num_steps=32, **kwargs):
"""
Plots the input against the output vector such that the color of the curve changes as a function of index
Parameters
----------
axis : matplotlib.axes.Axes object
Axis to plot the curve
x_vec : 1D float numpy array
... |
Plots the input against the output vector such that the color of the curve changes as a function of index
Parameters
----------
axis : matplotlib.axes.Axes object
Axis to plot the curve
x_vec : 1D float numpy array
vector that forms the X axis
y_vec : 1D float numpy array
... | Plots the input against the output vector such that the color of the curve changes as a function of index
Parameters
axis : matplotlib.axes.Axes object
Axis to plot the curve
x_vec : 1D float numpy array
vector that forms the X axis
y_vec : 1D float numpy array
vector that forms the Y axis
num_steps : unsigned int (Op... | [
"Plots",
"the",
"input",
"against",
"the",
"output",
"vector",
"such",
"that",
"the",
"color",
"of",
"the",
"curve",
"changes",
"as",
"a",
"function",
"of",
"index",
"Parameters",
"axis",
":",
"matplotlib",
".",
"axes",
".",
"Axes",
"object",
"Axis",
"to",... | def rainbow_plot(axis, x_vec, y_vec, num_steps=32, **kwargs):
if not isinstance(axis, mpl.axes.Axes):
raise TypeError('axis must be a matplotlib.axes.Axes object')
if not isinstance(x_vec, (list, tuple, np.ndarray, da.core.Array)):
raise TypeError('x_vec must be array-like of numbers')
if no... | [
"def",
"rainbow_plot",
"(",
"axis",
",",
"x_vec",
",",
"y_vec",
",",
"num_steps",
"=",
"32",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"axis",
",",
"mpl",
".",
"axes",
".",
"Axes",
")",
":",
"raise",
"TypeError",
"(",
"'axis must... | Plots the input against the output vector such that the color of the curve changes as a function of index
Parameters | [
"Plots",
"the",
"input",
"against",
"the",
"output",
"vector",
"such",
"that",
"the",
"color",
"of",
"the",
"curve",
"changes",
"as",
"a",
"function",
"of",
"index",
"Parameters"
] | [
"\"\"\"\n Plots the input against the output vector such that the color of the curve changes as a function of index\n\n Parameters\n ----------\n axis : matplotlib.axes.Axes object\n Axis to plot the curve\n x_vec : 1D float numpy array\n vector that forms the X axis\n y_vec : 1D flo... | [
{
"param": "axis",
"type": null
},
{
"param": "x_vec",
"type": null
},
{
"param": "y_vec",
"type": null
},
{
"param": "num_steps",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "axis",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x_vec",
"type": null,
"docstring": null,
"docstring_tokens": ... |
f1fbf506d4dd3a169f085fcfc458bb5088e961ef | ondrejdyck/sidpy | sidpy/viz/plot_utils/curve.py | [
"MIT"
] | Python | plot_line_family | null | def plot_line_family(axis, x_vec, line_family, line_names=None, label_prefix='', label_suffix='',
y_offset=0, show_cbar=False, **kwargs):
"""
Plots a family of lines with a sequence of colors
Parameters
----------
axis : matplotlib.axes.Axes object
Axis to plot the curv... |
Plots a family of lines with a sequence of colors
Parameters
----------
axis : matplotlib.axes.Axes object
Axis to plot the curve
x_vec : array-like
Values to plot against
line_family : 2D numpy array
family of curves arranged as [curve_index, features]
line_names :... | Plots a family of lines with a sequence of colors
Parameters
| [
"Plots",
"a",
"family",
"of",
"lines",
"with",
"a",
"sequence",
"of",
"colors",
"Parameters"
] | def plot_line_family(axis, x_vec, line_family, line_names=None, label_prefix='', label_suffix='',
y_offset=0, show_cbar=False, **kwargs):
if not isinstance(axis, mpl.axes.Axes):
raise TypeError('axis must be a matplotlib.axes.Axes object')
if not isinstance(x_vec, (list, tuple, np.n... | [
"def",
"plot_line_family",
"(",
"axis",
",",
"x_vec",
",",
"line_family",
",",
"line_names",
"=",
"None",
",",
"label_prefix",
"=",
"''",
",",
"label_suffix",
"=",
"''",
",",
"y_offset",
"=",
"0",
",",
"show_cbar",
"=",
"False",
",",
"**",
"kwargs",
")",... | Plots a family of lines with a sequence of colors
Parameters | [
"Plots",
"a",
"family",
"of",
"lines",
"with",
"a",
"sequence",
"of",
"colors",
"Parameters"
] | [
"\"\"\"\n Plots a family of lines with a sequence of colors\n\n Parameters\n ----------\n axis : matplotlib.axes.Axes object\n Axis to plot the curve\n x_vec : array-like\n Values to plot against\n line_family : 2D numpy array\n family of curves arranged as [curve_index, featu... | [
{
"param": "axis",
"type": null
},
{
"param": "x_vec",
"type": null
},
{
"param": "line_family",
"type": null
},
{
"param": "line_names",
"type": null
},
{
"param": "label_prefix",
"type": null
},
{
"param": "label_suffix",
"type": null
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "axis",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x_vec",
"type": null,
"docstring": null,
"docstring_tokens": ... |
16f3ff321718a70aea0f904278d73e170a22f8bb | ondrejdyck/sidpy | sidpy/proc/comp_utils.py | [
"MIT"
] | Python | group_ranks_by_socket | <not_specific> | def group_ranks_by_socket(verbose=False):
"""
Groups MPI ranks in COMM_WORLD by socket. Another way to think about this
is that it assigns a master rank for each rank such that there is a single
master rank per socket (CPU). The results from this function can be used to
split MPI communicators based... |
Groups MPI ranks in COMM_WORLD by socket. Another way to think about this
is that it assigns a master rank for each rank such that there is a single
master rank per socket (CPU). The results from this function can be used to
split MPI communicators based on the socket for intra-node communication.
... | Groups MPI ranks in COMM_WORLD by socket. Another way to think about this
is that it assigns a master rank for each rank such that there is a single
master rank per socket (CPU). The results from this function can be used to
split MPI communicators based on the socket for intra-node communication.
Parameters
verbose ... | [
"Groups",
"MPI",
"ranks",
"in",
"COMM_WORLD",
"by",
"socket",
".",
"Another",
"way",
"to",
"think",
"about",
"this",
"is",
"that",
"it",
"assigns",
"a",
"master",
"rank",
"for",
"each",
"rank",
"such",
"that",
"there",
"is",
"a",
"single",
"master",
"ran... | def group_ranks_by_socket(verbose=False):
MPI = get_MPI()
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()
sendbuf = MPI.Get_processor_name()
if verbose:
print('Rank: ', rank, ', sendbuf: ', sendbuf)
recvbuf = comm.allgather(sendbuf)
if verbose and rank == 0:
... | [
"def",
"group_ranks_by_socket",
"(",
"verbose",
"=",
"False",
")",
":",
"MPI",
"=",
"get_MPI",
"(",
")",
"comm",
"=",
"MPI",
".",
"COMM_WORLD",
"size",
"=",
"comm",
".",
"Get_size",
"(",
")",
"rank",
"=",
"comm",
".",
"Get_rank",
"(",
")",
"sendbuf",
... | Groups MPI ranks in COMM_WORLD by socket. | [
"Groups",
"MPI",
"ranks",
"in",
"COMM_WORLD",
"by",
"socket",
"."
] | [
"\"\"\"\n Groups MPI ranks in COMM_WORLD by socket. Another way to think about this\n is that it assigns a master rank for each rank such that there is a single\n master rank per socket (CPU). The results from this function can be used to\n split MPI communicators based on the socket for intra-node comm... | [
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "verbose",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
16f3ff321718a70aea0f904278d73e170a22f8bb | ondrejdyck/sidpy | sidpy/proc/comp_utils.py | [
"MIT"
] | Python | parallel_compute | <not_specific> | def parallel_compute(data, func, cores=None, lengthy_computation=False,
func_args=None, func_kwargs=None, verbose=False,
joblib_backend='multiprocessing'):
"""
Computes the provided function using multiple cores using the joblib
library
Parameters
---------... |
Computes the provided function using multiple cores using the joblib
library
Parameters
----------
data : numpy.ndarray
Data to map function to. Function will be mapped to the first axis of
data
func : callable
Function to map to data
cores : uint, optional
... | Computes the provided function using multiple cores using the joblib
library
Parameters
data : numpy.ndarray
Data to map function to. Function will be mapped to the first axis of
data
func : callable
Function to map to data
cores : uint, optional
Number of logical cores to use to compute
Default - All cores - 1 (tota... | [
"Computes",
"the",
"provided",
"function",
"using",
"multiple",
"cores",
"using",
"the",
"joblib",
"library",
"Parameters",
"data",
":",
"numpy",
".",
"ndarray",
"Data",
"to",
"map",
"function",
"to",
".",
"Function",
"will",
"be",
"mapped",
"to",
"the",
"fi... | def parallel_compute(data, func, cores=None, lengthy_computation=False,
func_args=None, func_kwargs=None, verbose=False,
joblib_backend='multiprocessing'):
if not callable(func):
raise TypeError('Function argument is not callable')
if not isinstance(data, np.nda... | [
"def",
"parallel_compute",
"(",
"data",
",",
"func",
",",
"cores",
"=",
"None",
",",
"lengthy_computation",
"=",
"False",
",",
"func_args",
"=",
"None",
",",
"func_kwargs",
"=",
"None",
",",
"verbose",
"=",
"False",
",",
"joblib_backend",
"=",
"'multiprocess... | Computes the provided function using multiple cores using the joblib
library | [
"Computes",
"the",
"provided",
"function",
"using",
"multiple",
"cores",
"using",
"the",
"joblib",
"library"
] | [
"\"\"\"\n Computes the provided function using multiple cores using the joblib\n library\n\n Parameters\n ----------\n data : numpy.ndarray\n Data to map function to. Function will be mapped to the first axis of\n data\n func : callable\n Function to map to data\n cores : u... | [
{
"param": "data",
"type": null
},
{
"param": "func",
"type": null
},
{
"param": "cores",
"type": null
},
{
"param": "lengthy_computation",
"type": null
},
{
"param": "func_args",
"type": null
},
{
"param": "func_kwargs",
"type": null
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "func",
"type": null,
"docstring": null,
"docstring_tokens": [... |
16f3ff321718a70aea0f904278d73e170a22f8bb | ondrejdyck/sidpy | sidpy/proc/comp_utils.py | [
"MIT"
] | Python | recommend_cpu_cores | <not_specific> | def recommend_cpu_cores(num_jobs, requested_cores=None, min_free_cores=None,
lengthy_computation=False, verbose=False):
"""
Decides the number of cores to use for parallel computing
Parameters
----------
num_jobs : unsigned int
Number of times a parallel operation ne... |
Decides the number of cores to use for parallel computing
Parameters
----------
num_jobs : unsigned int
Number of times a parallel operation needs to be performed
requested_cores : unsigned int (Optional. Default = None)
Number of logical cores to use for computation
lengthy_co... | Decides the number of cores to use for parallel computing
Parameters
num_jobs : unsigned int
Number of times a parallel operation needs to be performed
requested_cores : unsigned int (Optional. Default = None)
Number of logical cores to use for computation
lengthy_computation : Boolean (Optional. Default = False)
Whet... | [
"Decides",
"the",
"number",
"of",
"cores",
"to",
"use",
"for",
"parallel",
"computing",
"Parameters",
"num_jobs",
":",
"unsigned",
"int",
"Number",
"of",
"times",
"a",
"parallel",
"operation",
"needs",
"to",
"be",
"performed",
"requested_cores",
":",
"unsigned",... | def recommend_cpu_cores(num_jobs, requested_cores=None, min_free_cores=None,
lengthy_computation=False, verbose=False):
logical_cores = cpu_count()
if min_free_cores is not None:
if not isinstance(min_free_cores, int):
raise TypeError('min_free_cores should be an unsi... | [
"def",
"recommend_cpu_cores",
"(",
"num_jobs",
",",
"requested_cores",
"=",
"None",
",",
"min_free_cores",
"=",
"None",
",",
"lengthy_computation",
"=",
"False",
",",
"verbose",
"=",
"False",
")",
":",
"logical_cores",
"=",
"cpu_count",
"(",
")",
"if",
"min_fr... | Decides the number of cores to use for parallel computing
Parameters | [
"Decides",
"the",
"number",
"of",
"cores",
"to",
"use",
"for",
"parallel",
"computing",
"Parameters"
] | [
"\"\"\"\n Decides the number of cores to use for parallel computing\n\n Parameters\n ----------\n num_jobs : unsigned int\n Number of times a parallel operation needs to be performed\n requested_cores : unsigned int (Optional. Default = None)\n Number of logical cores to use for computa... | [
{
"param": "num_jobs",
"type": null
},
{
"param": "requested_cores",
"type": null
},
{
"param": "min_free_cores",
"type": null
},
{
"param": "lengthy_computation",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "num_jobs",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "requested_cores",
"type": null,
"docstring": null,
"docst... |
238fa453d1913b59f98ba5fc8e5d9a4a7868d424 | ondrejdyck/sidpy | sidpy/hdf/reg_ref.py | [
"MIT"
] | Python | clean_reg_ref | <not_specific> | def clean_reg_ref(h5_dset, reg_ref_tuple, verbose=False):
"""
Makes sure that the provided instructions for a region reference are indeed
valid. This method has become necessary since h5py allows the writing of
region references larger than the maxshape
Parameters
----------
h5_dset : h5.Da... |
Makes sure that the provided instructions for a region reference are indeed
valid. This method has become necessary since h5py allows the writing of
region references larger than the maxshape
Parameters
----------
h5_dset : h5.Dataset instance
Dataset to which region references will be... | Makes sure that the provided instructions for a region reference are indeed
valid. This method has become necessary since h5py allows the writing of
region references larger than the maxshape
Parameters
h5_dset : h5.Dataset instance
Dataset to which region references will be added as attributes
reg_ref_tuple : list /... | [
"Makes",
"sure",
"that",
"the",
"provided",
"instructions",
"for",
"a",
"region",
"reference",
"are",
"indeed",
"valid",
".",
"This",
"method",
"has",
"become",
"necessary",
"since",
"h5py",
"allows",
"the",
"writing",
"of",
"region",
"references",
"larger",
"... | def clean_reg_ref(h5_dset, reg_ref_tuple, verbose=False):
if not isinstance(reg_ref_tuple, (tuple, dict, slice)):
raise TypeError('slices should be a tuple, list, or slice but is '
'instead of type {}'.format(type(reg_ref_tuple)))
if not isinstance(h5_dset, h5py.Dataset):
... | [
"def",
"clean_reg_ref",
"(",
"h5_dset",
",",
"reg_ref_tuple",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"reg_ref_tuple",
",",
"(",
"tuple",
",",
"dict",
",",
"slice",
")",
")",
":",
"raise",
"TypeError",
"(",
"'slices should b... | Makes sure that the provided instructions for a region reference are indeed
valid. | [
"Makes",
"sure",
"that",
"the",
"provided",
"instructions",
"for",
"a",
"region",
"reference",
"are",
"indeed",
"valid",
"."
] | [
"\"\"\"\n Makes sure that the provided instructions for a region reference are indeed\n valid. This method has become necessary since h5py allows the writing of\n region references larger than the maxshape\n\n Parameters\n ----------\n h5_dset : h5.Dataset instance\n Dataset to which region... | [
{
"param": "h5_dset",
"type": null
},
{
"param": "reg_ref_tuple",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "h5_dset",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg_ref_tuple",
"type": null,
"docstring": null,
"docstrin... |
238fa453d1913b59f98ba5fc8e5d9a4a7868d424 | ondrejdyck/sidpy | sidpy/hdf/reg_ref.py | [
"MIT"
] | Python | __corners_to_point_array | <not_specific> | def __corners_to_point_array(start, stop):
"""
Convert a pair of tuples representing two opposite corners of an
HDF5 region reference
into a list of arrays for each dimension.
Parameters
----------
start : Tuple
the sta... |
Convert a pair of tuples representing two opposite corners of an
HDF5 region reference
into a list of arrays for each dimension.
Parameters
----------
start : Tuple
the starting indices of the region
stop : Tuple
... | Convert a pair of tuples representing two opposite corners of an
HDF5 region reference
into a list of arrays for each dimension.
Parameters
start : Tuple
the starting indices of the region
stop : Tuple
the final indices of the region
Returns
inds : Tuple of arrays
the list of points in each dimension | [
"Convert",
"a",
"pair",
"of",
"tuples",
"representing",
"two",
"opposite",
"corners",
"of",
"an",
"HDF5",
"region",
"reference",
"into",
"a",
"list",
"of",
"arrays",
"for",
"each",
"dimension",
".",
"Parameters",
"start",
":",
"Tuple",
"the",
"starting",
"in... | def __corners_to_point_array(start, stop):
ranges = []
for i in range(len(start)):
if start[i] == stop[i]:
ranges.append([stop[i]])
else:
ranges.append(np.arange(start[i], stop[i] + 1,
... | [
"def",
"__corners_to_point_array",
"(",
"start",
",",
"stop",
")",
":",
"ranges",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"start",
")",
")",
":",
"if",
"start",
"[",
"i",
"]",
"==",
"stop",
"[",
"i",
"]",
":",
"ranges",
".",
... | Convert a pair of tuples representing two opposite corners of an
HDF5 region reference
into a list of arrays for each dimension. | [
"Convert",
"a",
"pair",
"of",
"tuples",
"representing",
"two",
"opposite",
"corners",
"of",
"an",
"HDF5",
"region",
"reference",
"into",
"a",
"list",
"of",
"arrays",
"for",
"each",
"dimension",
"."
] | [
"\"\"\"\n Convert a pair of tuples representing two opposite corners of an\n HDF5 region reference\n into a list of arrays for each dimension.\n\n Parameters\n ----------\n start : Tuple\n the starting indices of the region\n ... | [
{
"param": "start",
"type": null
},
{
"param": "stop",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "start",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stop",
"type": null,
"docstring": null,
"docstring_tokens": ... |
238fa453d1913b59f98ba5fc8e5d9a4a7868d424 | ondrejdyck/sidpy | sidpy/hdf/reg_ref.py | [
"MIT"
] | Python | __corners_to_slices | <not_specific> | def __corners_to_slices(start, stop):
"""
Convert a pair of tuples representing two opposite corners of an
HDF5 region reference
into a pair of slices.
Parameters
----------
start : Tuple
the starting indices of the reg... |
Convert a pair of tuples representing two opposite corners of an
HDF5 region reference
into a pair of slices.
Parameters
----------
start : Tuple
the starting indices of the region
stop : Tuple
the fina... | Convert a pair of tuples representing two opposite corners of an
HDF5 region reference
into a pair of slices.
Parameters
start : Tuple
the starting indices of the region
stop : Tuple
the final indices of the region
Returns
slices : list
pair of slices representing the region | [
"Convert",
"a",
"pair",
"of",
"tuples",
"representing",
"two",
"opposite",
"corners",
"of",
"an",
"HDF5",
"region",
"reference",
"into",
"a",
"pair",
"of",
"slices",
".",
"Parameters",
"start",
":",
"Tuple",
"the",
"starting",
"indices",
"of",
"the",
"region... | def __corners_to_slices(start, stop):
slices = []
for idim in range(len(start)):
slices.append(slice(start[idim], stop[idim]))
return slices | [
"def",
"__corners_to_slices",
"(",
"start",
",",
"stop",
")",
":",
"slices",
"=",
"[",
"]",
"for",
"idim",
"in",
"range",
"(",
"len",
"(",
"start",
")",
")",
":",
"slices",
".",
"append",
"(",
"slice",
"(",
"start",
"[",
"idim",
"]",
",",
"stop",
... | Convert a pair of tuples representing two opposite corners of an
HDF5 region reference
into a pair of slices. | [
"Convert",
"a",
"pair",
"of",
"tuples",
"representing",
"two",
"opposite",
"corners",
"of",
"an",
"HDF5",
"region",
"reference",
"into",
"a",
"pair",
"of",
"slices",
"."
] | [
"\"\"\"\n Convert a pair of tuples representing two opposite corners of an\n HDF5 region reference\n into a pair of slices.\n\n Parameters\n ----------\n start : Tuple\n the starting indices of the region\n stop : Tuple\n ... | [
{
"param": "start",
"type": null
},
{
"param": "stop",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "start",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stop",
"type": null,
"docstring": null,
"docstring_tokens": ... |
238fa453d1913b59f98ba5fc8e5d9a4a7868d424 | ondrejdyck/sidpy | sidpy/hdf/reg_ref.py | [
"MIT"
] | Python | copy_reg_ref_reduced_dim | <not_specific> | def copy_reg_ref_reduced_dim(h5_source, h5_target, h5_source_inds,
h5_target_inds, key):
"""
Copies a region reference from one dataset to another taking into account
that a dimension has been lost from source to target
Parameters
----------
h5_source : HDF5 Dataset... |
Copies a region reference from one dataset to another taking into account
that a dimension has been lost from source to target
Parameters
----------
h5_source : HDF5 Dataset
source dataset for region reference copy
h5_target : HDF5 Dataset
target dataset for region refe... | Copies a region reference from one dataset to another taking into account
that a dimension has been lost from source to target
Parameters
Returns
ref_inds : Nx2x2 array of unsigned integers
Array containing pairs of points that define
the corners of each hyperslab in the region
reference | [
"Copies",
"a",
"region",
"reference",
"from",
"one",
"dataset",
"to",
"another",
"taking",
"into",
"account",
"that",
"a",
"dimension",
"has",
"been",
"lost",
"from",
"source",
"to",
"target",
"Parameters",
"Returns",
"ref_inds",
":",
"Nx2x2",
"array",
"of",
... | def copy_reg_ref_reduced_dim(h5_source, h5_target, h5_source_inds,
h5_target_inds, key):
for param, param_name in zip([h5_source, h5_target, h5_source_inds,
h5_target_inds],
['h5_source', 'h5_target', 'h5_source_inds',
... | [
"def",
"copy_reg_ref_reduced_dim",
"(",
"h5_source",
",",
"h5_target",
",",
"h5_source_inds",
",",
"h5_target_inds",
",",
"key",
")",
":",
"for",
"param",
",",
"param_name",
"in",
"zip",
"(",
"[",
"h5_source",
",",
"h5_target",
",",
"h5_source_inds",
",",
"h5_... | Copies a region reference from one dataset to another taking into account
that a dimension has been lost from source to target | [
"Copies",
"a",
"region",
"reference",
"from",
"one",
"dataset",
"to",
"another",
"taking",
"into",
"account",
"that",
"a",
"dimension",
"has",
"been",
"lost",
"from",
"source",
"to",
"target"
] | [
"\"\"\"\n Copies a region reference from one dataset to another taking into account\n that a dimension has been lost from source to target\n\n Parameters\n ----------\n h5_source : HDF5 Dataset\n source dataset for region reference copy\n h5_target : HDF5 Dataset\n target dat... | [
{
"param": "h5_source",
"type": null
},
{
"param": "h5_target",
"type": null
},
{
"param": "h5_source_inds",
"type": null
},
{
"param": "h5_target_inds",
"type": null
},
{
"param": "key",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "h5_source",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "h5_target",
"type": null,
"docstring": null,
"docstring_... |
238fa453d1913b59f98ba5fc8e5d9a4a7868d424 | ondrejdyck/sidpy | sidpy/hdf/reg_ref.py | [
"MIT"
] | Python | create_region_reference | <not_specific> | def create_region_reference(h5_main, ref_inds):
"""
Create a region reference in the destination dataset using an iterable of
pairs of indices representing the start and end points of a hyperslab block
Parameters
----------
h5_main : HDF5 dataset
dataset the region will be created in
... |
Create a region reference in the destination dataset using an iterable of
pairs of indices representing the start and end points of a hyperslab block
Parameters
----------
h5_main : HDF5 dataset
dataset the region will be created in
ref_inds : Iterable
index pairs, [start indic... | Create a region reference in the destination dataset using an iterable of
pairs of indices representing the start and end points of a hyperslab block
Parameters
h5_main : HDF5 dataset
dataset the region will be created in
ref_inds : Iterable
index pairs, [start indices, final indices] for each block in the
hyperslab
... | [
"Create",
"a",
"region",
"reference",
"in",
"the",
"destination",
"dataset",
"using",
"an",
"iterable",
"of",
"pairs",
"of",
"indices",
"representing",
"the",
"start",
"and",
"end",
"points",
"of",
"a",
"hyperslab",
"block",
"Parameters",
"h5_main",
":",
"HDF5... | def create_region_reference(h5_main, ref_inds):
if not isinstance(h5_main, h5py.Dataset):
raise TypeError('h5_main should be a h5py.Dataset object')
if not isinstance(ref_inds, Iterable):
raise TypeError('ref_inds should be a list or tuple')
h5_space = h5_main.id.get_space()
h5_space.sel... | [
"def",
"create_region_reference",
"(",
"h5_main",
",",
"ref_inds",
")",
":",
"if",
"not",
"isinstance",
"(",
"h5_main",
",",
"h5py",
".",
"Dataset",
")",
":",
"raise",
"TypeError",
"(",
"'h5_main should be a h5py.Dataset object'",
")",
"if",
"not",
"isinstance",
... | Create a region reference in the destination dataset using an iterable of
pairs of indices representing the start and end points of a hyperslab block | [
"Create",
"a",
"region",
"reference",
"in",
"the",
"destination",
"dataset",
"using",
"an",
"iterable",
"of",
"pairs",
"of",
"indices",
"representing",
"the",
"start",
"and",
"end",
"points",
"of",
"a",
"hyperslab",
"block"
] | [
"\"\"\"\n Create a region reference in the destination dataset using an iterable of\n pairs of indices representing the start and end points of a hyperslab block\n\n Parameters\n ----------\n h5_main : HDF5 dataset\n dataset the region will be created in\n ref_inds : Iterable\n index... | [
{
"param": "h5_main",
"type": null
},
{
"param": "ref_inds",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "h5_main",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ref_inds",
"type": null,
"docstring": null,
"docstring_tok... |
238fa453d1913b59f98ba5fc8e5d9a4a7868d424 | ondrejdyck/sidpy | sidpy/hdf/reg_ref.py | [
"MIT"
] | Python | simple_region_ref_copy | <not_specific> | def simple_region_ref_copy(h5_source, h5_target, key):
"""
Copies a region reference from one dataset to another
without alteration
Parameters
----------
h5_source : HDF5 Dataset
source dataset for region reference copy
h5_target : HDF5 Dataset
target dataset for reg... |
Copies a region reference from one dataset to another
without alteration
Parameters
----------
h5_source : HDF5 Dataset
source dataset for region reference copy
h5_target : HDF5 Dataset
target dataset for region reference copy
key : String
Name of attrib... | Copies a region reference from one dataset to another
without alteration
Parameters
h5_source : HDF5 Dataset
source dataset for region reference copy
h5_target : HDF5 Dataset
target dataset for region reference copy
key : String
Name of attribute in h5_source that contains
the Region Reference to copy
Returns
ref_i... | [
"Copies",
"a",
"region",
"reference",
"from",
"one",
"dataset",
"to",
"another",
"without",
"alteration",
"Parameters",
"h5_source",
":",
"HDF5",
"Dataset",
"source",
"dataset",
"for",
"region",
"reference",
"copy",
"h5_target",
":",
"HDF5",
"Dataset",
"target",
... | def simple_region_ref_copy(h5_source, h5_target, key):
for param, param_name in zip([h5_source, h5_target],
['h5_source', 'h5_target']):
if not isinstance(param, h5py.Dataset):
raise TypeError(param_name + ' should be a h5py.Dataset object')
if not isinstance... | [
"def",
"simple_region_ref_copy",
"(",
"h5_source",
",",
"h5_target",
",",
"key",
")",
":",
"for",
"param",
",",
"param_name",
"in",
"zip",
"(",
"[",
"h5_source",
",",
"h5_target",
"]",
",",
"[",
"'h5_source'",
",",
"'h5_target'",
"]",
")",
":",
"if",
"no... | Copies a region reference from one dataset to another
without alteration | [
"Copies",
"a",
"region",
"reference",
"from",
"one",
"dataset",
"to",
"another",
"without",
"alteration"
] | [
"\"\"\"\n Copies a region reference from one dataset to another\n without alteration\n\n Parameters\n ----------\n h5_source : HDF5 Dataset\n source dataset for region reference copy\n h5_target : HDF5 Dataset\n target dataset for region reference copy\n key : String\n ... | [
{
"param": "h5_source",
"type": null
},
{
"param": "h5_target",
"type": null
},
{
"param": "key",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "h5_source",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "h5_target",
"type": null,
"docstring": null,
"docstring_... |
238fa453d1913b59f98ba5fc8e5d9a4a7868d424 | ondrejdyck/sidpy | sidpy/hdf/reg_ref.py | [
"MIT"
] | Python | copy_all_region_refs | null | def copy_all_region_refs(h5_source, h5_target):
"""
Copies only region references from the source dataset to the target dataset
Parameters
----------
h5_source : h5py.Dataset
Dataset from which to copy region references
h5_target : h5py.Dataset
Dataset to which to copy region re... |
Copies only region references from the source dataset to the target dataset
Parameters
----------
h5_source : h5py.Dataset
Dataset from which to copy region references
h5_target : h5py.Dataset
Dataset to which to copy region references to
| Copies only region references from the source dataset to the target dataset
Parameters
h5_source : h5py.Dataset
Dataset from which to copy region references
h5_target : h5py.Dataset
Dataset to which to copy region references to | [
"Copies",
"only",
"region",
"references",
"from",
"the",
"source",
"dataset",
"to",
"the",
"target",
"dataset",
"Parameters",
"h5_source",
":",
"h5py",
".",
"Dataset",
"Dataset",
"from",
"which",
"to",
"copy",
"region",
"references",
"h5_target",
":",
"h5py",
... | def copy_all_region_refs(h5_source, h5_target):
if not isinstance(h5_source, h5py.Dataset):
raise TypeError("'h5_source' should be a h5py.Dataset object")
if not isinstance(h5_target, h5py.Dataset):
raise TypeError("'h5_target' should be a h5py.Dataset object")
for key in h5_source.attrs.key... | [
"def",
"copy_all_region_refs",
"(",
"h5_source",
",",
"h5_target",
")",
":",
"if",
"not",
"isinstance",
"(",
"h5_source",
",",
"h5py",
".",
"Dataset",
")",
":",
"raise",
"TypeError",
"(",
"\"'h5_source' should be a h5py.Dataset object\"",
")",
"if",
"not",
"isinst... | Copies only region references from the source dataset to the target dataset
Parameters | [
"Copies",
"only",
"region",
"references",
"from",
"the",
"source",
"dataset",
"to",
"the",
"target",
"dataset",
"Parameters"
] | [
"\"\"\"\n Copies only region references from the source dataset to the target dataset\n\n Parameters\n ----------\n h5_source : h5py.Dataset\n Dataset from which to copy region references\n h5_target : h5py.Dataset\n Dataset to which to copy region references to\n\n \"\"\""
] | [
{
"param": "h5_source",
"type": null
},
{
"param": "h5_target",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "h5_source",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "h5_target",
"type": null,
"docstring": null,
"docstring_... |
238fa453d1913b59f98ba5fc8e5d9a4a7868d424 | ondrejdyck/sidpy | sidpy/hdf/reg_ref.py | [
"MIT"
] | Python | write_region_references | null | def write_region_references(h5_dset, reg_ref_dict, add_labels_attr=True,
verbose=False):
"""
Creates attributes of a h5py.Dataset that refer to regions in the dataset
Parameters
----------
h5_dset : h5.Dataset instance
Dataset to which region references will be a... |
Creates attributes of a h5py.Dataset that refer to regions in the dataset
Parameters
----------
h5_dset : h5.Dataset instance
Dataset to which region references will be added as attributes
reg_ref_dict : dict
The slicing information must be formatted using tuples of slice objects
... | Creates attributes of a h5py.Dataset that refer to regions in the dataset
Parameters
| [
"Creates",
"attributes",
"of",
"a",
"h5py",
".",
"Dataset",
"that",
"refer",
"to",
"regions",
"in",
"the",
"dataset",
"Parameters"
] | def write_region_references(h5_dset, reg_ref_dict, add_labels_attr=True,
verbose=False):
if not isinstance(reg_ref_dict, dict):
raise TypeError('slices should be a dictionary but is instead of type '
'{}'.format(type(reg_ref_dict)))
if not isinstance(h... | [
"def",
"write_region_references",
"(",
"h5_dset",
",",
"reg_ref_dict",
",",
"add_labels_attr",
"=",
"True",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"reg_ref_dict",
",",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"'slices shoul... | Creates attributes of a h5py.Dataset that refer to regions in the dataset
Parameters | [
"Creates",
"attributes",
"of",
"a",
"h5py",
".",
"Dataset",
"that",
"refer",
"to",
"regions",
"in",
"the",
"dataset",
"Parameters"
] | [
"\"\"\"\n Creates attributes of a h5py.Dataset that refer to regions in the dataset\n\n Parameters\n ----------\n h5_dset : h5.Dataset instance\n Dataset to which region references will be added as attributes\n reg_ref_dict : dict\n The slicing information must be formatted using tuples... | [
{
"param": "h5_dset",
"type": null
},
{
"param": "reg_ref_dict",
"type": null
},
{
"param": "add_labels_attr",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "h5_dset",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg_ref_dict",
"type": null,
"docstring": null,
"docstring... |
cbf82277876ac07e954cf288f4bbc366cd2e2acd | ondrejdyck/sidpy | sidpy/base/num_utils.py | [
"MIT"
] | Python | integers_to_slices | <not_specific> | def integers_to_slices(int_array):
"""
Converts a sequence of iterables to a list of slice objects denoting sequences of consecutive numbers
Parameters
----------
int_array : :class:`collections.Iterable`
iterable object like a :class:`list` or :class:`numpy.ndarray`
Returns
------... |
Converts a sequence of iterables to a list of slice objects denoting sequences of consecutive numbers
Parameters
----------
int_array : :class:`collections.Iterable`
iterable object like a :class:`list` or :class:`numpy.ndarray`
Returns
-------
sequences : list
List of :cl... | Converts a sequence of iterables to a list of slice objects denoting sequences of consecutive numbers
Parameters
Returns
sequences : list
List of :class:`slice` objects each denoting sequences of consecutive numbers | [
"Converts",
"a",
"sequence",
"of",
"iterables",
"to",
"a",
"list",
"of",
"slice",
"objects",
"denoting",
"sequences",
"of",
"consecutive",
"numbers",
"Parameters",
"Returns",
"sequences",
":",
"list",
"List",
"of",
":",
"class",
":",
"`",
"slice",
"`",
"obje... | def integers_to_slices(int_array):
if not contains_integers(int_array):
raise ValueError('Expected a list, tuple, or numpy array of integers')
def integers_to_consecutive_sections(integer_array):
integer_array = sorted(set(integer_array))
for key, group in groupby(enumerate(integer_array... | [
"def",
"integers_to_slices",
"(",
"int_array",
")",
":",
"if",
"not",
"contains_integers",
"(",
"int_array",
")",
":",
"raise",
"ValueError",
"(",
"'Expected a list, tuple, or numpy array of integers'",
")",
"def",
"integers_to_consecutive_sections",
"(",
"integer_array",
... | Converts a sequence of iterables to a list of slice objects denoting sequences of consecutive numbers
Parameters | [
"Converts",
"a",
"sequence",
"of",
"iterables",
"to",
"a",
"list",
"of",
"slice",
"objects",
"denoting",
"sequences",
"of",
"consecutive",
"numbers",
"Parameters"
] | [
"\"\"\"\n Converts a sequence of iterables to a list of slice objects denoting sequences of consecutive numbers\n\n Parameters\n ----------\n int_array : :class:`collections.Iterable`\n iterable object like a :class:`list` or :class:`numpy.ndarray`\n\n Returns\n -------\n sequences : lis... | [
{
"param": "int_array",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "int_array",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cbf82277876ac07e954cf288f4bbc366cd2e2acd | ondrejdyck/sidpy | sidpy/base/num_utils.py | [
"MIT"
] | Python | integers_to_consecutive_sections | null | def integers_to_consecutive_sections(integer_array):
"""
Converts a sequence of iterables to tuples with start and stop bounds
@author: @juanchopanza and @luca from stackoverflow
Parameters
----------
integer_array : :class:`collections.Iterable`
iterable ob... |
Converts a sequence of iterables to tuples with start and stop bounds
@author: @juanchopanza and @luca from stackoverflow
Parameters
----------
integer_array : :class:`collections.Iterable`
iterable object like a :class:`list`
Returns
-------
... | Converts a sequence of iterables to tuples with start and stop bounds | [
"Converts",
"a",
"sequence",
"of",
"iterables",
"to",
"tuples",
"with",
"start",
"and",
"stop",
"bounds"
] | def integers_to_consecutive_sections(integer_array):
integer_array = sorted(set(integer_array))
for key, group in groupby(enumerate(integer_array),
lambda t: t[1] - t[0]):
group = list(group)
yield group[0][1], group[-1][1] | [
"def",
"integers_to_consecutive_sections",
"(",
"integer_array",
")",
":",
"integer_array",
"=",
"sorted",
"(",
"set",
"(",
"integer_array",
")",
")",
"for",
"key",
",",
"group",
"in",
"groupby",
"(",
"enumerate",
"(",
"integer_array",
")",
",",
"lambda",
"t",... | Converts a sequence of iterables to tuples with start and stop bounds | [
"Converts",
"a",
"sequence",
"of",
"iterables",
"to",
"tuples",
"with",
"start",
"and",
"stop",
"bounds"
] | [
"\"\"\"\n Converts a sequence of iterables to tuples with start and stop bounds\n\n @author: @juanchopanza and @luca from stackoverflow\n\n Parameters\n ----------\n integer_array : :class:`collections.Iterable`\n iterable object like a :class:`list`\n\n Returns\... | [
{
"param": "integer_array",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "integer_array",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": [
{
"identifier": "author",
"docstring": ... |
cbf82277876ac07e954cf288f4bbc366cd2e2acd | ondrejdyck/sidpy | sidpy/base/num_utils.py | [
"MIT"
] | Python | build_ind_val_matrices | <not_specific> | def build_ind_val_matrices(unit_values):
"""
Builds indices and values matrices using given unit values for each dimension.
This function is originally from pyUSID.io
Unit values must be arranged from fastest varying to slowest varying
Parameters
----------
unit_... |
Builds indices and values matrices using given unit values for each dimension.
This function is originally from pyUSID.io
Unit values must be arranged from fastest varying to slowest varying
Parameters
----------
unit_values : list / tuple
Sequence of values... | Builds indices and values matrices using given unit values for each dimension.
This function is originally from pyUSID.io
Unit values must be arranged from fastest varying to slowest varying
Parameters
unit_values : list / tuple
Sequence of values vectors for each dimension
Returns
ind_mat : 2D numpy array
Indices ... | [
"Builds",
"indices",
"and",
"values",
"matrices",
"using",
"given",
"unit",
"values",
"for",
"each",
"dimension",
".",
"This",
"function",
"is",
"originally",
"from",
"pyUSID",
".",
"io",
"Unit",
"values",
"must",
"be",
"arranged",
"from",
"fastest",
"varying"... | def build_ind_val_matrices(unit_values):
if not isinstance(unit_values, (list, tuple)):
raise TypeError('unit_values should be a list or tuple')
if not np.all([np.array(x).ndim == 1 for x in unit_values]):
raise ValueError('unit_values should only contain 1D array')
lengt... | [
"def",
"build_ind_val_matrices",
"(",
"unit_values",
")",
":",
"if",
"not",
"isinstance",
"(",
"unit_values",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"raise",
"TypeError",
"(",
"'unit_values should be a list or tuple'",
")",
"if",
"not",
"np",
".",
"all... | Builds indices and values matrices using given unit values for each dimension. | [
"Builds",
"indices",
"and",
"values",
"matrices",
"using",
"given",
"unit",
"values",
"for",
"each",
"dimension",
"."
] | [
"\"\"\"\n Builds indices and values matrices using given unit values for each dimension.\n This function is originally from pyUSID.io\n Unit values must be arranged from fastest varying to slowest varying\n\n Parameters\n ----------\n unit_values : list / tuple\n ... | [
{
"param": "unit_values",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "unit_values",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c1888bd63f0cc9f9048dc661341956c5924c927e | ondrejdyck/sidpy | sidpy/viz/plot_utils/cmap.py | [
"MIT"
] | Python | cmap_jet_white_center | <not_specific> | def cmap_jet_white_center():
"""
Generates the jet colormap with a white center
Returns
-------
white_jet : matplotlib.colors.LinearSegmentedColormap object
color map object that can be used in place of the default colormap
"""
# For red - central column is like brightness
# For... |
Generates the jet colormap with a white center
Returns
-------
white_jet : matplotlib.colors.LinearSegmentedColormap object
color map object that can be used in place of the default colormap
| Generates the jet colormap with a white center
Returns
white_jet : matplotlib.colors.LinearSegmentedColormap object
color map object that can be used in place of the default colormap | [
"Generates",
"the",
"jet",
"colormap",
"with",
"a",
"white",
"center",
"Returns",
"white_jet",
":",
"matplotlib",
".",
"colors",
".",
"LinearSegmentedColormap",
"object",
"color",
"map",
"object",
"that",
"can",
"be",
"used",
"in",
"place",
"of",
"the",
"defau... | def cmap_jet_white_center():
cdict = {'red': ((0.00, 0.0, 0.0),
(0.30, 0.0, 0.0),
(0.50, 1.0, 1.0),
(0.90, 1.0, 1.0),
(1.00, 0.5, 1.0)),
'green': ((0.00, 0.0, 0.0),
(0.10, 0.0, 0.0),
... | [
"def",
"cmap_jet_white_center",
"(",
")",
":",
"cdict",
"=",
"{",
"'red'",
":",
"(",
"(",
"0.00",
",",
"0.0",
",",
"0.0",
")",
",",
"(",
"0.30",
",",
"0.0",
",",
"0.0",
")",
",",
"(",
"0.50",
",",
"1.0",
",",
"1.0",
")",
",",
"(",
"0.90",
","... | Generates the jet colormap with a white center
Returns | [
"Generates",
"the",
"jet",
"colormap",
"with",
"a",
"white",
"center",
"Returns"
] | [
"\"\"\"\n Generates the jet colormap with a white center\n\n Returns\n -------\n white_jet : matplotlib.colors.LinearSegmentedColormap object\n color map object that can be used in place of the default colormap\n \"\"\"",
"# For red - central column is like brightness",
"# For blue - last ... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c1888bd63f0cc9f9048dc661341956c5924c927e | ondrejdyck/sidpy | sidpy/viz/plot_utils/cmap.py | [
"MIT"
] | Python | cmap_from_rgba | <not_specific> | def cmap_from_rgba(name, interp_vals, normalization_val):
"""
Generates a colormap given a matlab-style interpolation table
Parameters
----------
name : String / Unicode
Name of the desired colormap
interp_vals : List of tuples
Interpolation table that describes the desired colo... |
Generates a colormap given a matlab-style interpolation table
Parameters
----------
name : String / Unicode
Name of the desired colormap
interp_vals : List of tuples
Interpolation table that describes the desired color map. Each entry in the table should be described as:
(p... | Generates a colormap given a matlab-style interpolation table
Parameters
name : String / Unicode
Name of the desired colormap
interp_vals : List of tuples
Interpolation table that describes the desired color map. Each entry in the table should be described as:
(position in the colorbar, (red, green, blue, alpha))
The ... | [
"Generates",
"a",
"colormap",
"given",
"a",
"matlab",
"-",
"style",
"interpolation",
"table",
"Parameters",
"name",
":",
"String",
"/",
"Unicode",
"Name",
"of",
"the",
"desired",
"colormap",
"interp_vals",
":",
"List",
"of",
"tuples",
"Interpolation",
"table",
... | def cmap_from_rgba(name, interp_vals, normalization_val):
if not isinstance(name, (str, unicode)):
raise TypeError('name should be a string')
if not isinstance(interp_vals, (list, tuple, np.array)):
raise TypeError('interp_vals must be a list of tuples')
if not isinstance(normalization_val, ... | [
"def",
"cmap_from_rgba",
"(",
"name",
",",
"interp_vals",
",",
"normalization_val",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"raise",
"TypeError",
"(",
"'name should be a string'",
")",
"if",
"not",
... | Generates a colormap given a matlab-style interpolation table
Parameters | [
"Generates",
"a",
"colormap",
"given",
"a",
"matlab",
"-",
"style",
"interpolation",
"table",
"Parameters"
] | [
"\"\"\"\n Generates a colormap given a matlab-style interpolation table\n\n Parameters\n ----------\n name : String / Unicode\n Name of the desired colormap\n interp_vals : List of tuples\n Interpolation table that describes the desired color map. Each entry in the table should be descr... | [
{
"param": "name",
"type": null
},
{
"param": "interp_vals",
"type": null
},
{
"param": "normalization_val",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "interp_vals",
"type": null,
"docstring": null,
"docstring_tok... |
c1888bd63f0cc9f9048dc661341956c5924c927e | ondrejdyck/sidpy | sidpy/viz/plot_utils/cmap.py | [
"MIT"
] | Python | make_linear_alpha_cmap | <not_specific> | def make_linear_alpha_cmap(name, solid_color, normalization_val, min_alpha=0, max_alpha=1):
"""
Generates a transparent to opaque color map based on a single solid color
Parameters
----------
name : String / Unicode
Name of the desired colormap
solid_color : List of numbers
red,... |
Generates a transparent to opaque color map based on a single solid color
Parameters
----------
name : String / Unicode
Name of the desired colormap
solid_color : List of numbers
red, green, blue, and alpha values for a specific color
normalization_val : number
The comm... | Generates a transparent to opaque color map based on a single solid color
Parameters
name : String / Unicode
Name of the desired colormap
solid_color : List of numbers
red, green, blue, and alpha values for a specific color
normalization_val : number
The common maximum value for the red, green, blue, and alpha values.... | [
"Generates",
"a",
"transparent",
"to",
"opaque",
"color",
"map",
"based",
"on",
"a",
"single",
"solid",
"color",
"Parameters",
"name",
":",
"String",
"/",
"Unicode",
"Name",
"of",
"the",
"desired",
"colormap",
"solid_color",
":",
"List",
"of",
"numbers",
"re... | def make_linear_alpha_cmap(name, solid_color, normalization_val, min_alpha=0, max_alpha=1):
if not isinstance(name, (str, unicode)):
raise TypeError('name should be a string')
if not isinstance(solid_color, (list, tuple, np.ndarray, da.core.Array)):
raise TypeError('solid_color must be a list of... | [
"def",
"make_linear_alpha_cmap",
"(",
"name",
",",
"solid_color",
",",
"normalization_val",
",",
"min_alpha",
"=",
"0",
",",
"max_alpha",
"=",
"1",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"raise",... | Generates a transparent to opaque color map based on a single solid color
Parameters | [
"Generates",
"a",
"transparent",
"to",
"opaque",
"color",
"map",
"based",
"on",
"a",
"single",
"solid",
"color",
"Parameters"
] | [
"\"\"\"\n Generates a transparent to opaque color map based on a single solid color\n\n Parameters\n ----------\n name : String / Unicode\n Name of the desired colormap\n solid_color : List of numbers\n red, green, blue, and alpha values for a specific color\n normalization_val : num... | [
{
"param": "name",
"type": null
},
{
"param": "solid_color",
"type": null
},
{
"param": "normalization_val",
"type": null
},
{
"param": "min_alpha",
"type": null
},
{
"param": "max_alpha",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "solid_color",
"type": null,
"docstring": null,
"docstring_tok... |
c1888bd63f0cc9f9048dc661341956c5924c927e | ondrejdyck/sidpy | sidpy/viz/plot_utils/cmap.py | [
"MIT"
] | Python | cmap_hot_desaturated | <not_specific> | def cmap_hot_desaturated():
"""
Returns a desaturated color map based on the hot colormap
Returns
-------
new_cmap : matplotlib.colors.LinearSegmentedColormap object
Desaturated version of the hot color map
"""
hot_desaturated = [(255.0, (255, 76, 76, 255)),
(... |
Returns a desaturated color map based on the hot colormap
Returns
-------
new_cmap : matplotlib.colors.LinearSegmentedColormap object
Desaturated version of the hot color map
| Returns a desaturated color map based on the hot colormap
Returns
new_cmap : matplotlib.colors.LinearSegmentedColormap object
Desaturated version of the hot color map | [
"Returns",
"a",
"desaturated",
"color",
"map",
"based",
"on",
"the",
"hot",
"colormap",
"Returns",
"new_cmap",
":",
"matplotlib",
".",
"colors",
".",
"LinearSegmentedColormap",
"object",
"Desaturated",
"version",
"of",
"the",
"hot",
"color",
"map"
] | def cmap_hot_desaturated():
hot_desaturated = [(255.0, (255, 76, 76, 255)),
(218.5, (107, 0, 0, 255)),
(182.1, (255, 96, 0, 255)),
(145.6, (255, 255, 0, 255)),
(109.4, (0, 127, 0, 255)),
(72.675, (0, 2... | [
"def",
"cmap_hot_desaturated",
"(",
")",
":",
"hot_desaturated",
"=",
"[",
"(",
"255.0",
",",
"(",
"255",
",",
"76",
",",
"76",
",",
"255",
")",
")",
",",
"(",
"218.5",
",",
"(",
"107",
",",
"0",
",",
"0",
",",
"255",
")",
")",
",",
"(",
"182... | Returns a desaturated color map based on the hot colormap
Returns | [
"Returns",
"a",
"desaturated",
"color",
"map",
"based",
"on",
"the",
"hot",
"colormap",
"Returns"
] | [
"\"\"\"\n Returns a desaturated color map based on the hot colormap\n\n Returns\n -------\n new_cmap : matplotlib.colors.LinearSegmentedColormap object\n Desaturated version of the hot color map\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c1888bd63f0cc9f9048dc661341956c5924c927e | ondrejdyck/sidpy | sidpy/viz/plot_utils/cmap.py | [
"MIT"
] | Python | discrete_cmap | <not_specific> | def discrete_cmap(num_bins, cmap=None):
"""
Create an N-bin discrete colormap from the specified input map specified
Parameters
----------
num_bins : unsigned int
Number of discrete bins
cmap : matplotlib.colors.Colormap object
Base color map to discretize
Returns
-----... |
Create an N-bin discrete colormap from the specified input map specified
Parameters
----------
num_bins : unsigned int
Number of discrete bins
cmap : matplotlib.colors.Colormap object
Base color map to discretize
Returns
-------
new_cmap : matplotlib.colors.LinearSegme... | Create an N-bin discrete colormap from the specified input map specified
Parameters
num_bins : unsigned int
Number of discrete bins
cmap : matplotlib.colors.Colormap object
Base color map to discretize
Returns
new_cmap : matplotlib.colors.LinearSegmentedColormap object
Discretized color map
Notes
| [
"Create",
"an",
"N",
"-",
"bin",
"discrete",
"colormap",
"from",
"the",
"specified",
"input",
"map",
"specified",
"Parameters",
"num_bins",
":",
"unsigned",
"int",
"Number",
"of",
"discrete",
"bins",
"cmap",
":",
"matplotlib",
".",
"colors",
".",
"Colormap",
... | def discrete_cmap(num_bins, cmap=None):
if cmap is None:
cmap = default_cmap.name
elif isinstance(cmap, mpl.colors.Colormap):
cmap = cmap.name
elif not isinstance(cmap, (str, unicode)):
raise TypeError('cmap should be a string or a matplotlib.colors.Colormap object')
if not isins... | [
"def",
"discrete_cmap",
"(",
"num_bins",
",",
"cmap",
"=",
"None",
")",
":",
"if",
"cmap",
"is",
"None",
":",
"cmap",
"=",
"default_cmap",
".",
"name",
"elif",
"isinstance",
"(",
"cmap",
",",
"mpl",
".",
"colors",
".",
"Colormap",
")",
":",
"cmap",
"... | Create an N-bin discrete colormap from the specified input map specified
Parameters | [
"Create",
"an",
"N",
"-",
"bin",
"discrete",
"colormap",
"from",
"the",
"specified",
"input",
"map",
"specified",
"Parameters"
] | [
"\"\"\"\n Create an N-bin discrete colormap from the specified input map specified\n\n Parameters\n ----------\n num_bins : unsigned int\n Number of discrete bins\n cmap : matplotlib.colors.Colormap object\n Base color map to discretize\n\n Returns\n -------\n new_cmap : matplo... | [
{
"param": "num_bins",
"type": null
},
{
"param": "cmap",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "num_bins",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cmap",
"type": null,
"docstring": null,
"docstring_tokens... |
3530066d5077390d5dfa2c5232820d9d48d031b1 | ondrejdyck/sidpy | sidpy/viz/plot_utils/misc.py | [
"MIT"
] | Python | use_nice_plot_params | null | def use_nice_plot_params():
"""
Resets default plot parameters such as figure size, font sizes etc. to values better suited for scientific
publications
"""
# mpl.rcParams.keys() # gets all allowable keys
# mpl.rc('figure', figsize=(5.5, 5))
mpl.rc('lines', linewidth=2)
mpl.rc('axes', la... |
Resets default plot parameters such as figure size, font sizes etc. to values better suited for scientific
publications
| Resets default plot parameters such as figure size, font sizes etc. to values better suited for scientific
publications | [
"Resets",
"default",
"plot",
"parameters",
"such",
"as",
"figure",
"size",
"font",
"sizes",
"etc",
".",
"to",
"values",
"better",
"suited",
"for",
"scientific",
"publications"
] | def use_nice_plot_params():
mpl.rc('lines', linewidth=2)
mpl.rc('axes', labelsize=16, titlesize=16)
mpl.rc('figure', titlesize=20)
mpl.rc('font', size=14)
mpl.rc('legend', fontsize=16, fancybox=True)
mpl.rc('xtick.major', size=6)
mpl.rc('xtick.minor', size=4) | [
"def",
"use_nice_plot_params",
"(",
")",
":",
"mpl",
".",
"rc",
"(",
"'lines'",
",",
"linewidth",
"=",
"2",
")",
"mpl",
".",
"rc",
"(",
"'axes'",
",",
"labelsize",
"=",
"16",
",",
"titlesize",
"=",
"16",
")",
"mpl",
".",
"rc",
"(",
"'figure'",
",",... | Resets default plot parameters such as figure size, font sizes etc. | [
"Resets",
"default",
"plot",
"parameters",
"such",
"as",
"figure",
"size",
"font",
"sizes",
"etc",
"."
] | [
"\"\"\"\n Resets default plot parameters such as figure size, font sizes etc. to values better suited for scientific\n publications\n \"\"\"",
"# mpl.rcParams.keys() # gets all allowable keys",
"# mpl.rc('figure', figsize=(5.5, 5))",
"# global font size",
"# mpl.rcParams['xtick.major.size'] = 6"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3530066d5077390d5dfa2c5232820d9d48d031b1 | ondrejdyck/sidpy | sidpy/viz/plot_utils/misc.py | [
"MIT"
] | Python | __set_axis_tick | null | def __set_axis_tick(axis):
"""
Sets the font sizes to the x and y axis in the given axis object
Parameters
----------
axis : matplotlib.axes.Axes object
axis to set font sizes
"""
for tick in axis.xaxis.get_major_ticks():
tick.label.set_fo... |
Sets the font sizes to the x and y axis in the given axis object
Parameters
----------
axis : matplotlib.axes.Axes object
axis to set font sizes
| Sets the font sizes to the x and y axis in the given axis object
Parameters
axis : matplotlib.axes.Axes object
axis to set font sizes | [
"Sets",
"the",
"font",
"sizes",
"to",
"the",
"x",
"and",
"y",
"axis",
"in",
"the",
"given",
"axis",
"object",
"Parameters",
"axis",
":",
"matplotlib",
".",
"axes",
".",
"Axes",
"object",
"axis",
"to",
"set",
"font",
"sizes"
] | def __set_axis_tick(axis):
for tick in axis.xaxis.get_major_ticks():
tick.label.set_fontsize(font_size)
for tick in axis.yaxis.get_major_ticks():
tick.label.set_fontsize(font_size) | [
"def",
"__set_axis_tick",
"(",
"axis",
")",
":",
"for",
"tick",
"in",
"axis",
".",
"xaxis",
".",
"get_major_ticks",
"(",
")",
":",
"tick",
".",
"label",
".",
"set_fontsize",
"(",
"font_size",
")",
"for",
"tick",
"in",
"axis",
".",
"yaxis",
".",
"get_ma... | Sets the font sizes to the x and y axis in the given axis object
Parameters | [
"Sets",
"the",
"font",
"sizes",
"to",
"the",
"x",
"and",
"y",
"axis",
"in",
"the",
"given",
"axis",
"object",
"Parameters"
] | [
"\"\"\"\n Sets the font sizes to the x and y axis in the given axis object\n\n Parameters\n ----------\n axis : matplotlib.axes.Axes object\n axis to set font sizes\n \"\"\""
] | [
{
"param": "axis",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "axis",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3530066d5077390d5dfa2c5232820d9d48d031b1 | ondrejdyck/sidpy | sidpy/viz/plot_utils/misc.py | [
"MIT"
] | Python | use_scientific_ticks | null | def use_scientific_ticks(axis, is_x=True, formatting='%.2e'):
"""
Makes the desired axis use scientific notation for its tick labels. This is applicable only for 1D plots at the
moment.
Parameters
----------
axis : matplotlib.pyplot.axis object
Axis handle
is_x : bool, optional. Def... |
Makes the desired axis use scientific notation for its tick labels. This is applicable only for 1D plots at the
moment.
Parameters
----------
axis : matplotlib.pyplot.axis object
Axis handle
is_x : bool, optional. Default = True
If set to true, scientific notation will be appli... | Makes the desired axis use scientific notation for its tick labels. This is applicable only for 1D plots at the
moment.
Parameters
axis : matplotlib.pyplot.axis object
Axis handle
is_x : bool, optional. Default = True
If set to true, scientific notation will be applied only to the X axis.
If set to False, scientific ... | [
"Makes",
"the",
"desired",
"axis",
"use",
"scientific",
"notation",
"for",
"its",
"tick",
"labels",
".",
"This",
"is",
"applicable",
"only",
"for",
"1D",
"plots",
"at",
"the",
"moment",
".",
"Parameters",
"axis",
":",
"matplotlib",
".",
"pyplot",
".",
"axi... | def use_scientific_ticks(axis, is_x=True, formatting='%.2e'):
if not isinstance(axis, mpl.axes.Axes):
raise TypeError('axis must be a matplotlib.axes.Axes object')
if not isinstance(is_x, bool):
raise TypeError('is_x should be a boolean to avoid confusion')
if not isinstance(formatting, (str... | [
"def",
"use_scientific_ticks",
"(",
"axis",
",",
"is_x",
"=",
"True",
",",
"formatting",
"=",
"'%.2e'",
")",
":",
"if",
"not",
"isinstance",
"(",
"axis",
",",
"mpl",
".",
"axes",
".",
"Axes",
")",
":",
"raise",
"TypeError",
"(",
"'axis must be a matplotlib... | Makes the desired axis use scientific notation for its tick labels. | [
"Makes",
"the",
"desired",
"axis",
"use",
"scientific",
"notation",
"for",
"its",
"tick",
"labels",
"."
] | [
"\"\"\"\n Makes the desired axis use scientific notation for its tick labels. This is applicable only for 1D plots at the\n moment.\n\n Parameters\n ----------\n axis : matplotlib.pyplot.axis object\n Axis handle\n is_x : bool, optional. Default = True\n If set to true, scientific no... | [
{
"param": "axis",
"type": null
},
{
"param": "is_x",
"type": null
},
{
"param": "formatting",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "axis",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "is_x",
"type": null,
"docstring": null,
"docstring_tokens": [... |
3530066d5077390d5dfa2c5232820d9d48d031b1 | ondrejdyck/sidpy | sidpy/viz/plot_utils/misc.py | [
"MIT"
] | Python | make_scalar_mappable | <not_specific> | def make_scalar_mappable(vmin, vmax, cmap=None):
"""
Creates a scalar mappable object that can be used to create a colorbar for non-image (e.g. - line) plots
Parameters
----------
vmin : Number
Minimum value for colorbar
vmax : Number
Maximum value for colorbar
cmap : colorm... |
Creates a scalar mappable object that can be used to create a colorbar for non-image (e.g. - line) plots
Parameters
----------
vmin : Number
Minimum value for colorbar
vmax : Number
Maximum value for colorbar
cmap : colormap object
Colormap object to use
Returns
... | Creates a scalar mappable object that can be used to create a colorbar for non-image plots
Parameters
vmin : Number
Minimum value for colorbar
vmax : Number
Maximum value for colorbar
cmap : colormap object
Colormap object to use
Returns
sm : matplotlib.pyplot.cm.ScalarMappable object
The object that can used to cr... | [
"Creates",
"a",
"scalar",
"mappable",
"object",
"that",
"can",
"be",
"used",
"to",
"create",
"a",
"colorbar",
"for",
"non",
"-",
"image",
"plots",
"Parameters",
"vmin",
":",
"Number",
"Minimum",
"value",
"for",
"colorbar",
"vmax",
":",
"Number",
"Maximum",
... | def make_scalar_mappable(vmin, vmax, cmap=None):
assert isinstance(vmin, Number), 'vmin should be a number'
assert isinstance(vmax, Number), 'vmax should be a number'
assert vmin < vmax, 'vmin must be less than vmax'
if cmap is None:
cmap = default_cmap
else:
assert isinstance(cmap, ... | [
"def",
"make_scalar_mappable",
"(",
"vmin",
",",
"vmax",
",",
"cmap",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"vmin",
",",
"Number",
")",
",",
"'vmin should be a number'",
"assert",
"isinstance",
"(",
"vmax",
",",
"Number",
")",
",",
"'vmax shoul... | Creates a scalar mappable object that can be used to create a colorbar for non-image (e.g. | [
"Creates",
"a",
"scalar",
"mappable",
"object",
"that",
"can",
"be",
"used",
"to",
"create",
"a",
"colorbar",
"for",
"non",
"-",
"image",
"(",
"e",
".",
"g",
"."
] | [
"\"\"\"\n Creates a scalar mappable object that can be used to create a colorbar for non-image (e.g. - line) plots\n\n Parameters\n ----------\n vmin : Number\n Minimum value for colorbar\n vmax : Number\n Maximum value for colorbar\n cmap : colormap object\n Colormap object t... | [
{
"param": "vmin",
"type": null
},
{
"param": "vmax",
"type": null
},
{
"param": "cmap",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vmin",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vmax",
"type": null,
"docstring": null,
"docstring_tokens": [... |
3530066d5077390d5dfa2c5232820d9d48d031b1 | ondrejdyck/sidpy | sidpy/viz/plot_utils/misc.py | [
"MIT"
] | Python | export_fig_data | null | def export_fig_data(fig, filename, include_images=False):
"""
Export the data of all plots in the figure `fig` to a plain text file.
Parameters
----------
fig : matplotlib.figure.Figure
The figure containing the data to be exported
filename : str
The filename of the output text ... |
Export the data of all plots in the figure `fig` to a plain text file.
Parameters
----------
fig : matplotlib.figure.Figure
The figure containing the data to be exported
filename : str
The filename of the output text file
include_images : bool
Should images in the figur... | Export the data of all plots in the figure `fig` to a plain text file.
Parameters
fig : matplotlib.figure.Figure
The figure containing the data to be exported
filename : str
The filename of the output text file
include_images : bool
Should images in the figure also be exported
Returns | [
"Export",
"the",
"data",
"of",
"all",
"plots",
"in",
"the",
"figure",
"`",
"fig",
"`",
"to",
"a",
"plain",
"text",
"file",
".",
"Parameters",
"fig",
":",
"matplotlib",
".",
"figure",
".",
"Figure",
"The",
"figure",
"containing",
"the",
"data",
"to",
"b... | def export_fig_data(fig, filename, include_images=False):
axes = fig.get_axes()
axes_dict = dict()
for ax in axes:
ax_dict = dict()
ims = ax.get_images()
if len(ims) != 0 and include_images:
im_dict = dict()
for im in ims:
im_lab = im.get_label... | [
"def",
"export_fig_data",
"(",
"fig",
",",
"filename",
",",
"include_images",
"=",
"False",
")",
":",
"axes",
"=",
"fig",
".",
"get_axes",
"(",
")",
"axes_dict",
"=",
"dict",
"(",
")",
"for",
"ax",
"in",
"axes",
":",
"ax_dict",
"=",
"dict",
"(",
")",... | Export the data of all plots in the figure `fig` to a plain text file. | [
"Export",
"the",
"data",
"of",
"all",
"plots",
"in",
"the",
"figure",
"`",
"fig",
"`",
"to",
"a",
"plain",
"text",
"file",
"."
] | [
"\"\"\"\n Export the data of all plots in the figure `fig` to a plain text file.\n\n Parameters\n ----------\n fig : matplotlib.figure.Figure\n The figure containing the data to be exported\n filename : str\n The filename of the output text file\n include_images : bool\n Shoul... | [
{
"param": "fig",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "include_images",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fig",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens"... |
72273e3ff5670ca4905a22718657ee6b9315c62c | ondrejdyck/sidpy | sidpy/viz/jupyter_utils.py | [
"MIT"
] | Python | save_fig_filebox_button | <not_specific> | def save_fig_filebox_button(fig, filename):
"""
Create ipython widgets to allow the user to save a figure to the
specified file.
Parameters
----------
fig : matplotlib.Figure
The figure to be saved.
filename : str
The filename the figure should be saved to
Returns
-... |
Create ipython widgets to allow the user to save a figure to the
specified file.
Parameters
----------
fig : matplotlib.Figure
The figure to be saved.
filename : str
The filename the figure should be saved to
Returns
-------
widget_box : ipywidgets.HBox
Wid... | Create ipython widgets to allow the user to save a figure to the
specified file.
Parameters
fig : matplotlib.Figure
The figure to be saved.
filename : str
The filename the figure should be saved to
Returns
widget_box : ipywidgets.HBox
Widget box holding the text entry and save button | [
"Create",
"ipython",
"widgets",
"to",
"allow",
"the",
"user",
"to",
"save",
"a",
"figure",
"to",
"the",
"specified",
"file",
".",
"Parameters",
"fig",
":",
"matplotlib",
".",
"Figure",
"The",
"figure",
"to",
"be",
"saved",
".",
"filename",
":",
"str",
"T... | def save_fig_filebox_button(fig, filename):
filename = os.path.abspath(filename)
file_dir, filename = os.path.split(filename)
name_box = widgets.Text(value=filename,
placeholder='Type something',
description='Output Filename:',
... | [
"def",
"save_fig_filebox_button",
"(",
"fig",
",",
"filename",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"filename",
")",
"file_dir",
",",
"filename",
"=",
"os",
".",
"path",
".",
"split",
"(",
"filename",
")",
"name_box",
"=",
... | Create ipython widgets to allow the user to save a figure to the
specified file. | [
"Create",
"ipython",
"widgets",
"to",
"allow",
"the",
"user",
"to",
"save",
"a",
"figure",
"to",
"the",
"specified",
"file",
"."
] | [
"\"\"\"\n Create ipython widgets to allow the user to save a figure to the\n specified file.\n\n Parameters\n ----------\n fig : matplotlib.Figure\n The figure to be saved.\n filename : str\n The filename the figure should be saved to\n\n Returns\n -------\n widget_box : ipy... | [
{
"param": "fig",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fig",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens"... |
40efd4a54aa3b107f9bd89d66813a6e403b93916 | ondrejdyck/sidpy | sidpy/viz/plot_utils/image.py | [
"MIT"
] | Python | plot_map | <not_specific> | def plot_map(axis, img, show_xy_ticks=True, show_cbar=True, x_vec=None, y_vec=None,
num_ticks=4, stdevs=None, cbar_label=None, tick_font_size=None, infer_aspect=False, **kwargs):
"""
Plots an image within the given axis with a color bar + label and appropriate X, Y tick labels.
This is particul... |
Plots an image within the given axis with a color bar + label and appropriate X, Y tick labels.
This is particularly useful to get readily interpretable plots for papers
Parameters
----------
axis : matplotlib.axes.Axes object
Axis to plot this image onto
img : 2D numpy array with real... | Plots an image within the given axis with a color bar + label and appropriate X, Y tick labels.
This is particularly useful to get readily interpretable plots for papers
Parameters
Returns
im_handle : handle to image plot
handle to image plot
cbar : handle to color bar
handle to color bar
Note
The origin of the ... | [
"Plots",
"an",
"image",
"within",
"the",
"given",
"axis",
"with",
"a",
"color",
"bar",
"+",
"label",
"and",
"appropriate",
"X",
"Y",
"tick",
"labels",
".",
"This",
"is",
"particularly",
"useful",
"to",
"get",
"readily",
"interpretable",
"plots",
"for",
"pa... | def plot_map(axis, img, show_xy_ticks=True, show_cbar=True, x_vec=None, y_vec=None,
num_ticks=4, stdevs=None, cbar_label=None, tick_font_size=None, infer_aspect=False, **kwargs):
if not isinstance(axis, mpl.axes.Axes):
raise TypeError('axis must be a matplotlib.axes.Axes object')
if not isi... | [
"def",
"plot_map",
"(",
"axis",
",",
"img",
",",
"show_xy_ticks",
"=",
"True",
",",
"show_cbar",
"=",
"True",
",",
"x_vec",
"=",
"None",
",",
"y_vec",
"=",
"None",
",",
"num_ticks",
"=",
"4",
",",
"stdevs",
"=",
"None",
",",
"cbar_label",
"=",
"None"... | Plots an image within the given axis with a color bar + label and appropriate X, Y tick labels. | [
"Plots",
"an",
"image",
"within",
"the",
"given",
"axis",
"with",
"a",
"color",
"bar",
"+",
"label",
"and",
"appropriate",
"X",
"Y",
"tick",
"labels",
"."
] | [
"\"\"\"\n Plots an image within the given axis with a color bar + label and appropriate X, Y tick labels.\n This is particularly useful to get readily interpretable plots for papers\n\n Parameters\n ----------\n axis : matplotlib.axes.Axes object\n Axis to plot this image onto\n img : 2D nu... | [
{
"param": "axis",
"type": null
},
{
"param": "img",
"type": null
},
{
"param": "show_xy_ticks",
"type": null
},
{
"param": "show_cbar",
"type": null
},
{
"param": "x_vec",
"type": null
},
{
"param": "y_vec",
"type": null
},
{
"param": "num... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "axis",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "img",
"type": null,
"docstring": null,
"docstring_tokens": []... |
41959eb0b005f98e86b9efaa3cf708c3b5d018f3 | ondrejdyck/sidpy | sidpy/base/string_utils.py | [
"MIT"
] | Python | format_quantity | <not_specific> | def format_quantity(value, unit_names, factors, decimals=2):
"""
Formats the provided quantity such as time or size to appropriate strings
Parameters
----------
value : number
value in some base units. For example - time in seconds
unit_names : array-like
List of names of units ... |
Formats the provided quantity such as time or size to appropriate strings
Parameters
----------
value : number
value in some base units. For example - time in seconds
unit_names : array-like
List of names of units for each scale of the value
factors : array-like
List of... | Formats the provided quantity such as time or size to appropriate strings
Parameters
value : number
value in some base units. For example - time in seconds
unit_names : array-like
List of names of units for each scale of the value
factors : array-like
List of scaling factors for each scale of the value
decimals : uint... | [
"Formats",
"the",
"provided",
"quantity",
"such",
"as",
"time",
"or",
"size",
"to",
"appropriate",
"strings",
"Parameters",
"value",
":",
"number",
"value",
"in",
"some",
"base",
"units",
".",
"For",
"example",
"-",
"time",
"in",
"seconds",
"unit_names",
":"... | def format_quantity(value, unit_names, factors, decimals=2):
if not isinstance(unit_names, Iterable):
raise TypeError('unit_names must an Iterable')
if not isinstance(factors, Iterable):
raise TypeError('factors must be an Iterable')
if len(unit_names) != len(factors):
raise ValueErr... | [
"def",
"format_quantity",
"(",
"value",
",",
"unit_names",
",",
"factors",
",",
"decimals",
"=",
"2",
")",
":",
"if",
"not",
"isinstance",
"(",
"unit_names",
",",
"Iterable",
")",
":",
"raise",
"TypeError",
"(",
"'unit_names must an Iterable'",
")",
"if",
"n... | Formats the provided quantity such as time or size to appropriate strings
Parameters | [
"Formats",
"the",
"provided",
"quantity",
"such",
"as",
"time",
"or",
"size",
"to",
"appropriate",
"strings",
"Parameters"
] | [
"\"\"\"\n Formats the provided quantity such as time or size to appropriate strings\n\n Parameters\n ----------\n value : number\n value in some base units. For example - time in seconds\n unit_names : array-like\n List of names of units for each scale of the value\n factors : array-... | [
{
"param": "value",
"type": null
},
{
"param": "unit_names",
"type": null
},
{
"param": "factors",
"type": null
},
{
"param": "decimals",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "unit_names",
"type": null,
"docstring": null,
"docstring_tok... |
41959eb0b005f98e86b9efaa3cf708c3b5d018f3 | ondrejdyck/sidpy | sidpy/base/string_utils.py | [
"MIT"
] | Python | format_time | <not_specific> | def format_time(time_in_seconds, decimals=2):
"""
Formats the provided time in seconds to seconds, minutes, or hours
Parameters
----------
time_in_seconds : number
Time in seconds
decimals : uint, optional. default = 2
Number of decimal places to which the time needs to be forma... |
Formats the provided time in seconds to seconds, minutes, or hours
Parameters
----------
time_in_seconds : number
Time in seconds
decimals : uint, optional. default = 2
Number of decimal places to which the time needs to be formatted
Returns
-------
str
String ... | Formats the provided time in seconds to seconds, minutes, or hours
Parameters
time_in_seconds : number
Time in seconds
decimals : uint, optional. default = 2
Number of decimal places to which the time needs to be formatted
Returns
str
String with time formatted correctly
Examples
| [
"Formats",
"the",
"provided",
"time",
"in",
"seconds",
"to",
"seconds",
"minutes",
"or",
"hours",
"Parameters",
"time_in_seconds",
":",
"number",
"Time",
"in",
"seconds",
"decimals",
":",
"uint",
"optional",
".",
"default",
"=",
"2",
"Number",
"of",
"decimal",... | def format_time(time_in_seconds, decimals=2):
units = ['msec', 'sec', 'mins', 'hours']
factors = [0.001, 1, 60, 3600]
return format_quantity(time_in_seconds, units, factors, decimals=decimals) | [
"def",
"format_time",
"(",
"time_in_seconds",
",",
"decimals",
"=",
"2",
")",
":",
"units",
"=",
"[",
"'msec'",
",",
"'sec'",
",",
"'mins'",
",",
"'hours'",
"]",
"factors",
"=",
"[",
"0.001",
",",
"1",
",",
"60",
",",
"3600",
"]",
"return",
"format_q... | Formats the provided time in seconds to seconds, minutes, or hours
Parameters | [
"Formats",
"the",
"provided",
"time",
"in",
"seconds",
"to",
"seconds",
"minutes",
"or",
"hours",
"Parameters"
] | [
"\"\"\"\n Formats the provided time in seconds to seconds, minutes, or hours\n\n Parameters\n ----------\n time_in_seconds : number\n Time in seconds\n decimals : uint, optional. default = 2\n Number of decimal places to which the time needs to be formatted\n\n Returns\n -------\n... | [
{
"param": "time_in_seconds",
"type": null
},
{
"param": "decimals",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "time_in_seconds",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "decimals",
"type": null,
"docstring": null,
"docst... |
41959eb0b005f98e86b9efaa3cf708c3b5d018f3 | ondrejdyck/sidpy | sidpy/base/string_utils.py | [
"MIT"
] | Python | validate_single_string_arg | <not_specific> | def validate_single_string_arg(value, name):
"""
This function is to be used when validating a SINGLE string parameter for a
function. Trims the provided value.
Errors in the string will result in Exceptions
Parameters
----------
value : str
Value of the parameter
name : str
... |
This function is to be used when validating a SINGLE string parameter for a
function. Trims the provided value.
Errors in the string will result in Exceptions
Parameters
----------
value : str
Value of the parameter
name : str
Name of the parameter
Returns
-------
... | This function is to be used when validating a SINGLE string parameter for a
function. Trims the provided value.
Errors in the string will result in Exceptions
Parameters
value : str
Value of the parameter
name : str
Name of the parameter
Returns
str
Cleaned string value of the parameter | [
"This",
"function",
"is",
"to",
"be",
"used",
"when",
"validating",
"a",
"SINGLE",
"string",
"parameter",
"for",
"a",
"function",
".",
"Trims",
"the",
"provided",
"value",
".",
"Errors",
"in",
"the",
"string",
"will",
"result",
"in",
"Exceptions",
"Parameter... | def validate_single_string_arg(value, name):
if not isinstance(value, (str, unicode)):
raise TypeError(name + ' should be a string')
value = value.strip()
if len(value) <= 0:
raise ValueError(name + ' should not be an empty string')
return value | [
"def",
"validate_single_string_arg",
"(",
"value",
",",
"name",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"raise",
"TypeError",
"(",
"name",
"+",
"' should be a string'",
")",
"value",
"=",
"value",
... | This function is to be used when validating a SINGLE string parameter for a
function. | [
"This",
"function",
"is",
"to",
"be",
"used",
"when",
"validating",
"a",
"SINGLE",
"string",
"parameter",
"for",
"a",
"function",
"."
] | [
"\"\"\"\n This function is to be used when validating a SINGLE string parameter for a\n function. Trims the provided value.\n Errors in the string will result in Exceptions\n\n Parameters\n ----------\n value : str\n Value of the parameter\n name : str\n Name of the parameter\n\n ... | [
{
"param": "value",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": ... |
41959eb0b005f98e86b9efaa3cf708c3b5d018f3 | ondrejdyck/sidpy | sidpy/base/string_utils.py | [
"MIT"
] | Python | validate_list_of_strings | <not_specific> | def validate_list_of_strings(str_list, parm_name='parameter'):
"""
This function is to be used when validating and cleaning a list of strings.
Trims the provided strings. Errors in the strings will result in Exceptions
Parameters
----------
str_list : array-like
list or tuple of strings... |
This function is to be used when validating and cleaning a list of strings.
Trims the provided strings. Errors in the strings will result in Exceptions
Parameters
----------
str_list : array-like
list or tuple of strings
parm_name : str, Optional. Default = 'parameter'
Name of ... | This function is to be used when validating and cleaning a list of strings.
Trims the provided strings. Errors in the strings will result in Exceptions
Parameters
str_list : array-like
list or tuple of strings
parm_name : str, Optional. Default = 'parameter'
Name of the parameter corresponding to this string list tha... | [
"This",
"function",
"is",
"to",
"be",
"used",
"when",
"validating",
"and",
"cleaning",
"a",
"list",
"of",
"strings",
".",
"Trims",
"the",
"provided",
"strings",
".",
"Errors",
"in",
"the",
"strings",
"will",
"result",
"in",
"Exceptions",
"Parameters",
"str_l... | def validate_list_of_strings(str_list, parm_name='parameter'):
if isinstance(str_list, (str, unicode)):
return [validate_single_string_arg(str_list, parm_name)]
if not isinstance(str_list, (list, tuple)):
raise TypeError(parm_name + ' should be a string or list / tuple of '
... | [
"def",
"validate_list_of_strings",
"(",
"str_list",
",",
"parm_name",
"=",
"'parameter'",
")",
":",
"if",
"isinstance",
"(",
"str_list",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"return",
"[",
"validate_single_string_arg",
"(",
"str_list",
",",
"parm_na... | This function is to be used when validating and cleaning a list of strings. | [
"This",
"function",
"is",
"to",
"be",
"used",
"when",
"validating",
"and",
"cleaning",
"a",
"list",
"of",
"strings",
"."
] | [
"\"\"\"\n This function is to be used when validating and cleaning a list of strings.\n Trims the provided strings. Errors in the strings will result in Exceptions\n\n Parameters\n ----------\n str_list : array-like\n list or tuple of strings\n parm_name : str, Optional. Default = 'paramete... | [
{
"param": "str_list",
"type": null
},
{
"param": "parm_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str_list",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parm_name",
"type": null,
"docstring": null,
"docstring_t... |
41959eb0b005f98e86b9efaa3cf708c3b5d018f3 | ondrejdyck/sidpy | sidpy/base/string_utils.py | [
"MIT"
] | Python | validate_string_args | <not_specific> | def validate_string_args(arg_list, arg_names):
"""
This function is to be used when validating string parameters for a
function. Trims the provided strings.
Errors in the strings will result in Exceptions
Parameters
----------
arg_list : array-like
List of str objects that signify t... |
This function is to be used when validating string parameters for a
function. Trims the provided strings.
Errors in the strings will result in Exceptions
Parameters
----------
arg_list : array-like
List of str objects that signify the value for a position argument in
a function... | This function is to be used when validating string parameters for a
function. Trims the provided strings.
Errors in the strings will result in Exceptions
Parameters
arg_list : array-like
List of str objects that signify the value for a position argument in
a function
arg_names : array-like
List of str objects with th... | [
"This",
"function",
"is",
"to",
"be",
"used",
"when",
"validating",
"string",
"parameters",
"for",
"a",
"function",
".",
"Trims",
"the",
"provided",
"strings",
".",
"Errors",
"in",
"the",
"strings",
"will",
"result",
"in",
"Exceptions",
"Parameters",
"arg_list... | def validate_string_args(arg_list, arg_names):
if isinstance(arg_list, (str, unicode)):
arg_list = [arg_list]
if isinstance(arg_names, (str, unicode)):
arg_names = [arg_names]
cleaned_args = []
if not isinstance(arg_list, (tuple, list)):
raise TypeError('arg_list should be a tupl... | [
"def",
"validate_string_args",
"(",
"arg_list",
",",
"arg_names",
")",
":",
"if",
"isinstance",
"(",
"arg_list",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"arg_list",
"=",
"[",
"arg_list",
"]",
"if",
"isinstance",
"(",
"arg_names",
",",
"(",
"str",... | This function is to be used when validating string parameters for a
function. | [
"This",
"function",
"is",
"to",
"be",
"used",
"when",
"validating",
"string",
"parameters",
"for",
"a",
"function",
"."
] | [
"\"\"\"\n This function is to be used when validating string parameters for a\n function. Trims the provided strings.\n Errors in the strings will result in Exceptions\n\n Parameters\n ----------\n arg_list : array-like\n List of str objects that signify the value for a position argument in... | [
{
"param": "arg_list",
"type": null
},
{
"param": "arg_names",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arg_list",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg_names",
"type": null,
"docstring": null,
"docstring_t... |
41959eb0b005f98e86b9efaa3cf708c3b5d018f3 | ondrejdyck/sidpy | sidpy/base/string_utils.py | [
"MIT"
] | Python | clean_string_att | <not_specific> | def clean_string_att(att_val):
"""
Replaces any unicode objects within lists with their string counterparts to
ensure compatibility with python 3. If the attribute is indeed a list of
unicodes, the changes will be made in-place
Parameters
----------
att_val : object
Attribute object... |
Replaces any unicode objects within lists with their string counterparts to
ensure compatibility with python 3. If the attribute is indeed a list of
unicodes, the changes will be made in-place
Parameters
----------
att_val : object
Attribute object
Returns
-------
att_val ... | Replaces any unicode objects within lists with their string counterparts to
ensure compatibility with python 3. If the attribute is indeed a list of
unicodes, the changes will be made in-place
Parameters
att_val : object
Attribute object
Returns
att_val : object
Attribute object
Notes
The ``h5py`` package used fo... | [
"Replaces",
"any",
"unicode",
"objects",
"within",
"lists",
"with",
"their",
"string",
"counterparts",
"to",
"ensure",
"compatibility",
"with",
"python",
"3",
".",
"If",
"the",
"attribute",
"is",
"indeed",
"a",
"list",
"of",
"unicodes",
"the",
"changes",
"will... | def clean_string_att(att_val):
try:
if isinstance(att_val, Iterable):
if type(att_val) in [unicode, str]:
return att_val
elif np.any([type(x) in [str, unicode, bytes, np.str_] for x in att_val]):
return np.array(att_val, dtype='S')
elif isi... | [
"def",
"clean_string_att",
"(",
"att_val",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"att_val",
",",
"Iterable",
")",
":",
"if",
"type",
"(",
"att_val",
")",
"in",
"[",
"unicode",
",",
"str",
"]",
":",
"return",
"att_val",
"elif",
"np",
".",
"an... | Replaces any unicode objects within lists with their string counterparts to
ensure compatibility with python 3. | [
"Replaces",
"any",
"unicode",
"objects",
"within",
"lists",
"with",
"their",
"string",
"counterparts",
"to",
"ensure",
"compatibility",
"with",
"python",
"3",
"."
] | [
"\"\"\"\n Replaces any unicode objects within lists with their string counterparts to\n ensure compatibility with python 3. If the attribute is indeed a list of\n unicodes, the changes will be made in-place\n\n Parameters\n ----------\n att_val : object\n Attribute object\n\n Returns\n ... | [
{
"param": "att_val",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "att_val",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
41959eb0b005f98e86b9efaa3cf708c3b5d018f3 | ondrejdyck/sidpy | sidpy/base/string_utils.py | [
"MIT"
] | Python | str_to_other | <not_specific> | def str_to_other(value):
"""
Casts a single value encoded in a string to the appropriate python object.
Useful when parsing numbers, boolean, etc. in text files
Parameters
----------
value : str / unicode
String to be casted into other appropriate python object
"""
if not isinst... |
Casts a single value encoded in a string to the appropriate python object.
Useful when parsing numbers, boolean, etc. in text files
Parameters
----------
value : str / unicode
String to be casted into other appropriate python object
| Casts a single value encoded in a string to the appropriate python object.
Useful when parsing numbers, boolean, etc. in text files
Parameters
value : str / unicode
String to be casted into other appropriate python object | [
"Casts",
"a",
"single",
"value",
"encoded",
"in",
"a",
"string",
"to",
"the",
"appropriate",
"python",
"object",
".",
"Useful",
"when",
"parsing",
"numbers",
"boolean",
"etc",
".",
"in",
"text",
"files",
"Parameters",
"value",
":",
"str",
"/",
"unicode",
"... | def str_to_other(value):
if not isinstance(value, (str, unicode)):
raise TypeError('Expected object of type str. Provided object was: {}'
''.format(type(value)))
if len(value.split(' ')) > 1:
raise ValueError('Expected a string without spaces. Got: "{}"'
... | [
"def",
"str_to_other",
"(",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"raise",
"TypeError",
"(",
"'Expected object of type str. Provided object was: {}'",
"''",
".",
"format",
"(",
"type",
"(",
... | Casts a single value encoded in a string to the appropriate python object. | [
"Casts",
"a",
"single",
"value",
"encoded",
"in",
"a",
"string",
"to",
"the",
"appropriate",
"python",
"object",
"."
] | [
"\"\"\"\n Casts a single value encoded in a string to the appropriate python object.\n Useful when parsing numbers, boolean, etc. in text files\n\n Parameters\n ----------\n value : str / unicode\n String to be casted into other appropriate python object\n \"\"\""
] | [
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
84a191920be31bf1ed378962e22e1fb19de9948d | ondrejdyck/sidpy | sidpy/io/interface_utils.py | [
"MIT"
] | Python | check_ssh | <not_specific> | def check_ssh():
"""
Checks whether or not the python kernel is running locally (False) or remotely (True)
Returns
-------
output : bool
Whether or not the kernel is running over SSH (remote machine)
Notes
-----
When developing workflows that need to work on remote or virtual m... |
Checks whether or not the python kernel is running locally (False) or remotely (True)
Returns
-------
output : bool
Whether or not the kernel is running over SSH (remote machine)
Notes
-----
When developing workflows that need to work on remote or virtual machines
in addition ... | Checks whether or not the python kernel is running locally (False) or remotely (True)
Returns
output : bool
Whether or not the kernel is running over SSH (remote machine)
Notes
When developing workflows that need to work on remote or virtual machines
in addition to one's own personal computer such as a laptop, this ... | [
"Checks",
"whether",
"or",
"not",
"the",
"python",
"kernel",
"is",
"running",
"locally",
"(",
"False",
")",
"or",
"remotely",
"(",
"True",
")",
"Returns",
"output",
":",
"bool",
"Whether",
"or",
"not",
"the",
"kernel",
"is",
"running",
"over",
"SSH",
"("... | def check_ssh():
return 'SSH_CLIENT' in os.environ or 'SSH_TTY' in os.environ | [
"def",
"check_ssh",
"(",
")",
":",
"return",
"'SSH_CLIENT'",
"in",
"os",
".",
"environ",
"or",
"'SSH_TTY'",
"in",
"os",
".",
"environ"
] | Checks whether or not the python kernel is running locally (False) or remotely (True)
Returns | [
"Checks",
"whether",
"or",
"not",
"the",
"python",
"kernel",
"is",
"running",
"locally",
"(",
"False",
")",
"or",
"remotely",
"(",
"True",
")",
"Returns"
] | [
"\"\"\"\n Checks whether or not the python kernel is running locally (False) or remotely (True)\n\n Returns\n -------\n output : bool\n Whether or not the kernel is running over SSH (remote machine)\n\n Notes\n -----\n When developing workflows that need to work on remote or virtual mach... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c9bc01720629b702b9f1ef2f6ad26f7a30c081ce | ondrejdyck/sidpy | sidpy/sid/translator.py | [
"MIT"
] | Python | is_valid_file | <not_specific> | def is_valid_file(file_path, *args, **kwargs):
"""
Checks whether the provided file can be read by this translator.
This basic function compares the file extension against the "extension"
keyword argument. If the extension matches, this function returns True
Parameters
... |
Checks whether the provided file can be read by this translator.
This basic function compares the file extension against the "extension"
keyword argument. If the extension matches, this function returns True
Parameters
----------
file_path : str
Path to raw... | Checks whether the provided file can be read by this translator.
This basic function compares the file extension against the "extension"
keyword argument. If the extension matches, this function returns True
Parameters
file_path : str
Path to raw data file
Returns
file_path : str
Path to the file that needs to be p... | [
"Checks",
"whether",
"the",
"provided",
"file",
"can",
"be",
"read",
"by",
"this",
"translator",
".",
"This",
"basic",
"function",
"compares",
"the",
"file",
"extension",
"against",
"the",
"\"",
"extension",
"\"",
"keyword",
"argument",
".",
"If",
"the",
"ex... | def is_valid_file(file_path, *args, **kwargs):
file_path = validate_single_string_arg(file_path, 'file_name')
if not os.path.exists(file_path):
raise FileNotFoundError(file_path + ' does not exist')
targ_ext = kwargs.get('extension', None)
if not targ_ext:
raise N... | [
"def",
"is_valid_file",
"(",
"file_path",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"file_path",
"=",
"validate_single_string_arg",
"(",
"file_path",
",",
"'file_name'",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"file_path",
")",
":",... | Checks whether the provided file can be read by this translator. | [
"Checks",
"whether",
"the",
"provided",
"file",
"can",
"be",
"read",
"by",
"this",
"translator",
"."
] | [
"\"\"\"\n Checks whether the provided file can be read by this translator.\n\n This basic function compares the file extension against the \"extension\"\n keyword argument. If the extension matches, this function returns True\n\n Parameters\n ----------\n file_path : str\n ... | [
{
"param": "file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83bff6ae116012a0c5794db1e853906021b4f4aa | ondrejdyck/sidpy | sidpy/sid/reader.py | [
"MIT"
] | Python | can_read | <not_specific> | def can_read(self, *args, **kwargs):
"""
Checks whether the provided file can be read by this reader.
This basic function compares the file extension against the
``extension`` keyword argument. If the extension matches, this function
returns True
Parameters
----... |
Checks whether the provided file can be read by this reader.
This basic function compares the file extension against the
``extension`` keyword argument. If the extension matches, this function
returns True
Parameters
----------
extension : str or iterable of st... | Checks whether the provided file can be read by this reader.
This basic function compares the file extension against the
``extension`` keyword argument. If the extension matches, this function
returns True
Parameters
extension : str or iterable of str, Optional. Default = None
File extension for the input file.
Retu... | [
"Checks",
"whether",
"the",
"provided",
"file",
"can",
"be",
"read",
"by",
"this",
"reader",
".",
"This",
"basic",
"function",
"compares",
"the",
"file",
"extension",
"against",
"the",
"`",
"`",
"extension",
"`",
"`",
"keyword",
"argument",
".",
"If",
"the... | def can_read(self, *args, **kwargs):
targ_ext = kwargs.get('extension', None)
if not targ_ext:
raise NotImplementedError('Either can_read() has not been '
'implemented by this Reader or the '
'"extension" keyword arg... | [
"def",
"can_read",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"targ_ext",
"=",
"kwargs",
".",
"get",
"(",
"'extension'",
",",
"None",
")",
"if",
"not",
"targ_ext",
":",
"raise",
"NotImplementedError",
"(",
"'Either can_read() has not been ... | Checks whether the provided file can be read by this reader. | [
"Checks",
"whether",
"the",
"provided",
"file",
"can",
"be",
"read",
"by",
"this",
"reader",
"."
] | [
"\"\"\"\n Checks whether the provided file can be read by this reader.\n\n This basic function compares the file extension against the\n ``extension`` keyword argument. If the extension matches, this function\n returns True\n\n Parameters\n ----------\n extension : s... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d463de9f6ca13d43061cc3bf0cbff3623aad647d | ondrejdyck/sidpy | sidpy/base/dict_utils.py | [
"MIT"
] | Python | nest_dict | <not_specific> | def nest_dict(flat_dict, separator='-'):
"""
Generates a nested dictionary from a flattened dictionary
Parameters
----------
flat_dict : dict
Dictionary whose keys are flattened to a single string with a separator
separator : str, optional. Default = '-'
Separator used to delimi... |
Generates a nested dictionary from a flattened dictionary
Parameters
----------
flat_dict : dict
Dictionary whose keys are flattened to a single string with a separator
separator : str, optional. Default = '-'
Separator used to delimit the levels in the keys
Returns
------... | Generates a nested dictionary from a flattened dictionary
Parameters
flat_dict : dict
Dictionary whose keys are flattened to a single string with a separator
separator : str, optional. Default = '-'
Separator used to delimit the levels in the keys
Returns
nested_dict : dict
Nested dictionary
Notes
| [
"Generates",
"a",
"nested",
"dictionary",
"from",
"a",
"flattened",
"dictionary",
"Parameters",
"flat_dict",
":",
"dict",
"Dictionary",
"whose",
"keys",
"are",
"flattened",
"to",
"a",
"single",
"string",
"with",
"a",
"separator",
"separator",
":",
"str",
"option... | def nest_dict(flat_dict, separator='-'):
nested_dict = dict()
conflict_items = dict()
for key, val in flat_dict.items():
this_dict = nested_dict_from_flattened_key({key: val},
separator=separator)
try:
nested_dict = merge_dicts(n... | [
"def",
"nest_dict",
"(",
"flat_dict",
",",
"separator",
"=",
"'-'",
")",
":",
"nested_dict",
"=",
"dict",
"(",
")",
"conflict_items",
"=",
"dict",
"(",
")",
"for",
"key",
",",
"val",
"in",
"flat_dict",
".",
"items",
"(",
")",
":",
"this_dict",
"=",
"... | Generates a nested dictionary from a flattened dictionary
Parameters | [
"Generates",
"a",
"nested",
"dictionary",
"from",
"a",
"flattened",
"dictionary",
"Parameters"
] | [
"\"\"\"\n Generates a nested dictionary from a flattened dictionary\n\n Parameters\n ----------\n flat_dict : dict\n Dictionary whose keys are flattened to a single string with a separator\n separator : str, optional. Default = '-'\n Separator used to delimit the levels in the keys\n\n ... | [
{
"param": "flat_dict",
"type": null
},
{
"param": "separator",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "flat_dict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "separator",
"type": null,
"docstring": null,
"docstring_... |
d463de9f6ca13d43061cc3bf0cbff3623aad647d | ondrejdyck/sidpy | sidpy/base/dict_utils.py | [
"MIT"
] | Python | print_nested_dict | null | def print_nested_dict(nested_dict, level=0):
"""
Prints a nested dictionary in a nested manner
Parameters
----------
nested_dict : dict
Nested dictionary
level : uint, internal variable. Leave unspecified
Current depth of nested dictionary
Returns
-------
None
"... |
Prints a nested dictionary in a nested manner
Parameters
----------
nested_dict : dict
Nested dictionary
level : uint, internal variable. Leave unspecified
Current depth of nested dictionary
Returns
-------
None
| Prints a nested dictionary in a nested manner
Parameters
nested_dict : dict
Nested dictionary
level : uint, internal variable. Leave unspecified
Current depth of nested dictionary
Returns
None | [
"Prints",
"a",
"nested",
"dictionary",
"in",
"a",
"nested",
"manner",
"Parameters",
"nested_dict",
":",
"dict",
"Nested",
"dictionary",
"level",
":",
"uint",
"internal",
"variable",
".",
"Leave",
"unspecified",
"Current",
"depth",
"of",
"nested",
"dictionary",
"... | def print_nested_dict(nested_dict, level=0):
if not isinstance(nested_dict, dict):
raise TypeError('nested_dict should be a dict. Provided object was: {}'
''.format(type(nested_dict)))
for key, val in nested_dict.items():
if isinstance(val, dict):
print('\t'*l... | [
"def",
"print_nested_dict",
"(",
"nested_dict",
",",
"level",
"=",
"0",
")",
":",
"if",
"not",
"isinstance",
"(",
"nested_dict",
",",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"'nested_dict should be a dict. Provided object was: {}'",
"''",
".",
"format",
"(",
... | Prints a nested dictionary in a nested manner
Parameters | [
"Prints",
"a",
"nested",
"dictionary",
"in",
"a",
"nested",
"manner",
"Parameters"
] | [
"\"\"\"\n Prints a nested dictionary in a nested manner\n\n Parameters\n ----------\n nested_dict : dict\n Nested dictionary\n level : uint, internal variable. Leave unspecified\n Current depth of nested dictionary\n\n Returns\n -------\n None\n \"\"\""
] | [
{
"param": "nested_dict",
"type": null
},
{
"param": "level",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "nested_dict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "level",
"type": null,
"docstring": null,
"docstring_to... |
e0a53fff1b1ab8d0a6ce370dc83330a549f59b39 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/pulses/contexts/awg_context.py | [
"BSD-3-Clause"
] | Python | compile_and_transfer_sequence | <not_specific> | def compile_and_transfer_sequence(self, sequence, driver=None):
"""Compile the pulse sequence and send it to the instruments.
As this context does not support any special sequence it will always
get a flat list of pulses.
Parameters
----------
sequence : RootSequence
... | Compile the pulse sequence and send it to the instruments.
As this context does not support any special sequence it will always
get a flat list of pulses.
Parameters
----------
sequence : RootSequence
Sequence to compile and transfer.
driver : object, optio... | Compile the pulse sequence and send it to the instruments.
As this context does not support any special sequence it will always
get a flat list of pulses.
Parameters
sequence : RootSequence
Sequence to compile and transfer.
driver : object, optional
Instrument driver to use to transfer the sequence once compiled.
If... | [
"Compile",
"the",
"pulse",
"sequence",
"and",
"send",
"it",
"to",
"the",
"instruments",
".",
"As",
"this",
"context",
"does",
"not",
"support",
"any",
"special",
"sequence",
"it",
"will",
"always",
"get",
"a",
"flat",
"list",
"of",
"pulses",
".",
"Paramete... | def compile_and_transfer_sequence(self, sequence, driver=None):
items, errors = self.preprocess_sequence(sequence)
if errors:
return False, {}, errors
duration = max([pulse.stop for pulse in items])
if sequence.time_constrained:
duration = sequence.duration
... | [
"def",
"compile_and_transfer_sequence",
"(",
"self",
",",
"sequence",
",",
"driver",
"=",
"None",
")",
":",
"items",
",",
"errors",
"=",
"self",
".",
"preprocess_sequence",
"(",
"sequence",
")",
"if",
"errors",
":",
"return",
"False",
",",
"{",
"}",
",",
... | Compile the pulse sequence and send it to the instruments. | [
"Compile",
"the",
"pulse",
"sequence",
"and",
"send",
"it",
"to",
"the",
"instruments",
"."
] | [
"\"\"\"Compile the pulse sequence and send it to the instruments.\n\n As this context does not support any special sequence it will always\n get a flat list of pulses.\n\n Parameters\n ----------\n sequence : RootSequence\n Sequence to compile and transfer.\n\n d... | [
{
"param": "self",
"type": null
},
{
"param": "sequence",
"type": null
},
{
"param": "driver",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sequence",
"type": null,
"docstring": null,
"docstring_tokens... |
e0a53fff1b1ab8d0a6ce370dc83330a549f59b39 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/pulses/contexts/awg_context.py | [
"BSD-3-Clause"
] | Python | list_sequence_infos | <not_specific> | def list_sequence_infos(self):
"""List the sequence infos returned after a successful completion.
Returns
-------
infos : dict
Dict mimicking the one returned on successful completion of
a compilation and transfer. The values types should match the
th... | List the sequence infos returned after a successful completion.
Returns
-------
infos : dict
Dict mimicking the one returned on successful completion of
a compilation and transfer. The values types should match the
the ones found in the real infos.
| List the sequence infos returned after a successful completion.
Returns
infos : dict
Dict mimicking the one returned on successful completion of
a compilation and transfer. The values types should match the
the ones found in the real infos. | [
"List",
"the",
"sequence",
"infos",
"returned",
"after",
"a",
"successful",
"completion",
".",
"Returns",
"infos",
":",
"dict",
"Dict",
"mimicking",
"the",
"one",
"returned",
"on",
"successful",
"completion",
"of",
"a",
"compilation",
"and",
"transfer",
".",
"... | def list_sequence_infos(self):
return dict(sampling_frequency=1e9,
sequence_ch1='Seq_Ch1',
sequence_ch2='Seq_Ch2',
sequence_ch3='Seq_Ch3',
sequence_ch4='Seq_Ch4') | [
"def",
"list_sequence_infos",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"sampling_frequency",
"=",
"1e9",
",",
"sequence_ch1",
"=",
"'Seq_Ch1'",
",",
"sequence_ch2",
"=",
"'Seq_Ch2'",
",",
"sequence_ch3",
"=",
"'Seq_Ch3'",
",",
"sequence_ch4",
"=",
"'Seq_Ch4... | List the sequence infos returned after a successful completion. | [
"List",
"the",
"sequence",
"infos",
"returned",
"after",
"a",
"successful",
"completion",
"."
] | [
"\"\"\"List the sequence infos returned after a successful completion.\n\n Returns\n -------\n infos : dict\n Dict mimicking the one returned on successful completion of\n a compilation and transfer. The values types should match the\n the ones found in the real... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e0a53fff1b1ab8d0a6ce370dc83330a549f59b39 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/pulses/contexts/awg_context.py | [
"BSD-3-Clause"
] | Python | _transfer_sequences | <not_specific> | def _transfer_sequences(self, driver, sequences, infos):
"""Transfer a previously compiled sequence.
"""
for ch_id in driver.defined_channels:
if ch_id in sequences:
driver.to_send(infos['sequence_ch%s' % ch_id],
sequences[ch_id])
... | Transfer a previously compiled sequence.
| Transfer a previously compiled sequence. | [
"Transfer",
"a",
"previously",
"compiled",
"sequence",
"."
] | def _transfer_sequences(self, driver, sequences, infos):
for ch_id in driver.defined_channels:
if ch_id in sequences:
driver.to_send(infos['sequence_ch%s' % ch_id],
sequences[ch_id])
if self.select_after_transfer:
driver.sampling_fre... | [
"def",
"_transfer_sequences",
"(",
"self",
",",
"driver",
",",
"sequences",
",",
"infos",
")",
":",
"for",
"ch_id",
"in",
"driver",
".",
"defined_channels",
":",
"if",
"ch_id",
"in",
"sequences",
":",
"driver",
".",
"to_send",
"(",
"infos",
"[",
"'sequence... | Transfer a previously compiled sequence. | [
"Transfer",
"a",
"previously",
"compiled",
"sequence",
"."
] | [
"\"\"\"Transfer a previously compiled sequence.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "driver",
"type": null
},
{
"param": "sequences",
"type": null
},
{
"param": "infos",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "driver",
"type": null,
"docstring": null,
"docstring_tokens":... |
e0a53fff1b1ab8d0a6ce370dc83330a549f59b39 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/pulses/contexts/awg_context.py | [
"BSD-3-Clause"
] | Python | _get_sampling_time | <not_specific> | def _get_sampling_time(self):
"""Getter for the sampling time prop of BaseContext.
"""
return 1/self.sampling_frequency*TIME_CONVERSION['s'][self.time_unit] | Getter for the sampling time prop of BaseContext.
| Getter for the sampling time prop of BaseContext. | [
"Getter",
"for",
"the",
"sampling",
"time",
"prop",
"of",
"BaseContext",
"."
] | def _get_sampling_time(self):
return 1/self.sampling_frequency*TIME_CONVERSION['s'][self.time_unit] | [
"def",
"_get_sampling_time",
"(",
"self",
")",
":",
"return",
"1",
"/",
"self",
".",
"sampling_frequency",
"*",
"TIME_CONVERSION",
"[",
"'s'",
"]",
"[",
"self",
".",
"time_unit",
"]"
] | Getter for the sampling time prop of BaseContext. | [
"Getter",
"for",
"the",
"sampling",
"time",
"prop",
"of",
"BaseContext",
"."
] | [
"\"\"\"Getter for the sampling time prop of BaseContext.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e0a53fff1b1ab8d0a6ce370dc83330a549f59b39 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/pulses/contexts/awg_context.py | [
"BSD-3-Clause"
] | Python | _post_setattr_time_unit | null | def _post_setattr_time_unit(self, old, new):
"""Reset sampling time as the conversion changed.
"""
self._reset_sampling_time() | Reset sampling time as the conversion changed.
| Reset sampling time as the conversion changed. | [
"Reset",
"sampling",
"time",
"as",
"the",
"conversion",
"changed",
"."
] | def _post_setattr_time_unit(self, old, new):
self._reset_sampling_time() | [
"def",
"_post_setattr_time_unit",
"(",
"self",
",",
"old",
",",
"new",
")",
":",
"self",
".",
"_reset_sampling_time",
"(",
")"
] | Reset sampling time as the conversion changed. | [
"Reset",
"sampling",
"time",
"as",
"the",
"conversion",
"changed",
"."
] | [
"\"\"\"Reset sampling time as the conversion changed.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "old",
"type": null
},
{
"param": "new",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "old",
"type": null,
"docstring": null,
"docstring_tokens": []... |
e0a53fff1b1ab8d0a6ce370dc83330a549f59b39 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/pulses/contexts/awg_context.py | [
"BSD-3-Clause"
] | Python | _post_setattr_sampling_frequency | null | def _post_setattr_sampling_frequency(self, old, new):
"""Reset sampling when the frequency change.
"""
self._reset_sampling_time() | Reset sampling when the frequency change.
| Reset sampling when the frequency change. | [
"Reset",
"sampling",
"when",
"the",
"frequency",
"change",
"."
] | def _post_setattr_sampling_frequency(self, old, new):
self._reset_sampling_time() | [
"def",
"_post_setattr_sampling_frequency",
"(",
"self",
",",
"old",
",",
"new",
")",
":",
"self",
".",
"_reset_sampling_time",
"(",
")"
] | Reset sampling when the frequency change. | [
"Reset",
"sampling",
"when",
"the",
"frequency",
"change",
"."
] | [
"\"\"\"Reset sampling when the frequency change.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "old",
"type": null
},
{
"param": "new",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "old",
"type": null,
"docstring": null,
"docstring_tokens": []... |
9741d8a8b5849df8ebfbac0de31b1148c2fcd48e | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/instr/dc_tasks.py | [
"BSD-3-Clause"
] | Python | smooth_set | <not_specific> | def smooth_set(self, target_value, setter, current_value):
""" Smoothly set the current.
target_value : float
Current to reach.
setter : callable
Function to set the current, should take as single argument the
value.
"""
if target_value is n... | Smoothly set the current.
target_value : float
Current to reach.
setter : callable
Function to set the current, should take as single argument the
value.
| Smoothly set the current.
target_value : float
Current to reach.
setter : callable
Function to set the current, should take as single argument the
value. | [
"Smoothly",
"set",
"the",
"current",
".",
"target_value",
":",
"float",
"Current",
"to",
"reach",
".",
"setter",
":",
"callable",
"Function",
"to",
"set",
"the",
"current",
"should",
"take",
"as",
"single",
"argument",
"the",
"value",
"."
] | def smooth_set(self, target_value, setter, current_value):
if target_value is not None:
value = target_value
else:
value = self.format_and_eval_string(self.target_value)
if self.safe_max and self.safe_max < abs(value):
msg = 'Requested current {} exceeds safe ... | [
"def",
"smooth_set",
"(",
"self",
",",
"target_value",
",",
"setter",
",",
"current_value",
")",
":",
"if",
"target_value",
"is",
"not",
"None",
":",
"value",
"=",
"target_value",
"else",
":",
"value",
"=",
"self",
".",
"format_and_eval_string",
"(",
"self",... | Smoothly set the current. | [
"Smoothly",
"set",
"the",
"current",
"."
] | [
"\"\"\" Smoothly set the current.\n\n target_value : float\n Current to reach.\n\n setter : callable\n Function to set the current, should take as single argument the\n value.\n\n \"\"\"",
"# Avoid the accumulation of rounding errors"
] | [
{
"param": "self",
"type": null
},
{
"param": "target_value",
"type": null
},
{
"param": "setter",
"type": null
},
{
"param": "current_value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target_value",
"type": null,
"docstring": null,
"docstring_to... |
659d5e7a5ad3a49cf88c76f012a77a963ba0a598 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/instr/lock_in_measure_task.py | [
"BSD-3-Clause"
] | Python | perform | null | def perform(self):
"""Wait and query the last value in the instrument buffer.
"""
sleep(self.waiting_time)
if self.mode == 'X':
value = self.driver.read_x()
self.write_in_database('x', value)
elif self.mode == 'Y':
value = self.driver.read_y(... | Wait and query the last value in the instrument buffer.
| Wait and query the last value in the instrument buffer. | [
"Wait",
"and",
"query",
"the",
"last",
"value",
"in",
"the",
"instrument",
"buffer",
"."
] | def perform(self):
sleep(self.waiting_time)
if self.mode == 'X':
value = self.driver.read_x()
self.write_in_database('x', value)
elif self.mode == 'Y':
value = self.driver.read_y()
self.write_in_database('y', value)
elif self.mode == 'X&Y':... | [
"def",
"perform",
"(",
"self",
")",
":",
"sleep",
"(",
"self",
".",
"waiting_time",
")",
"if",
"self",
".",
"mode",
"==",
"'X'",
":",
"value",
"=",
"self",
".",
"driver",
".",
"read_x",
"(",
")",
"self",
".",
"write_in_database",
"(",
"'x'",
",",
"... | Wait and query the last value in the instrument buffer. | [
"Wait",
"and",
"query",
"the",
"last",
"value",
"in",
"the",
"instrument",
"buffer",
"."
] | [
"\"\"\"Wait and query the last value in the instrument buffer.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
659d5e7a5ad3a49cf88c76f012a77a963ba0a598 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/instr/lock_in_measure_task.py | [
"BSD-3-Clause"
] | Python | _post_setattr_mode | null | def _post_setattr_mode(self, old, new):
""" Update the database entries acording to the mode.
"""
entries = self.database_entries.copy()
for k in ('x', 'y', 'amplitude', 'phase'):
if k in entries:
del entries[k]
if new == 'X':
entries['x']... | Update the database entries acording to the mode.
| Update the database entries acording to the mode. | [
"Update",
"the",
"database",
"entries",
"acording",
"to",
"the",
"mode",
"."
] | def _post_setattr_mode(self, old, new):
entries = self.database_entries.copy()
for k in ('x', 'y', 'amplitude', 'phase'):
if k in entries:
del entries[k]
if new == 'X':
entries['x'] = 1.0
elif new == 'Y':
entries['y'] = 1.0
elif... | [
"def",
"_post_setattr_mode",
"(",
"self",
",",
"old",
",",
"new",
")",
":",
"entries",
"=",
"self",
".",
"database_entries",
".",
"copy",
"(",
")",
"for",
"k",
"in",
"(",
"'x'",
",",
"'y'",
",",
"'amplitude'",
",",
"'phase'",
")",
":",
"if",
"k",
"... | Update the database entries acording to the mode. | [
"Update",
"the",
"database",
"entries",
"acording",
"to",
"the",
"mode",
"."
] | [
"\"\"\" Update the database entries acording to the mode.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "old",
"type": null
},
{
"param": "new",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "old",
"type": null,
"docstring": null,
"docstring_tokens": []... |
260b2e2cd6d8e29c5ca50332b66d5dd8d8f696c3 | rassouly/exopy_hqc_legacy | tests/tasks/tasks/util/test_load_tasks.py | [
"BSD-3-Clause"
] | Python | fake_data | <not_specific> | def fake_data(tmpdir):
"""Create some false data for testing.
"""
data = np.zeros((5,), dtype={'names': ['Freq', 'Log'],
'formats': ['f8', 'f8']})
full_path = os.path.join(str(tmpdir), 'fake.dat')
with open(full_path, 'wb') as f:
f.write('# this is a commen... | Create some false data for testing.
| Create some false data for testing. | [
"Create",
"some",
"false",
"data",
"for",
"testing",
"."
] | def fake_data(tmpdir):
data = np.zeros((5,), dtype={'names': ['Freq', 'Log'],
'formats': ['f8', 'f8']})
full_path = os.path.join(str(tmpdir), 'fake.dat')
with open(full_path, 'wb') as f:
f.write('# this is a comment \n'.encode('utf-8'))
f.write(('\t'.join(dat... | [
"def",
"fake_data",
"(",
"tmpdir",
")",
":",
"data",
"=",
"np",
".",
"zeros",
"(",
"(",
"5",
",",
")",
",",
"dtype",
"=",
"{",
"'names'",
":",
"[",
"'Freq'",
",",
"'Log'",
"]",
",",
"'formats'",
":",
"[",
"'f8'",
",",
"'f8'",
"]",
"}",
")",
"... | Create some false data for testing. | [
"Create",
"some",
"false",
"data",
"for",
"testing",
"."
] | [
"\"\"\"Create some false data for testing.\n\n \"\"\""
] | [
{
"param": "tmpdir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tmpdir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
260b2e2cd6d8e29c5ca50332b66d5dd8d8f696c3 | rassouly/exopy_hqc_legacy | tests/tasks/tasks/util/test_load_tasks.py | [
"BSD-3-Clause"
] | Python | load_array_task | <not_specific> | def load_array_task(tmpdir, fake_data):
"""Build a LoadArrayTask for testing purposes.
"""
root = RootTask(should_stop=Event(), should_pause=Event())
task = LoadArrayTask(name='Test')
task.interface = CSVLoadInterface()
task.folder = str(tmpdir)
task.filename = 'fake.dat'
root.add_child... | Build a LoadArrayTask for testing purposes.
| Build a LoadArrayTask for testing purposes. | [
"Build",
"a",
"LoadArrayTask",
"for",
"testing",
"purposes",
"."
] | def load_array_task(tmpdir, fake_data):
root = RootTask(should_stop=Event(), should_pause=Event())
task = LoadArrayTask(name='Test')
task.interface = CSVLoadInterface()
task.folder = str(tmpdir)
task.filename = 'fake.dat'
root.add_child_task(0, task)
return task | [
"def",
"load_array_task",
"(",
"tmpdir",
",",
"fake_data",
")",
":",
"root",
"=",
"RootTask",
"(",
"should_stop",
"=",
"Event",
"(",
")",
",",
"should_pause",
"=",
"Event",
"(",
")",
")",
"task",
"=",
"LoadArrayTask",
"(",
"name",
"=",
"'Test'",
")",
"... | Build a LoadArrayTask for testing purposes. | [
"Build",
"a",
"LoadArrayTask",
"for",
"testing",
"purposes",
"."
] | [
"\"\"\"Build a LoadArrayTask for testing purposes.\n\n \"\"\""
] | [
{
"param": "tmpdir",
"type": null
},
{
"param": "fake_data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tmpdir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fake_data",
"type": null,
"docstring": null,
"docstring_tok... |
0820c6e046faa1c76f64faa6365fd295dabfa701 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/instr/set_awg_parameters.py | [
"BSD-3-Clause"
] | Python | preferences_from_members | <not_specific> | def preferences_from_members(self):
"""Overwritten to handle channels saving.
"""
pref = super(AWGChannelParameters, self).preferences_from_members()
for i, para in enumerate(self.logicals):
pref['logical_{}'.format(i)] = para.preferences_from_members()
for i, para i... | Overwritten to handle channels saving.
| Overwritten to handle channels saving. | [
"Overwritten",
"to",
"handle",
"channels",
"saving",
"."
] | def preferences_from_members(self):
pref = super(AWGChannelParameters, self).preferences_from_members()
for i, para in enumerate(self.logicals):
pref['logical_{}'.format(i)] = para.preferences_from_members()
for i, para in enumerate(self.analogicals):
pref['analogical_{}'... | [
"def",
"preferences_from_members",
"(",
"self",
")",
":",
"pref",
"=",
"super",
"(",
"AWGChannelParameters",
",",
"self",
")",
".",
"preferences_from_members",
"(",
")",
"for",
"i",
",",
"para",
"in",
"enumerate",
"(",
"self",
".",
"logicals",
")",
":",
"p... | Overwritten to handle channels saving. | [
"Overwritten",
"to",
"handle",
"channels",
"saving",
"."
] | [
"\"\"\"Overwritten to handle channels saving.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0820c6e046faa1c76f64faa6365fd295dabfa701 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/instr/set_awg_parameters.py | [
"BSD-3-Clause"
] | Python | check | <not_specific> | def check(self, *args, **kwargs):
"""Automatically test all parameters evaluation.
"""
test, traceback = super(SetAWGParametersTask,
self).check(*args, **kwargs)
err_path = self.get_error_path()
for id, ch in self._channels.items():
re... | Automatically test all parameters evaluation.
| Automatically test all parameters evaluation. | [
"Automatically",
"test",
"all",
"parameters",
"evaluation",
"."
] | def check(self, *args, **kwargs):
test, traceback = super(SetAWGParametersTask,
self).check(*args, **kwargs)
err_path = self.get_error_path()
for id, ch in self._channels.items():
res, tr = ch.check(self)
aux = {err_path + 'Ch{}_{}'.format(... | [
"def",
"check",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"test",
",",
"traceback",
"=",
"super",
"(",
"SetAWGParametersTask",
",",
"self",
")",
".",
"check",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
"err_path",
"=",
"self",
... | Automatically test all parameters evaluation. | [
"Automatically",
"test",
"all",
"parameters",
"evaluation",
"."
] | [
"\"\"\"Automatically test all parameters evaluation.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0820c6e046faa1c76f64faa6365fd295dabfa701 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/instr/set_awg_parameters.py | [
"BSD-3-Clause"
] | Python | build_from_config | <not_specific> | def build_from_config(cls, config, dependencies):
"""Handle rebuilding the channel dict.
"""
new = super(SetAWGParametersTask, cls).build_from_config(config,
dependencies)
channels = {}
chs = {k: literal_eval(k[8:]... | Handle rebuilding the channel dict.
| Handle rebuilding the channel dict. | [
"Handle",
"rebuilding",
"the",
"channel",
"dict",
"."
] | def build_from_config(cls, config, dependencies):
new = super(SetAWGParametersTask, cls).build_from_config(config,
dependencies)
channels = {}
chs = {k: literal_eval(k[8:])
for k in config if k.startswith('channel_')... | [
"def",
"build_from_config",
"(",
"cls",
",",
"config",
",",
"dependencies",
")",
":",
"new",
"=",
"super",
"(",
"SetAWGParametersTask",
",",
"cls",
")",
".",
"build_from_config",
"(",
"config",
",",
"dependencies",
")",
"channels",
"=",
"{",
"}",
"chs",
"=... | Handle rebuilding the channel dict. | [
"Handle",
"rebuilding",
"the",
"channel",
"dict",
"."
] | [
"\"\"\"Handle rebuilding the channel dict.\n\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "config",
"type": null
},
{
"param": "dependencies",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens": ... |
0820c6e046faa1c76f64faa6365fd295dabfa701 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/instr/set_awg_parameters.py | [
"BSD-3-Clause"
] | Python | _post_setattr_interface | null | def _post_setattr_interface(self, old, new):
"""Create empty channels when an interface is selected.
"""
super(SetAWGParametersTask, self)._post_setattr_interface(old, new)
if new:
channels = {}
specs = new.channels_specs
for i in new.channels_ids:
... | Create empty channels when an interface is selected.
| Create empty channels when an interface is selected. | [
"Create",
"empty",
"channels",
"when",
"an",
"interface",
"is",
"selected",
"."
] | def _post_setattr_interface(self, old, new):
super(SetAWGParametersTask, self)._post_setattr_interface(old, new)
if new:
channels = {}
specs = new.channels_specs
for i in new.channels_ids:
channels[i] = AWGChannelParameters(logical=specs[i][0],
... | [
"def",
"_post_setattr_interface",
"(",
"self",
",",
"old",
",",
"new",
")",
":",
"super",
"(",
"SetAWGParametersTask",
",",
"self",
")",
".",
"_post_setattr_interface",
"(",
"old",
",",
"new",
")",
"if",
"new",
":",
"channels",
"=",
"{",
"}",
"specs",
"=... | Create empty channels when an interface is selected. | [
"Create",
"empty",
"channels",
"when",
"an",
"interface",
"is",
"selected",
"."
] | [
"\"\"\"Create empty channels when an interface is selected.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "old",
"type": null
},
{
"param": "new",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "old",
"type": null,
"docstring": null,
"docstring_tokens": []... |
be085465cb2b2b5c013801c614c70cd855345571 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/alazar935x.py | [
"BSD-3-Clause"
] | Python | open_connection | null | def open_connection(self):
"""Close Alazar app and create the underlying driver.
"""
try:
if sys.platform == 'win32':
call("TASKKILL /F /IM AlazarDSO.exe", shell=True)
except Exception:
pass
self.board = ats.Board() | Close Alazar app and create the underlying driver.
| Close Alazar app and create the underlying driver. | [
"Close",
"Alazar",
"app",
"and",
"create",
"the",
"underlying",
"driver",
"."
] | def open_connection(self):
try:
if sys.platform == 'win32':
call("TASKKILL /F /IM AlazarDSO.exe", shell=True)
except Exception:
pass
self.board = ats.Board() | [
"def",
"open_connection",
"(",
"self",
")",
":",
"try",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"call",
"(",
"\"TASKKILL /F /IM AlazarDSO.exe\"",
",",
"shell",
"=",
"True",
")",
"except",
"Exception",
":",
"pass",
"self",
".",
"board",
"="... | Close Alazar app and create the underlying driver. | [
"Close",
"Alazar",
"app",
"and",
"create",
"the",
"underlying",
"driver",
"."
] | [
"\"\"\"Close Alazar app and create the underlying driver.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1631dad9bc54ac7b55e2125aec129a79343ded61 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/agilent_pna.py | [
"BSD-3-Clause"
] | Python | read_formatted_data | <not_specific> | def read_formatted_data(self, meas_name=''):
""" Read formatted data for a measure.
Parameters
----------
meas_name : str
Name of the measure which should be read. If not provided the data
for the currently selected measure will be read. This measure will
... | Read formatted data for a measure.
Parameters
----------
meas_name : str
Name of the measure which should be read. If not provided the data
for the currently selected measure will be read. This measure will
be the new selected measure once this function retu... | Read formatted data for a measure.
Parameters
meas_name : str
Name of the measure which should be read. If not provided the data
for the currently selected measure will be read. This measure will
be the new selected measure once this function returns.
Returns
data : numpy.array
Array of Floating points holding the d... | [
"Read",
"formatted",
"data",
"for",
"a",
"measure",
".",
"Parameters",
"meas_name",
":",
"str",
"Name",
"of",
"the",
"measure",
"which",
"should",
"be",
"read",
".",
"If",
"not",
"provided",
"the",
"data",
"for",
"the",
"currently",
"selected",
"measure",
... | def read_formatted_data(self, meas_name=''):
if meas_name:
self.selected_measure = meas_name
else:
meas_name = self.selected_measure
data_request = 'CALCulate{}:DATA? FDATA'.format(self._channel)
if self._pna.data_format == 'REAL,32':
data = self._pna.... | [
"def",
"read_formatted_data",
"(",
"self",
",",
"meas_name",
"=",
"''",
")",
":",
"if",
"meas_name",
":",
"self",
".",
"selected_measure",
"=",
"meas_name",
"else",
":",
"meas_name",
"=",
"self",
".",
"selected_measure",
"data_request",
"=",
"'CALCulate{}:DATA? ... | Read formatted data for a measure. | [
"Read",
"formatted",
"data",
"for",
"a",
"measure",
"."
] | [
"\"\"\" Read formatted data for a measure.\n\n Parameters\n ----------\n meas_name : str\n Name of the measure which should be read. If not provided the data\n for the currently selected measure will be read. This measure will\n be the new selected measure once ... | [
{
"param": "self",
"type": null
},
{
"param": "meas_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "meas_name",
"type": null,
"docstring": null,
"docstring_token... |
1631dad9bc54ac7b55e2125aec129a79343ded61 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/agilent_pna.py | [
"BSD-3-Clause"
] | Python | read_raw_data | <not_specific> | def read_raw_data(self, meas_name=''):
""" Read raw data for a measure.
Parameters
----------
meas_name : str, optional
Name of the measure which should be read. If not provided the data
for the currently selected measure will be read. This measure will
... | Read raw data for a measure.
Parameters
----------
meas_name : str, optional
Name of the measure which should be read. If not provided the data
for the currently selected measure will be read. This measure will
be the new selected measure once this function ... | Read raw data for a measure.
Parameters
meas_name : str, optional
Name of the measure which should be read. If not provided the data
for the currently selected measure will be read. This measure will
be the new selected measure once this function returns.
Returns
data : numpy.array
Array of Floating points holding t... | [
"Read",
"raw",
"data",
"for",
"a",
"measure",
".",
"Parameters",
"meas_name",
":",
"str",
"optional",
"Name",
"of",
"the",
"measure",
"which",
"should",
"be",
"read",
".",
"If",
"not",
"provided",
"the",
"data",
"for",
"the",
"currently",
"selected",
"meas... | def read_raw_data(self, meas_name=''):
if meas_name:
self.selected_measure = meas_name
data_request = 'CALCulate{}:DATA? SDATA'.format(self._channel)
if self._pna.data_format == 'REAL,32':
data = self._pna.query_binary_values(data_request, 'f')
elif self._pna.data... | [
"def",
"read_raw_data",
"(",
"self",
",",
"meas_name",
"=",
"''",
")",
":",
"if",
"meas_name",
":",
"self",
".",
"selected_measure",
"=",
"meas_name",
"data_request",
"=",
"'CALCulate{}:DATA? SDATA'",
".",
"format",
"(",
"self",
".",
"_channel",
")",
"if",
"... | Read raw data for a measure. | [
"Read",
"raw",
"data",
"for",
"a",
"measure",
"."
] | [
"\"\"\" Read raw data for a measure.\n\n Parameters\n ----------\n meas_name : str, optional\n Name of the measure which should be read. If not provided the data\n for the currently selected measure will be read. This measure will\n be the new selected measure o... | [
{
"param": "self",
"type": null
},
{
"param": "meas_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "meas_name",
"type": null,
"docstring": null,
"docstring_token... |
1631dad9bc54ac7b55e2125aec129a79343ded61 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/agilent_pna.py | [
"BSD-3-Clause"
] | Python | run_averaging | null | def run_averaging(self, aver_count=''):
""" Restart averaging on the channel and wait until it is over
Parameters
----------
aver_count : str, optional
Number of averages to perform. Default value is the current one
"""
self._pna.trigger_source = 'Immediate'
... | Restart averaging on the channel and wait until it is over
Parameters
----------
aver_count : str, optional
Number of averages to perform. Default value is the current one
| Restart averaging on the channel and wait until it is over
Parameters
aver_count : str, optional
Number of averages to perform. Default value is the current one | [
"Restart",
"averaging",
"on",
"the",
"channel",
"and",
"wait",
"until",
"it",
"is",
"over",
"Parameters",
"aver_count",
":",
"str",
"optional",
"Number",
"of",
"averages",
"to",
"perform",
".",
"Default",
"value",
"is",
"the",
"current",
"one"
] | def run_averaging(self, aver_count=''):
self._pna.trigger_source = 'Immediate'
self.sweep_mode = 'Hold'
self._pna.clear_averaging()
if aver_count:
self.average_count = aver_count
self.average_state = 1
for i in range(0, int(self.average_count)):
se... | [
"def",
"run_averaging",
"(",
"self",
",",
"aver_count",
"=",
"''",
")",
":",
"self",
".",
"_pna",
".",
"trigger_source",
"=",
"'Immediate'",
"self",
".",
"sweep_mode",
"=",
"'Hold'",
"self",
".",
"_pna",
".",
"clear_averaging",
"(",
")",
"if",
"aver_count"... | Restart averaging on the channel and wait until it is over
Parameters | [
"Restart",
"averaging",
"on",
"the",
"channel",
"and",
"wait",
"until",
"it",
"is",
"over",
"Parameters"
] | [
"\"\"\" Restart averaging on the channel and wait until it is over\n\n Parameters\n ----------\n aver_count : str, optional\n Number of averages to perform. Default value is the current one\n \"\"\"",
"# Getting an timeout here simply means that the",
"# PNA isn't done ave... | [
{
"param": "self",
"type": null
},
{
"param": "aver_count",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "aver_count",
"type": null,
"docstring": null,
"docstring_toke... |
1631dad9bc54ac7b55e2125aec129a79343ded61 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/agilent_pna.py | [
"BSD-3-Clause"
] | Python | tracenb | <not_specific> | def tracenb(self):
"""Current trace number getter method
WARNING: this command will not work if the trace selection has not been
made by the software beforehand
"""
trace_nb = self._pna.query('CALC{}:PAR:MNUM?'.format(self._channel))
if trace_nb:
return int(t... | Current trace number getter method
WARNING: this command will not work if the trace selection has not been
made by the software beforehand
| Current trace number getter method
WARNING: this command will not work if the trace selection has not been
made by the software beforehand | [
"Current",
"trace",
"number",
"getter",
"method",
"WARNING",
":",
"this",
"command",
"will",
"not",
"work",
"if",
"the",
"trace",
"selection",
"has",
"not",
"been",
"made",
"by",
"the",
"software",
"beforehand"
] | def tracenb(self):
trace_nb = self._pna.query('CALC{}:PAR:MNUM?'.format(self._channel))
if trace_nb:
return int(trace_nb)
else:
raise InstrIOError(cleandoc('''Agilent PNA did not return the
trace number on channel {} '''.format(self._channel))) | [
"def",
"tracenb",
"(",
"self",
")",
":",
"trace_nb",
"=",
"self",
".",
"_pna",
".",
"query",
"(",
"'CALC{}:PAR:MNUM?'",
".",
"format",
"(",
"self",
".",
"_channel",
")",
")",
"if",
"trace_nb",
":",
"return",
"int",
"(",
"trace_nb",
")",
"else",
":",
... | Current trace number getter method
WARNING: this command will not work if the trace selection has not been
made by the software beforehand | [
"Current",
"trace",
"number",
"getter",
"method",
"WARNING",
":",
"this",
"command",
"will",
"not",
"work",
"if",
"the",
"trace",
"selection",
"has",
"not",
"been",
"made",
"by",
"the",
"software",
"beforehand"
] | [
"\"\"\"Current trace number getter method\n\n WARNING: this command will not work if the trace selection has not been\n made by the software beforehand\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1631dad9bc54ac7b55e2125aec129a79343ded61 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/agilent_pna.py | [
"BSD-3-Clause"
] | Python | sweep_x_axis | <not_specific> | def sweep_x_axis(self):
"""List of values on the Sweep X axis getter method.
"""
sweep_type = self.sweep_type
sweep_points = self.sweep_points
if sweep_type == 'LIN':
sweep_start = float(self._pna.query(
'SENSe{}:FREQuency:STARt?'.format(self._channel... | List of values on the Sweep X axis getter method.
| List of values on the Sweep X axis getter method. | [
"List",
"of",
"values",
"on",
"the",
"Sweep",
"X",
"axis",
"getter",
"method",
"."
] | def sweep_x_axis(self):
sweep_type = self.sweep_type
sweep_points = self.sweep_points
if sweep_type == 'LIN':
sweep_start = float(self._pna.query(
'SENSe{}:FREQuency:STARt?'.format(self._channel)))*1e-9
sweep_stop = float(self._pna.query(
'... | [
"def",
"sweep_x_axis",
"(",
"self",
")",
":",
"sweep_type",
"=",
"self",
".",
"sweep_type",
"sweep_points",
"=",
"self",
".",
"sweep_points",
"if",
"sweep_type",
"==",
"'LIN'",
":",
"sweep_start",
"=",
"float",
"(",
"self",
".",
"_pna",
".",
"query",
"(",
... | List of values on the Sweep X axis getter method. | [
"List",
"of",
"values",
"on",
"the",
"Sweep",
"X",
"axis",
"getter",
"method",
"."
] | [
"\"\"\"List of values on the Sweep X axis getter method.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1631dad9bc54ac7b55e2125aec129a79343ded61 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/agilent_pna.py | [
"BSD-3-Clause"
] | Python | selected_measure | <not_specific> | def selected_measure(self):
"""Name of the selected measurement
WARNING: this command will not work if the trace selection has not been
made by the software beforehand
"""
meas = self._pna.query('CALC{}:PARameter:SELect?'.format(self._channel))
if meas:
retur... | Name of the selected measurement
WARNING: this command will not work if the trace selection has not been
made by the software beforehand
| Name of the selected measurement
WARNING: this command will not work if the trace selection has not been
made by the software beforehand | [
"Name",
"of",
"the",
"selected",
"measurement",
"WARNING",
":",
"this",
"command",
"will",
"not",
"work",
"if",
"the",
"trace",
"selection",
"has",
"not",
"been",
"made",
"by",
"the",
"software",
"beforehand"
] | def selected_measure(self):
meas = self._pna.query('CALC{}:PARameter:SELect?'.format(self._channel))
if meas:
return meas[1:-1]
else:
raise InstrIOError(cleandoc('''Agilent PNA did not return the
channel {} selected measure'''.format(self._channel))) | [
"def",
"selected_measure",
"(",
"self",
")",
":",
"meas",
"=",
"self",
".",
"_pna",
".",
"query",
"(",
"'CALC{}:PARameter:SELect?'",
".",
"format",
"(",
"self",
".",
"_channel",
")",
")",
"if",
"meas",
":",
"return",
"meas",
"[",
"1",
":",
"-",
"1",
... | Name of the selected measurement
WARNING: this command will not work if the trace selection has not been
made by the software beforehand | [
"Name",
"of",
"the",
"selected",
"measurement",
"WARNING",
":",
"this",
"command",
"will",
"not",
"work",
"if",
"the",
"trace",
"selection",
"has",
"not",
"been",
"made",
"by",
"the",
"software",
"beforehand"
] | [
"\"\"\"Name of the selected measurement\n\n WARNING: this command will not work if the trace selection has not been\n made by the software beforehand\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1631dad9bc54ac7b55e2125aec129a79343ded61 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/agilent_pna.py | [
"BSD-3-Clause"
] | Python | electrical_delay | <not_specific> | def electrical_delay(self):
"""electrical delay for the selected trace in ns
"""
mode = self._pna.query('CALC{}:CORR:EDEL:TIME?'.format(self._channel))
if mode:
return float(mode)*1000000000.0
else:
raise InstrIOError(cleandoc('''Agilent PNA did not return... | electrical delay for the selected trace in ns
| electrical delay for the selected trace in ns | [
"electrical",
"delay",
"for",
"the",
"selected",
"trace",
"in",
"ns"
] | def electrical_delay(self):
mode = self._pna.query('CALC{}:CORR:EDEL:TIME?'.format(self._channel))
if mode:
return float(mode)*1000000000.0
else:
raise InstrIOError(cleandoc('''Agilent PNA did not return the
channel {} electrical delay'''.format(self._... | [
"def",
"electrical_delay",
"(",
"self",
")",
":",
"mode",
"=",
"self",
".",
"_pna",
".",
"query",
"(",
"'CALC{}:CORR:EDEL:TIME?'",
".",
"format",
"(",
"self",
".",
"_channel",
")",
")",
"if",
"mode",
":",
"return",
"float",
"(",
"mode",
")",
"*",
"1000... | electrical delay for the selected trace in ns | [
"electrical",
"delay",
"for",
"the",
"selected",
"trace",
"in",
"ns"
] | [
"\"\"\"electrical delay for the selected trace in ns\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1631dad9bc54ac7b55e2125aec129a79343ded61 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/agilent_pna.py | [
"BSD-3-Clause"
] | Python | electrical_delay | null | def electrical_delay(self, value):
"""
electrical delay for the selected trace in ns
"""
self._pna.write('CALC{}:CORR:EDEL:TIME {}NS'.format(self._channel,
value)) |
electrical delay for the selected trace in ns
| electrical delay for the selected trace in ns | [
"electrical",
"delay",
"for",
"the",
"selected",
"trace",
"in",
"ns"
] | def electrical_delay(self, value):
self._pna.write('CALC{}:CORR:EDEL:TIME {}NS'.format(self._channel,
value)) | [
"def",
"electrical_delay",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_pna",
".",
"write",
"(",
"'CALC{}:CORR:EDEL:TIME {}NS'",
".",
"format",
"(",
"self",
".",
"_channel",
",",
"value",
")",
")"
] | electrical delay for the selected trace in ns | [
"electrical",
"delay",
"for",
"the",
"selected",
"trace",
"in",
"ns"
] | [
"\"\"\"\n electrical delay for the selected trace in ns\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens": ... |
1631dad9bc54ac7b55e2125aec129a79343ded61 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/agilent_pna.py | [
"BSD-3-Clause"
] | Python | open_connection | null | def open_connection(self, **para):
"""Open the connection to the instr using the `connection_str`.
"""
super(AgilentPNA, self).open_connection(**para)
self.write_termination = '\n'
self.read_termination = '\n'
self.timeout = 10000 | Open the connection to the instr using the `connection_str`.
| Open the connection to the instr using the `connection_str`. | [
"Open",
"the",
"connection",
"to",
"the",
"instr",
"using",
"the",
"`",
"connection_str",
"`",
"."
] | def open_connection(self, **para):
super(AgilentPNA, self).open_connection(**para)
self.write_termination = '\n'
self.read_termination = '\n'
self.timeout = 10000 | [
"def",
"open_connection",
"(",
"self",
",",
"**",
"para",
")",
":",
"super",
"(",
"AgilentPNA",
",",
"self",
")",
".",
"open_connection",
"(",
"**",
"para",
")",
"self",
".",
"write_termination",
"=",
"'\\n'",
"self",
".",
"read_termination",
"=",
"'\\n'",... | Open the connection to the instr using the `connection_str`. | [
"Open",
"the",
"connection",
"to",
"the",
"instr",
"using",
"the",
"`",
"connection_str",
"`",
"."
] | [
"\"\"\"Open the connection to the instr using the `connection_str`.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1631dad9bc54ac7b55e2125aec129a79343ded61 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/agilent_pna.py | [
"BSD-3-Clause"
] | Python | clear_averaging | null | def clear_averaging(self):
"""Clear and restart averaging of the measurement data.
"""
self.write('SENS:AVER:CLE') | Clear and restart averaging of the measurement data.
| Clear and restart averaging of the measurement data. | [
"Clear",
"and",
"restart",
"averaging",
"of",
"the",
"measurement",
"data",
"."
] | def clear_averaging(self):
self.write('SENS:AVER:CLE') | [
"def",
"clear_averaging",
"(",
"self",
")",
":",
"self",
".",
"write",
"(",
"'SENS:AVER:CLE'",
")"
] | Clear and restart averaging of the measurement data. | [
"Clear",
"and",
"restart",
"averaging",
"of",
"the",
"measurement",
"data",
"."
] | [
"\"\"\"Clear and restart averaging of the measurement data.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
85aea4a56ca6c824f8cdc88dc30e8dd7f72f2bac | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/tinybuilt.py | [
"BSD-3-Clause"
] | Python | big_volt_range | <not_specific> | def big_volt_range(self):
"""Voltage range getter method. Two values possible :
big range = 12V and small range = 1.2V
"""
with self.secure():
voltage = self._TB.query(self._header + 'volt:rang?')
if voltage:
return float(voltage)
else:... | Voltage range getter method. Two values possible :
big range = 12V and small range = 1.2V
| Voltage range getter method. Two values possible :
big range = 12V and small range = 1.2V | [
"Voltage",
"range",
"getter",
"method",
".",
"Two",
"values",
"possible",
":",
"big",
"range",
"=",
"12V",
"and",
"small",
"range",
"=",
"1",
".",
"2V"
] | def big_volt_range(self):
with self.secure():
voltage = self._TB.query(self._header + 'volt:rang?')
if voltage:
return float(voltage)
else:
raise InstrIOError | [
"def",
"big_volt_range",
"(",
"self",
")",
":",
"with",
"self",
".",
"secure",
"(",
")",
":",
"voltage",
"=",
"self",
".",
"_TB",
".",
"query",
"(",
"self",
".",
"_header",
"+",
"'volt:rang?'",
")",
"if",
"voltage",
":",
"return",
"float",
"(",
"volt... | Voltage range getter method. | [
"Voltage",
"range",
"getter",
"method",
"."
] | [
"\"\"\"Voltage range getter method. Two values possible :\n big range = 12V and small range = 1.2V\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
85aea4a56ca6c824f8cdc88dc30e8dd7f72f2bac | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/tinybuilt.py | [
"BSD-3-Clause"
] | Python | big_volt_range | null | def big_volt_range(self, value):
"""Voltage range method. Two values possible :
big range = 12V = 'True' or 1 and small range = 1.2V = 'False' or 0
TinyBilt need to be turned off to change the voltage range
"""
with self.secure():
outp = self._TB.query(self._header + ... | Voltage range method. Two values possible :
big range = 12V = 'True' or 1 and small range = 1.2V = 'False' or 0
TinyBilt need to be turned off to change the voltage range
| Voltage range method. Two values possible :
big range = 12V = 'True' or 1 and small range = 1.2V = 'False' or 0
TinyBilt need to be turned off to change the voltage range | [
"Voltage",
"range",
"method",
".",
"Two",
"values",
"possible",
":",
"big",
"range",
"=",
"12V",
"=",
"'",
"True",
"'",
"or",
"1",
"and",
"small",
"range",
"=",
"1",
".",
"2V",
"=",
"'",
"False",
"'",
"or",
"0",
"TinyBilt",
"need",
"to",
"be",
"t... | def big_volt_range(self, value):
with self.secure():
outp = self._TB.query(self._header + 'OUTP?')
if outp == 1:
raise InstrIOError(cleandoc('''TinyBilt need to be turned
off to change the voltage
... | [
"def",
"big_volt_range",
"(",
"self",
",",
"value",
")",
":",
"with",
"self",
".",
"secure",
"(",
")",
":",
"outp",
"=",
"self",
".",
"_TB",
".",
"query",
"(",
"self",
".",
"_header",
"+",
"'OUTP?'",
")",
"if",
"outp",
"==",
"1",
":",
"raise",
"I... | Voltage range method. | [
"Voltage",
"range",
"method",
"."
] | [
"\"\"\"Voltage range method. Two values possible :\n big range = 12V = 'True' or 1 and small range = 1.2V = 'False' or 0\n TinyBilt need to be turned off to change the voltage range\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens": ... |
85aea4a56ca6c824f8cdc88dc30e8dd7f72f2bac | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/tinybuilt.py | [
"BSD-3-Clause"
] | Python | smooth_change | null | def smooth_change(self, volt_destination, volt_step, time_step):
""" Set a ramp from the present voltage
to the volt_destination by step of volt_step
with time of time_step between each step
"""
with self.secure():
present_voltage = round(float(self._TB.query
... | Set a ramp from the present voltage
to the volt_destination by step of volt_step
with time of time_step between each step
| Set a ramp from the present voltage
to the volt_destination by step of volt_step
with time of time_step between each step | [
"Set",
"a",
"ramp",
"from",
"the",
"present",
"voltage",
"to",
"the",
"volt_destination",
"by",
"step",
"of",
"volt_step",
"with",
"time",
"of",
"time_step",
"between",
"each",
"step"
] | def smooth_change(self, volt_destination, volt_step, time_step):
with self.secure():
present_voltage = round(float(self._TB.query
(self._header + 'Volt?')), 5)
while abs(round(present_voltage - volt_destination,
5)) >=... | [
"def",
"smooth_change",
"(",
"self",
",",
"volt_destination",
",",
"volt_step",
",",
"time_step",
")",
":",
"with",
"self",
".",
"secure",
"(",
")",
":",
"present_voltage",
"=",
"round",
"(",
"float",
"(",
"self",
".",
"_TB",
".",
"query",
"(",
"self",
... | Set a ramp from the present voltage
to the volt_destination by step of volt_step
with time of time_step between each step | [
"Set",
"a",
"ramp",
"from",
"the",
"present",
"voltage",
"to",
"the",
"volt_destination",
"by",
"step",
"of",
"volt_step",
"with",
"time",
"of",
"time_step",
"between",
"each",
"step"
] | [
"\"\"\" Set a ramp from the present voltage\n to the volt_destination by step of volt_step\n with time of time_step between each step\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "volt_destination",
"type": null
},
{
"param": "volt_step",
"type": null
},
{
"param": "time_step",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "volt_destination",
"type": null,
"docstring": null,
"docstrin... |
85aea4a56ca6c824f8cdc88dc30e8dd7f72f2bac | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/tinybuilt.py | [
"BSD-3-Clause"
] | Python | open_connection | null | def open_connection(self, **para):
"""Open the connection to the instr using the `connection_str`
"""
super(TinyBilt, self).open_connection(**para)
self.write_termination = '\n'
self.read_termination = '\n' | Open the connection to the instr using the `connection_str`
| Open the connection to the instr using the `connection_str` | [
"Open",
"the",
"connection",
"to",
"the",
"instr",
"using",
"the",
"`",
"connection_str",
"`"
] | def open_connection(self, **para):
super(TinyBilt, self).open_connection(**para)
self.write_termination = '\n'
self.read_termination = '\n' | [
"def",
"open_connection",
"(",
"self",
",",
"**",
"para",
")",
":",
"super",
"(",
"TinyBilt",
",",
"self",
")",
".",
"open_connection",
"(",
"**",
"para",
")",
"self",
".",
"write_termination",
"=",
"'\\n'",
"self",
".",
"read_termination",
"=",
"'\\n'"
] | Open the connection to the instr using the `connection_str` | [
"Open",
"the",
"connection",
"to",
"the",
"instr",
"using",
"the",
"`",
"connection_str",
"`"
] | [
"\"\"\"Open the connection to the instr using the `connection_str`\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
85aea4a56ca6c824f8cdc88dc30e8dd7f72f2bac | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/tinybuilt.py | [
"BSD-3-Clause"
] | Python | defined_channels | <not_specific> | def defined_channels(self):
"""defined_channels is a list of tuple with format (module_number,
channel_number)
"""
modules = self.query('I:L?')
if modules:
defined_modules = np.array([s.split(',')
... | defined_channels is a list of tuple with format (module_number,
channel_number)
| defined_channels is a list of tuple with format (module_number,
channel_number) | [
"defined_channels",
"is",
"a",
"list",
"of",
"tuple",
"with",
"format",
"(",
"module_number",
"channel_number",
")"
] | def defined_channels(self):
modules = self.query('I:L?')
if modules:
defined_modules = np.array([s.split(',')
for s in modules.split(';')],
dtype=np.uint)
defined_channels = []
for... | [
"def",
"defined_channels",
"(",
"self",
")",
":",
"modules",
"=",
"self",
".",
"query",
"(",
"'I:L?'",
")",
"if",
"modules",
":",
"defined_modules",
"=",
"np",
".",
"array",
"(",
"[",
"s",
".",
"split",
"(",
"','",
")",
"for",
"s",
"in",
"modules",
... | defined_channels is a list of tuple with format (module_number,
channel_number) | [
"defined_channels",
"is",
"a",
"list",
"of",
"tuple",
"with",
"format",
"(",
"module_number",
"channel_number",
")"
] | [
"\"\"\"defined_channels is a list of tuple with format (module_number,\n channel_number)\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6851faa389816dd7ca58004f33211453e6e81ea1 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr830.py | [
"BSD-3-Clause"
] | Python | read_x | <not_specific> | def read_x(self):
"""
Return the x quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
value = self.query('OUTP?1')
if not value:
raise Inst... |
Return the x quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the x quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"x",
"quadrature",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",
"queried",
"too",
"often",
"."
] | def read_x(self):
value = self.query('OUTP?1')
if not value:
raise InstrIOError('The command did not complete correctly')
else:
return float(value) | [
"def",
"read_x",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"query",
"(",
"'OUTP?1'",
")",
"if",
"not",
"value",
":",
"raise",
"InstrIOError",
"(",
"'The command did not complete correctly'",
")",
"else",
":",
"return",
"float",
"(",
"value",
")"
] | Return the x quadrature measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"x",
"quadrature",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the x quadrature measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6851faa389816dd7ca58004f33211453e6e81ea1 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr830.py | [
"BSD-3-Clause"
] | Python | read_y | <not_specific> | def read_y(self):
"""
Return the y quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
value = self.query('OUTP?2')
if not value:
raise Inst... |
Return the y quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the y quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"y",
"quadrature",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",
"queried",
"too",
"often",
"."
] | def read_y(self):
value = self.query('OUTP?2')
if not value:
raise InstrIOError('The command did not complete correctly')
else:
return float(value) | [
"def",
"read_y",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"query",
"(",
"'OUTP?2'",
")",
"if",
"not",
"value",
":",
"raise",
"InstrIOError",
"(",
"'The command did not complete correctly'",
")",
"else",
":",
"return",
"float",
"(",
"value",
")"
] | Return the y quadrature measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"y",
"quadrature",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the y quadrature measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6851faa389816dd7ca58004f33211453e6e81ea1 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr830.py | [
"BSD-3-Clause"
] | Python | read_xy | <not_specific> | def read_xy(self):
"""
Return the x and y quadratures measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
values = self.query_ascii_values('SNAP?1,2')
if not value... |
Return the x and y quadratures measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the x and y quadratures measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"x",
"and",
"y",
"quadratures",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",
"queried",
"too",
... | def read_xy(self):
values = self.query_ascii_values('SNAP?1,2')
if not values:
raise InstrIOError('The command did not complete correctly')
else:
return values | [
"def",
"read_xy",
"(",
"self",
")",
":",
"values",
"=",
"self",
".",
"query_ascii_values",
"(",
"'SNAP?1,2'",
")",
"if",
"not",
"values",
":",
"raise",
"InstrIOError",
"(",
"'The command did not complete correctly'",
")",
"else",
":",
"return",
"values"
] | Return the x and y quadratures measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"x",
"and",
"y",
"quadratures",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the x and y quadratures measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6851faa389816dd7ca58004f33211453e6e81ea1 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr830.py | [
"BSD-3-Clause"
] | Python | read_amplitude | <not_specific> | def read_amplitude(self):
"""
Return the amplitude of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
value = self.query('OUTP?3')
if not value:
... |
Return the amplitude of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the amplitude of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"amplitude",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",
"queried",
"too... | def read_amplitude(self):
value = self.query('OUTP?3')
if not value:
return InstrIOError('The command did not complete correctly')
else:
return float(value) | [
"def",
"read_amplitude",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"query",
"(",
"'OUTP?3'",
")",
"if",
"not",
"value",
":",
"return",
"InstrIOError",
"(",
"'The command did not complete correctly'",
")",
"else",
":",
"return",
"float",
"(",
"value",
... | Return the amplitude of the signal measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"amplitude",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the amplitude of the signal measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6851faa389816dd7ca58004f33211453e6e81ea1 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr830.py | [
"BSD-3-Clause"
] | Python | read_phase | <not_specific> | def read_phase(self):
"""
Return the phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
value = self.query('OUTP?4')
if not value:
... |
Return the phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"phase",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",
"queried",
"too",
... | def read_phase(self):
value = self.query('OUTP?4')
if not value:
raise InstrIOError('The command did not complete correctly')
else:
return float(value) | [
"def",
"read_phase",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"query",
"(",
"'OUTP?4'",
")",
"if",
"not",
"value",
":",
"raise",
"InstrIOError",
"(",
"'The command did not complete correctly'",
")",
"else",
":",
"return",
"float",
"(",
"value",
")"
... | Return the phase of the signal measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"phase",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the phase of the signal measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6851faa389816dd7ca58004f33211453e6e81ea1 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr830.py | [
"BSD-3-Clause"
] | Python | read_amp_and_phase | <not_specific> | def read_amp_and_phase(self):
"""
Return the amplitude and phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
values = self.query_ascii_values('SNAP?3... |
Return the amplitude and phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the amplitude and phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"amplitude",
"and",
"phase",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",... | def read_amp_and_phase(self):
values = self.query_ascii_values('SNAP?3,4')
if not values:
raise InstrIOError('The command did not complete correctly')
else:
return values | [
"def",
"read_amp_and_phase",
"(",
"self",
")",
":",
"values",
"=",
"self",
".",
"query_ascii_values",
"(",
"'SNAP?3,4'",
")",
"if",
"not",
"values",
":",
"raise",
"InstrIOError",
"(",
"'The command did not complete correctly'",
")",
"else",
":",
"return",
"values"... | Return the amplitude and phase of the signal measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"amplitude",
"and",
"phase",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the amplitude and phase of the signal measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
595270c8267fca07b972af1a727cf086ac8e6768 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/instr/meas_mag_field_task.py | [
"BSD-3-Clause"
] | Python | perform | null | def perform(self):
"""Wait and read the magnetic field.
"""
sleep(self.wait_time)
value = self.driver.persistent_field
self.write_in_database('field', value) | Wait and read the magnetic field.
| Wait and read the magnetic field. | [
"Wait",
"and",
"read",
"the",
"magnetic",
"field",
"."
] | def perform(self):
sleep(self.wait_time)
value = self.driver.persistent_field
self.write_in_database('field', value) | [
"def",
"perform",
"(",
"self",
")",
":",
"sleep",
"(",
"self",
".",
"wait_time",
")",
"value",
"=",
"self",
".",
"driver",
".",
"persistent_field",
"self",
".",
"write_in_database",
"(",
"'field'",
",",
"value",
")"
] | Wait and read the magnetic field. | [
"Wait",
"and",
"read",
"the",
"magnetic",
"field",
"."
] | [
"\"\"\"Wait and read the magnetic field.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f00d7f9b12c681557d9cb80a2aa526bf13e7059c | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/cryomagnetics_g4.py | [
"BSD-3-Clause"
] | Python | open_connection | null | def open_connection(self, **para):
"""Open the connection and set up the parameters.
"""
super().open_connection(**para)
if not para:
self.write_termination = '\n'
self.read_termination = '\n'
# Need to write the lower limit in kG for source 4G
#(... | Open the connection and set up the parameters.
| Open the connection and set up the parameters. | [
"Open",
"the",
"connection",
"and",
"set",
"up",
"the",
"parameters",
"."
] | def open_connection(self, **para):
super().open_connection(**para)
if not para:
self.write_termination = '\n'
self.read_termination = '\n'
self.write('LLIM -70') | [
"def",
"open_connection",
"(",
"self",
",",
"**",
"para",
")",
":",
"super",
"(",
")",
".",
"open_connection",
"(",
"**",
"para",
")",
"if",
"not",
"para",
":",
"self",
".",
"write_termination",
"=",
"'\\n'",
"self",
".",
"read_termination",
"=",
"'\\n'"... | Open the connection and set up the parameters. | [
"Open",
"the",
"connection",
"and",
"set",
"up",
"the",
"parameters",
"."
] | [
"\"\"\"Open the connection and set up the parameters.\n\n \"\"\"",
"# Need to write the lower limit in kG for source 4G",
"#(LLIM needs to be lower than any ULIM)"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f00d7f9b12c681557d9cb80a2aa526bf13e7059c | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/cryomagnetics_g4.py | [
"BSD-3-Clause"
] | Python | read_output_field | <not_specific> | def read_output_field(self):
"""Read the current value of the output field.
"""
return float(self.query('IOUT?').strip(' kG')) / 10 | Read the current value of the output field.
| Read the current value of the output field. | [
"Read",
"the",
"current",
"value",
"of",
"the",
"output",
"field",
"."
] | def read_output_field(self):
return float(self.query('IOUT?').strip(' kG')) / 10 | [
"def",
"read_output_field",
"(",
"self",
")",
":",
"return",
"float",
"(",
"self",
".",
"query",
"(",
"'IOUT?'",
")",
".",
"strip",
"(",
"' kG'",
")",
")",
"/",
"10"
] | Read the current value of the output field. | [
"Read",
"the",
"current",
"value",
"of",
"the",
"output",
"field",
"."
] | [
"\"\"\"Read the current value of the output field.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f00d7f9b12c681557d9cb80a2aa526bf13e7059c | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/cryomagnetics_g4.py | [
"BSD-3-Clause"
] | Python | read_persistent_field | <not_specific> | def read_persistent_field(self):
"""Read the current value of the persistent field.
"""
return float(self.query('IMAG?').strip(' kG')) / 10 | Read the current value of the persistent field.
| Read the current value of the persistent field. | [
"Read",
"the",
"current",
"value",
"of",
"the",
"persistent",
"field",
"."
] | def read_persistent_field(self):
return float(self.query('IMAG?').strip(' kG')) / 10 | [
"def",
"read_persistent_field",
"(",
"self",
")",
":",
"return",
"float",
"(",
"self",
".",
"query",
"(",
"'IMAG?'",
")",
".",
"strip",
"(",
"' kG'",
")",
")",
"/",
"10"
] | Read the current value of the persistent field. | [
"Read",
"the",
"current",
"value",
"of",
"the",
"persistent",
"field",
"."
] | [
"\"\"\"Read the current value of the persistent field.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f00d7f9b12c681557d9cb80a2aa526bf13e7059c | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/cryomagnetics_g4.py | [
"BSD-3-Clause"
] | Python | target_field | <not_specific> | def target_field(self):
"""Field that the source will try to reach.
"""
# in T
return float(self.query('ULIM?').strip(' kG')) / 10 | Field that the source will try to reach.
| Field that the source will try to reach. | [
"Field",
"that",
"the",
"source",
"will",
"try",
"to",
"reach",
"."
] | def target_field(self):
return float(self.query('ULIM?').strip(' kG')) / 10 | [
"def",
"target_field",
"(",
"self",
")",
":",
"return",
"float",
"(",
"self",
".",
"query",
"(",
"'ULIM?'",
")",
".",
"strip",
"(",
"' kG'",
")",
")",
"/",
"10"
] | Field that the source will try to reach. | [
"Field",
"that",
"the",
"source",
"will",
"try",
"to",
"reach",
"."
] | [
"\"\"\"Field that the source will try to reach.\n\n \"\"\"",
"# in T"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f00d7f9b12c681557d9cb80a2aa526bf13e7059c | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/cryomagnetics_g4.py | [
"BSD-3-Clause"
] | Python | target_field | null | def target_field(self, target):
"""Sweep the output intensity to reach the specified ULIM (in T)
at a rate depending on the intensity, as defined in the range(s).
"""
# convert target field from T to kG
# can't reuse CS4 class because a semi-colon is needed
self.write('U... | Sweep the output intensity to reach the specified ULIM (in T)
at a rate depending on the intensity, as defined in the range(s).
| Sweep the output intensity to reach the specified ULIM (in T)
at a rate depending on the intensity, as defined in the range(s). | [
"Sweep",
"the",
"output",
"intensity",
"to",
"reach",
"the",
"specified",
"ULIM",
"(",
"in",
"T",
")",
"at",
"a",
"rate",
"depending",
"on",
"the",
"intensity",
"as",
"defined",
"in",
"the",
"range",
"(",
"s",
")",
"."
] | def target_field(self, target):
self.write('ULIM {};'.format(target * 10)) | [
"def",
"target_field",
"(",
"self",
",",
"target",
")",
":",
"self",
".",
"write",
"(",
"'ULIM {};'",
".",
"format",
"(",
"target",
"*",
"10",
")",
")"
] | Sweep the output intensity to reach the specified ULIM (in T)
at a rate depending on the intensity, as defined in the range(s). | [
"Sweep",
"the",
"output",
"intensity",
"to",
"reach",
"the",
"specified",
"ULIM",
"(",
"in",
"T",
")",
"at",
"a",
"rate",
"depending",
"on",
"the",
"intensity",
"as",
"defined",
"in",
"the",
"range",
"(",
"s",
")",
"."
] | [
"\"\"\"Sweep the output intensity to reach the specified ULIM (in T)\n at a rate depending on the intensity, as defined in the range(s).\n\n \"\"\"",
"# convert target field from T to kG",
"# can't reuse CS4 class because a semi-colon is needed"
] | [
{
"param": "self",
"type": null
},
{
"param": "target",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_tokens":... |
f00d7f9b12c681557d9cb80a2aa526bf13e7059c | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/cryomagnetics_g4.py | [
"BSD-3-Clause"
] | Python | fast_sweep_rate | <not_specific> | def fast_sweep_rate(self):
"""Rate at which to ramp the field when the switch heater is off
(T/min).
"""
rate = float(self.query('RATE? 5'))
return rate * (60 * self.field_current_ratio) | Rate at which to ramp the field when the switch heater is off
(T/min).
| Rate at which to ramp the field when the switch heater is off
(T/min). | [
"Rate",
"at",
"which",
"to",
"ramp",
"the",
"field",
"when",
"the",
"switch",
"heater",
"is",
"off",
"(",
"T",
"/",
"min",
")",
"."
] | def fast_sweep_rate(self):
rate = float(self.query('RATE? 5'))
return rate * (60 * self.field_current_ratio) | [
"def",
"fast_sweep_rate",
"(",
"self",
")",
":",
"rate",
"=",
"float",
"(",
"self",
".",
"query",
"(",
"'RATE? 5'",
")",
")",
"return",
"rate",
"*",
"(",
"60",
"*",
"self",
".",
"field_current_ratio",
")"
] | Rate at which to ramp the field when the switch heater is off
(T/min). | [
"Rate",
"at",
"which",
"to",
"ramp",
"the",
"field",
"when",
"the",
"switch",
"heater",
"is",
"off",
"(",
"T",
"/",
"min",
")",
"."
] | [
"\"\"\"Rate at which to ramp the field when the switch heater is off\n (T/min).\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f50cf40f1b9342fa4e0daffb6fa8b7860c2d01bb | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/instr/meas_dc_tasks.py | [
"BSD-3-Clause"
] | Python | perform | null | def perform(self):
"""Wait and read the DC voltage.
"""
sleep(self.wait_time)
value = self.driver.read_voltage_dc()
self.write_in_database('voltage', value) | Wait and read the DC voltage.
| Wait and read the DC voltage. | [
"Wait",
"and",
"read",
"the",
"DC",
"voltage",
"."
] | def perform(self):
sleep(self.wait_time)
value = self.driver.read_voltage_dc()
self.write_in_database('voltage', value) | [
"def",
"perform",
"(",
"self",
")",
":",
"sleep",
"(",
"self",
".",
"wait_time",
")",
"value",
"=",
"self",
".",
"driver",
".",
"read_voltage_dc",
"(",
")",
"self",
".",
"write_in_database",
"(",
"'voltage'",
",",
"value",
")"
] | Wait and read the DC voltage. | [
"Wait",
"and",
"read",
"the",
"DC",
"voltage",
"."
] | [
"\"\"\"Wait and read the DC voltage.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
21b160f4236365649419c071e72ae0cbd6fdd576 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/instr/anapico_tasks.py | [
"BSD-3-Clause"
] | Python | perform | null | def perform(self, frequency=None):
"""Set the central frequency of the specified channel.
"""
task = self.task
channel = self.channel
task.driver.channel = channel
task.i_perform() | Set the central frequency of the specified channel.
| Set the central frequency of the specified channel. | [
"Set",
"the",
"central",
"frequency",
"of",
"the",
"specified",
"channel",
"."
] | def perform(self, frequency=None):
task = self.task
channel = self.channel
task.driver.channel = channel
task.i_perform() | [
"def",
"perform",
"(",
"self",
",",
"frequency",
"=",
"None",
")",
":",
"task",
"=",
"self",
".",
"task",
"channel",
"=",
"self",
".",
"channel",
"task",
".",
"driver",
".",
"channel",
"=",
"channel",
"task",
".",
"i_perform",
"(",
")"
] | Set the central frequency of the specified channel. | [
"Set",
"the",
"central",
"frequency",
"of",
"the",
"specified",
"channel",
"."
] | [
"\"\"\"Set the central frequency of the specified channel.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "frequency",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "frequency",
"type": null,
"docstring": null,
"docstring_token... |
548d2885f3676d2bbf2cd5fe186104b9a6e8102c | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll_tools.py | [
"BSD-3-Clause"
] | Python | secure | null | def secure(self):
""" Lock acquire and release method.
"""
t = 0
while not self.lock.acquire():
time.sleep(0.1)
t += 0.1
if t > self.timeout:
raise InstrIOError('Timeout in trying to acquire dll lock.')
try:
yield
... | Lock acquire and release method.
| Lock acquire and release method. | [
"Lock",
"acquire",
"and",
"release",
"method",
"."
] | def secure(self):
t = 0
while not self.lock.acquire():
time.sleep(0.1)
t += 0.1
if t > self.timeout:
raise InstrIOError('Timeout in trying to acquire dll lock.')
try:
yield
finally:
self.lock.release() | [
"def",
"secure",
"(",
"self",
")",
":",
"t",
"=",
"0",
"while",
"not",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
":",
"time",
".",
"sleep",
"(",
"0.1",
")",
"t",
"+=",
"0.1",
"if",
"t",
">",
"self",
".",
"timeout",
":",
"raise",
"InstrIOEr... | Lock acquire and release method. | [
"Lock",
"acquire",
"and",
"release",
"method",
"."
] | [
"\"\"\" Lock acquire and release method.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.