body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
f0c4de5b1bbf8b36bdcbd18b95ab18f5bb667284594f92a4f2903931aecc081d
def load_keypoints(file_path): '\n Load keypoints from a specific file as tuples\n\n Parameters\n ----------\n file_path : str\n path to the file with keypoints\n\n Returns\n -------\n keypoints : list of tuples\n list of keypoint tuples in format (x, y, obj_class)\n\n Note\n ...
Load keypoints from a specific file as tuples Parameters ---------- file_path : str path to the file with keypoints Returns ------- keypoints : list of tuples list of keypoint tuples in format (x, y, obj_class) Note ---- This function serves as helper for the pointdet.utils.dataset.PointsDataset class and pr...
contextnet/utils/utils.py
load_keypoints
ushakovegor/ContextNetwork
0
python
def load_keypoints(file_path): '\n Load keypoints from a specific file as tuples\n\n Parameters\n ----------\n file_path : str\n path to the file with keypoints\n\n Returns\n -------\n keypoints : list of tuples\n list of keypoint tuples in format (x, y, obj_class)\n\n Note\n ...
def load_keypoints(file_path): '\n Load keypoints from a specific file as tuples\n\n Parameters\n ----------\n file_path : str\n path to the file with keypoints\n\n Returns\n -------\n keypoints : list of tuples\n list of keypoint tuples in format (x, y, obj_class)\n\n Note\n ...
7ffb869d7eb856815ccd5f71c0d09015a01347e87f26c1aa9ca2e100de8b092a
def parse_master_yaml(yaml_path): '\n Imports master yaml and converts paths to make the usable from inside the script\n\n Parameters\n ----------\n yaml_path : str\n path to master yaml from the script\n\n Returns\n -------\n lists : dict of list of str\n dict with lists pf conve...
Imports master yaml and converts paths to make the usable from inside the script Parameters ---------- yaml_path : str path to master yaml from the script Returns ------- lists : dict of list of str dict with lists pf converted paths
contextnet/utils/utils.py
parse_master_yaml
ushakovegor/ContextNetwork
0
python
def parse_master_yaml(yaml_path): '\n Imports master yaml and converts paths to make the usable from inside the script\n\n Parameters\n ----------\n yaml_path : str\n path to master yaml from the script\n\n Returns\n -------\n lists : dict of list of str\n dict with lists pf conve...
def parse_master_yaml(yaml_path): '\n Imports master yaml and converts paths to make the usable from inside the script\n\n Parameters\n ----------\n yaml_path : str\n path to master yaml from the script\n\n Returns\n -------\n lists : dict of list of str\n dict with lists pf conve...
406a98c0a8755fd68c5e292c0f71174f4df3e64d11a37d9fb374e703c0c9a590
def compute_distances_no_loops(Y, X): '\n Compute the distance between each test point in X and each training point\n in self.X_train using no explicit loops.\n\n Input / Output: Same as compute_distances_two_loops\n ' dists = np.zeros((Y.shape[0], X.shape[0])) dists -= ((2 * X) @ Y.T) dists...
Compute the distance between each test point in X and each training point in self.X_train using no explicit loops. Input / Output: Same as compute_distances_two_loops
contextnet/utils/utils.py
compute_distances_no_loops
ushakovegor/ContextNetwork
0
python
def compute_distances_no_loops(Y, X): '\n Compute the distance between each test point in X and each training point\n in self.X_train using no explicit loops.\n\n Input / Output: Same as compute_distances_two_loops\n ' dists = np.zeros((Y.shape[0], X.shape[0])) dists -= ((2 * X) @ Y.T) dists...
def compute_distances_no_loops(Y, X): '\n Compute the distance between each test point in X and each training point\n in self.X_train using no explicit loops.\n\n Input / Output: Same as compute_distances_two_loops\n ' dists = np.zeros((Y.shape[0], X.shape[0])) dists -= ((2 * X) @ Y.T) dists...
2f5b5288e19cc0f3123c05c9a72b089e93ebd3bccf99651fc5ac2cb448764b75
def measure(self, object1, object2): '\n Returns the measure value between two objects\n ' return 0
Returns the measure value between two objects
contextnet/utils/utils.py
measure
ushakovegor/ContextNetwork
0
python
def measure(self, object1, object2): '\n \n ' return 0
def measure(self, object1, object2): '\n \n ' return 0<|docstring|>Returns the measure value between two objects<|endoftext|>
be53767f60000534d3f848e3acafbedf8c66b146fd92a406d9ba5af92e4e8786
def matrix(self, container1, container2): '\n Returns the matrix of measure values between two sets of objects\n Sometimes can be implemented in a faster way than making couplewise measurements\n ' matrix = np.zeros((len(container1), len(container2))) for (i, object1) in enumerate(conta...
Returns the matrix of measure values between two sets of objects Sometimes can be implemented in a faster way than making couplewise measurements
contextnet/utils/utils.py
matrix
ushakovegor/ContextNetwork
0
python
def matrix(self, container1, container2): '\n Returns the matrix of measure values between two sets of objects\n Sometimes can be implemented in a faster way than making couplewise measurements\n ' matrix = np.zeros((len(container1), len(container2))) for (i, object1) in enumerate(conta...
def matrix(self, container1, container2): '\n Returns the matrix of measure values between two sets of objects\n Sometimes can be implemented in a faster way than making couplewise measurements\n ' matrix = np.zeros((len(container1), len(container2))) for (i, object1) in enumerate(conta...
41b9ac6e745e94aea266cf5ad488492adb61e200d7a7b89efb7399222547a608
def pixel_histogram(img, nbits=None, ax=None, log_scale=True): '\n Plot pixel value histogram.\n\n Parameters\n ----------\n img : py:class:`~numpy.ndarray`\n 2D or 3D image.\n nbits : int, optional\n Bit-depth of camera data.\n ax : :py:class:`~matplotlib.axes.Axes`, optional\n ...
Plot pixel value histogram. Parameters ---------- img : py:class:`~numpy.ndarray` 2D or 3D image. nbits : int, optional Bit-depth of camera data. ax : :py:class:`~matplotlib.axes.Axes`, optional `Axes` object to fill, default is to create one. log_scale : bool, optional Whether to use log scale in ...
DiffuserCam/diffcam/plot.py
pixel_histogram
WilliamCappelletti/diffusercam-project
0
python
def pixel_histogram(img, nbits=None, ax=None, log_scale=True): '\n Plot pixel value histogram.\n\n Parameters\n ----------\n img : py:class:`~numpy.ndarray`\n 2D or 3D image.\n nbits : int, optional\n Bit-depth of camera data.\n ax : :py:class:`~matplotlib.axes.Axes`, optional\n ...
def pixel_histogram(img, nbits=None, ax=None, log_scale=True): '\n Plot pixel value histogram.\n\n Parameters\n ----------\n img : py:class:`~numpy.ndarray`\n 2D or 3D image.\n nbits : int, optional\n Bit-depth of camera data.\n ax : :py:class:`~matplotlib.axes.Axes`, optional\n ...
4ebe2b22f624a50525973beaca2e62fff69c7aaae783aae85f074c8be89ad500
def plot_cross_section(vals, idx=None, ax=None, dB=True, plot_db_drop=3, min_val=0.0001, max_val=None, plot_width=None, **kwargs): '\n Plot cross-section of a 2-D image.\n\n Parameters\n ----------\n vals : py:class:`~numpy.ndarray`\n 2-D image data.\n idx : int, optional\n Row for whic...
Plot cross-section of a 2-D image. Parameters ---------- vals : py:class:`~numpy.ndarray` 2-D image data. idx : int, optional Row for which to plot cross-section. Default is to take middle. ax : :py:class:`~matplotlib.axes.Axes`, optional `Axes` object to fill, default is to create one. dB : bool, optional...
DiffuserCam/diffcam/plot.py
plot_cross_section
WilliamCappelletti/diffusercam-project
0
python
def plot_cross_section(vals, idx=None, ax=None, dB=True, plot_db_drop=3, min_val=0.0001, max_val=None, plot_width=None, **kwargs): '\n Plot cross-section of a 2-D image.\n\n Parameters\n ----------\n vals : py:class:`~numpy.ndarray`\n 2-D image data.\n idx : int, optional\n Row for whic...
def plot_cross_section(vals, idx=None, ax=None, dB=True, plot_db_drop=3, min_val=0.0001, max_val=None, plot_width=None, **kwargs): '\n Plot cross-section of a 2-D image.\n\n Parameters\n ----------\n vals : py:class:`~numpy.ndarray`\n 2-D image data.\n idx : int, optional\n Row for whic...
51562f2d4f069fb566b15da1e4ed6e9102b550587c3e02c330707424c78df0dc
def plot_autocorr2d(vals, pad_mode='reflect', ax=None): '\n Plot 2-D autocorrelation of image.\n\n Parameters\n ----------\n vals : py:class:`~numpy.ndarray`\n 2-D image.\n pad_mode : str\n Desired padding. See NumPy documentation: https://numpy.org/doc/stable/reference/generated/numpy....
Plot 2-D autocorrelation of image. Parameters ---------- vals : py:class:`~numpy.ndarray` 2-D image. pad_mode : str Desired padding. See NumPy documentation: https://numpy.org/doc/stable/reference/generated/numpy.pad.html ax : :py:class:`~matplotlib.axes.Axes`, optional `Axes` object to fill, default i...
DiffuserCam/diffcam/plot.py
plot_autocorr2d
WilliamCappelletti/diffusercam-project
0
python
def plot_autocorr2d(vals, pad_mode='reflect', ax=None): '\n Plot 2-D autocorrelation of image.\n\n Parameters\n ----------\n vals : py:class:`~numpy.ndarray`\n 2-D image.\n pad_mode : str\n Desired padding. See NumPy documentation: https://numpy.org/doc/stable/reference/generated/numpy....
def plot_autocorr2d(vals, pad_mode='reflect', ax=None): '\n Plot 2-D autocorrelation of image.\n\n Parameters\n ----------\n vals : py:class:`~numpy.ndarray`\n 2-D image.\n pad_mode : str\n Desired padding. See NumPy documentation: https://numpy.org/doc/stable/reference/generated/numpy....
0dd9962b22210a6ff737c6802f3f9a89c9a31f58b1c3c56301f073dc174b09ac
def check_pipeline_parameters(self): 'Check pipeline parameters.' if ('full_width_at_half_maximum' not in self.parameters.keys()): self.parameters['full_width_at_half_maximum'] = [8, 8, 8] if ('t1_native_space' not in self.parameters.keys()): self.parameters['t1_native_space'] = False if...
Check pipeline parameters.
pipelines/fmri_preprocessing/fmri_preprocessing_pipeline.py
check_pipeline_parameters
aramis-lab/clinica_pipeline_fmri_preprocessing
1
python
def check_pipeline_parameters(self): if ('full_width_at_half_maximum' not in self.parameters.keys()): self.parameters['full_width_at_half_maximum'] = [8, 8, 8] if ('t1_native_space' not in self.parameters.keys()): self.parameters['t1_native_space'] = False if ('freesurfer_brain_mask' no...
def check_pipeline_parameters(self): if ('full_width_at_half_maximum' not in self.parameters.keys()): self.parameters['full_width_at_half_maximum'] = [8, 8, 8] if ('t1_native_space' not in self.parameters.keys()): self.parameters['t1_native_space'] = False if ('freesurfer_brain_mask' no...
c8fcfaa17224eb15d04c1abe0461f9ea3cdb1ae5c642ab770c92f2088911dbbf
def get_input_fields(self): 'Specify the list of possible inputs of this pipelines.\n\n Returns:\n A list of (string) input fields name.\n ' if (('unwarping' in self.parameters) and self.parameters['unwarping']): return ['et', 'blipdir', 'tert', 'time_repetition', 'num_slices', ...
Specify the list of possible inputs of this pipelines. Returns: A list of (string) input fields name.
pipelines/fmri_preprocessing/fmri_preprocessing_pipeline.py
get_input_fields
aramis-lab/clinica_pipeline_fmri_preprocessing
1
python
def get_input_fields(self): 'Specify the list of possible inputs of this pipelines.\n\n Returns:\n A list of (string) input fields name.\n ' if (('unwarping' in self.parameters) and self.parameters['unwarping']): return ['et', 'blipdir', 'tert', 'time_repetition', 'num_slices', ...
def get_input_fields(self): 'Specify the list of possible inputs of this pipelines.\n\n Returns:\n A list of (string) input fields name.\n ' if (('unwarping' in self.parameters) and self.parameters['unwarping']): return ['et', 'blipdir', 'tert', 'time_repetition', 'num_slices', ...
e279c6f2441d20b5ff74ee605ccaf1a051c22278d65e8c3d6c148d17fa875b29
def get_output_fields(self): 'Specify the list of possible outputs of this pipelines.\n\n Returns:\n A list of (string) output fields name.\n ' if (('t1_native_space' in self.parameters) and self.parameters['t1_native_space']): return ['t1_brain_mask', 'mc_params', 'native_fmri'...
Specify the list of possible outputs of this pipelines. Returns: A list of (string) output fields name.
pipelines/fmri_preprocessing/fmri_preprocessing_pipeline.py
get_output_fields
aramis-lab/clinica_pipeline_fmri_preprocessing
1
python
def get_output_fields(self): 'Specify the list of possible outputs of this pipelines.\n\n Returns:\n A list of (string) output fields name.\n ' if (('t1_native_space' in self.parameters) and self.parameters['t1_native_space']): return ['t1_brain_mask', 'mc_params', 'native_fmri'...
def get_output_fields(self): 'Specify the list of possible outputs of this pipelines.\n\n Returns:\n A list of (string) output fields name.\n ' if (('t1_native_space' in self.parameters) and self.parameters['t1_native_space']): return ['t1_brain_mask', 'mc_params', 'native_fmri'...
74ecf0c7fb3d9a1557516837143edee4814d7da3f53710fceb7054e8a37498d8
def build_input_node(self): 'Build and connect an input node to the pipelines.\n\n References:\n https://lcni.uoregon.edu/kb-articles/kb-0003\n\n ' import nipype.interfaces.utility as nutil import nipype.pipeline.engine as npe import json import numpy as np from clinica....
Build and connect an input node to the pipelines. References: https://lcni.uoregon.edu/kb-articles/kb-0003
pipelines/fmri_preprocessing/fmri_preprocessing_pipeline.py
build_input_node
aramis-lab/clinica_pipeline_fmri_preprocessing
1
python
def build_input_node(self): 'Build and connect an input node to the pipelines.\n\n References:\n https://lcni.uoregon.edu/kb-articles/kb-0003\n\n ' import nipype.interfaces.utility as nutil import nipype.pipeline.engine as npe import json import numpy as np from clinica....
def build_input_node(self): 'Build and connect an input node to the pipelines.\n\n References:\n https://lcni.uoregon.edu/kb-articles/kb-0003\n\n ' import nipype.interfaces.utility as nutil import nipype.pipeline.engine as npe import json import numpy as np from clinica....
3bfdad0572db2d65299193732e182f939d6aaac40c197d5e903890e67bdfc3ca
def build_output_node(self): 'Build and connect an output node to the pipelines.\n ' import nipype.pipeline.engine as npe import nipype.interfaces.io as nio write_node = npe.MapNode(name='WritingCAPS', iterfield=(['container'] + self.get_output_fields()), interface=nio.DataSink(infields=self.get_...
Build and connect an output node to the pipelines.
pipelines/fmri_preprocessing/fmri_preprocessing_pipeline.py
build_output_node
aramis-lab/clinica_pipeline_fmri_preprocessing
1
python
def build_output_node(self): '\n ' import nipype.pipeline.engine as npe import nipype.interfaces.io as nio write_node = npe.MapNode(name='WritingCAPS', iterfield=(['container'] + self.get_output_fields()), interface=nio.DataSink(infields=self.get_output_fields())) write_node.inputs.base_direc...
def build_output_node(self): '\n ' import nipype.pipeline.engine as npe import nipype.interfaces.io as nio write_node = npe.MapNode(name='WritingCAPS', iterfield=(['container'] + self.get_output_fields()), interface=nio.DataSink(infields=self.get_output_fields())) write_node.inputs.base_direc...
799f3f87b778833914512edd515e8ba302a97529bc71ce8950f23abaeb367880
def build_core_nodes(self): 'Build and connect the core nodes of the pipelines.\n ' import fmri_preprocessing_workflows as utils import nipype.interfaces.utility as nutil import nipype.interfaces.spm as spm import nipype.pipeline.engine as npe from clinica.utils.filemanip import zip_nii, ...
Build and connect the core nodes of the pipelines.
pipelines/fmri_preprocessing/fmri_preprocessing_pipeline.py
build_core_nodes
aramis-lab/clinica_pipeline_fmri_preprocessing
1
python
def build_core_nodes(self): '\n ' import fmri_preprocessing_workflows as utils import nipype.interfaces.utility as nutil import nipype.interfaces.spm as spm import nipype.pipeline.engine as npe from clinica.utils.filemanip import zip_nii, unzip_nii unzip_node = npe.MapNode(name='Unzip...
def build_core_nodes(self): '\n ' import fmri_preprocessing_workflows as utils import nipype.interfaces.utility as nutil import nipype.interfaces.spm as spm import nipype.pipeline.engine as npe from clinica.utils.filemanip import zip_nii, unzip_nii unzip_node = npe.MapNode(name='Unzip...
8a99eb5608796a58569716c3a1f4e27a0d05ecb38bae5dd4d86515ad0cced9d8
def check_metadata(layer_name, neuron_indices, ideal_activation): 'Checks metadata for errors.\n\n :param layer_name: See doc for `get_saliency_one_neuron`.\n :param neuron_indices: Same.\n :param ideal_activation: Same.\n ' error_checking.assert_is_string(layer_name) error_checking.assert_is_in...
Checks metadata for errors. :param layer_name: See doc for `get_saliency_one_neuron`. :param neuron_indices: Same. :param ideal_activation: Same.
ml4tc/machine_learning/saliency.py
check_metadata
thunderhoser/ml4tc
2
python
def check_metadata(layer_name, neuron_indices, ideal_activation): 'Checks metadata for errors.\n\n :param layer_name: See doc for `get_saliency_one_neuron`.\n :param neuron_indices: Same.\n :param ideal_activation: Same.\n ' error_checking.assert_is_string(layer_name) error_checking.assert_is_in...
def check_metadata(layer_name, neuron_indices, ideal_activation): 'Checks metadata for errors.\n\n :param layer_name: See doc for `get_saliency_one_neuron`.\n :param neuron_indices: Same.\n :param ideal_activation: Same.\n ' error_checking.assert_is_string(layer_name) error_checking.assert_is_in...
bfef33a2a7623f0e87ba9ed2516c0689b93ab42e962746ed2b435eb8e464cf41
def get_saliency_one_neuron(model_object, three_predictor_matrices, layer_name, neuron_indices, ideal_activation): 'Computes saliency maps with respect to activation of one neuron.\n\n The "relevant neuron" is that whose activation will be used in the numerator\n of the saliency equation. In other words, if ...
Computes saliency maps with respect to activation of one neuron. The "relevant neuron" is that whose activation will be used in the numerator of the saliency equation. In other words, if the relevant neuron is n, the saliency of each predictor x will be d(a_n) / dx, where a_n is the activation of n. :param model_obj...
ml4tc/machine_learning/saliency.py
get_saliency_one_neuron
thunderhoser/ml4tc
2
python
def get_saliency_one_neuron(model_object, three_predictor_matrices, layer_name, neuron_indices, ideal_activation): 'Computes saliency maps with respect to activation of one neuron.\n\n The "relevant neuron" is that whose activation will be used in the numerator\n of the saliency equation. In other words, if ...
def get_saliency_one_neuron(model_object, three_predictor_matrices, layer_name, neuron_indices, ideal_activation): 'Computes saliency maps with respect to activation of one neuron.\n\n The "relevant neuron" is that whose activation will be used in the numerator\n of the saliency equation. In other words, if ...
6a4eab573131d9f4234103ca3cf0e87f2feaa7d22eab281eef9f182fe4161314
def write_composite_file(netcdf_file_name, three_saliency_matrices, three_input_grad_matrices, three_predictor_matrices, model_file_name, use_pmm, pmm_max_percentile_level=None): 'Writes composite saliency map to NetCDF file.\n\n :param netcdf_file_name: Path to output file.\n :param three_saliency_matrices: ...
Writes composite saliency map to NetCDF file. :param netcdf_file_name: Path to output file. :param three_saliency_matrices: length-3 list, where each element is either None or a numpy array of saliency values. three_saliency_matrices[i] should have the same shape as the [i]th input tensor to the model, but ...
ml4tc/machine_learning/saliency.py
write_composite_file
thunderhoser/ml4tc
2
python
def write_composite_file(netcdf_file_name, three_saliency_matrices, three_input_grad_matrices, three_predictor_matrices, model_file_name, use_pmm, pmm_max_percentile_level=None): 'Writes composite saliency map to NetCDF file.\n\n :param netcdf_file_name: Path to output file.\n :param three_saliency_matrices: ...
def write_composite_file(netcdf_file_name, three_saliency_matrices, three_input_grad_matrices, three_predictor_matrices, model_file_name, use_pmm, pmm_max_percentile_level=None): 'Writes composite saliency map to NetCDF file.\n\n :param netcdf_file_name: Path to output file.\n :param three_saliency_matrices: ...
97ddf8c469e193e8224d38058694692752cf33609e2d7e615a4d350fe6168e5c
def read_composite_file(netcdf_file_name): "Reads composite saliency map from NetCDF file.\n\n :param netcdf_file_name: Path to input file.\n :return: saliency_dict: Dictionary with the following keys.\n saliency_dict['three_saliency_matrices']: See doc for\n `write_composite_file`.\n saliency_di...
Reads composite saliency map from NetCDF file. :param netcdf_file_name: Path to input file. :return: saliency_dict: Dictionary with the following keys. saliency_dict['three_saliency_matrices']: See doc for `write_composite_file`. saliency_dict['three_input_grad_matrices']: Same. saliency_dict['three_predictor_matr...
ml4tc/machine_learning/saliency.py
read_composite_file
thunderhoser/ml4tc
2
python
def read_composite_file(netcdf_file_name): "Reads composite saliency map from NetCDF file.\n\n :param netcdf_file_name: Path to input file.\n :return: saliency_dict: Dictionary with the following keys.\n saliency_dict['three_saliency_matrices']: See doc for\n `write_composite_file`.\n saliency_di...
def read_composite_file(netcdf_file_name): "Reads composite saliency map from NetCDF file.\n\n :param netcdf_file_name: Path to input file.\n :return: saliency_dict: Dictionary with the following keys.\n saliency_dict['three_saliency_matrices']: See doc for\n `write_composite_file`.\n saliency_di...
4b5a4335c6a5182f84976689071b194b803a5e4f7fb0540363d0836439e234ac
def write_file(netcdf_file_name, three_saliency_matrices, three_input_grad_matrices, cyclone_id_strings, init_times_unix_sec, model_file_name, layer_name, neuron_indices, ideal_activation): 'Writes saliency maps to NetCDF file.\n\n E = number of examples\n\n :param netcdf_file_name: Path to output file.\n ...
Writes saliency maps to NetCDF file. E = number of examples :param netcdf_file_name: Path to output file. :param three_saliency_matrices: length-3 list, where each element is either None or a numpy array of saliency values. three_saliency_matrices[i] should have the same shape as the [i]th input tensor to th...
ml4tc/machine_learning/saliency.py
write_file
thunderhoser/ml4tc
2
python
def write_file(netcdf_file_name, three_saliency_matrices, three_input_grad_matrices, cyclone_id_strings, init_times_unix_sec, model_file_name, layer_name, neuron_indices, ideal_activation): 'Writes saliency maps to NetCDF file.\n\n E = number of examples\n\n :param netcdf_file_name: Path to output file.\n ...
def write_file(netcdf_file_name, three_saliency_matrices, three_input_grad_matrices, cyclone_id_strings, init_times_unix_sec, model_file_name, layer_name, neuron_indices, ideal_activation): 'Writes saliency maps to NetCDF file.\n\n E = number of examples\n\n :param netcdf_file_name: Path to output file.\n ...
77ec04955554a5fa54ac3d44673ac318b776b7b11190419bf08ee417a8bf4d5d
def read_file(netcdf_file_name): "Reads saliency maps from NetCDF file.\n\n :param netcdf_file_name: Path to input file.\n :return: saliency_dict: Dictionary with the following keys.\n saliency_dict['three_saliency_matrices']: See doc for `write_file`.\n saliency_dict['three_input_grad_matrices']: Same....
Reads saliency maps from NetCDF file. :param netcdf_file_name: Path to input file. :return: saliency_dict: Dictionary with the following keys. saliency_dict['three_saliency_matrices']: See doc for `write_file`. saliency_dict['three_input_grad_matrices']: Same. saliency_dict['cyclone_id_strings']: Same. saliency_dict['...
ml4tc/machine_learning/saliency.py
read_file
thunderhoser/ml4tc
2
python
def read_file(netcdf_file_name): "Reads saliency maps from NetCDF file.\n\n :param netcdf_file_name: Path to input file.\n :return: saliency_dict: Dictionary with the following keys.\n saliency_dict['three_saliency_matrices']: See doc for `write_file`.\n saliency_dict['three_input_grad_matrices']: Same....
def read_file(netcdf_file_name): "Reads saliency maps from NetCDF file.\n\n :param netcdf_file_name: Path to input file.\n :return: saliency_dict: Dictionary with the following keys.\n saliency_dict['three_saliency_matrices']: See doc for `write_file`.\n saliency_dict['three_input_grad_matrices']: Same....
95375aedb115f017568215e9ec0d3721e8fccf4e90b110ae27bb16d75508a3c9
def fit_eval(self, x, y, validation_data=None, mc=False, verbose=0, epochs=1, metric='mse', **config): '\n fit_eval will build a model at the first time it is built\n config will be updated for the second or later times with only non-model-arch\n params be functional\n TODO: check the up...
fit_eval will build a model at the first time it is built config will be updated for the second or later times with only non-model-arch params be functional TODO: check the updated params and decide if the model is needed to be rebuilt
pyzoo/zoo/automl/model/base_pytorch_model.py
fit_eval
OpheliaLjh/analytics-zoo
4
python
def fit_eval(self, x, y, validation_data=None, mc=False, verbose=0, epochs=1, metric='mse', **config): '\n fit_eval will build a model at the first time it is built\n config will be updated for the second or later times with only non-model-arch\n params be functional\n TODO: check the up...
def fit_eval(self, x, y, validation_data=None, mc=False, verbose=0, epochs=1, metric='mse', **config): '\n fit_eval will build a model at the first time it is built\n config will be updated for the second or later times with only non-model-arch\n params be functional\n TODO: check the up...
d70cd16c2e6f7ab6e2b4037763da3b2125a3dd26721d7475ea0098a78b9419aa
@classmethod def run(cls, benchmark, _, idfile: str) -> None: 'Generate random results\n\n Args:\n benchmark: the `lib.benchmark.base.Benchmark` object that has\n ordered running a series.\n _: ignored.\n idfile: the output file to store the results.\n ' ...
Generate random results Args: benchmark: the `lib.benchmark.base.Benchmark` object that has ordered running a series. _: ignored. idfile: the output file to store the results.
tools/perf/lib/benchmark/runner/dummy.py
run
sinkinben/rpma
2
python
@classmethod def run(cls, benchmark, _, idfile: str) -> None: 'Generate random results\n\n Args:\n benchmark: the `lib.benchmark.base.Benchmark` object that has\n ordered running a series.\n _: ignored.\n idfile: the output file to store the results.\n ' ...
@classmethod def run(cls, benchmark, _, idfile: str) -> None: 'Generate random results\n\n Args:\n benchmark: the `lib.benchmark.base.Benchmark` object that has\n ordered running a series.\n _: ignored.\n idfile: the output file to store the results.\n ' ...
1eb303deec444b045491b70fcc3e76194b26b02e62c69f8105b44bb8b1de8003
def discreteSampling(weights, domain, nrSamples): 'Samples from a discrete probability distribution.\n \n Parameters\n ----------\n weights : 1-D array_like\n Probability mass function.\n domain : 1-D array_like\n Categories or indices.\n nrSamples : int\n Number of samples.\n...
Samples from a discrete probability distribution. Parameters ---------- weights : 1-D array_like Probability mass function. domain : 1-D array_like Categories or indices. nrSamples : int Number of samples. Returns ------- domain : 1-D array_like Sampled categories. Examples -------- >>> w = n...
src/pyResampling.py
discreteSampling
can-cs/pyResampling
0
python
def discreteSampling(weights, domain, nrSamples): 'Samples from a discrete probability distribution.\n \n Parameters\n ----------\n weights : 1-D array_like\n Probability mass function.\n domain : 1-D array_like\n Categories or indices.\n nrSamples : int\n Number of samples.\n...
def discreteSampling(weights, domain, nrSamples): 'Samples from a discrete probability distribution.\n \n Parameters\n ----------\n weights : 1-D array_like\n Probability mass function.\n domain : 1-D array_like\n Categories or indices.\n nrSamples : int\n Number of samples.\n...
c9dfaa81f25edf4d3fd2b74d88449b6d9450930b636650e035482bcbc6132a7e
def resampling(w, scheme='mult'): "Resampling of particle indices.\n \n Parameters\n ----------\n w : 1-D array_like\n Normalized weights\n scheme : string\n Resampling scheme to use:\n \n mult : Multinomial resampling\n \n res : Residual resampling\n ...
Resampling of particle indices. Parameters ---------- w : 1-D array_like Normalized weights scheme : string Resampling scheme to use: mult : Multinomial resampling res : Residual resampling strat : Stratified resampling sys : Systematic resampling Returns ------- ind : 1-D ...
src/pyResampling.py
resampling
can-cs/pyResampling
0
python
def resampling(w, scheme='mult'): "Resampling of particle indices.\n \n Parameters\n ----------\n w : 1-D array_like\n Normalized weights\n scheme : string\n Resampling scheme to use:\n \n mult : Multinomial resampling\n \n res : Residual resampling\n ...
def resampling(w, scheme='mult'): "Resampling of particle indices.\n \n Parameters\n ----------\n w : 1-D array_like\n Normalized weights\n scheme : string\n Resampling scheme to use:\n \n mult : Multinomial resampling\n \n res : Residual resampling\n ...
233df30edca811f1bf3ceef12eb47fe29bcc05c537ad09964e3fe1a506205227
@click.command() @click.argument('config_file') def run(config_file): 'This program is the starting point for every neural_network. It pulls together the configuration and all necessary\n neural_network classes to load\n\n ' config = load_config(config_file) config_global = config['global'] sess_c...
This program is the starting point for every neural_network. It pulls together the configuration and all necessary neural_network classes to load
nn/run_experiment.py
run
UKPLab/lsdsem2017-story-cloze
12
python
@click.command() @click.argument('config_file') def run(config_file): 'This program is the starting point for every neural_network. It pulls together the configuration and all necessary\n neural_network classes to load\n\n ' config = load_config(config_file) config_global = config['global'] sess_c...
@click.command() @click.argument('config_file') def run(config_file): 'This program is the starting point for every neural_network. It pulls together the configuration and all necessary\n neural_network classes to load\n\n ' config = load_config(config_file) config_global = config['global'] sess_c...
80a493239328fe84f715c7701a69e7cd1c809a8ebee5aba4b616330b15210f4b
def numJewelsInStones(self, J, S): '\n :type J: str\n :type S: str\n :rtype: int\n ' count = 0 for jewel in J: for stone in S: if (jewel == stone): count += 1 return count
:type J: str :type S: str :rtype: int
algorithm/leetcode/2018-03-25.py
numJewelsInStones
mhoonjeon/problemsolving
0
python
def numJewelsInStones(self, J, S): '\n :type J: str\n :type S: str\n :rtype: int\n ' count = 0 for jewel in J: for stone in S: if (jewel == stone): count += 1 return count
def numJewelsInStones(self, J, S): '\n :type J: str\n :type S: str\n :rtype: int\n ' count = 0 for jewel in J: for stone in S: if (jewel == stone): count += 1 return count<|docstring|>:type J: str :type S: str :rtype: int<|endoftext|>
0fdfe218951efa08bf7ccc278266528fde7d2ad4a9303e0f8bae060bdb30e292
def numberOfLines(self, widths, S): '\n :type widths: List[int]\n :type S: str\n :rtype: List[int]\n ' lines = 1 line_width = 0 for ch in S: index = (ord(ch) - ord('a')) if ((line_width + widths[index]) <= 100): line_width += widths[index] else: ...
:type widths: List[int] :type S: str :rtype: List[int]
algorithm/leetcode/2018-03-25.py
numberOfLines
mhoonjeon/problemsolving
0
python
def numberOfLines(self, widths, S): '\n :type widths: List[int]\n :type S: str\n :rtype: List[int]\n ' lines = 1 line_width = 0 for ch in S: index = (ord(ch) - ord('a')) if ((line_width + widths[index]) <= 100): line_width += widths[index] else: ...
def numberOfLines(self, widths, S): '\n :type widths: List[int]\n :type S: str\n :rtype: List[int]\n ' lines = 1 line_width = 0 for ch in S: index = (ord(ch) - ord('a')) if ((line_width + widths[index]) <= 100): line_width += widths[index] else: ...
dcf38366be4da12e81a582f9d1a34d5edfd08243f5f93f4cf9c18866fcb621c2
def uniqueMorseRepresentations(self, words): '\n :type words: List[str]\n :rtype: int\n ' word_set = [] for word in words: s = '' for ch in word: s += self.alpha_morse[ch] word_set.append(s) return len(list(set(word_set)))
:type words: List[str] :rtype: int
algorithm/leetcode/2018-03-25.py
uniqueMorseRepresentations
mhoonjeon/problemsolving
0
python
def uniqueMorseRepresentations(self, words): '\n :type words: List[str]\n :rtype: int\n ' word_set = [] for word in words: s = for ch in word: s += self.alpha_morse[ch] word_set.append(s) return len(list(set(word_set)))
def uniqueMorseRepresentations(self, words): '\n :type words: List[str]\n :rtype: int\n ' word_set = [] for word in words: s = for ch in word: s += self.alpha_morse[ch] word_set.append(s) return len(list(set(word_set)))<|docstring|>:type words: L...
dd3c81d849de39e6d1754378a3ff733dfb56eff3ccde26ba2c4390103f9fa74a
def _quick_sub_sort_tail(self, start, end): '循环版本,模拟尾递归,可以大大减少递归栈深度,而且时间复杂度不变' while (start < end): pivot = self._rand_partition(start, end) if ((pivot - start) < (end - pivot)): self._quick_sub_sort_tail(start, (pivot - 1)) start = (pivot + 1) else: s...
循环版本,模拟尾递归,可以大大减少递归栈深度,而且时间复杂度不变
algorithms/ch02sort/m05_quick_sort.py
_quick_sub_sort_tail
yidao620c/core-algorithm
819
python
def _quick_sub_sort_tail(self, start, end): while (start < end): pivot = self._rand_partition(start, end) if ((pivot - start) < (end - pivot)): self._quick_sub_sort_tail(start, (pivot - 1)) start = (pivot + 1) else: self._quick_sub_sort_tail((pivot + ...
def _quick_sub_sort_tail(self, start, end): while (start < end): pivot = self._rand_partition(start, end) if ((pivot - start) < (end - pivot)): self._quick_sub_sort_tail(start, (pivot - 1)) start = (pivot + 1) else: self._quick_sub_sort_tail((pivot + ...
39af815b4453e92f45433fcdc89b84d511f02a5dc040abff639a6db948b52c72
def _rand_partition(self, start, end): '分解子数组: 随机化版本' pivot = randint(start, end) (self.seq[pivot], self.seq[end]) = (self.seq[end], self.seq[pivot]) pivot_value = self.seq[end] i = (start - 1) for j in range(start, end): if (self.seq[j] <= pivot_value): i += 1 (s...
分解子数组: 随机化版本
algorithms/ch02sort/m05_quick_sort.py
_rand_partition
yidao620c/core-algorithm
819
python
def _rand_partition(self, start, end): pivot = randint(start, end) (self.seq[pivot], self.seq[end]) = (self.seq[end], self.seq[pivot]) pivot_value = self.seq[end] i = (start - 1) for j in range(start, end): if (self.seq[j] <= pivot_value): i += 1 (self.seq[i], se...
def _rand_partition(self, start, end): pivot = randint(start, end) (self.seq[pivot], self.seq[end]) = (self.seq[end], self.seq[pivot]) pivot_value = self.seq[end] i = (start - 1) for j in range(start, end): if (self.seq[j] <= pivot_value): i += 1 (self.seq[i], se...
ab4725ac78e7533804e78e555f1bd0f7aa245feab368e07215c190e8f5cc222c
def _quick_sub_sort_recursive(self, start, end): '递归版本的' if (start < end): q = self._rand_partition(start, end) self._quick_sub_sort_recursive(start, (q - 1)) self._quick_sub_sort_recursive((q + 1), end)
递归版本的
algorithms/ch02sort/m05_quick_sort.py
_quick_sub_sort_recursive
yidao620c/core-algorithm
819
python
def _quick_sub_sort_recursive(self, start, end): if (start < end): q = self._rand_partition(start, end) self._quick_sub_sort_recursive(start, (q - 1)) self._quick_sub_sort_recursive((q + 1), end)
def _quick_sub_sort_recursive(self, start, end): if (start < end): q = self._rand_partition(start, end) self._quick_sub_sort_recursive(start, (q - 1)) self._quick_sub_sort_recursive((q + 1), end)<|docstring|>递归版本的<|endoftext|>
c131ad33c0c4049a4069a8ae7ca337712b87112004bb883aba3e6ad1f1453463
def prepare_data(self, obj, data): '\n Hook for modifying outgoing data\n ' return data
Hook for modifying outgoing data
flask_peewee/rest/__init__.py
prepare_data
rammie/flask-peewee
0
python
def prepare_data(self, obj, data): '\n \n ' return data
def prepare_data(self, obj, data): '\n \n ' return data<|docstring|>Hook for modifying outgoing data<|endoftext|>
b0f0667412debe7948f51880923a2b8876469524f333a44ae9619a7dc319bcd6
def __init__(self) -> None: 'Initialize the internal data structure.' self._src = None warnings.warn('The QuadraticProgramToIsing class is deprecated and will be removed in a future release. Use the .to_ising() method on a QuadraticProgram object instead.', DeprecationWarning)
Initialize the internal data structure.
qiskit/optimization/converters/quadratic_program_to_ising.py
__init__
MartenSkogh/qiskit-aqua
15
python
def __init__(self) -> None: self._src = None warnings.warn('The QuadraticProgramToIsing class is deprecated and will be removed in a future release. Use the .to_ising() method on a QuadraticProgram object instead.', DeprecationWarning)
def __init__(self) -> None: self._src = None warnings.warn('The QuadraticProgramToIsing class is deprecated and will be removed in a future release. Use the .to_ising() method on a QuadraticProgram object instead.', DeprecationWarning)<|docstring|>Initialize the internal data structure.<|endoftext|>
00a0eeab66be0627b86242216b4ef472b8edced6eac97e4b489b4f740effea0b
def encode(self, op: QuadraticProgram) -> Tuple[(OperatorBase, float)]: 'Convert a problem into a qubit operator\n\n Args:\n op: The optimization problem to be converted. Must be an unconstrained problem with\n binary variables only.\n Returns:\n The qubit operator...
Convert a problem into a qubit operator Args: op: The optimization problem to be converted. Must be an unconstrained problem with binary variables only. Returns: The qubit operator of the problem and the shift value. Raises: QiskitOptimizationError: If a variable type is not binary. QiskitOptim...
qiskit/optimization/converters/quadratic_program_to_ising.py
encode
MartenSkogh/qiskit-aqua
15
python
def encode(self, op: QuadraticProgram) -> Tuple[(OperatorBase, float)]: 'Convert a problem into a qubit operator\n\n Args:\n op: The optimization problem to be converted. Must be an unconstrained problem with\n binary variables only.\n Returns:\n The qubit operator...
def encode(self, op: QuadraticProgram) -> Tuple[(OperatorBase, float)]: 'Convert a problem into a qubit operator\n\n Args:\n op: The optimization problem to be converted. Must be an unconstrained problem with\n binary variables only.\n Returns:\n The qubit operator...
acdf5bfd64fb5c3ab557176afbab4616e27ea426d3e195a3342f0ee15ae452ea
def set_fake_reg_key(fake_reg_key: FakeRegistryKey, sub_key: Union[(str, None)]=None, last_modified_ns: Union[(int, None)]=None) -> FakeRegistryKey: "\n Creates a registry key if it does not exist already\n\n >>> fake_reg_root = FakeRegistryKey()\n >>> assert set_fake_reg_key(fake_reg_key=fake_reg_root, su...
Creates a registry key if it does not exist already >>> fake_reg_root = FakeRegistryKey() >>> assert set_fake_reg_key(fake_reg_key=fake_reg_root, sub_key=r'HKEY_LOCAL_MACHINE').full_key == 'HKEY_LOCAL_MACHINE' >>> assert set_fake_reg_key(fake_reg_key=fake_reg_root, ... sub_key=r'HKEY_LOCAL_MACHINE\SOFTWARE\Microso...
fake_winreg/fake_reg.py
set_fake_reg_key
bitranox/fake_winreg
2
python
def set_fake_reg_key(fake_reg_key: FakeRegistryKey, sub_key: Union[(str, None)]=None, last_modified_ns: Union[(int, None)]=None) -> FakeRegistryKey: "\n Creates a registry key if it does not exist already\n\n >>> fake_reg_root = FakeRegistryKey()\n >>> assert set_fake_reg_key(fake_reg_key=fake_reg_root, su...
def set_fake_reg_key(fake_reg_key: FakeRegistryKey, sub_key: Union[(str, None)]=None, last_modified_ns: Union[(int, None)]=None) -> FakeRegistryKey: "\n Creates a registry key if it does not exist already\n\n >>> fake_reg_root = FakeRegistryKey()\n >>> assert set_fake_reg_key(fake_reg_key=fake_reg_root, su...
1196bd53b8923064ebd77c2f4a0fbf49702ed079fbcb5c0f0971b664df377f16
def get_fake_reg_key(fake_reg_key: FakeRegistryKey, sub_key: str) -> FakeRegistryKey: '\n >>> # Setup\n >>> fake_reg_root = FakeRegistryKey()\n >>> assert set_fake_reg_key(fake_reg_key=fake_reg_root,\n ... sub_key=r\'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\').full_key == r\'HKEY_LOCAL_MA...
>>> # Setup >>> fake_reg_root = FakeRegistryKey() >>> assert set_fake_reg_key(fake_reg_key=fake_reg_root, ... sub_key=r'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT').full_key == r'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT' >>> # Test existing Key >>> assert get_fake_reg_key(fake_reg_key=fake_reg_root, ...
fake_winreg/fake_reg.py
get_fake_reg_key
bitranox/fake_winreg
2
python
def get_fake_reg_key(fake_reg_key: FakeRegistryKey, sub_key: str) -> FakeRegistryKey: '\n >>> # Setup\n >>> fake_reg_root = FakeRegistryKey()\n >>> assert set_fake_reg_key(fake_reg_key=fake_reg_root,\n ... sub_key=r\'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\').full_key == r\'HKEY_LOCAL_MA...
def get_fake_reg_key(fake_reg_key: FakeRegistryKey, sub_key: str) -> FakeRegistryKey: '\n >>> # Setup\n >>> fake_reg_root = FakeRegistryKey()\n >>> assert set_fake_reg_key(fake_reg_key=fake_reg_root,\n ... sub_key=r\'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\').full_key == r\'HKEY_LOCAL_MA...
5d7fa99df2cfd977cc865961b2c062065db57e0e562b70adb479248b79cf6826
def set_fake_reg_value(fake_reg_key: FakeRegistryKey, sub_key: str, value_name: str, value: Union[(None, bytes, str, List[str], int)], value_type: int=REG_SZ, last_modified_ns: Union[(int, None)]=None) -> FakeRegistryValue: "\n sets the value of the fake key - we create here keys on the fly, but beware of the la...
sets the value of the fake key - we create here keys on the fly, but beware of the last_modified_ns time ! if You need to have correct last_modified_ns time for each subkey, You need to create those keys first >>> # Setup >>> fake_reg_root = FakeRegistryKey() >>> fake_reg_key = set_fake_reg_key(fake_reg_key=fake_reg_r...
fake_winreg/fake_reg.py
set_fake_reg_value
bitranox/fake_winreg
2
python
def set_fake_reg_value(fake_reg_key: FakeRegistryKey, sub_key: str, value_name: str, value: Union[(None, bytes, str, List[str], int)], value_type: int=REG_SZ, last_modified_ns: Union[(int, None)]=None) -> FakeRegistryValue: "\n sets the value of the fake key - we create here keys on the fly, but beware of the la...
def set_fake_reg_value(fake_reg_key: FakeRegistryKey, sub_key: str, value_name: str, value: Union[(None, bytes, str, List[str], int)], value_type: int=REG_SZ, last_modified_ns: Union[(int, None)]=None) -> FakeRegistryValue: "\n sets the value of the fake key - we create here keys on the fly, but beware of the la...
ddee84f411db70d5a35870fe4b3e1d8be582f7861888b75034d20ab4cee127c5
def get_windows_timestamp_now() -> int: '\n Windows Timestamp in hundreds of ns since 01.01.1601 – 00:00:00 UTC\n\n >>> assert get_windows_timestamp_now() > 10000\n >>> save_time = get_windows_timestamp_now()\n >>> time.sleep(0.1)\n >>> assert get_windows_timestamp_now() > save_time\n\n ' linu...
Windows Timestamp in hundreds of ns since 01.01.1601 – 00:00:00 UTC >>> assert get_windows_timestamp_now() > 10000 >>> save_time = get_windows_timestamp_now() >>> time.sleep(0.1) >>> assert get_windows_timestamp_now() > save_time
fake_winreg/fake_reg.py
get_windows_timestamp_now
bitranox/fake_winreg
2
python
def get_windows_timestamp_now() -> int: '\n Windows Timestamp in hundreds of ns since 01.01.1601 – 00:00:00 UTC\n\n >>> assert get_windows_timestamp_now() > 10000\n >>> save_time = get_windows_timestamp_now()\n >>> time.sleep(0.1)\n >>> assert get_windows_timestamp_now() > save_time\n\n ' linu...
def get_windows_timestamp_now() -> int: '\n Windows Timestamp in hundreds of ns since 01.01.1601 – 00:00:00 UTC\n\n >>> assert get_windows_timestamp_now() > 10000\n >>> save_time = get_windows_timestamp_now()\n >>> time.sleep(0.1)\n >>> assert get_windows_timestamp_now() > save_time\n\n ' linu...
8138cb165b34430b3f2d0c74195497fea3421b51dea0a9f29f22045834f01835
def __init__(self) -> None: '\n >>> fake_reg_root = FakeRegistryKey()\n ' self.full_key: str = '' self.parent_fake_registry_key: Optional[FakeRegistryKey] = None self.subkeys: Dict[(str, FakeRegistryKey)] = dict() self.values: Dict[(str, FakeRegistryValue)] = dict() self.last_modif...
>>> fake_reg_root = FakeRegistryKey()
fake_winreg/fake_reg.py
__init__
bitranox/fake_winreg
2
python
def __init__(self) -> None: '\n \n ' self.full_key: str = self.parent_fake_registry_key: Optional[FakeRegistryKey] = None self.subkeys: Dict[(str, FakeRegistryKey)] = dict() self.values: Dict[(str, FakeRegistryValue)] = dict() self.last_modified_ns: int = 0
def __init__(self) -> None: '\n \n ' self.full_key: str = self.parent_fake_registry_key: Optional[FakeRegistryKey] = None self.subkeys: Dict[(str, FakeRegistryKey)] = dict() self.values: Dict[(str, FakeRegistryValue)] = dict() self.last_modified_ns: int = 0<|docstring|>>>> fake_re...
811d6eb948c6d707f41ba144b12b104aa691e065f073cdd81996a7c874a91a34
def __init__(self) -> None: '\n >>> fake_reg_value = FakeRegistryValue()\n ' self.full_key: str = '' self.value_name: str = '' self.value: RegData = '' self.value_type: int = REG_SZ self.access: int = 0 self.last_modified_ns: Union[(None, int)] = None
>>> fake_reg_value = FakeRegistryValue()
fake_winreg/fake_reg.py
__init__
bitranox/fake_winreg
2
python
def __init__(self) -> None: '\n \n ' self.full_key: str = self.value_name: str = self.value: RegData = self.value_type: int = REG_SZ self.access: int = 0 self.last_modified_ns: Union[(None, int)] = None
def __init__(self) -> None: '\n \n ' self.full_key: str = self.value_name: str = self.value: RegData = self.value_type: int = REG_SZ self.access: int = 0 self.last_modified_ns: Union[(None, int)] = None<|docstring|>>>> fake_reg_value = FakeRegistryValue()<|endoftext|>
32fca93c44b1c47f1ac51dd51103c2f700dbac0f1d7688aa749eba3e11545ffd
def restrict2ROI(img, vertices): '\n Applies an image mask.\n \n Only keeps the region of the image defined by the polygon\n formed from `vertices`. The rest of the image is set to black.\n `vertices` should be a numpy array of integer points.\n ' mask = np.zeros_like(img) if (len(img.shap...
Applies an image mask. Only keeps the region of the image defined by the polygon formed from `vertices`. The rest of the image is set to black. `vertices` should be a numpy array of integer points.
P2_subroutines.py
restrict2ROI
felipeqda/CarND-Advanced-Lane-Lines
0
python
def restrict2ROI(img, vertices): '\n Applies an image mask.\n \n Only keeps the region of the image defined by the polygon\n formed from `vertices`. The rest of the image is set to black.\n `vertices` should be a numpy array of integer points.\n ' mask = np.zeros_like(img) if (len(img.shap...
def restrict2ROI(img, vertices): '\n Applies an image mask.\n \n Only keeps the region of the image defined by the polygon\n formed from `vertices`. The rest of the image is set to black.\n `vertices` should be a numpy array of integer points.\n ' mask = np.zeros_like(img) if (len(img.shap...
567d2dbe70cd6ec9c6ca1e10d092517c63138d227019b8768ba5c28b85ea5a83
def gaussian_blur(img, kernel_size): 'Applies a Gaussian Noise kernel' return cv2.GaussianBlur(img, (kernel_size, kernel_size), 0)
Applies a Gaussian Noise kernel
P2_subroutines.py
gaussian_blur
felipeqda/CarND-Advanced-Lane-Lines
0
python
def gaussian_blur(img, kernel_size): return cv2.GaussianBlur(img, (kernel_size, kernel_size), 0)
def gaussian_blur(img, kernel_size): return cv2.GaussianBlur(img, (kernel_size, kernel_size), 0)<|docstring|>Applies a Gaussian Noise kernel<|endoftext|>
9998f1991fff90f37103d018878f9c7040b21f7500b0a043666dc6a216551545
def calibrateCamera(FORCE_REDO=False): ' Load images, get the corner positions in image and generate\n the calibration matrix and the distortion coefficients.\n if FORCE_REDO == False; reads previously saved .npz file, if available\n ' if (os.path.isfile('cal_para.npz') and (FORCE_REDO == False...
Load images, get the corner positions in image and generate the calibration matrix and the distortion coefficients. if FORCE_REDO == False; reads previously saved .npz file, if available
P2_subroutines.py
calibrateCamera
felipeqda/CarND-Advanced-Lane-Lines
0
python
def calibrateCamera(FORCE_REDO=False): ' Load images, get the corner positions in image and generate\n the calibration matrix and the distortion coefficients.\n if FORCE_REDO == False; reads previously saved .npz file, if available\n ' if (os.path.isfile('cal_para.npz') and (FORCE_REDO == False...
def calibrateCamera(FORCE_REDO=False): ' Load images, get the corner positions in image and generate\n the calibration matrix and the distortion coefficients.\n if FORCE_REDO == False; reads previously saved .npz file, if available\n ' if (os.path.isfile('cal_para.npz') and (FORCE_REDO == False...
fedd0a09a146c11034a20609e65120978827438d0914f30f127119408cf0ef8a
def lanepxmask(img_RGB, sobel_kernel=7): ' Take RGB image, perform necessary color transformation /gradient calculations\n and output the detected lane pixels mask, alongside an RGB composition of the 3 sub-masks (added)\n for visualization\n ' MORPH_ENHANCE = True kernel = cv2.getStructuri...
Take RGB image, perform necessary color transformation /gradient calculations and output the detected lane pixels mask, alongside an RGB composition of the 3 sub-masks (added) for visualization
P2_subroutines.py
lanepxmask
felipeqda/CarND-Advanced-Lane-Lines
0
python
def lanepxmask(img_RGB, sobel_kernel=7): ' Take RGB image, perform necessary color transformation /gradient calculations\n and output the detected lane pixels mask, alongside an RGB composition of the 3 sub-masks (added)\n for visualization\n ' MORPH_ENHANCE = True kernel = cv2.getStructuri...
def lanepxmask(img_RGB, sobel_kernel=7): ' Take RGB image, perform necessary color transformation /gradient calculations\n and output the detected lane pixels mask, alongside an RGB composition of the 3 sub-masks (added)\n for visualization\n ' MORPH_ENHANCE = True kernel = cv2.getStructuri...
6dbe582070fbf432b4eb9d3eaa6d3b2906aab0b565050e4102c2f6480b329004
def color_preprocessing(img_RGB, GET_BOX=False): ' Apply color-based pre-processing of frames' box_size = 30 box_ystep = 80 box_vertices = (box_size * np.array([((- 1), (- 1)), ((- 1), 1), (1, 1), (1, (- 1))], dtype=np.int32)) (x_box, y_box) = closePolygon(box_vertices) image_new = np.copy(img_R...
Apply color-based pre-processing of frames
P2_subroutines.py
color_preprocessing
felipeqda/CarND-Advanced-Lane-Lines
0
python
def color_preprocessing(img_RGB, GET_BOX=False): ' ' box_size = 30 box_ystep = 80 box_vertices = (box_size * np.array([((- 1), (- 1)), ((- 1), 1), (1, 1), (1, (- 1))], dtype=np.int32)) (x_box, y_box) = closePolygon(box_vertices) image_new = np.copy(img_RGB) (Ny, Nx) = np.shape(img_RGB)[0:2] ...
def color_preprocessing(img_RGB, GET_BOX=False): ' ' box_size = 30 box_ystep = 80 box_vertices = (box_size * np.array([((- 1), (- 1)), ((- 1), 1), (1, 1), (1, (- 1))], dtype=np.int32)) (x_box, y_box) = closePolygon(box_vertices) image_new = np.copy(img_RGB) (Ny, Nx) = np.shape(img_RGB)[0:2] ...
d5f0d3348eabedfba5b87b81f232fde45c9d12bfebb40050ee9c9e18b621fe5b
def weight_fit_cfs(left, right): ' judge fit quality, providing weights and a weighted average of the coefficients\n inputs are LaneLine objects ' cfs = np.vstack((left.cf, right.cf)) cf_MSE = np.vstack((left.MSE, right.MSE)) w1 = (np.sum(cf_MSE) / cf_MSE) w2 = np.reshape((np.array([left.Npix...
judge fit quality, providing weights and a weighted average of the coefficients inputs are LaneLine objects
P2_subroutines.py
weight_fit_cfs
felipeqda/CarND-Advanced-Lane-Lines
0
python
def weight_fit_cfs(left, right): ' judge fit quality, providing weights and a weighted average of the coefficients\n inputs are LaneLine objects ' cfs = np.vstack((left.cf, right.cf)) cf_MSE = np.vstack((left.MSE, right.MSE)) w1 = (np.sum(cf_MSE) / cf_MSE) w2 = np.reshape((np.array([left.Npix...
def weight_fit_cfs(left, right): ' judge fit quality, providing weights and a weighted average of the coefficients\n inputs are LaneLine objects ' cfs = np.vstack((left.cf, right.cf)) cf_MSE = np.vstack((left.MSE, right.MSE)) w1 = (np.sum(cf_MSE) / cf_MSE) w2 = np.reshape((np.array([left.Npix...
0f1ea2098a5ed6473a726d508e2dfbfa620cc3409c0bd07c83729221ab0a750b
def find_lane_xy_frommask(mask_input, nwindows=9, margin=100, minpix=50, NO_IMG=False): ' Take the input mask and perform a sliding window search\n Return the coordinates of the located pixels, polynomial coefficients and optionally an image showing the\n windows/detections\n **Parameters/Keywords:\n ...
Take the input mask and perform a sliding window search Return the coordinates of the located pixels, polynomial coefficients and optionally an image showing the windows/detections **Parameters/Keywords: nwindows ==> Choose the number of sliding windows margin ==> Set the width of the windows +/- margin minpix ==> Se...
P2_subroutines.py
find_lane_xy_frommask
felipeqda/CarND-Advanced-Lane-Lines
0
python
def find_lane_xy_frommask(mask_input, nwindows=9, margin=100, minpix=50, NO_IMG=False): ' Take the input mask and perform a sliding window search\n Return the coordinates of the located pixels, polynomial coefficients and optionally an image showing the\n windows/detections\n **Parameters/Keywords:\n ...
def find_lane_xy_frommask(mask_input, nwindows=9, margin=100, minpix=50, NO_IMG=False): ' Take the input mask and perform a sliding window search\n Return the coordinates of the located pixels, polynomial coefficients and optionally an image showing the\n windows/detections\n **Parameters/Keywords:\n ...
148bd8038e73111cd854f28ce37b9cce55c2ae5fae729aedc8359dacebf4a74e
def find_lane_xy_frompoly(mask_input, polycf_left, polycf_right, margin=80, NO_IMG=False): ' Take the input mask and perform a search around the polynomial-matching area\n Return the coordinates of the located pixels, polynomial coefficients and optionally an image showing the\n windows/detections\n *...
Take the input mask and perform a search around the polynomial-matching area Return the coordinates of the located pixels, polynomial coefficients and optionally an image showing the windows/detections **Parameters/Keywords: margin ==> Set the width of the windows +/- margin NO_IMG ==> do not calculate the diagnose o...
P2_subroutines.py
find_lane_xy_frompoly
felipeqda/CarND-Advanced-Lane-Lines
0
python
def find_lane_xy_frompoly(mask_input, polycf_left, polycf_right, margin=80, NO_IMG=False): ' Take the input mask and perform a search around the polynomial-matching area\n Return the coordinates of the located pixels, polynomial coefficients and optionally an image showing the\n windows/detections\n *...
def find_lane_xy_frompoly(mask_input, polycf_left, polycf_right, margin=80, NO_IMG=False): ' Take the input mask and perform a search around the polynomial-matching area\n Return the coordinates of the located pixels, polynomial coefficients and optionally an image showing the\n windows/detections\n *...
7328f87317d9a4def5d5ebc605e4e445fb5419288c443fbc6965dd59bea144e9
def getlane_annotation(mask_shape, polycf_left, polycf_right, img2annotate=[], xmargin=5, ymin=0, PLOT_LINES=False): ' Give the shape and the polynomial coefficients, return byte mask showing the region inside the two curves\n (plus an optional x-margin). Also add the annotations to an image if it is provide...
Give the shape and the polynomial coefficients, return byte mask showing the region inside the two curves (plus an optional x-margin). Also add the annotations to an image if it is provided. **Parameters/Keywords: img2annotate ==> RGB image to annotate, if provided (should match the size of mask_shape!) xmargin ==> ...
P2_subroutines.py
getlane_annotation
felipeqda/CarND-Advanced-Lane-Lines
0
python
def getlane_annotation(mask_shape, polycf_left, polycf_right, img2annotate=[], xmargin=5, ymin=0, PLOT_LINES=False): ' Give the shape and the polynomial coefficients, return byte mask showing the region inside the two curves\n (plus an optional x-margin). Also add the annotations to an image if it is provide...
def getlane_annotation(mask_shape, polycf_left, polycf_right, img2annotate=[], xmargin=5, ymin=0, PLOT_LINES=False): ' Give the shape and the polynomial coefficients, return byte mask showing the region inside the two curves\n (plus an optional x-margin). Also add the annotations to an image if it is provide...
368880227f5858458b0b094590c10129580aff9064f54c36417b743182044bc3
def cf_px2m(poly_cf_px, img_shape): ' Convert from pixel polynomial coefficients (order 2) to m\n x = f(y), with origin at center/bottom of image, positive y upwards!' (Ny, Nx) = img_shape[0:2] ym_per_pix = (30 / 720) xm_per_pix = (3.7 / 700) (a, b, c) = poly_cf_px poly_cf_m = np.array([(...
Convert from pixel polynomial coefficients (order 2) to m x = f(y), with origin at center/bottom of image, positive y upwards!
P2_subroutines.py
cf_px2m
felipeqda/CarND-Advanced-Lane-Lines
0
python
def cf_px2m(poly_cf_px, img_shape): ' Convert from pixel polynomial coefficients (order 2) to m\n x = f(y), with origin at center/bottom of image, positive y upwards!' (Ny, Nx) = img_shape[0:2] ym_per_pix = (30 / 720) xm_per_pix = (3.7 / 700) (a, b, c) = poly_cf_px poly_cf_m = np.array([(...
def cf_px2m(poly_cf_px, img_shape): ' Convert from pixel polynomial coefficients (order 2) to m\n x = f(y), with origin at center/bottom of image, positive y upwards!' (Ny, Nx) = img_shape[0:2] ym_per_pix = (30 / 720) xm_per_pix = (3.7 / 700) (a, b, c) = poly_cf_px poly_cf_m = np.array([(...
eb25619189b599323e26c3047025f527bdb84d104b2636b2751a67a52dfb20d4
def get_direction(ball_angle: float) -> int: 'Get direction to navigate robot to face the ball\n\n Args:\n ball_angle (float): Angle between the ball and the robot\n\n Returns:\n int: 0 = forward, -1 = right, 1 = left\n ' if ((ball_angle >= 340) or (ball_angle <= 20)): return 0 ...
Get direction to navigate robot to face the ball Args: ball_angle (float): Angle between the ball and the robot Returns: int: 0 = forward, -1 = right, 1 = left
controllers/rcj_soccer_team_yellow/utils.py
get_direction
fdmxfarhan/phasemoon
0
python
def get_direction(ball_angle: float) -> int: 'Get direction to navigate robot to face the ball\n\n Args:\n ball_angle (float): Angle between the ball and the robot\n\n Returns:\n int: 0 = forward, -1 = right, 1 = left\n ' if ((ball_angle >= 340) or (ball_angle <= 20)): return 0 ...
def get_direction(ball_angle: float) -> int: 'Get direction to navigate robot to face the ball\n\n Args:\n ball_angle (float): Angle between the ball and the robot\n\n Returns:\n int: 0 = forward, -1 = right, 1 = left\n ' if ((ball_angle >= 340) or (ball_angle <= 20)): return 0 ...
9fe124824fabbed4eb4583dd8ef6aa475cf042ae4b3f2aea60cb666a12556b7c
def set_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set border style.\n\n Args:\n style: border style\n\n Raises:\n InvalidParamError: border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): raise InvalidParamErr...
Set border style. Args: style: border style Raises: InvalidParamError: border style does not exist
prettyqt/gui/texttablecellformat.py
set_border_style
phil65/PrettyQt
7
python
def set_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set border style.\n\n Args:\n style: border style\n\n Raises:\n InvalidParamError: border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): raise InvalidParamErr...
def set_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set border style.\n\n Args:\n style: border style\n\n Raises:\n InvalidParamError: border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): raise InvalidParamErr...
4e84fecee05e0756a08a21fb210c9741f17f4b342d6ac2f29b97f0ab6f119b94
def set_bottom_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set bottom border style.\n\n Args:\n style: bottom border style\n\n Raises:\n InvalidParamError: bottom border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): ...
Set bottom border style. Args: style: bottom border style Raises: InvalidParamError: bottom border style does not exist
prettyqt/gui/texttablecellformat.py
set_bottom_border_style
phil65/PrettyQt
7
python
def set_bottom_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set bottom border style.\n\n Args:\n style: bottom border style\n\n Raises:\n InvalidParamError: bottom border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): ...
def set_bottom_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set bottom border style.\n\n Args:\n style: bottom border style\n\n Raises:\n InvalidParamError: bottom border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): ...
51ecdf491c934285ede2074d9bda3c60cf1946ab28f25518afda9b6b21612f42
def get_bottom_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current bottom border style.\n\n Returns:\n bottom border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.bottomBorderStyle()]
Get the current bottom border style. Returns: bottom border style
prettyqt/gui/texttablecellformat.py
get_bottom_border_style
phil65/PrettyQt
7
python
def get_bottom_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current bottom border style.\n\n Returns:\n bottom border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.bottomBorderStyle()]
def get_bottom_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current bottom border style.\n\n Returns:\n bottom border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.bottomBorderStyle()]<|docstring|>Get the current bottom border style. Returns: ...
dd263f731def0c5237f79ab0f098194f4b12c9f2edfd75d006e321be6f53dc8a
def set_left_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set left border style.\n\n Args:\n style: left border style\n\n Raises:\n InvalidParamError: left border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): r...
Set left border style. Args: style: left border style Raises: InvalidParamError: left border style does not exist
prettyqt/gui/texttablecellformat.py
set_left_border_style
phil65/PrettyQt
7
python
def set_left_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set left border style.\n\n Args:\n style: left border style\n\n Raises:\n InvalidParamError: left border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): r...
def set_left_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set left border style.\n\n Args:\n style: left border style\n\n Raises:\n InvalidParamError: left border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): r...
5aa787139d44526882947c14b34393f9408f90eb7fa8376db1fc874bd6d9a5c1
def get_left_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current left border style.\n\n Returns:\n left border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.leftBorderStyle()]
Get the current left border style. Returns: left border style
prettyqt/gui/texttablecellformat.py
get_left_border_style
phil65/PrettyQt
7
python
def get_left_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current left border style.\n\n Returns:\n left border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.leftBorderStyle()]
def get_left_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current left border style.\n\n Returns:\n left border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.leftBorderStyle()]<|docstring|>Get the current left border style. Returns: left bord...
c049b04a4cf3ff2b9d4d2e5b999716f09f50d84a82f49264d00ec3d80d222918
def set_right_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set right border style.\n\n Args:\n style: right border style\n\n Raises:\n InvalidParamError: right border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): ...
Set right border style. Args: style: right border style Raises: InvalidParamError: right border style does not exist
prettyqt/gui/texttablecellformat.py
set_right_border_style
phil65/PrettyQt
7
python
def set_right_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set right border style.\n\n Args:\n style: right border style\n\n Raises:\n InvalidParamError: right border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): ...
def set_right_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set right border style.\n\n Args:\n style: right border style\n\n Raises:\n InvalidParamError: right border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): ...
3afa918a3ff563c1739f51fe058d0da46b5b40760e6d3a291ec8cd43ad9f0f0f
def get_right_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current right border style.\n\n Returns:\n right border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.rightBorderStyle()]
Get the current right border style. Returns: right border style
prettyqt/gui/texttablecellformat.py
get_right_border_style
phil65/PrettyQt
7
python
def get_right_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current right border style.\n\n Returns:\n right border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.rightBorderStyle()]
def get_right_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current right border style.\n\n Returns:\n right border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.rightBorderStyle()]<|docstring|>Get the current right border style. Returns: righ...
f369010d2a11e94ab7b9a3a6c55eb75bfb757a20c57142a95f53d0dce3198ab2
def set_top_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set top border style.\n\n Args:\n style: top border style\n\n Raises:\n InvalidParamError: top border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): raise...
Set top border style. Args: style: top border style Raises: InvalidParamError: top border style does not exist
prettyqt/gui/texttablecellformat.py
set_top_border_style
phil65/PrettyQt
7
python
def set_top_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set top border style.\n\n Args:\n style: top border style\n\n Raises:\n InvalidParamError: top border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): raise...
def set_top_border_style(self, style: gui.textframeformat.BorderStyleStr): 'Set top border style.\n\n Args:\n style: top border style\n\n Raises:\n InvalidParamError: top border style does not exist\n ' if (style not in gui.textframeformat.BORDER_STYLES): raise...
7a1fab1c6d1b005c9c9a2d12e7d551eead52abdecbf34a391a011ec91fa789cf
def get_top_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current top border style.\n\n Returns:\n top border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.topBorderStyle()]
Get the current top border style. Returns: top border style
prettyqt/gui/texttablecellformat.py
get_top_border_style
phil65/PrettyQt
7
python
def get_top_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current top border style.\n\n Returns:\n top border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.topBorderStyle()]
def get_top_border_style(self) -> gui.textframeformat.BorderStyleStr: 'Get the current top border style.\n\n Returns:\n top border style\n ' return gui.textframeformat.BORDER_STYLES.inverse[self.topBorderStyle()]<|docstring|>Get the current top border style. Returns: top border sty...
2213e7f2714da41e313990dd806665c40f74df8ff181e98eaca1360ab1ffa3d9
def __init__(self, file_name, timeout=30, delay=0.2, stealing=False): ' Prepare the file locker. Specify the file to lock and optionally\n the maximum timeout and the delay between each attempt to lock.\n ' self.is_locked = False self.lockfile = os.path.join(os.getcwd(), ('%s.lock' % file_...
Prepare the file locker. Specify the file to lock and optionally the maximum timeout and the delay between each attempt to lock.
useful/filelock.py
__init__
tuttle/python-useful
7
python
def __init__(self, file_name, timeout=30, delay=0.2, stealing=False): ' Prepare the file locker. Specify the file to lock and optionally\n the maximum timeout and the delay between each attempt to lock.\n ' self.is_locked = False self.lockfile = os.path.join(os.getcwd(), ('%s.lock' % file_...
def __init__(self, file_name, timeout=30, delay=0.2, stealing=False): ' Prepare the file locker. Specify the file to lock and optionally\n the maximum timeout and the delay between each attempt to lock.\n ' self.is_locked = False self.lockfile = os.path.join(os.getcwd(), ('%s.lock' % file_...
997995282f9dd2094226f65b499af017127f5064364add750004ef818f71d8b3
def acquire(self): ' Acquire the lock, if possible. If the lock is in use, it check again\n every `wait` seconds. It does this until it either gets the lock or\n exceeds `timeout` number of seconds, in which case it throws\n an exception.\n ' start_time = time.time() ...
Acquire the lock, if possible. If the lock is in use, it check again every `wait` seconds. It does this until it either gets the lock or exceeds `timeout` number of seconds, in which case it throws an exception.
useful/filelock.py
acquire
tuttle/python-useful
7
python
def acquire(self): ' Acquire the lock, if possible. If the lock is in use, it check again\n every `wait` seconds. It does this until it either gets the lock or\n exceeds `timeout` number of seconds, in which case it throws\n an exception.\n ' start_time = time.time() ...
def acquire(self): ' Acquire the lock, if possible. If the lock is in use, it check again\n every `wait` seconds. It does this until it either gets the lock or\n exceeds `timeout` number of seconds, in which case it throws\n an exception.\n ' start_time = time.time() ...
3cca8d7b23c621f707f5dbc3ca2eaed2c35a3ec6ea85f32633703b9a68257e5a
def release(self): ' Get rid of the lock by deleting the lockfile.\n When working in a `with` statement, this gets automatically\n called at the end.\n ' if self.is_locked: if (self.fd is not None): os.close(self.fd) os.unlink(self.lockfile) self....
Get rid of the lock by deleting the lockfile. When working in a `with` statement, this gets automatically called at the end.
useful/filelock.py
release
tuttle/python-useful
7
python
def release(self): ' Get rid of the lock by deleting the lockfile.\n When working in a `with` statement, this gets automatically\n called at the end.\n ' if self.is_locked: if (self.fd is not None): os.close(self.fd) os.unlink(self.lockfile) self....
def release(self): ' Get rid of the lock by deleting the lockfile.\n When working in a `with` statement, this gets automatically\n called at the end.\n ' if self.is_locked: if (self.fd is not None): os.close(self.fd) os.unlink(self.lockfile) self....
940a31c8c8d2897818c23a5d89ad9379a6fa02731e3540af375eb331e3cfa556
def __enter__(self): ' Activated when used in the with statement.\n Should automatically acquire a lock to be used in the with block.\n ' if (not self.is_locked): self.acquire() return self
Activated when used in the with statement. Should automatically acquire a lock to be used in the with block.
useful/filelock.py
__enter__
tuttle/python-useful
7
python
def __enter__(self): ' Activated when used in the with statement.\n Should automatically acquire a lock to be used in the with block.\n ' if (not self.is_locked): self.acquire() return self
def __enter__(self): ' Activated when used in the with statement.\n Should automatically acquire a lock to be used in the with block.\n ' if (not self.is_locked): self.acquire() return self<|docstring|>Activated when used in the with statement. Should automatically acquire a lock t...
ec81bab2cc1c0341532d83545e67a38c5e3201faf5846d1f5acf0b53f9d3be87
def __exit__(self, exc_type, exc_value, traceback): " Activated at the end of the with statement.\n It automatically releases the lock if it isn't locked.\n " if self.is_locked: self.release()
Activated at the end of the with statement. It automatically releases the lock if it isn't locked.
useful/filelock.py
__exit__
tuttle/python-useful
7
python
def __exit__(self, exc_type, exc_value, traceback): " Activated at the end of the with statement.\n It automatically releases the lock if it isn't locked.\n " if self.is_locked: self.release()
def __exit__(self, exc_type, exc_value, traceback): " Activated at the end of the with statement.\n It automatically releases the lock if it isn't locked.\n " if self.is_locked: self.release()<|docstring|>Activated at the end of the with statement. It automatically releases the lock if...
5d4311be612c9baababcc02d5aeac6a7c27403cbabf04459950928043657a002
def __del__(self): " Make sure that the FileLock instance doesn't leave a lockfile\n lying around.\n " self.release()
Make sure that the FileLock instance doesn't leave a lockfile lying around.
useful/filelock.py
__del__
tuttle/python-useful
7
python
def __del__(self): " Make sure that the FileLock instance doesn't leave a lockfile\n lying around.\n " self.release()
def __del__(self): " Make sure that the FileLock instance doesn't leave a lockfile\n lying around.\n " self.release()<|docstring|>Make sure that the FileLock instance doesn't leave a lockfile lying around.<|endoftext|>
ec4f1bbcaaa6be54f018cb9b6a06156fa3af56156b919530288cb5f53620abf4
def __call__(self, func): '\n Support for using the instance as decorator. The entire function will be protected.\n ' @wraps(func) def inner(*args, **kwargs): with self: return func(*args, **kwargs) return inner
Support for using the instance as decorator. The entire function will be protected.
useful/filelock.py
__call__
tuttle/python-useful
7
python
def __call__(self, func): '\n \n ' @wraps(func) def inner(*args, **kwargs): with self: return func(*args, **kwargs) return inner
def __call__(self, func): '\n \n ' @wraps(func) def inner(*args, **kwargs): with self: return func(*args, **kwargs) return inner<|docstring|>Support for using the instance as decorator. The entire function will be protected.<|endoftext|>
ce9c3eb48cc54efd9cfd750acb9d6a5cc7c9d4b70546074caec94b232fe06dab
def GetParams(self): 'Testing engine with the same tensor repeated as output via identity.' input_name = 'input' input_dims = [100, 32] g = ops.Graph() with g.as_default(): x = array_ops.placeholder(dtype=dtypes.float32, shape=input_dims, name=input_name) b = self._ConstOp((32, 4)) ...
Testing engine with the same tensor repeated as output via identity.
tensorflow/python/compiler/tensorrt/test/identity_output_test.py
GetParams
2hyan8/tensorflow
36
python
def GetParams(self): input_name = 'input' input_dims = [100, 32] g = ops.Graph() with g.as_default(): x = array_ops.placeholder(dtype=dtypes.float32, shape=input_dims, name=input_name) b = self._ConstOp((32, 4)) x1 = math_ops.matmul(x, b) b = self._ConstOp((1, 4)) ...
def GetParams(self): input_name = 'input' input_dims = [100, 32] g = ops.Graph() with g.as_default(): x = array_ops.placeholder(dtype=dtypes.float32, shape=input_dims, name=input_name) b = self._ConstOp((32, 4)) x1 = math_ops.matmul(x, b) b = self._ConstOp((1, 4)) ...
b8d6e0955969ca4cf3bbb11a67542acd2c2fe7d505f2994006ea6d6db4ec61b5
def ExpectedEnginesToBuild(self, run_params): 'Return the expected engines to build.' return ['TRTEngineOp_0']
Return the expected engines to build.
tensorflow/python/compiler/tensorrt/test/identity_output_test.py
ExpectedEnginesToBuild
2hyan8/tensorflow
36
python
def ExpectedEnginesToBuild(self, run_params): return ['TRTEngineOp_0']
def ExpectedEnginesToBuild(self, run_params): return ['TRTEngineOp_0']<|docstring|>Return the expected engines to build.<|endoftext|>
78ee1a6603d0b62b884429280dd209e5b65667d11bfe02c9fb3f8d7f084d9569
def session_expired(self): 'The session has ended due to session expiration' if self.expiry_time: return (self.expiry_time <= timezone.now()) return False
The session has ended due to session expiration
tracking/models.py
session_expired
yassam/django-tracking2
0
python
def session_expired(self): if self.expiry_time: return (self.expiry_time <= timezone.now()) return False
def session_expired(self): if self.expiry_time: return (self.expiry_time <= timezone.now()) return False<|docstring|>The session has ended due to session expiration<|endoftext|>
3cd51f3a6b5298db332e6d93d22f5b0ef5fddcd0cdb7b342818bd4a19ea7be5f
def session_ended(self): 'The session has ended due to an explicit logout' return bool(self.end_time)
The session has ended due to an explicit logout
tracking/models.py
session_ended
yassam/django-tracking2
0
python
def session_ended(self): return bool(self.end_time)
def session_ended(self): return bool(self.end_time)<|docstring|>The session has ended due to an explicit logout<|endoftext|>
c6ac0ffd6d7b640767da5e7ff56c7c15f846ba953b2173b676984fa4d2f9ad94
@property def last_time(self): 'datetime of last time visited - start_time + time_on_site' return (self.start_time + timedelta(seconds=self.time_on_site))
datetime of last time visited - start_time + time_on_site
tracking/models.py
last_time
yassam/django-tracking2
0
python
@property def last_time(self): return (self.start_time + timedelta(seconds=self.time_on_site))
@property def last_time(self): return (self.start_time + timedelta(seconds=self.time_on_site))<|docstring|>datetime of last time visited - start_time + time_on_site<|endoftext|>
22030fc976f4294f47e1485792c59d46edc20fe83be35d2af00e0efce8947455
@property def geoip_data(self): "Attempts to retrieve MaxMind GeoIP data based upon the visitor's IP" if ((not HAS_GEOIP) or (not TRACK_USING_GEOIP)): return if (not hasattr(self, '_geoip_data')): self._geoip_data = None try: gip = GeoIP(cache=GEOIP_CACHE_TYPE) ...
Attempts to retrieve MaxMind GeoIP data based upon the visitor's IP
tracking/models.py
geoip_data
yassam/django-tracking2
0
python
@property def geoip_data(self): if ((not HAS_GEOIP) or (not TRACK_USING_GEOIP)): return if (not hasattr(self, '_geoip_data')): self._geoip_data = None try: gip = GeoIP(cache=GEOIP_CACHE_TYPE) self._geoip_data = gip.city(self.ip_address) except GeoIPEx...
@property def geoip_data(self): if ((not HAS_GEOIP) or (not TRACK_USING_GEOIP)): return if (not hasattr(self, '_geoip_data')): self._geoip_data = None try: gip = GeoIP(cache=GEOIP_CACHE_TYPE) self._geoip_data = gip.city(self.ip_address) except GeoIPEx...
ca3b83d46df29f4680ca63ccc927357957e8f6a1511c48b22a882ddf0606ac0d
@property def platform(self): '\n Returns string describing browser platform. Falls back to agent\n string if either user_agents module not found, or\n TRACK_PARSE_AGENT is False\n ' if (not user_agents): return self.user_agent if (not hasattr(self, '_platform_string')): ...
Returns string describing browser platform. Falls back to agent string if either user_agents module not found, or TRACK_PARSE_AGENT is False
tracking/models.py
platform
yassam/django-tracking2
0
python
@property def platform(self): '\n Returns string describing browser platform. Falls back to agent\n string if either user_agents module not found, or\n TRACK_PARSE_AGENT is False\n ' if (not user_agents): return self.user_agent if (not hasattr(self, '_platform_string')): ...
@property def platform(self): '\n Returns string describing browser platform. Falls back to agent\n string if either user_agents module not found, or\n TRACK_PARSE_AGENT is False\n ' if (not user_agents): return self.user_agent if (not hasattr(self, '_platform_string')): ...
bbdb08ad55cf49ed0ebed5f76b89e4b8306d795335be28e3fbcee9c0009c516b
def task_hutch_install(): '\n Hutch: Compile and install the Hutch extension.\n ' return {'actions': [(lambda : os.chdir('cmudb/extensions/hutch/')), 'sudo PYTHONPATH=../../tscout:$PYTHONPATH python3 tscout_feature_gen.py', 'PG_CONFIG=%(pg_config)s make clean -j', 'PG_CONFIG=%(pg_config)s make -j', 'PG_CO...
Hutch: Compile and install the Hutch extension.
dodos/hutch.py
task_hutch_install
17zhangw/postgres
0
python
def task_hutch_install(): '\n \n ' return {'actions': [(lambda : os.chdir('cmudb/extensions/hutch/')), 'sudo PYTHONPATH=../../tscout:$PYTHONPATH python3 tscout_feature_gen.py', 'PG_CONFIG=%(pg_config)s make clean -j', 'PG_CONFIG=%(pg_config)s make -j', 'PG_CONFIG=%(pg_config)s make install -j', (lambda : ...
def task_hutch_install(): '\n \n ' return {'actions': [(lambda : os.chdir('cmudb/extensions/hutch/')), 'sudo PYTHONPATH=../../tscout:$PYTHONPATH python3 tscout_feature_gen.py', 'PG_CONFIG=%(pg_config)s make clean -j', 'PG_CONFIG=%(pg_config)s make -j', 'PG_CONFIG=%(pg_config)s make install -j', (lambda : ...
3b2bdd5db92d4357c6c6ce2e824e955737da0ee052326a689f0889b92930339f
def logoutfunction(self, line): ' Main logout worker function\n\n :param line: command line input\n :type line: string.\n ' try: (_, _) = self._parse_arglist(line) except (InvalidCommandLineErrorOPTS, SystemExit): if (('-h' in line) or ('--help' in line)): re...
Main logout worker function :param line: command line input :type line: string.
src/extensions/COMMANDS/LogoutCommand.py
logoutfunction
xnox/python-redfish-utility
0
python
def logoutfunction(self, line): ' Main logout worker function\n\n :param line: command line input\n :type line: string.\n ' try: (_, _) = self._parse_arglist(line) except (InvalidCommandLineErrorOPTS, SystemExit): if (('-h' in line) or ('--help' in line)): re...
def logoutfunction(self, line): ' Main logout worker function\n\n :param line: command line input\n :type line: string.\n ' try: (_, _) = self._parse_arglist(line) except (InvalidCommandLineErrorOPTS, SystemExit): if (('-h' in line) or ('--help' in line)): re...
51714612da3c83e0bb904a2284a207355b682d7495f4c518b97a27e19b10efab
def run(self, line): ' Wrapper function for main logout function\n\n :param line: command line input\n :type line: string.\n ' sys.stdout.write('Logging session out.\n') self.logoutfunction(line) return ReturnCodes.SUCCESS
Wrapper function for main logout function :param line: command line input :type line: string.
src/extensions/COMMANDS/LogoutCommand.py
run
xnox/python-redfish-utility
0
python
def run(self, line): ' Wrapper function for main logout function\n\n :param line: command line input\n :type line: string.\n ' sys.stdout.write('Logging session out.\n') self.logoutfunction(line) return ReturnCodes.SUCCESS
def run(self, line): ' Wrapper function for main logout function\n\n :param line: command line input\n :type line: string.\n ' sys.stdout.write('Logging session out.\n') self.logoutfunction(line) return ReturnCodes.SUCCESS<|docstring|>Wrapper function for main logout function :para...
64b13e0cdc3f473e0413f9ecb2c06ee0bab7470a7a9ad77faf84250587f6692d
def definearguments(self, customparser): ' Wrapper function for new command main function\n\n :param customparser: command line input\n :type customparser: parser.\n ' if (not customparser): return customparser.add_argument('-u', '--user', dest='user', help='Pass this flag along...
Wrapper function for new command main function :param customparser: command line input :type customparser: parser.
src/extensions/COMMANDS/LogoutCommand.py
definearguments
xnox/python-redfish-utility
0
python
def definearguments(self, customparser): ' Wrapper function for new command main function\n\n :param customparser: command line input\n :type customparser: parser.\n ' if (not customparser): return customparser.add_argument('-u', '--user', dest='user', help='Pass this flag along...
def definearguments(self, customparser): ' Wrapper function for new command main function\n\n :param customparser: command line input\n :type customparser: parser.\n ' if (not customparser): return customparser.add_argument('-u', '--user', dest='user', help='Pass this flag along...
baf991d31965b80ba3f4c423e9f65de32ba930c321340b196069420d0fffe4a5
def __init__(self, game, show_progress=True): 'Build new CFR instance.\n\n Args:\n game (Game): ACPC game definition object.\n ' self.game = game self.show_progress = show_progress if (game.get_num_players() != 2): raise AttributeError('Only games with 2 players are supp...
Build new CFR instance. Args: game (Game): ACPC game definition object.
cfr/main.py
__init__
JakubPetriska/poker-agent-kit
19
python
def __init__(self, game, show_progress=True): 'Build new CFR instance.\n\n Args:\n game (Game): ACPC game definition object.\n ' self.game = game self.show_progress = show_progress if (game.get_num_players() != 2): raise AttributeError('Only games with 2 players are supp...
def __init__(self, game, show_progress=True): 'Build new CFR instance.\n\n Args:\n game (Game): ACPC game definition object.\n ' self.game = game self.show_progress = show_progress if (game.get_num_players() != 2): raise AttributeError('Only games with 2 players are supp...
f08d17b3d0ecaf6a5f63ca1d48de9c1849fded104d9f5ad28b8ef5871c411370
def train(self, iterations, weight_delay=700, checkpoint_iterations=None, checkpoint_callback=(lambda *args: None), minimal_action_probability=None): 'Run CFR for given number of iterations.\n\n The trained tree can be found by retrieving the game_tree\n property from this object. The result strategy ...
Run CFR for given number of iterations. The trained tree can be found by retrieving the game_tree property from this object. The result strategy is stored in average_strategy of each ActionNode in game tree. This method can be called multiple times on one instance to train more. This can be used for evaluation during...
cfr/main.py
train
JakubPetriska/poker-agent-kit
19
python
def train(self, iterations, weight_delay=700, checkpoint_iterations=None, checkpoint_callback=(lambda *args: None), minimal_action_probability=None): 'Run CFR for given number of iterations.\n\n The trained tree can be found by retrieving the game_tree\n property from this object. The result strategy ...
def train(self, iterations, weight_delay=700, checkpoint_iterations=None, checkpoint_callback=(lambda *args: None), minimal_action_probability=None): 'Run CFR for given number of iterations.\n\n The trained tree can be found by retrieving the game_tree\n property from this object. The result strategy ...
b1b3162eca93c3f5747480406dbee5cb9a720d65f6a7df47ab760fa83fbbe912
def make_users_me_request(self): "\n Need to wrap the get in a class method to get 'self' context into timeit\n " response = self.client.get(self.url, **self.exporter_headers) self.assertTrue((response.status_code == status.HTTP_200_OK))
Need to wrap the get in a class method to get 'self' context into timeit
api/users/tests/tests_performance.py
make_users_me_request
code-review-doctor/lite-api
3
python
def make_users_me_request(self): "\n \n " response = self.client.get(self.url, **self.exporter_headers) self.assertTrue((response.status_code == status.HTTP_200_OK))
def make_users_me_request(self): "\n \n " response = self.client.get(self.url, **self.exporter_headers) self.assertTrue((response.status_code == status.HTTP_200_OK))<|docstring|>Need to wrap the get in a class method to get 'self' context into timeit<|endoftext|>
c0b536aff21d42c65998028e3dbf93a3a18d0d439a892d7293ef6c45439b2498
@parameterized.expand([(10, 0), (100, 0), (1000, 0)]) def test_users_me_performance_by_organisation(self, org_count, users): "\n Tests the performance of the 'users/me' endpoint\n " self.create_organisations_multiple_users(required_user=self.exporter_user, organisations=org_count, users_per_org=us...
Tests the performance of the 'users/me' endpoint
api/users/tests/tests_performance.py
test_users_me_performance_by_organisation
code-review-doctor/lite-api
3
python
@parameterized.expand([(10, 0), (100, 0), (1000, 0)]) def test_users_me_performance_by_organisation(self, org_count, users): "\n \n " self.create_organisations_multiple_users(required_user=self.exporter_user, organisations=org_count, users_per_org=users) print(f'organisations: {org_count}') ...
@parameterized.expand([(10, 0), (100, 0), (1000, 0)]) def test_users_me_performance_by_organisation(self, org_count, users): "\n \n " self.create_organisations_multiple_users(required_user=self.exporter_user, organisations=org_count, users_per_org=users) print(f'organisations: {org_count}') ...
7c3e8832283c92e3af1164983eede6a7766dddaa10bcd07017b9d59c88d00a7c
@parameterized.expand([(10, 0), (100, 0), (1000, 0)]) def test_users_me_performance_by_sites(self, sites, users): "\n Tests the performance of the 'users/me' endpoint\n " self.create_multiple_sites_for_an_organisation(organisation=self.organisation, sites_count=sites) print(f'sites: {sites}') ...
Tests the performance of the 'users/me' endpoint
api/users/tests/tests_performance.py
test_users_me_performance_by_sites
code-review-doctor/lite-api
3
python
@parameterized.expand([(10, 0), (100, 0), (1000, 0)]) def test_users_me_performance_by_sites(self, sites, users): "\n \n " self.create_multiple_sites_for_an_organisation(organisation=self.organisation, sites_count=sites) print(f'sites: {sites}') self.timeit(self.make_users_me_request)
@parameterized.expand([(10, 0), (100, 0), (1000, 0)]) def test_users_me_performance_by_sites(self, sites, users): "\n \n " self.create_multiple_sites_for_an_organisation(organisation=self.organisation, sites_count=sites) print(f'sites: {sites}') self.timeit(self.make_users_me_request)<|doc...
031c240b78b9bd87a79d369b06e4f995243bb136ef12ccb538896a8ba0808ce4
@parameterized.expand([(1, 10), (1, 100), (1, 1000)]) def test_users_me_performance_by_users_per_site(self, sites, users): "\n Tests the performance of the 'users/me' endpoint\n " print(f'users: {users}') self.create_multiple_sites_for_an_organisation(organisation=self.organisation, sites_coun...
Tests the performance of the 'users/me' endpoint
api/users/tests/tests_performance.py
test_users_me_performance_by_users_per_site
code-review-doctor/lite-api
3
python
@parameterized.expand([(1, 10), (1, 100), (1, 1000)]) def test_users_me_performance_by_users_per_site(self, sites, users): "\n \n " print(f'users: {users}') self.create_multiple_sites_for_an_organisation(organisation=self.organisation, sites_count=1, users_per_site=users) self.timeit(self....
@parameterized.expand([(1, 10), (1, 100), (1, 1000)]) def test_users_me_performance_by_users_per_site(self, sites, users): "\n \n " print(f'users: {users}') self.create_multiple_sites_for_an_organisation(organisation=self.organisation, sites_count=1, users_per_site=users) self.timeit(self....
86204316e7d80ec4ac38865f66a173dae719cb2373c211c02cfaf2b1524ceb80
def train(X, Y, args): '\n Train a model given the arguments, the dataset and \n the corresponding labels (ground-truth)\n\n Parameters\n ----------\n\n X : array\n features of the dataset\n Y : array\n corresponding labels\n args : dict\n arguments to prepare the model\n\n...
Train a model given the arguments, the dataset and the corresponding labels (ground-truth) Parameters ---------- X : array features of the dataset Y : array corresponding labels args : dict arguments to prepare the model Returns ------- model : object trained model
rrgp/algorithm.py
train
patrickaudriaz/mini-project
4
python
def train(X, Y, args): '\n Train a model given the arguments, the dataset and \n the corresponding labels (ground-truth)\n\n Parameters\n ----------\n\n X : array\n features of the dataset\n Y : array\n corresponding labels\n args : dict\n arguments to prepare the model\n\n...
def train(X, Y, args): '\n Train a model given the arguments, the dataset and \n the corresponding labels (ground-truth)\n\n Parameters\n ----------\n\n X : array\n features of the dataset\n Y : array\n corresponding labels\n args : dict\n arguments to prepare the model\n\n...
829f9a1974c3f3c7cc794039b5df35a581e19f8953dcc5bff8dc07ffe3b9e24b
def predict(X, model): '\n Predict labels given the features and the trained model\n\n Parameters\n ----------\n\n X : array\n features to predict on\n model : object\n trained model\n\n Returns\n -------\n\n predictions : array\n Array with the predicted labels\n\n '...
Predict labels given the features and the trained model Parameters ---------- X : array features to predict on model : object trained model Returns ------- predictions : array Array with the predicted labels
rrgp/algorithm.py
predict
patrickaudriaz/mini-project
4
python
def predict(X, model): '\n Predict labels given the features and the trained model\n\n Parameters\n ----------\n\n X : array\n features to predict on\n model : object\n trained model\n\n Returns\n -------\n\n predictions : array\n Array with the predicted labels\n\n '...
def predict(X, model): '\n Predict labels given the features and the trained model\n\n Parameters\n ----------\n\n X : array\n features to predict on\n model : object\n trained model\n\n Returns\n -------\n\n predictions : array\n Array with the predicted labels\n\n '...
4cca8fb29c02e720f7cbf29bc423f83f5f0d0a8ad0ac4f123ea819e7c94489e1
def uast2graphlets(self, uast): "\n :param uast: The UAST root node.\n :generate: The nodes which compose the UAST.\n :class: 'Node' is used to access the nodes of the graphlets.\n " root = self._extract_node(uast, None) stack = [(root, uast)] while stack: (parent...
:param uast: The UAST root node. :generate: The nodes which compose the UAST. :class: 'Node' is used to access the nodes of the graphlets.
sourced/ml/algorithms/uast_inttypes_to_graphlets.py
uast2graphlets
vmarkovtsev/ml
122
python
def uast2graphlets(self, uast): "\n :param uast: The UAST root node.\n :generate: The nodes which compose the UAST.\n :class: 'Node' is used to access the nodes of the graphlets.\n " root = self._extract_node(uast, None) stack = [(root, uast)] while stack: (parent...
def uast2graphlets(self, uast): "\n :param uast: The UAST root node.\n :generate: The nodes which compose the UAST.\n :class: 'Node' is used to access the nodes of the graphlets.\n " root = self._extract_node(uast, None) stack = [(root, uast)] while stack: (parent...
f53f03bbf12da5e39e0b3beb70aa69a218f3033ee79c673fcbb0b55e52e33b41
def node2key(self, node): "\n Builds the string joining internal types of all the nodes\n in the node's graphlet in the following order:\n parent_node_child1_child2_child3. The children are sorted by alphabetic order.\n str format is required for BagsExtractor.\n\n :param node: a ...
Builds the string joining internal types of all the nodes in the node's graphlet in the following order: parent_node_child1_child2_child3. The children are sorted by alphabetic order. str format is required for BagsExtractor. :param node: a node of UAST :return: The string key of node
sourced/ml/algorithms/uast_inttypes_to_graphlets.py
node2key
vmarkovtsev/ml
122
python
def node2key(self, node): "\n Builds the string joining internal types of all the nodes\n in the node's graphlet in the following order:\n parent_node_child1_child2_child3. The children are sorted by alphabetic order.\n str format is required for BagsExtractor.\n\n :param node: a ...
def node2key(self, node): "\n Builds the string joining internal types of all the nodes\n in the node's graphlet in the following order:\n parent_node_child1_child2_child3. The children are sorted by alphabetic order.\n str format is required for BagsExtractor.\n\n :param node: a ...
9da5bb8e3ad9cc1f726071765de4103f9e5e86611c6ee5bc9377a608305056dc
def __call__(self, uast): '\n Converts a UAST to a weighed bag of graphlets. The weights are graphlets frequencies.\n :param uast: The UAST root node.\n :return: bag of graphlets.\n ' bag = defaultdict(int) for node in self.uast2graphlets(uast): bag[self.node2key(node)] +...
Converts a UAST to a weighed bag of graphlets. The weights are graphlets frequencies. :param uast: The UAST root node. :return: bag of graphlets.
sourced/ml/algorithms/uast_inttypes_to_graphlets.py
__call__
vmarkovtsev/ml
122
python
def __call__(self, uast): '\n Converts a UAST to a weighed bag of graphlets. The weights are graphlets frequencies.\n :param uast: The UAST root node.\n :return: bag of graphlets.\n ' bag = defaultdict(int) for node in self.uast2graphlets(uast): bag[self.node2key(node)] +...
def __call__(self, uast): '\n Converts a UAST to a weighed bag of graphlets. The weights are graphlets frequencies.\n :param uast: The UAST root node.\n :return: bag of graphlets.\n ' bag = defaultdict(int) for node in self.uast2graphlets(uast): bag[self.node2key(node)] +...
9e722c97904581dec05898eb08559e4f69a4a81befa564a2272d3e7ea067a995
def scatterplot(self, func=None, xlabel='[Compound] (nM)', ylabel='Anisotropy', palette='viridis_r', baseline_correction=True, invert=False, *args, **kargs): 'Plot and Curve Fit data on a log[x] axis.' if (self.df_main is None): self._load_data() self._prep_data_for_plotting() if (self.df_pl...
Plot and Curve Fit data on a log[x] axis.
DoseResponse/dose_response_curve.py
scatterplot
Spill-Tea/Rio
0
python
def scatterplot(self, func=None, xlabel='[Compound] (nM)', ylabel='Anisotropy', palette='viridis_r', baseline_correction=True, invert=False, *args, **kargs): if (self.df_main is None): self._load_data() self._prep_data_for_plotting() if (self.df_plot_ready is None): self._prep_data_...
def scatterplot(self, func=None, xlabel='[Compound] (nM)', ylabel='Anisotropy', palette='viridis_r', baseline_correction=True, invert=False, *args, **kargs): if (self.df_main is None): self._load_data() self._prep_data_for_plotting() if (self.df_plot_ready is None): self._prep_data_...
f9d265a133c1b72a353e29a6107a23f9a53bedd8886744df5b8390e4954f2005
def data_summary(self): 'This function summarizes the raw Data.' if (self.df_main is None): self._load_data() self.df_summary = self.df_main.copy() self.df_summary['N'] = self.df_main.count(axis=1) self.df_summary['MEAN'] = self.df_main.mean(axis=1) self.df_summary['SD'] = self.df_main.s...
This function summarizes the raw Data.
DoseResponse/dose_response_curve.py
data_summary
Spill-Tea/Rio
0
python
def data_summary(self): if (self.df_main is None): self._load_data() self.df_summary = self.df_main.copy() self.df_summary['N'] = self.df_main.count(axis=1) self.df_summary['MEAN'] = self.df_main.mean(axis=1) self.df_summary['SD'] = self.df_main.std(axis=1)
def data_summary(self): if (self.df_main is None): self._load_data() self.df_summary = self.df_main.copy() self.df_summary['N'] = self.df_main.count(axis=1) self.df_summary['MEAN'] = self.df_main.mean(axis=1) self.df_summary['SD'] = self.df_main.std(axis=1)<|docstring|>This function sum...
0af176e0250f06bd7bead4a4b96d1c52ce9d38e6eceb6f794ccc6ba49bfb4c36
def _load_data(self): 'Helper Function to Load data from a file.' self.df_main = pd.read_csv(self.datafile, header=[0, 1], sep='\t').T self.n_replicates = len(self.df_main.columns)
Helper Function to Load data from a file.
DoseResponse/dose_response_curve.py
_load_data
Spill-Tea/Rio
0
python
def _load_data(self): self.df_main = pd.read_csv(self.datafile, header=[0, 1], sep='\t').T self.n_replicates = len(self.df_main.columns)
def _load_data(self): self.df_main = pd.read_csv(self.datafile, header=[0, 1], sep='\t').T self.n_replicates = len(self.df_main.columns)<|docstring|>Helper Function to Load data from a file.<|endoftext|>
194d353cd3dc9c218cf545ea0d95fb0f2ddeacc96c06232450c28b1a7c1de39d
def pad_image(img): '\n Pad image with 0s to make it square\n :param image: HxWx3 numpy array\n :return: AxAx3 numpy array (square image)\n ' (height, width, _) = img.shape if (width < height): border_width = ((height - width) // 2) padded = cv2.copyMakeBorder(img, 0, 0, border_w...
Pad image with 0s to make it square :param image: HxWx3 numpy array :return: AxAx3 numpy array (square image)
bodypart_segmentation_predict.py
pad_image
akashsengupta1997/segmentation_models
0
python
def pad_image(img): '\n Pad image with 0s to make it square\n :param image: HxWx3 numpy array\n :return: AxAx3 numpy array (square image)\n ' (height, width, _) = img.shape if (width < height): border_width = ((height - width) // 2) padded = cv2.copyMakeBorder(img, 0, 0, border_w...
def pad_image(img): '\n Pad image with 0s to make it square\n :param image: HxWx3 numpy array\n :return: AxAx3 numpy array (square image)\n ' (height, width, _) = img.shape if (width < height): border_width = ((height - width) // 2) padded = cv2.copyMakeBorder(img, 0, 0, border_w...
0e5db6dcf0e6636c5fc48adb6f15123020a73a91b5b9774ab21b1ed0f01fb8f4
def readWrite(self): '\n Step through the structure of a PWDINT file and read/write it.\n\n Logic to control which records will be present is here, which\n comes directly off the File specification.\n ' self._rwFileID() self._rw1DRecord() self._rw2DRecord()
Step through the structure of a PWDINT file and read/write it. Logic to control which records will be present is here, which comes directly off the File specification.
armi/nuclearDataIO/cccc/pwdint.py
readWrite
DennisYelizarov/armi
162
python
def readWrite(self): '\n Step through the structure of a PWDINT file and read/write it.\n\n Logic to control which records will be present is here, which\n comes directly off the File specification.\n ' self._rwFileID() self._rw1DRecord() self._rw2DRecord()
def readWrite(self): '\n Step through the structure of a PWDINT file and read/write it.\n\n Logic to control which records will be present is here, which\n comes directly off the File specification.\n ' self._rwFileID() self._rw1DRecord() self._rw2DRecord()<|docstring|>Step t...
c4ecf571c30ff697e388b970e0af6cf0f20c739b280bfc9e542b23b0c2d589e6
def _rw1DRecord(self): '\n Read/write File specifications on 1D record.\n ' with self.createRecord() as record: self._metadata.update(record.rwImplicitlyTypedMap(FILE_SPEC_1D_KEYS, self._metadata))
Read/write File specifications on 1D record.
armi/nuclearDataIO/cccc/pwdint.py
_rw1DRecord
DennisYelizarov/armi
162
python
def _rw1DRecord(self): '\n \n ' with self.createRecord() as record: self._metadata.update(record.rwImplicitlyTypedMap(FILE_SPEC_1D_KEYS, self._metadata))
def _rw1DRecord(self): '\n \n ' with self.createRecord() as record: self._metadata.update(record.rwImplicitlyTypedMap(FILE_SPEC_1D_KEYS, self._metadata))<|docstring|>Read/write File specifications on 1D record.<|endoftext|>
49e004df0a5ad58b4afe12172f7b351af6583783aaece9cd91ce094ad0702d9d
def _rw2DRecord(self): 'Read/write power density by mesh point.' imax = self._metadata['NINTI'] jmax = self._metadata['NINTJ'] kmax = self._metadata['NINTK'] nblck = self._metadata['NBLOK'] if (self._data.powerDensity.size == 0): self._data.powerDensity = numpy.zeros((imax, jmax, kmax), ...
Read/write power density by mesh point.
armi/nuclearDataIO/cccc/pwdint.py
_rw2DRecord
DennisYelizarov/armi
162
python
def _rw2DRecord(self): imax = self._metadata['NINTI'] jmax = self._metadata['NINTJ'] kmax = self._metadata['NINTK'] nblck = self._metadata['NBLOK'] if (self._data.powerDensity.size == 0): self._data.powerDensity = numpy.zeros((imax, jmax, kmax), dtype=numpy.float32) for ki in range(...
def _rw2DRecord(self): imax = self._metadata['NINTI'] jmax = self._metadata['NINTJ'] kmax = self._metadata['NINTK'] nblck = self._metadata['NBLOK'] if (self._data.powerDensity.size == 0): self._data.powerDensity = numpy.zeros((imax, jmax, kmax), dtype=numpy.float32) for ki in range(...
9421d2986aef6901d9007624fa79ff6376e81a930b60c448c4f9ac10262c9829
def load_traces_optimally(roi_data_handle, roi_ns=None, frame_ns=None, rois_first=True): '\n load_traces_optimally(roi_data_handle)\n\n Updates indices, possibly reordered, for optimal loading of ROI traces.\n\n Optional args:\n - roi_ns (int or array-like) : ROIs to load (None for all)\n ...
load_traces_optimally(roi_data_handle) Updates indices, possibly reordered, for optimal loading of ROI traces. Optional args: - roi_ns (int or array-like) : ROIs to load (None for all) default: None - frame_ns (int or array-like): frames to load (None for all) ...
sess_util/sess_trace_util.py
load_traces_optimally
AllenInstitute/OpenScope_CA_Analysis
0
python
def load_traces_optimally(roi_data_handle, roi_ns=None, frame_ns=None, rois_first=True): '\n load_traces_optimally(roi_data_handle)\n\n Updates indices, possibly reordered, for optimal loading of ROI traces.\n\n Optional args:\n - roi_ns (int or array-like) : ROIs to load (None for all)\n ...
def load_traces_optimally(roi_data_handle, roi_ns=None, frame_ns=None, rois_first=True): '\n load_traces_optimally(roi_data_handle)\n\n Updates indices, possibly reordered, for optimal loading of ROI traces.\n\n Optional args:\n - roi_ns (int or array-like) : ROIs to load (None for all)\n ...
cd68a37138f9a2cb8d98a74b9ebad72d6a81070036368d4d51ef19894200f86a
def load_roi_traces_nwb(sess_files, roi_ns=None, frame_ns=None): '\n load_roi_traces_nwb(sess_files)\n\n Returns ROI traces from NWB files (stored as frames x ROIs). \n\n Required args:\n - sess_files (list): full path names of the session files\n\n Optional args:\n - roi_ns (int or array-...
load_roi_traces_nwb(sess_files) Returns ROI traces from NWB files (stored as frames x ROIs). Required args: - sess_files (list): full path names of the session files Optional args: - roi_ns (int or array-like) : ROIs to load (None for all) default: None - frame_ns (i...
sess_util/sess_trace_util.py
load_roi_traces_nwb
AllenInstitute/OpenScope_CA_Analysis
0
python
def load_roi_traces_nwb(sess_files, roi_ns=None, frame_ns=None): '\n load_roi_traces_nwb(sess_files)\n\n Returns ROI traces from NWB files (stored as frames x ROIs). \n\n Required args:\n - sess_files (list): full path names of the session files\n\n Optional args:\n - roi_ns (int or array-...
def load_roi_traces_nwb(sess_files, roi_ns=None, frame_ns=None): '\n load_roi_traces_nwb(sess_files)\n\n Returns ROI traces from NWB files (stored as frames x ROIs). \n\n Required args:\n - sess_files (list): full path names of the session files\n\n Optional args:\n - roi_ns (int or array-...
a87cc4c9b62237682cc5b81b0c5416801306e6bb9c074cc72e36d73068601643
def load_roi_traces(roi_trace_path, roi_ns=None, frame_ns=None): '\n load_roi_traces(roi_trace_path)\n\n Returns ROI traces from ROI data file (stored as ROI x frames). \n\n Required args:\n - roi_trace_path (Path): full path name of the ROI data file\n\n Optional args:\n - roi_ns (int or ...
load_roi_traces(roi_trace_path) Returns ROI traces from ROI data file (stored as ROI x frames). Required args: - roi_trace_path (Path): full path name of the ROI data file Optional args: - roi_ns (int or array-like) : ROIs to load (None for all) default: None - frame...
sess_util/sess_trace_util.py
load_roi_traces
AllenInstitute/OpenScope_CA_Analysis
0
python
def load_roi_traces(roi_trace_path, roi_ns=None, frame_ns=None): '\n load_roi_traces(roi_trace_path)\n\n Returns ROI traces from ROI data file (stored as ROI x frames). \n\n Required args:\n - roi_trace_path (Path): full path name of the ROI data file\n\n Optional args:\n - roi_ns (int or ...
def load_roi_traces(roi_trace_path, roi_ns=None, frame_ns=None): '\n load_roi_traces(roi_trace_path)\n\n Returns ROI traces from ROI data file (stored as ROI x frames). \n\n Required args:\n - roi_trace_path (Path): full path name of the ROI data file\n\n Optional args:\n - roi_ns (int or ...
34927ce5b493a10198563cedf28caf0cb9d53db075bf401e3e3f6c8c20ffc932
def load_roi_data_nwb(sess_files): '\n load_roi_data_nwb(sess_files)\n\n Returns ROI data from NWB files. \n\n Required args:\n - sess_files (Path): full path names of the session files\n\n Returns:\n - roi_ids (list) : ROI IDs\n - nrois (int) : total number of ROIs\n ...
load_roi_data_nwb(sess_files) Returns ROI data from NWB files. Required args: - sess_files (Path): full path names of the session files Returns: - roi_ids (list) : ROI IDs - nrois (int) : total number of ROIs - tot_twop_fr (int): total number of two-photon frames recorded
sess_util/sess_trace_util.py
load_roi_data_nwb
AllenInstitute/OpenScope_CA_Analysis
0
python
def load_roi_data_nwb(sess_files): '\n load_roi_data_nwb(sess_files)\n\n Returns ROI data from NWB files. \n\n Required args:\n - sess_files (Path): full path names of the session files\n\n Returns:\n - roi_ids (list) : ROI IDs\n - nrois (int) : total number of ROIs\n ...
def load_roi_data_nwb(sess_files): '\n load_roi_data_nwb(sess_files)\n\n Returns ROI data from NWB files. \n\n Required args:\n - sess_files (Path): full path names of the session files\n\n Returns:\n - roi_ids (list) : ROI IDs\n - nrois (int) : total number of ROIs\n ...