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
d2eaf851d77ba3ff512ba37c09916e63a2034a53b333172647f38f8af95dc4e4
def addFilesToCombineArchive(archive_path, file_names, entry_locations, file_formats, master_attributes, out_archive_path): ' Add multiple files to an existing COMBINE archive on disk and save the result as a new archive.\n\n :param archive_path: The path to the archive.\n :param file_names: List of extra fil...
Add multiple files to an existing COMBINE archive on disk and save the result as a new archive. :param archive_path: The path to the archive. :param file_names: List of extra files to add. :param entry_locations: List of destination locations for the files in the output archive. :param file_format: List of formats for...
tellurium/bombBeetle.py
addFilesToCombineArchive
madfain/BombBeetle
1
python
def addFilesToCombineArchive(archive_path, file_names, entry_locations, file_formats, master_attributes, out_archive_path): ' Add multiple files to an existing COMBINE archive on disk and save the result as a new archive.\n\n :param archive_path: The path to the archive.\n :param file_names: List of extra fil...
def addFilesToCombineArchive(archive_path, file_names, entry_locations, file_formats, master_attributes, out_archive_path): ' Add multiple files to an existing COMBINE archive on disk and save the result as a new archive.\n\n :param archive_path: The path to the archive.\n :param file_names: List of extra fil...
a8353acf36cc3cb3cf31f6ba251a8fa9c00d7993050b4ee94f8f6e46f72e9c9e
def createCombineArchive(archive_path, file_names, entry_locations, file_formats, master_attributes, description=None): ' Create a new COMBINE archive containing the provided entries and locations.\n\n :param archive_path: The path to the archive.\n :param file_names: List of extra files to add.\n :param e...
Create a new COMBINE archive containing the provided entries and locations. :param archive_path: The path to the archive. :param file_names: List of extra files to add. :param entry_locations: List of destination locations for the files in the output archive. :param file_format: List of formats for the resp. files. :p...
tellurium/bombBeetle.py
createCombineArchive
madfain/BombBeetle
1
python
def createCombineArchive(archive_path, file_names, entry_locations, file_formats, master_attributes, description=None): ' Create a new COMBINE archive containing the provided entries and locations.\n\n :param archive_path: The path to the archive.\n :param file_names: List of extra files to add.\n :param e...
def createCombineArchive(archive_path, file_names, entry_locations, file_formats, master_attributes, description=None): ' Create a new COMBINE archive containing the provided entries and locations.\n\n :param archive_path: The path to the archive.\n :param file_names: List of extra files to add.\n :param e...
7fcd714539c5e3be8e23bd3c72d72bba2f71a8e2c0eee8de9352f785ed155f7f
def getEigenvalues(m): ' Eigenvalues of matrix.\n\n Convenience method for computing the eigenvalues of a matrix m\n Uses numpy eig to compute the eigenvalues.\n\n :param m: numpy array\n :returns: numpy array containing eigenvalues\n ' from numpy import linalg (w, v) = linalg.eig(m) retu...
Eigenvalues of matrix. Convenience method for computing the eigenvalues of a matrix m Uses numpy eig to compute the eigenvalues. :param m: numpy array :returns: numpy array containing eigenvalues
tellurium/bombBeetle.py
getEigenvalues
madfain/BombBeetle
1
python
def getEigenvalues(m): ' Eigenvalues of matrix.\n\n Convenience method for computing the eigenvalues of a matrix m\n Uses numpy eig to compute the eigenvalues.\n\n :param m: numpy array\n :returns: numpy array containing eigenvalues\n ' from numpy import linalg (w, v) = linalg.eig(m) retu...
def getEigenvalues(m): ' Eigenvalues of matrix.\n\n Convenience method for computing the eigenvalues of a matrix m\n Uses numpy eig to compute the eigenvalues.\n\n :param m: numpy array\n :returns: numpy array containing eigenvalues\n ' from numpy import linalg (w, v) = linalg.eig(m) retu...
b058dffb0d0d3f6dc3983b473775155af253e12bbc519497727c3ab00b88d818
def plotArray(result, loc='upper right', show=True, resetColorCycle=True, xlabel=None, ylabel=None, title=None, xlim=None, ylim=None, xscale='linear', yscale='linear', grid=False, labels=None, **kwargs): ' Plot an array.\n\n :param result: Array to plot, first column of the array must be the x-axis and remaining...
Plot an array. :param result: Array to plot, first column of the array must be the x-axis and remaining columns the y-axis :param loc: Location of legend box. Valid strings 'best' | upper right' | 'upper left' | 'lower left' | 'lower right' | 'right' | 'center left' | 'center right' | 'lower center' | 'upper center' |...
tellurium/bombBeetle.py
plotArray
madfain/BombBeetle
1
python
def plotArray(result, loc='upper right', show=True, resetColorCycle=True, xlabel=None, ylabel=None, title=None, xlim=None, ylim=None, xscale='linear', yscale='linear', grid=False, labels=None, **kwargs): ' Plot an array.\n\n :param result: Array to plot, first column of the array must be the x-axis and remaining...
def plotArray(result, loc='upper right', show=True, resetColorCycle=True, xlabel=None, ylabel=None, title=None, xlim=None, ylim=None, xscale='linear', yscale='linear', grid=False, labels=None, **kwargs): ' Plot an array.\n\n :param result: Array to plot, first column of the array must be the x-axis and remaining...
272d7f678c44b3ba635e2719ecf5c5a4bfaebca4bb86ff55d98badb0ac00f4d0
def plotWithLegend(r, result=None, loc='upper right', show=True): '\n Plot an array and include a legend. The first argument must be a roadrunner variable.\n The second argument must be an array containing data to plot. The first column of the array will\n be the x-axis and remaining columns the y-axis. Re...
Plot an array and include a legend. The first argument must be a roadrunner variable. The second argument must be an array containing data to plot. The first column of the array will be the x-axis and remaining columns the y-axis. Returns a handle to the plotting object. plotWithLegend (r)
tellurium/bombBeetle.py
plotWithLegend
madfain/BombBeetle
1
python
def plotWithLegend(r, result=None, loc='upper right', show=True): '\n Plot an array and include a legend. The first argument must be a roadrunner variable.\n The second argument must be an array containing data to plot. The first column of the array will\n be the x-axis and remaining columns the y-axis. Re...
def plotWithLegend(r, result=None, loc='upper right', show=True): '\n Plot an array and include a legend. The first argument must be a roadrunner variable.\n The second argument must be an array containing data to plot. The first column of the array will\n be the x-axis and remaining columns the y-axis. Re...
00b0422a89f75c3c52b5946dc95d4aaeddac1e34b40f0f49bb4bc04878c65b4f
def loadTestModel(string): "Loads particular test model into roadrunner.\n ::\n\n rr = te.loadTestModel('feedback.xml')\n\n :returns: RoadRunner instance with test model loaded\n " import roadrunner.testing return roadrunner.testing.getRoadRunner(string)
Loads particular test model into roadrunner. :: rr = te.loadTestModel('feedback.xml') :returns: RoadRunner instance with test model loaded
tellurium/bombBeetle.py
loadTestModel
madfain/BombBeetle
1
python
def loadTestModel(string): "Loads particular test model into roadrunner.\n ::\n\n rr = te.loadTestModel('feedback.xml')\n\n :returns: RoadRunner instance with test model loaded\n " import roadrunner.testing return roadrunner.testing.getRoadRunner(string)
def loadTestModel(string): "Loads particular test model into roadrunner.\n ::\n\n rr = te.loadTestModel('feedback.xml')\n\n :returns: RoadRunner instance with test model loaded\n " import roadrunner.testing return roadrunner.testing.getRoadRunner(string)<|docstring|>Loads particular test mod...
bc602df0528bc404c02ddd07a3120ce2d3ac305e4daf0001ab5c00760d66a55c
def getTestModel(string): "SBML of given test model as a string.\n ::\n\n # load test model as SBML\n sbml = te.getTestModel('feedback.xml')\n r = te.loadSBMLModel(sbml)\n # simulate\n r.simulate(0, 100, 20)\n\n :returns: SBML string of test model\n " import roadrunne...
SBML of given test model as a string. :: # load test model as SBML sbml = te.getTestModel('feedback.xml') r = te.loadSBMLModel(sbml) # simulate r.simulate(0, 100, 20) :returns: SBML string of test model
tellurium/bombBeetle.py
getTestModel
madfain/BombBeetle
1
python
def getTestModel(string): "SBML of given test model as a string.\n ::\n\n # load test model as SBML\n sbml = te.getTestModel('feedback.xml')\n r = te.loadSBMLModel(sbml)\n # simulate\n r.simulate(0, 100, 20)\n\n :returns: SBML string of test model\n " import roadrunne...
def getTestModel(string): "SBML of given test model as a string.\n ::\n\n # load test model as SBML\n sbml = te.getTestModel('feedback.xml')\n r = te.loadSBMLModel(sbml)\n # simulate\n r.simulate(0, 100, 20)\n\n :returns: SBML string of test model\n " import roadrunne...
8bc338e74a4a62b14d01cc4c7cc1bdca799f6b57c9194151258aaea5dadc289f
def listTestModels(): ' List roadrunner SBML test models.\n ::\n\n print(te.listTestModels())\n\n :returns: list of test model paths\n ' import roadrunner.testing modelList = [] fileList = roadrunner.testing.dir('*.xml') for pathName in fileList: modelList.append(os.path.base...
List roadrunner SBML test models. :: print(te.listTestModels()) :returns: list of test model paths
tellurium/bombBeetle.py
listTestModels
madfain/BombBeetle
1
python
def listTestModels(): ' List roadrunner SBML test models.\n ::\n\n print(te.listTestModels())\n\n :returns: list of test model paths\n ' import roadrunner.testing modelList = [] fileList = roadrunner.testing.dir('*.xml') for pathName in fileList: modelList.append(os.path.base...
def listTestModels(): ' List roadrunner SBML test models.\n ::\n\n print(te.listTestModels())\n\n :returns: list of test model paths\n ' import roadrunner.testing modelList = [] fileList = roadrunner.testing.dir('*.xml') for pathName in fileList: modelList.append(os.path.base...
46ed15f0dbba070e21e23cfc1448444a728efa37ef5c88be6f42c8f203eaf7be
def _model_function_factory(key): ' Dynamic creation of model functions.\n\n :param key: function key, i.e. the name of the function\n :type key: str\n :return: function object\n :rtype: function\n ' def f(self): return getattr(self.model, key).__call__() f.__name__ = key f.__doc...
Dynamic creation of model functions. :param key: function key, i.e. the name of the function :type key: str :return: function object :rtype: function
tellurium/bombBeetle.py
_model_function_factory
madfain/BombBeetle
1
python
def _model_function_factory(key): ' Dynamic creation of model functions.\n\n :param key: function key, i.e. the name of the function\n :type key: str\n :return: function object\n :rtype: function\n ' def f(self): return getattr(self.model, key).__call__() f.__name__ = key f.__doc...
def _model_function_factory(key): ' Dynamic creation of model functions.\n\n :param key: function key, i.e. the name of the function\n :type key: str\n :return: function object\n :rtype: function\n ' def f(self): return getattr(self.model, key).__call__() f.__name__ = key f.__doc...
444383f11511e76164aa551db6acd12e0f1d35830be98a952e45c6445a3f3316
def VersionDict(): 'Return dict of version strings.' import tesbml, tesedml, tecombine return {'tellurium': getTelluriumVersion(), 'roadrunner': roadrunner.getVersionStr(roadrunner.VERSIONSTR_BASIC), 'antimony': antimony.__version__, 'phrasedml': phrasedml.__version__, 'tesbml': libsbml.getLibSBMLDottedVers...
Return dict of version strings.
tellurium/bombBeetle.py
VersionDict
madfain/BombBeetle
1
python
def VersionDict(): import tesbml, tesedml, tecombine return {'tellurium': getTelluriumVersion(), 'roadrunner': roadrunner.getVersionStr(roadrunner.VERSIONSTR_BASIC), 'antimony': antimony.__version__, 'phrasedml': phrasedml.__version__, 'tesbml': libsbml.getLibSBMLDottedVersion(), 'tesedml': tesedml.__versi...
def VersionDict(): import tesbml, tesedml, tecombine return {'tellurium': getTelluriumVersion(), 'roadrunner': roadrunner.getVersionStr(roadrunner.VERSIONSTR_BASIC), 'antimony': antimony.__version__, 'phrasedml': phrasedml.__version__, 'tesbml': libsbml.getLibSBMLDottedVersion(), 'tesedml': tesedml.__versi...
d05b1e641925aec3ee0d0093991b489771654513cdcbacc10817ed4f92a6526f
def DumpJSONInfo(): 'Tellurium dist info. Goes into COMBINE archive.' return json.dumps({'authoring_tool': 'tellurium', 'info': 'Created with Tellurium (tellurium.analogmachine.org).', 'version_info': VersionDict()})
Tellurium dist info. Goes into COMBINE archive.
tellurium/bombBeetle.py
DumpJSONInfo
madfain/BombBeetle
1
python
def DumpJSONInfo(): return json.dumps({'authoring_tool': 'tellurium', 'info': 'Created with Tellurium (tellurium.analogmachine.org).', 'version_info': VersionDict()})
def DumpJSONInfo(): return json.dumps({'authoring_tool': 'tellurium', 'info': 'Created with Tellurium (tellurium.analogmachine.org).', 'version_info': VersionDict()})<|docstring|>Tellurium dist info. Goes into COMBINE archive.<|endoftext|>
d75aa109fab436cb3ba19ad3ea3d3d35ed119b940bf27bb56ff6e3037fd9603b
def setLastReport(report): 'Used by SED-ML to save the last report created (for validation).' global _last_report _last_report = report
Used by SED-ML to save the last report created (for validation).
tellurium/bombBeetle.py
setLastReport
madfain/BombBeetle
1
python
def setLastReport(report): global _last_report _last_report = report
def setLastReport(report): global _last_report _last_report = report<|docstring|>Used by SED-ML to save the last report created (for validation).<|endoftext|>
afee1cb5d42c9af24bd144e73c2ac8aff03f104a5e77934c10f1692459e4f48d
def getLastReport(): 'Get the last report generated by SED-ML.' global _last_report return _last_report
Get the last report generated by SED-ML.
tellurium/bombBeetle.py
getLastReport
madfain/BombBeetle
1
python
def getLastReport(): global _last_report return _last_report
def getLastReport(): global _last_report return _last_report<|docstring|>Get the last report generated by SED-ML.<|endoftext|>
c278e53f72a1fcf501f86f011ebed233b2705b0e13ce34dcbf9ccbb988f11488
@classmethod def all(cls, preds, index=0, conf_thresh=cfg.NMS_CONF_THRESH): '\n Calculates NMS predictions for all object classes\n\n Returns:\n 3 item tuple (\n bbs: 2d torch.Tensor\n scores: 1d torch.Tensor\n cls ids: 1d torch.Tensor\n ...
Calculates NMS predictions for all object classes Returns: 3 item tuple ( bbs: 2d torch.Tensor scores: 1d torch.Tensor cls ids: 1d torch.Tensor )
ssdmultibox/predict.py
all
aaronlelevier/ssd-pytorch
0
python
@classmethod def all(cls, preds, index=0, conf_thresh=cfg.NMS_CONF_THRESH): '\n Calculates NMS predictions for all object classes\n\n Returns:\n 3 item tuple (\n bbs: 2d torch.Tensor\n scores: 1d torch.Tensor\n cls ids: 1d torch.Tensor\n ...
@classmethod def all(cls, preds, index=0, conf_thresh=cfg.NMS_CONF_THRESH): '\n Calculates NMS predictions for all object classes\n\n Returns:\n 3 item tuple (\n bbs: 2d torch.Tensor\n scores: 1d torch.Tensor\n cls ids: 1d torch.Tensor\n ...
fc5efc8bb30a8da2e93ec082ca9b789616f62be434c9f36fc80c775ab01ffab1
@classmethod def single(cls, cls_id, preds, index=0, conf_thresh=cfg.NMS_CONF_THRESH): '\n Full predictions for a single class\n\n Args:\n cls_id (int): category_id\n preds: mini-batch preds from model\n index (int): index of batch item to choose\n conf_thre...
Full predictions for a single class Args: cls_id (int): category_id preds: mini-batch preds from model index (int): index of batch item to choose conf_thresh (float): percent confidence threshold to filter detections by Returns: tuple(bbs, scores, cls_ids) or None
ssdmultibox/predict.py
single
aaronlelevier/ssd-pytorch
0
python
@classmethod def single(cls, cls_id, preds, index=0, conf_thresh=cfg.NMS_CONF_THRESH): '\n Full predictions for a single class\n\n Args:\n cls_id (int): category_id\n preds: mini-batch preds from model\n index (int): index of batch item to choose\n conf_thre...
@classmethod def single(cls, cls_id, preds, index=0, conf_thresh=cfg.NMS_CONF_THRESH): '\n Full predictions for a single class\n\n Args:\n cls_id (int): category_id\n preds: mini-batch preds from model\n index (int): index of batch item to choose\n conf_thre...
ec87e67a9ff57f2357ffd068664b7968e13e6225319e72e89fda9e584d9842cb
@classmethod def single_nms(cls, cls_id, item_bbs, item_cats, conf_thresh=cfg.NMS_CONF_THRESH): '\n Returns the NMS detections for a single image\n\n Args:\n cls_id (int): category id of object to detect\n item_bbs (2d array): [feature_maps, 4] bbs preds\n item_cats (2...
Returns the NMS detections for a single image Args: cls_id (int): category id of object to detect item_bbs (2d array): [feature_maps, 4] bbs preds item_cats (2d array):[feature_maps, 20] one-hot cats preds conf_thresh (float): percent confidence threshold to filter detections by Returns: tu...
ssdmultibox/predict.py
single_nms
aaronlelevier/ssd-pytorch
0
python
@classmethod def single_nms(cls, cls_id, item_bbs, item_cats, conf_thresh=cfg.NMS_CONF_THRESH): '\n Returns the NMS detections for a single image\n\n Args:\n cls_id (int): category id of object to detect\n item_bbs (2d array): [feature_maps, 4] bbs preds\n item_cats (2...
@classmethod def single_nms(cls, cls_id, item_bbs, item_cats, conf_thresh=cfg.NMS_CONF_THRESH): '\n Returns the NMS detections for a single image\n\n Args:\n cls_id (int): category id of object to detect\n item_bbs (2d array): [feature_maps, 4] bbs preds\n item_cats (2...
7e73047e4937f8d8818550333e850dd1c2b058d9c1ab73e21fd155b5365bc580
@staticmethod def nms(boxes, scores, overlap=0.5, top_k=200): 'Apply non-maximum suppression at test time to avoid detecting too many\n overlapping bounding boxes for a given object.\n Args:\n boxes: (tensor) The location preds for the img, Shape: [num_priors,4].\n scores: (tenso...
Apply non-maximum suppression at test time to avoid detecting too many overlapping bounding boxes for a given object. Args: boxes: (tensor) The location preds for the img, Shape: [num_priors,4]. scores: (tensor) The class predscores for the img, Shape:[num_priors]. overlap: (float) The overlap thresh for su...
ssdmultibox/predict.py
nms
aaronlelevier/ssd-pytorch
0
python
@staticmethod def nms(boxes, scores, overlap=0.5, top_k=200): 'Apply non-maximum suppression at test time to avoid detecting too many\n overlapping bounding boxes for a given object.\n Args:\n boxes: (tensor) The location preds for the img, Shape: [num_priors,4].\n scores: (tenso...
@staticmethod def nms(boxes, scores, overlap=0.5, top_k=200): 'Apply non-maximum suppression at test time to avoid detecting too many\n overlapping bounding boxes for a given object.\n Args:\n boxes: (tensor) The location preds for the img, Shape: [num_priors,4].\n scores: (tenso...
bb7afc8f55b6153b449a1d9ed6a75316f9fff51b7cf890ee251bd268a648a1a8
def estep(X: np.ndarray, mixture: GaussianMixture) -> Tuple[(np.ndarray, float)]: 'E-step: Softly assigns each datapoint to a gaussian component\n\n Args:\n X: (n, d) array holding the data\n mixture: the current gaussian mixture\n\n Returns:\n np.ndarray: (n, K) array holding the soft co...
E-step: Softly assigns each datapoint to a gaussian component Args: X: (n, d) array holding the data mixture: the current gaussian mixture Returns: np.ndarray: (n, K) array holding the soft counts for all components for all examples float: log-likelihood of the assignment
Statistical Method for Colaborative Filtering/em_simple.py
estep
arifmujib/MIT-Machine-Learning-Projects
0
python
def estep(X: np.ndarray, mixture: GaussianMixture) -> Tuple[(np.ndarray, float)]: 'E-step: Softly assigns each datapoint to a gaussian component\n\n Args:\n X: (n, d) array holding the data\n mixture: the current gaussian mixture\n\n Returns:\n np.ndarray: (n, K) array holding the soft co...
def estep(X: np.ndarray, mixture: GaussianMixture) -> Tuple[(np.ndarray, float)]: 'E-step: Softly assigns each datapoint to a gaussian component\n\n Args:\n X: (n, d) array holding the data\n mixture: the current gaussian mixture\n\n Returns:\n np.ndarray: (n, K) array holding the soft co...
e22b59d74b7d155010597d20f62313aa22cbe16ab44319a6db3828424f2f99fe
def mstep(X: np.ndarray, post: np.ndarray) -> GaussianMixture: 'M-step: Updates the gaussian mixture by maximizing the log-likelihood\n of the weighted dataset\n\n Args:\n X: (n, d) array holding the data\n post: (n, K) array holding the soft counts\n for all components for all exampl...
M-step: Updates the gaussian mixture by maximizing the log-likelihood of the weighted dataset Args: X: (n, d) array holding the data post: (n, K) array holding the soft counts for all components for all examples Returns: GaussianMixture: the new gaussian mixture
Statistical Method for Colaborative Filtering/em_simple.py
mstep
arifmujib/MIT-Machine-Learning-Projects
0
python
def mstep(X: np.ndarray, post: np.ndarray) -> GaussianMixture: 'M-step: Updates the gaussian mixture by maximizing the log-likelihood\n of the weighted dataset\n\n Args:\n X: (n, d) array holding the data\n post: (n, K) array holding the soft counts\n for all components for all exampl...
def mstep(X: np.ndarray, post: np.ndarray) -> GaussianMixture: 'M-step: Updates the gaussian mixture by maximizing the log-likelihood\n of the weighted dataset\n\n Args:\n X: (n, d) array holding the data\n post: (n, K) array holding the soft counts\n for all components for all exampl...
a80b44ed1d8d7cb7dba5979a5a509f76d2833b9329ff86af92f192a0389d565c
def run(X: np.ndarray, mixture: GaussianMixture, post: np.ndarray) -> Tuple[(GaussianMixture, np.ndarray, float)]: 'Runs the mixture model\n\n Args:\n X: (n, d) array holding the data\n post: (n, K) array holding the soft counts\n for all components for all examples\n\n Returns:\n ...
Runs the mixture model Args: X: (n, d) array holding the data post: (n, K) array holding the soft counts for all components for all examples Returns: GaussianMixture: the new gaussian mixture np.ndarray: (n, K) array holding the soft counts for all components for all examples float...
Statistical Method for Colaborative Filtering/em_simple.py
run
arifmujib/MIT-Machine-Learning-Projects
0
python
def run(X: np.ndarray, mixture: GaussianMixture, post: np.ndarray) -> Tuple[(GaussianMixture, np.ndarray, float)]: 'Runs the mixture model\n\n Args:\n X: (n, d) array holding the data\n post: (n, K) array holding the soft counts\n for all components for all examples\n\n Returns:\n ...
def run(X: np.ndarray, mixture: GaussianMixture, post: np.ndarray) -> Tuple[(GaussianMixture, np.ndarray, float)]: 'Runs the mixture model\n\n Args:\n X: (n, d) array holding the data\n post: (n, K) array holding the soft counts\n for all components for all examples\n\n Returns:\n ...
105ed72bdb04f3dc280d8069b074065171fc22195edce4d891efb90a56b4edf8
def ksg_cmi(x_data, y_data, z_data, k=5): '\n KSG Conditional Mutual Information Estimator: I(X;Y|Z)\n See e.g. http://proceedings.mlr.press/v84/runge18a.html\n\n x_data: data with shape (num_samples, x_dim) or (num_samples,)\n y_data: data with shape (num_samples, y_dim) or (num_samples...
KSG Conditional Mutual Information Estimator: I(X;Y|Z) See e.g. http://proceedings.mlr.press/v84/runge18a.html x_data: data with shape (num_samples, x_dim) or (num_samples,) y_data: data with shape (num_samples, y_dim) or (num_samples,) z_data: conditioning data with shape (num_samples, z_dim) or (num_samples,) k: num...
pycit/estimators/ksg_cmi.py
ksg_cmi
syanga/pycit
10
python
def ksg_cmi(x_data, y_data, z_data, k=5): '\n KSG Conditional Mutual Information Estimator: I(X;Y|Z)\n See e.g. http://proceedings.mlr.press/v84/runge18a.html\n\n x_data: data with shape (num_samples, x_dim) or (num_samples,)\n y_data: data with shape (num_samples, y_dim) or (num_samples...
def ksg_cmi(x_data, y_data, z_data, k=5): '\n KSG Conditional Mutual Information Estimator: I(X;Y|Z)\n See e.g. http://proceedings.mlr.press/v84/runge18a.html\n\n x_data: data with shape (num_samples, x_dim) or (num_samples,)\n y_data: data with shape (num_samples, y_dim) or (num_samples...
baeabc73d3136570af6251ab40da854276dc84ab372f0bc2475578633c8c66ac
def plot_pfilter(time, expected, observed, particles, weights, means): 'Apply a particle filter to a time series, and plot the\n first component of the predictions alongside the expected\n output.' plt.plot(time, expected, 'C1', lw=3) plt.plot(time, observed, '+C3', lw=3) ts = np.tile(time[(:, Non...
Apply a particle filter to a time series, and plot the first component of the predictions alongside the expected output.
dynamic/particle_utils.py
plot_pfilter
johnhw/summerschool2017
6
python
def plot_pfilter(time, expected, observed, particles, weights, means): 'Apply a particle filter to a time series, and plot the\n first component of the predictions alongside the expected\n output.' plt.plot(time, expected, 'C1', lw=3) plt.plot(time, observed, '+C3', lw=3) ts = np.tile(time[(:, Non...
def plot_pfilter(time, expected, observed, particles, weights, means): 'Apply a particle filter to a time series, and plot the\n first component of the predictions alongside the expected\n output.' plt.plot(time, expected, 'C1', lw=3) plt.plot(time, observed, '+C3', lw=3) ts = np.tile(time[(:, Non...
66eb7c8e5c20905fa00e8b271c0774102646afffcbeb206cb2242ed09b661ed2
def test_mia_run(self): '"This tests the run method of MIA with a reduced data set' (traces, keys, plain) = FileLoader.main(CONST_DEFAULT_TRACES_FILE, CONST_DEFAULT_KEYS_FILE, CONST_DEFAULT_PLAIN_FILE) (profiling_traces, profiling_keys, profiling_plaintext, attack_traces, attack_keys, attack_plaintext) = Da...
"This tests the run method of MIA with a reduced data set
tests/attack/test_mia_integration.py
test_mia_run
AISyLab/side-channel-attacks
14
python
def test_mia_run(self): (traces, keys, plain) = FileLoader.main(CONST_DEFAULT_TRACES_FILE, CONST_DEFAULT_KEYS_FILE, CONST_DEFAULT_PLAIN_FILE) (profiling_traces, profiling_keys, profiling_plaintext, attack_traces, attack_keys, attack_plaintext) = DataPartitioner.get_traces(traces, keys, plain, 1000, 0, 0, 1...
def test_mia_run(self): (traces, keys, plain) = FileLoader.main(CONST_DEFAULT_TRACES_FILE, CONST_DEFAULT_KEYS_FILE, CONST_DEFAULT_PLAIN_FILE) (profiling_traces, profiling_keys, profiling_plaintext, attack_traces, attack_keys, attack_plaintext) = DataPartitioner.get_traces(traces, keys, plain, 1000, 0, 0, 1...
ca1149be38092976dd554c734b0958160fd009550b59551e4526c2e9660de017
@functools.lru_cache() def get_backend(): 'Return current backend.' return {'file': FileBackend, 's3': S3Backend}[app.config['STORAGE_BACKEND']['name']]()
Return current backend.
fluffy/component/backends.py
get_backend
fawaf/fluffy
135
python
@functools.lru_cache() def get_backend(): return {'file': FileBackend, 's3': S3Backend}[app.config['STORAGE_BACKEND']['name']]()
@functools.lru_cache() def get_backend(): return {'file': FileBackend, 's3': S3Backend}[app.config['STORAGE_BACKEND']['name']]()<|docstring|>Return current backend.<|endoftext|>
1a337dae630dac627863a5f8d99be0ba67fc88a39db3683d7db99946ea53dddf
def test_list_forms_data(admin_user): 'Should return the correct fields about the forms.' form = EventFormFactory() field = form.fields.first() option = field.options.first() client = get_api_client(user=admin_user) url = (_get_forms_url() + '?all') response = client.get(url) response = ...
Should return the correct fields about the forms.
app/tests/forms/test_eventform_integration.py
test_list_forms_data
TIHLDE/Lepton
7
python
def test_list_forms_data(admin_user): form = EventFormFactory() field = form.fields.first() option = field.options.first() client = get_api_client(user=admin_user) url = (_get_forms_url() + '?all') response = client.get(url) response = response.json() assert (response[0] == {'id': s...
def test_list_forms_data(admin_user): form = EventFormFactory() field = form.fields.first() option = field.options.first() client = get_api_client(user=admin_user) url = (_get_forms_url() + '?all') response = client.get(url) response = response.json() assert (response[0] == {'id': s...
fc60472e02e3df846426609678a97dece5afe7a257ee07ed3bbdfc3e97d86f17
def test_retrieve_evaluation_event_form_as_member_when_has_attended_event(member): '\n A member should be able to retrieve an event form of type evaluation if\n they has attended the event.\n ' event = EventFactory(limit=1) registration = RegistrationFactory(user=member, event=event, is_on_wait=Fal...
A member should be able to retrieve an event form of type evaluation if they has attended the event.
app/tests/forms/test_eventform_integration.py
test_retrieve_evaluation_event_form_as_member_when_has_attended_event
TIHLDE/Lepton
7
python
def test_retrieve_evaluation_event_form_as_member_when_has_attended_event(member): '\n A member should be able to retrieve an event form of type evaluation if\n they has attended the event.\n ' event = EventFactory(limit=1) registration = RegistrationFactory(user=member, event=event, is_on_wait=Fal...
def test_retrieve_evaluation_event_form_as_member_when_has_attended_event(member): '\n A member should be able to retrieve an event form of type evaluation if\n they has attended the event.\n ' event = EventFactory(limit=1) registration = RegistrationFactory(user=member, event=event, is_on_wait=Fal...
306a220bae60b0c43005d0e20868255a2420e1ce928c59d4ae0697200f8cbd73
def test_retrieve_evaluation_event_form_as_member_when_has_not_attended_event(member): 'A member should not be able to retrieve an event evaluation form if they have not attended the event.' event = EventFactory(limit=1) registration = RegistrationFactory(user=member, event=event, is_on_wait=False, has_atte...
A member should not be able to retrieve an event evaluation form if they have not attended the event.
app/tests/forms/test_eventform_integration.py
test_retrieve_evaluation_event_form_as_member_when_has_not_attended_event
TIHLDE/Lepton
7
python
def test_retrieve_evaluation_event_form_as_member_when_has_not_attended_event(member): event = EventFactory(limit=1) registration = RegistrationFactory(user=member, event=event, is_on_wait=False, has_attended=False) form = EventFormFactory(event=registration.event, type=EventFormType.EVALUATION) cl...
def test_retrieve_evaluation_event_form_as_member_when_has_not_attended_event(member): event = EventFactory(limit=1) registration = RegistrationFactory(user=member, event=event, is_on_wait=False, has_attended=False) form = EventFormFactory(event=registration.event, type=EventFormType.EVALUATION) cl...
0e1145af89e6a8734f46476e43388afc1293f6d8ebfa41b798f1450742177676
@permission_params def test_create_event_form_as_admin(permission_test_util): 'An admin should be able to create an event form.' (member, event, expected_create_status_code, expected_update_delete_status_code) = permission_test_util form = EventFormFactory.build() client = get_api_client(user=member) ...
An admin should be able to create an event form.
app/tests/forms/test_eventform_integration.py
test_create_event_form_as_admin
TIHLDE/Lepton
7
python
@permission_params def test_create_event_form_as_admin(permission_test_util): (member, event, expected_create_status_code, expected_update_delete_status_code) = permission_test_util form = EventFormFactory.build() client = get_api_client(user=member) url = _get_forms_url() response = client.pos...
@permission_params def test_create_event_form_as_admin(permission_test_util): (member, event, expected_create_status_code, expected_update_delete_status_code) = permission_test_util form = EventFormFactory.build() client = get_api_client(user=member) url = _get_forms_url() response = client.pos...
e6655269e921a7b3101e578dee4fa7842c67af36c1cb0b3ab61958ffc896a9ad
@permission_params def test_update_event_form_as_admin(permission_test_util): 'An admin should be able to update an event form.' (member, event, _, expected_update_delete_status_code) = permission_test_util form = EventFormFactory(event=event) client = get_api_client(user=member) url = _get_form_det...
An admin should be able to update an event form.
app/tests/forms/test_eventform_integration.py
test_update_event_form_as_admin
TIHLDE/Lepton
7
python
@permission_params def test_update_event_form_as_admin(permission_test_util): (member, event, _, expected_update_delete_status_code) = permission_test_util form = EventFormFactory(event=event) client = get_api_client(user=member) url = _get_form_detail_url(form) new_title = 'New form title' ...
@permission_params def test_update_event_form_as_admin(permission_test_util): (member, event, _, expected_update_delete_status_code) = permission_test_util form = EventFormFactory(event=event) client = get_api_client(user=member) url = _get_form_detail_url(form) new_title = 'New form title' ...
5506199c3852019cdc9760aa6c7dae372670b702a2d9cdf974c70c38197b9772
@permission_params def test_delete_event_form_as_admin(permission_test_util): 'An admin should be able to delete an event form.' (member, event, _, expected_update_delete_status_code) = permission_test_util form = EventFormFactory(event=event) client = get_api_client(user=member) url = _get_form_det...
An admin should be able to delete an event form.
app/tests/forms/test_eventform_integration.py
test_delete_event_form_as_admin
TIHLDE/Lepton
7
python
@permission_params def test_delete_event_form_as_admin(permission_test_util): (member, event, _, expected_update_delete_status_code) = permission_test_util form = EventFormFactory(event=event) client = get_api_client(user=member) url = _get_form_detail_url(form) response = client.delete(url) ...
@permission_params def test_delete_event_form_as_admin(permission_test_util): (member, event, _, expected_update_delete_status_code) = permission_test_util form = EventFormFactory(event=event) client = get_api_client(user=member) url = _get_form_detail_url(form) response = client.delete(url) ...
05839a9a07b6b6fd8ecbae81fe12a3ddbbaf4c769fe720d8e6c45f473d5ac409
def eval(model, data_loader, criterion): '\n Function for evaluation step\n\n Args:\n model ([]): tranformer model\n data_loader (BucketIterator): data_loader to evaluate\n criterion (Loss Object): criterion to calculate the loss \n ' losses = [] with torch.no_grad(): f...
Function for evaluation step Args: model ([]): tranformer model data_loader (BucketIterator): data_loader to evaluate criterion (Loss Object): criterion to calculate the loss
notebooks/train.py
eval
macabdul9/transformers
3
python
def eval(model, data_loader, criterion): '\n Function for evaluation step\n\n Args:\n model ([]): tranformer model\n data_loader (BucketIterator): data_loader to evaluate\n criterion (Loss Object): criterion to calculate the loss \n ' losses = [] with torch.no_grad(): f...
def eval(model, data_loader, criterion): '\n Function for evaluation step\n\n Args:\n model ([]): tranformer model\n data_loader (BucketIterator): data_loader to evaluate\n criterion (Loss Object): criterion to calculate the loss \n ' losses = [] with torch.no_grad(): f...
d0f99490376cc9cefc08eb0175637e6a3d1962430614d735411303615b4fa2f8
def train(model, train_loader, val_loader, criterion, optimizer, epochs=10): '\n \n Function to train the model\n\n Args:\n model (nn.Module): model \n train_loader (B): [description]\n val_loader ([type]): [description]\n criterion ([type]): [description]\n optimizer ([t...
Function to train the model Args: model (nn.Module): model train_loader (B): [description] val_loader ([type]): [description] criterion ([type]): [description] optimizer ([type]): [description] epochs (int, optional): [description]. Defaults to 10.
notebooks/train.py
train
macabdul9/transformers
3
python
def train(model, train_loader, val_loader, criterion, optimizer, epochs=10): '\n \n Function to train the model\n\n Args:\n model (nn.Module): model \n train_loader (B): [description]\n val_loader ([type]): [description]\n criterion ([type]): [description]\n optimizer ([t...
def train(model, train_loader, val_loader, criterion, optimizer, epochs=10): '\n \n Function to train the model\n\n Args:\n model (nn.Module): model \n train_loader (B): [description]\n val_loader ([type]): [description]\n criterion ([type]): [description]\n optimizer ([t...
6d0fbe99c8c7f98221dc0a7c25ea8bb7897d41a867da7fa6589b5b6148ee621a
def poincare_2d_visualization(model, animation, epoch, eval_result, avg_loss, avg_pos_loss, avg_neg_loss, tree, figure_title, num_nodes=50, show_node_labels=()): 'Create a 2-d plot of the nodes and edges of a 2-d poincare embedding.\n\n Parameters\n ----------\n model : :class:`~hyperbolic.dag_emb_model.DA...
Create a 2-d plot of the nodes and edges of a 2-d poincare embedding. Parameters ---------- model : :class:`~hyperbolic.dag_emb_model.DAGEmbeddingModel` The model to visualize, model size must be 2. tree : list Set of tuples containing the direct edges present in the original dataset. figure_title : str Ti...
poincare_viz.py
poincare_2d_visualization
dalab/hyperbolic_cones
103
python
def poincare_2d_visualization(model, animation, epoch, eval_result, avg_loss, avg_pos_loss, avg_neg_loss, tree, figure_title, num_nodes=50, show_node_labels=()): 'Create a 2-d plot of the nodes and edges of a 2-d poincare embedding.\n\n Parameters\n ----------\n model : :class:`~hyperbolic.dag_emb_model.DA...
def poincare_2d_visualization(model, animation, epoch, eval_result, avg_loss, avg_pos_loss, avg_neg_loss, tree, figure_title, num_nodes=50, show_node_labels=()): 'Create a 2-d plot of the nodes and edges of a 2-d poincare embedding.\n\n Parameters\n ----------\n model : :class:`~hyperbolic.dag_emb_model.DA...
0a6d05ec08d1f784d0b8f2bf746cde6ca20b9bf344c02fa6b3be0aac9714f54a
def poincare_distance_heatmap(origin_point, x_range=((- 1.0), 1.0), y_range=((- 1.0), 1.0), num_points=100): 'Create a heatmap of Poincare distances from `origin_point` for each point (x, y),\n where x and y lie in `x_range` and `y_range` respectively, with `num_points` points chosen uniformly in both ranges.\n\...
Create a heatmap of Poincare distances from `origin_point` for each point (x, y), where x and y lie in `x_range` and `y_range` respectively, with `num_points` points chosen uniformly in both ranges. Parameters ---------- origin_point : tuple (int, int) (x, y) from which distances are to be measured and plotted. x_...
poincare_viz.py
poincare_distance_heatmap
dalab/hyperbolic_cones
103
python
def poincare_distance_heatmap(origin_point, x_range=((- 1.0), 1.0), y_range=((- 1.0), 1.0), num_points=100): 'Create a heatmap of Poincare distances from `origin_point` for each point (x, y),\n where x and y lie in `x_range` and `y_range` respectively, with `num_points` points chosen uniformly in both ranges.\n\...
def poincare_distance_heatmap(origin_point, x_range=((- 1.0), 1.0), y_range=((- 1.0), 1.0), num_points=100): 'Create a heatmap of Poincare distances from `origin_point` for each point (x, y),\n where x and y lie in `x_range` and `y_range` respectively, with `num_points` points chosen uniformly in both ranges.\n\...
547f13775870625b43fa74deac07f9568c673854e409bf32a5eed5dd995239a8
def __init__(self, *args, **kwds): '\n Constructor. Any message fields that are implicitly/explicitly\n set to None will be assigned a default value. The recommend\n use is keyword arguments as this is more robust to future message\n changes. You cannot mix in-order arguments and keyword arguments.\n\n...
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: header,pose :param args: complete...
TrekBot2_WS/devel/.private/geographic_msgs/lib/python2.7/dist-packages/geographic_msgs/msg/_GeoPoseStamped.py
__init__
Rafcin/RescueRoboticsLHMV
1
python
def __init__(self, *args, **kwds): '\n Constructor. Any message fields that are implicitly/explicitly\n set to None will be assigned a default value. The recommend\n use is keyword arguments as this is more robust to future message\n changes. You cannot mix in-order arguments and keyword arguments.\n\n...
def __init__(self, *args, **kwds): '\n Constructor. Any message fields that are implicitly/explicitly\n set to None will be assigned a default value. The recommend\n use is keyword arguments as this is more robust to future message\n changes. You cannot mix in-order arguments and keyword arguments.\n\n...
1fb6b2b708db1f101aab56633ecd49b6f4087e60f5bbe6926e83ee92f9106530
def _get_types(self): '\n internal API method\n ' return self._slot_types
internal API method
TrekBot2_WS/devel/.private/geographic_msgs/lib/python2.7/dist-packages/geographic_msgs/msg/_GeoPoseStamped.py
_get_types
Rafcin/RescueRoboticsLHMV
1
python
def _get_types(self): '\n \n ' return self._slot_types
def _get_types(self): '\n \n ' return self._slot_types<|docstring|>internal API method<|endoftext|>
3411963652b50dc80a3ad33fc6ae6284e1ec01a7407c670cfca5ec67a7cf4f07
def serialize(self, buff): '\n serialize message into buffer\n :param buff: buffer, ``StringIO``\n ' try: _x = self buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) _x = self.header.frame_id length = len(_x) if (python...
serialize message into buffer :param buff: buffer, ``StringIO``
TrekBot2_WS/devel/.private/geographic_msgs/lib/python2.7/dist-packages/geographic_msgs/msg/_GeoPoseStamped.py
serialize
Rafcin/RescueRoboticsLHMV
1
python
def serialize(self, buff): '\n serialize message into buffer\n :param buff: buffer, ``StringIO``\n ' try: _x = self buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) _x = self.header.frame_id length = len(_x) if (python...
def serialize(self, buff): '\n serialize message into buffer\n :param buff: buffer, ``StringIO``\n ' try: _x = self buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) _x = self.header.frame_id length = len(_x) if (python...
62db6f4627009d5683ea157115e112419acb1e4094ed957bc46187e2c3d2f790
def deserialize(self, str): '\n unpack serialized message in str into this message instance\n :param str: byte array of serialized message, ``str``\n ' try: if (self.header is None): self.header = std_msgs.msg.Header() if (self.pose is None): self.pose = geograph...
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
TrekBot2_WS/devel/.private/geographic_msgs/lib/python2.7/dist-packages/geographic_msgs/msg/_GeoPoseStamped.py
deserialize
Rafcin/RescueRoboticsLHMV
1
python
def deserialize(self, str): '\n unpack serialized message in str into this message instance\n :param str: byte array of serialized message, ``str``\n ' try: if (self.header is None): self.header = std_msgs.msg.Header() if (self.pose is None): self.pose = geograph...
def deserialize(self, str): '\n unpack serialized message in str into this message instance\n :param str: byte array of serialized message, ``str``\n ' try: if (self.header is None): self.header = std_msgs.msg.Header() if (self.pose is None): self.pose = geograph...
51423eb71bd72896fc7f08265580e021e911cbf4a479425187fd4b7f98f3fc4e
def serialize_numpy(self, buff, numpy): '\n serialize message with numpy array types into buffer\n :param buff: buffer, ``StringIO``\n :param numpy: numpy python module\n ' try: _x = self buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) ...
serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module
TrekBot2_WS/devel/.private/geographic_msgs/lib/python2.7/dist-packages/geographic_msgs/msg/_GeoPoseStamped.py
serialize_numpy
Rafcin/RescueRoboticsLHMV
1
python
def serialize_numpy(self, buff, numpy): '\n serialize message with numpy array types into buffer\n :param buff: buffer, ``StringIO``\n :param numpy: numpy python module\n ' try: _x = self buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) ...
def serialize_numpy(self, buff, numpy): '\n serialize message with numpy array types into buffer\n :param buff: buffer, ``StringIO``\n :param numpy: numpy python module\n ' try: _x = self buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) ...
38896605d88d39d0f35035f8150e35b77381fef724b12a47444543de878e9402
def deserialize_numpy(self, str, numpy): '\n unpack serialized message in str into this message instance using numpy for array types\n :param str: byte array of serialized message, ``str``\n :param numpy: numpy python module\n ' try: if (self.header is None): self.header = std_ms...
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
TrekBot2_WS/devel/.private/geographic_msgs/lib/python2.7/dist-packages/geographic_msgs/msg/_GeoPoseStamped.py
deserialize_numpy
Rafcin/RescueRoboticsLHMV
1
python
def deserialize_numpy(self, str, numpy): '\n unpack serialized message in str into this message instance using numpy for array types\n :param str: byte array of serialized message, ``str``\n :param numpy: numpy python module\n ' try: if (self.header is None): self.header = std_ms...
def deserialize_numpy(self, str, numpy): '\n unpack serialized message in str into this message instance using numpy for array types\n :param str: byte array of serialized message, ``str``\n :param numpy: numpy python module\n ' try: if (self.header is None): self.header = std_ms...
9d1b6e8267c581e066375e6463351edc4934d18f8d1ee3919229212ecde43dd9
def utctoweekseconds(utc=datetime.datetime.utcnow(), leapseconds=37): ' Returns the GPS week, the GPS day, and the seconds\n and microseconds since the beginning of the GPS week ' datetimeformat = '%Y-%m-%d %H:%M:%S' epoch = datetime.datetime.strptime('1980-01-06 00:00:00', datetimeformat) ...
Returns the GPS week, the GPS day, and the seconds and microseconds since the beginning of the GPS week
Simulation/python/FMU.py
utctoweekseconds
elke0011/OpenFlightSim
15
python
def utctoweekseconds(utc=datetime.datetime.utcnow(), leapseconds=37): ' Returns the GPS week, the GPS day, and the seconds\n and microseconds since the beginning of the GPS week ' datetimeformat = '%Y-%m-%d %H:%M:%S' epoch = datetime.datetime.strptime('1980-01-06 00:00:00', datetimeformat) ...
def utctoweekseconds(utc=datetime.datetime.utcnow(), leapseconds=37): ' Returns the GPS week, the GPS day, and the seconds\n and microseconds since the beginning of the GPS week ' datetimeformat = '%Y-%m-%d %H:%M:%S' epoch = datetime.datetime.strptime('1980-01-06 00:00:00', datetimeformat) ...
893688f6a64378c1fe02a0a977328ca65d744f61d9a62c0641e8e8e1e015ff7b
def __init__(self, parent): '\n Initialize a Resource Layer.\n\n :type parent: CoAP\n :param parent: the CoAP server\n ' self._parent = parent
Initialize a Resource Layer. :type parent: CoAP :param parent: the CoAP server
src/Bubot_CoAP/layers/resource_layer.py
__init__
businka/Bubot_CoAP
0
python
def __init__(self, parent): '\n Initialize a Resource Layer.\n\n :type parent: CoAP\n :param parent: the CoAP server\n ' self._parent = parent
def __init__(self, parent): '\n Initialize a Resource Layer.\n\n :type parent: CoAP\n :param parent: the CoAP server\n ' self._parent = parent<|docstring|>Initialize a Resource Layer. :type parent: CoAP :param parent: the CoAP server<|endoftext|>
a4e54fdf24aaf5cbf742162a6dc2f6d3c06dd2fcb7cc03b0482e997383ea637a
async def edit_resource(self, transaction, path): '\n Render a POST on an already created resource.\n\n :param path: the path of the resource\n :param transaction: the transaction\n :return: the transaction\n ' resource_node = self._parent.root[path] transaction.resource =...
Render a POST on an already created resource. :param path: the path of the resource :param transaction: the transaction :return: the transaction
src/Bubot_CoAP/layers/resource_layer.py
edit_resource
businka/Bubot_CoAP
0
python
async def edit_resource(self, transaction, path): '\n Render a POST on an already created resource.\n\n :param path: the path of the resource\n :param transaction: the transaction\n :return: the transaction\n ' resource_node = self._parent.root[path] transaction.resource =...
async def edit_resource(self, transaction, path): '\n Render a POST on an already created resource.\n\n :param path: the path of the resource\n :param transaction: the transaction\n :return: the transaction\n ' resource_node = self._parent.root[path] transaction.resource =...
8ba2cb1819e4e08ae69403cb6b8617c201ab47c0415d720f1c9effe5fbd61b35
async def add_resource(self, transaction, parent_resource, lp): '\n Render a POST on a new resource.\n\n :param transaction: the transaction\n :param parent_resource: the parent of the resource\n :param lp: the location_path attribute of the resource\n :return: the response\n ...
Render a POST on a new resource. :param transaction: the transaction :param parent_resource: the parent of the resource :param lp: the location_path attribute of the resource :return: the response
src/Bubot_CoAP/layers/resource_layer.py
add_resource
businka/Bubot_CoAP
0
python
async def add_resource(self, transaction, parent_resource, lp): '\n Render a POST on a new resource.\n\n :param transaction: the transaction\n :param parent_resource: the parent of the resource\n :param lp: the location_path attribute of the resource\n :return: the response\n ...
async def add_resource(self, transaction, parent_resource, lp): '\n Render a POST on a new resource.\n\n :param transaction: the transaction\n :param parent_resource: the parent of the resource\n :param lp: the location_path attribute of the resource\n :return: the response\n ...
465c5779d0e1f93e813e8e270b429a8ebeb93ab9952fed46d926ca713e55ec33
async def create_resource(self, path, transaction): '\n Render a POST request.\n\n :param path: the path of the request\n :param transaction: the transaction\n :return: the response\n ' t = self._parent.root.with_prefix(path) max_len = 0 imax = None for i in t: ...
Render a POST request. :param path: the path of the request :param transaction: the transaction :return: the response
src/Bubot_CoAP/layers/resource_layer.py
create_resource
businka/Bubot_CoAP
0
python
async def create_resource(self, path, transaction): '\n Render a POST request.\n\n :param path: the path of the request\n :param transaction: the transaction\n :return: the response\n ' t = self._parent.root.with_prefix(path) max_len = 0 imax = None for i in t: ...
async def create_resource(self, path, transaction): '\n Render a POST request.\n\n :param path: the path of the request\n :param transaction: the transaction\n :return: the response\n ' t = self._parent.root.with_prefix(path) max_len = 0 imax = None for i in t: ...
671ebdc6eeb186be54b54d58cd54cd90ae2c891ed9260db4f1c6cd13bea353bf
async def update_resource(self, transaction): '\n Render a PUT request.\n\n :param transaction: the transaction\n :return: the response\n ' if transaction.request.if_match: if ((None not in transaction.request.if_match) and (str(transaction.resource.etag) not in transaction.r...
Render a PUT request. :param transaction: the transaction :return: the response
src/Bubot_CoAP/layers/resource_layer.py
update_resource
businka/Bubot_CoAP
0
python
async def update_resource(self, transaction): '\n Render a PUT request.\n\n :param transaction: the transaction\n :return: the response\n ' if transaction.request.if_match: if ((None not in transaction.request.if_match) and (str(transaction.resource.etag) not in transaction.r...
async def update_resource(self, transaction): '\n Render a PUT request.\n\n :param transaction: the transaction\n :return: the response\n ' if transaction.request.if_match: if ((None not in transaction.request.if_match) and (str(transaction.resource.etag) not in transaction.r...
93146a3f224279b4de48928eae3642d41d7edb9422ae5882f1b7d5d57613fd84
async def delete_resource(self, transaction, path): '\n Render a DELETE request.\n\n :param transaction: the transaction\n :param path: the path\n :return: the response\n ' resource = transaction.resource method = getattr(resource, 'render_DELETE', None) try: r...
Render a DELETE request. :param transaction: the transaction :param path: the path :return: the response
src/Bubot_CoAP/layers/resource_layer.py
delete_resource
businka/Bubot_CoAP
0
python
async def delete_resource(self, transaction, path): '\n Render a DELETE request.\n\n :param transaction: the transaction\n :param path: the path\n :return: the response\n ' resource = transaction.resource method = getattr(resource, 'render_DELETE', None) try: r...
async def delete_resource(self, transaction, path): '\n Render a DELETE request.\n\n :param transaction: the transaction\n :param path: the path\n :return: the response\n ' resource = transaction.resource method = getattr(resource, 'render_DELETE', None) try: r...
625e2ca5c81448dcb8f838650cb1cbf2065b561761cea9f6ccbc72bd918f59ea
async def get_resource(self, transaction): '\n Render a GET request.\n\n :param transaction: the transaction\n :return: the transaction\n ' method = getattr(transaction.resource, 'render_GET', None) try: resource = (await method(request=transaction.request)) except No...
Render a GET request. :param transaction: the transaction :return: the transaction
src/Bubot_CoAP/layers/resource_layer.py
get_resource
businka/Bubot_CoAP
0
python
async def get_resource(self, transaction): '\n Render a GET request.\n\n :param transaction: the transaction\n :return: the transaction\n ' method = getattr(transaction.resource, 'render_GET', None) try: resource = (await method(request=transaction.request)) except No...
async def get_resource(self, transaction): '\n Render a GET request.\n\n :param transaction: the transaction\n :return: the transaction\n ' method = getattr(transaction.resource, 'render_GET', None) try: resource = (await method(request=transaction.request)) except No...
bd6f53ef40ab041f94c77729a10ea71ba554dde572c94b8230e31996e4f54919
async def discover(self, transaction): '\n Render a GET request to the .well-know/core link.\n\n :param transaction: the transaction\n :return: the transaction\n ' transaction.response.code = defines.Codes.CONTENT.number payload = '' for i in self._parent.root.dump(): ...
Render a GET request to the .well-know/core link. :param transaction: the transaction :return: the transaction
src/Bubot_CoAP/layers/resource_layer.py
discover
businka/Bubot_CoAP
0
python
async def discover(self, transaction): '\n Render a GET request to the .well-know/core link.\n\n :param transaction: the transaction\n :return: the transaction\n ' transaction.response.code = defines.Codes.CONTENT.number payload = for i in self._parent.root.dump(): i...
async def discover(self, transaction): '\n Render a GET request to the .well-know/core link.\n\n :param transaction: the transaction\n :return: the transaction\n ' transaction.response.code = defines.Codes.CONTENT.number payload = for i in self._parent.root.dump(): i...
aa6247e0de8ab3e034a7359ac49f0c84e42588aadf4a67fd9b5fcf109c25f2da
@staticmethod def corelinkformat(resource): '\n Return a formatted string representation of the corelinkformat in the tree.\n\n :return: the string\n ' msg = (('<' + resource.path) + '>;') assert isinstance(resource, Resource) keys = sorted(list(resource.attributes.keys())) for ...
Return a formatted string representation of the corelinkformat in the tree. :return: the string
src/Bubot_CoAP/layers/resource_layer.py
corelinkformat
businka/Bubot_CoAP
0
python
@staticmethod def corelinkformat(resource): '\n Return a formatted string representation of the corelinkformat in the tree.\n\n :return: the string\n ' msg = (('<' + resource.path) + '>;') assert isinstance(resource, Resource) keys = sorted(list(resource.attributes.keys())) for ...
@staticmethod def corelinkformat(resource): '\n Return a formatted string representation of the corelinkformat in the tree.\n\n :return: the string\n ' msg = (('<' + resource.path) + '>;') assert isinstance(resource, Resource) keys = sorted(list(resource.attributes.keys())) for ...
f824b27641433887977d4221e74d1400a4aeddad338625e7077a2bf306454119
def load_data(messages_filepath, categories_filepath): 'Load messages and categories data from the given file paths, process them and merge them\n \n Args:\n messages_filepath: \n categories_filepath:\n\n Returns:\n df: pandas.DataFrame: dataframe containing the messages data combined with their c...
Load messages and categories data from the given file paths, process them and merge them Args: messages_filepath: categories_filepath: Returns: df: pandas.DataFrame: dataframe containing the messages data combined with their category classifications
process_data.py
load_data
karthikvijayakumar/Disaster-Response-Text-Classification
1
python
def load_data(messages_filepath, categories_filepath): 'Load messages and categories data from the given file paths, process them and merge them\n \n Args:\n messages_filepath: \n categories_filepath:\n\n Returns:\n df: pandas.DataFrame: dataframe containing the messages data combined with their c...
def load_data(messages_filepath, categories_filepath): 'Load messages and categories data from the given file paths, process them and merge them\n \n Args:\n messages_filepath: \n categories_filepath:\n\n Returns:\n df: pandas.DataFrame: dataframe containing the messages data combined with their c...
24dde391793e88edf9891dd925014d406c668cc82e4ddce35b8165d0756d78f3
def clean_data(df): 'Removes duplicates from the dataset\n Args:\n df: pandas.DataFrame: Input data containing messages and their classifications into multiple categories\n\n Returns:\n df: pandas.DataFrame: Deduplicated input data \n ' return df.drop_duplicates()
Removes duplicates from the dataset Args: df: pandas.DataFrame: Input data containing messages and their classifications into multiple categories Returns: df: pandas.DataFrame: Deduplicated input data
process_data.py
clean_data
karthikvijayakumar/Disaster-Response-Text-Classification
1
python
def clean_data(df): 'Removes duplicates from the dataset\n Args:\n df: pandas.DataFrame: Input data containing messages and their classifications into multiple categories\n\n Returns:\n df: pandas.DataFrame: Deduplicated input data \n ' return df.drop_duplicates()
def clean_data(df): 'Removes duplicates from the dataset\n Args:\n df: pandas.DataFrame: Input data containing messages and their classifications into multiple categories\n\n Returns:\n df: pandas.DataFrame: Deduplicated input data \n ' return df.drop_duplicates()<|docstring|>Removes duplicate...
f8875a2ac4aec92143751e8a53d9672e6b833ad00c7d555bd7c463942593513c
def save_data(df, table_name, database_filename): 'Writes the dataframe into a sqlite database at the given location\n \n Args:\n df: pandas.DataFrame: Input data containing messages and their classifications into multiple categories \n table_name: string. Table to write the input data frame to\n ...
Writes the dataframe into a sqlite database at the given location Args: df: pandas.DataFrame: Input data containing messages and their classifications into multiple categories table_name: string. Table to write the input data frame to database_filename: File location to create and store SQLite database Returns: N...
process_data.py
save_data
karthikvijayakumar/Disaster-Response-Text-Classification
1
python
def save_data(df, table_name, database_filename): 'Writes the dataframe into a sqlite database at the given location\n \n Args:\n df: pandas.DataFrame: Input data containing messages and their classifications into multiple categories \n table_name: string. Table to write the input data frame to\n ...
def save_data(df, table_name, database_filename): 'Writes the dataframe into a sqlite database at the given location\n \n Args:\n df: pandas.DataFrame: Input data containing messages and their classifications into multiple categories \n table_name: string. Table to write the input data frame to\n ...
b832c292b18df7c95166f67666622390484393765e78eee3d7d3d0b6b3aa425a
def main(): 'Main function for the file. This is entry point of execution\n \n Args:\n None\n\n Returns:\n None\n\n ' if (len(sys.argv) == 4): (messages_filepath, categories_filepath, database_filepath) = sys.argv[1:] print('Loading data...\n MESSAGES: {}\n CATEGORIES: {}...
Main function for the file. This is entry point of execution Args: None Returns: None
process_data.py
main
karthikvijayakumar/Disaster-Response-Text-Classification
1
python
def main(): 'Main function for the file. This is entry point of execution\n \n Args:\n None\n\n Returns:\n None\n\n ' if (len(sys.argv) == 4): (messages_filepath, categories_filepath, database_filepath) = sys.argv[1:] print('Loading data...\n MESSAGES: {}\n CATEGORIES: {}...
def main(): 'Main function for the file. This is entry point of execution\n \n Args:\n None\n\n Returns:\n None\n\n ' if (len(sys.argv) == 4): (messages_filepath, categories_filepath, database_filepath) = sys.argv[1:] print('Loading data...\n MESSAGES: {}\n CATEGORIES: {}...
a2d6fcfbd01c97f8b3c33ec88d0f9acd0a47cc173c70c0c4b10e9ef2ccaaa5f8
def deprecated(func): 'This is a decorator which can be used to mark functions\n as deprecated. It will result in a warning being emitted\n when the function is used.' @functools.wraps(func) def new_func(*args, **kwargs): warnings.simplefilter('always', DeprecationWarning) warnings.wa...
This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used.
src/helpers/decorators.py
deprecated
Lakoc/bachelor_thesis
0
python
def deprecated(func): 'This is a decorator which can be used to mark functions\n as deprecated. It will result in a warning being emitted\n when the function is used.' @functools.wraps(func) def new_func(*args, **kwargs): warnings.simplefilter('always', DeprecationWarning) warnings.wa...
def deprecated(func): 'This is a decorator which can be used to mark functions\n as deprecated. It will result in a warning being emitted\n when the function is used.' @functools.wraps(func) def new_func(*args, **kwargs): warnings.simplefilter('always', DeprecationWarning) warnings.wa...
092ade2784f9fac8b3df89ff37a86faf0e8eb3f3bc2a44068fc1bb33bddd555e
def timeit(func): 'This is a decorator which can be used to measure function time spent.' @functools.wraps(func) def new_func(*args, **kwargs): start_time = time.time() ret_val = func(*args, **kwargs) elapsed_time = (time.time() - start_time) print(f'function [{func.__name__...
This is a decorator which can be used to measure function time spent.
src/helpers/decorators.py
timeit
Lakoc/bachelor_thesis
0
python
def timeit(func): @functools.wraps(func) def new_func(*args, **kwargs): start_time = time.time() ret_val = func(*args, **kwargs) elapsed_time = (time.time() - start_time) print(f'function [{func.__name__}] finished in {int((elapsed_time * 1000))} ms') return ret_val...
def timeit(func): @functools.wraps(func) def new_func(*args, **kwargs): start_time = time.time() ret_val = func(*args, **kwargs) elapsed_time = (time.time() - start_time) print(f'function [{func.__name__}] finished in {int((elapsed_time * 1000))} ms') return ret_val...
71a0573133235de5923e716950a1653146e0bdeaf1ed8023f224198c53d0920e
def frankie_angles_from_g(g, verbo=True, energy=50): "\n Converted from David's code, which converted from Bob's code.\n I9 internal simulation coordinates: x ray direction is positive x direction, positive z direction is upward, y direction can be determined by right hand rule.\n I9 mic file coordinates: ...
Converted from David's code, which converted from Bob's code. I9 internal simulation coordinates: x ray direction is positive x direction, positive z direction is upward, y direction can be determined by right hand rule. I9 mic file coordinates: x, y directions are the same as the simulation coordinates. I9 detector im...
util/Simulation.py
frankie_angles_from_g
Yufeng-shen/StrainRecon
0
python
def frankie_angles_from_g(g, verbo=True, energy=50): "\n Converted from David's code, which converted from Bob's code.\n I9 internal simulation coordinates: x ray direction is positive x direction, positive z direction is upward, y direction can be determined by right hand rule.\n I9 mic file coordinates: ...
def frankie_angles_from_g(g, verbo=True, energy=50): "\n Converted from David's code, which converted from Bob's code.\n I9 internal simulation coordinates: x ray direction is positive x direction, positive z direction is upward, y direction can be determined by right hand rule.\n I9 mic file coordinates: ...
1664484bd3026d18e9fb119dcfe468db4cb8bceb0e37727d767150332e30f9d8
def GetProjectedVertex(Det1, sample, orien, etalimit, grainpos, getPeaksInfo=False, bIdx=True, omegaL=(- 90), omegaU=90, energy=50): '\n Get the observable projected vertex on a single detector and their G vectors.\n Caution!!! This function only works for traditional nf-HEDM experiment setup.\n\n Paramete...
Get the observable projected vertex on a single detector and their G vectors. Caution!!! This function only works for traditional nf-HEDM experiment setup. Parameters ------------ Det1: Detector Remember to move this detector object to correct position first. sample: CrystalStr Must calculated G list o...
util/Simulation.py
GetProjectedVertex
Yufeng-shen/StrainRecon
0
python
def GetProjectedVertex(Det1, sample, orien, etalimit, grainpos, getPeaksInfo=False, bIdx=True, omegaL=(- 90), omegaU=90, energy=50): '\n Get the observable projected vertex on a single detector and their G vectors.\n Caution!!! This function only works for traditional nf-HEDM experiment setup.\n\n Paramete...
def GetProjectedVertex(Det1, sample, orien, etalimit, grainpos, getPeaksInfo=False, bIdx=True, omegaL=(- 90), omegaU=90, energy=50): '\n Get the observable projected vertex on a single detector and their G vectors.\n Caution!!! This function only works for traditional nf-HEDM experiment setup.\n\n Paramete...
c759171fa6e1f200cb71807caac6ce0a6a3e8804222fcd140a1f3163ecda0029
def digitize(xy): '\n xy: ndarray shape(4,2)\n J and K indices in float, four points. This digitize method is far from ideal\n\n Returns\n -------------\n f: list\n list of integer tuples (J,K) that is hitted. (filled polygon)\n\n ' p = path.Path(xy) def line(pixels, x0, y0, x1...
xy: ndarray shape(4,2) J and K indices in float, four points. This digitize method is far from ideal Returns ------------- f: list list of integer tuples (J,K) that is hitted. (filled polygon)
util/Simulation.py
digitize
Yufeng-shen/StrainRecon
0
python
def digitize(xy): '\n xy: ndarray shape(4,2)\n J and K indices in float, four points. This digitize method is far from ideal\n\n Returns\n -------------\n f: list\n list of integer tuples (J,K) that is hitted. (filled polygon)\n\n ' p = path.Path(xy) def line(pixels, x0, y0, x1...
def digitize(xy): '\n xy: ndarray shape(4,2)\n J and K indices in float, four points. This digitize method is far from ideal\n\n Returns\n -------------\n f: list\n list of integer tuples (J,K) that is hitted. (filled polygon)\n\n ' p = path.Path(xy) def line(pixels, x0, y0, x1...
3f88052c4f0b2313aceb753633f595b83966c02beae0ced43948add7e15d97db
def BackProj(self, HitPos, omega, TwoTheta, eta): '\n HitPos: ndarray (3,)\n The position of hitted point on lab coord, unit in mm\n ' scatterdir = np.array([np.cos(TwoTheta), (np.sin(TwoTheta) * np.sin(eta)), (np.sin(TwoTheta) * np.cos(eta))]) t = (HitPos[2] / (np.sin(TwoTheta)...
HitPos: ndarray (3,) The position of hitted point on lab coord, unit in mm
util/Simulation.py
BackProj
Yufeng-shen/StrainRecon
0
python
def BackProj(self, HitPos, omega, TwoTheta, eta): '\n HitPos: ndarray (3,)\n The position of hitted point on lab coord, unit in mm\n ' scatterdir = np.array([np.cos(TwoTheta), (np.sin(TwoTheta) * np.sin(eta)), (np.sin(TwoTheta) * np.cos(eta))]) t = (HitPos[2] / (np.sin(TwoTheta)...
def BackProj(self, HitPos, omega, TwoTheta, eta): '\n HitPos: ndarray (3,)\n The position of hitted point on lab coord, unit in mm\n ' scatterdir = np.array([np.cos(TwoTheta), (np.sin(TwoTheta) * np.sin(eta)), (np.sin(TwoTheta) * np.cos(eta))]) t = (HitPos[2] / (np.sin(TwoTheta)...
5edb27b47b45fe96c4b77cee9fe28542094b5590b7331b29deb0cb22a7dc56cb
def _get_file_as_dict(self, file_path): 'Open file path and return as dict.' with open(file_path) as f: return json.load(f)
Open file path and return as dict.
rdsslib/taxonomy/taxonomy_client.py
_get_file_as_dict
JiscSD/rdss-shared-libraries
0
python
def _get_file_as_dict(self, file_path): with open(file_path) as f: return json.load(f)
def _get_file_as_dict(self, file_path): with open(file_path) as f: return json.load(f)<|docstring|>Open file path and return as dict.<|endoftext|>
0473eeadcf74c9df64e5abdb67293f9791104a52a03b6aa729f0418e698fac2c
def _get_vocab_dict(self, vocab_id): 'Get a vocabulary by ID.' base_dir = self._get_filedir() file_name = None try: file_name = VOCAB_FILE_LOOKUP[vocab_id] except KeyError: raise VocabularyNotFound path = os.path.join(base_dir, file_name) return self._get_file_as_dict(path)
Get a vocabulary by ID.
rdsslib/taxonomy/taxonomy_client.py
_get_vocab_dict
JiscSD/rdss-shared-libraries
0
python
def _get_vocab_dict(self, vocab_id): base_dir = self._get_filedir() file_name = None try: file_name = VOCAB_FILE_LOOKUP[vocab_id] except KeyError: raise VocabularyNotFound path = os.path.join(base_dir, file_name) return self._get_file_as_dict(path)
def _get_vocab_dict(self, vocab_id): base_dir = self._get_filedir() file_name = None try: file_name = VOCAB_FILE_LOOKUP[vocab_id] except KeyError: raise VocabularyNotFound path = os.path.join(base_dir, file_name) return self._get_file_as_dict(path)<|docstring|>Get a vocabula...
7bfff14bad6cee278deaebef796e0056cf80272875c0a9634ec303b631dc9f6e
def get_by_name(self, vocab_id, name): 'Get a vocab item by name.' values_dict = self._get_vocab_dict(vocab_id) values = values_dict.get('vocabularyValues', []) for val in values: val_name = val['valueName'] if (val_name == name): return val['valueId'] raise ValueNotFound
Get a vocab item by name.
rdsslib/taxonomy/taxonomy_client.py
get_by_name
JiscSD/rdss-shared-libraries
0
python
def get_by_name(self, vocab_id, name): values_dict = self._get_vocab_dict(vocab_id) values = values_dict.get('vocabularyValues', []) for val in values: val_name = val['valueName'] if (val_name == name): return val['valueId'] raise ValueNotFound
def get_by_name(self, vocab_id, name): values_dict = self._get_vocab_dict(vocab_id) values = values_dict.get('vocabularyValues', []) for val in values: val_name = val['valueName'] if (val_name == name): return val['valueId'] raise ValueNotFound<|docstring|>Get a vocab it...
7acb5fbf249c945c6faace458b7e5bcc2ca9b48086967d8c269cfecd77667091
def globus_initFlow(): '\n Retrieve cached/Create a new access token\n and use it to create an OAuth2WebServerFlow\n ' userAndPass = ('%s:%s' % (auth_settings.GLOBUS_OAUTH_ID, auth_settings.GLOBUS_OAUTH_SECRET)) b64_userAndPass = b64encode(userAndPass) auth_header = ('Basic %s' % b64_userAndPas...
Retrieve cached/Create a new access token and use it to create an OAuth2WebServerFlow
django_cyverse_auth/protocol/globus.py
globus_initFlow
simpsonw/django-cyverse-auth
1
python
def globus_initFlow(): '\n Retrieve cached/Create a new access token\n and use it to create an OAuth2WebServerFlow\n ' userAndPass = ('%s:%s' % (auth_settings.GLOBUS_OAUTH_ID, auth_settings.GLOBUS_OAUTH_SECRET)) b64_userAndPass = b64encode(userAndPass) auth_header = ('Basic %s' % b64_userAndPas...
def globus_initFlow(): '\n Retrieve cached/Create a new access token\n and use it to create an OAuth2WebServerFlow\n ' userAndPass = ('%s:%s' % (auth_settings.GLOBUS_OAUTH_ID, auth_settings.GLOBUS_OAUTH_SECRET)) b64_userAndPass = b64encode(userAndPass) auth_header = ('Basic %s' % b64_userAndPas...
d91225ab7a1147273349dcd31acc7c05d79923a47bfc1f32c0dcab9b33ce6bd4
def globus_logout(redirect_uri, redirect_name='Jetstream'): '\n Redirect to logout of globus\n ' flow = globus_initFlow() auth_uri = flow.auth_uri web_logout_url = auth_uri.replace('oauth2/authorize', 'web/logout') web_logout_url += ('?client_id=%s&redirect_name=%s&redirect_uri=%s' % (flow.cli...
Redirect to logout of globus
django_cyverse_auth/protocol/globus.py
globus_logout
simpsonw/django-cyverse-auth
1
python
def globus_logout(redirect_uri, redirect_name='Jetstream'): '\n \n ' flow = globus_initFlow() auth_uri = flow.auth_uri web_logout_url = auth_uri.replace('oauth2/authorize', 'web/logout') web_logout_url += ('?client_id=%s&redirect_name=%s&redirect_uri=%s' % (flow.client_id, redirect_name, redir...
def globus_logout(redirect_uri, redirect_name='Jetstream'): '\n \n ' flow = globus_initFlow() auth_uri = flow.auth_uri web_logout_url = auth_uri.replace('oauth2/authorize', 'web/logout') web_logout_url += ('?client_id=%s&redirect_name=%s&redirect_uri=%s' % (flow.client_id, redirect_name, redir...
1f54562ea0b4ffc36f04149dd61fb7fbac0699d8f181c501193be358e416f31b
def globus_authorize(request): "\n Redirect to the IdP based on 'flow'\n " flow = globus_initFlow() auth_uri = flow.step1_get_authorize_url() auth_uri += '&authentication_hint=36007761-2cf2-4e74-a068-7473afc1d054' auth_uri = auth_uri.replace('access_type=offline', 'access_type=online') log...
Redirect to the IdP based on 'flow'
django_cyverse_auth/protocol/globus.py
globus_authorize
simpsonw/django-cyverse-auth
1
python
def globus_authorize(request): "\n \n " flow = globus_initFlow() auth_uri = flow.step1_get_authorize_url() auth_uri += '&authentication_hint=36007761-2cf2-4e74-a068-7473afc1d054' auth_uri = auth_uri.replace('access_type=offline', 'access_type=online') logger.warn(auth_uri) return HttpR...
def globus_authorize(request): "\n \n " flow = globus_initFlow() auth_uri = flow.step1_get_authorize_url() auth_uri += '&authentication_hint=36007761-2cf2-4e74-a068-7473afc1d054' auth_uri = auth_uri.replace('access_type=offline', 'access_type=online') logger.warn(auth_uri) return HttpR...
88c4e35a2f8edf664ffb0e321fee605538f164f895036249e4da4e977b279bc2
def _extract_user_from_email(raw_username): '\n Usernames come from the globus provider in the form:\n example@example.com\n ' if (not raw_username): return None return raw_username.split('@')[0]
Usernames come from the globus provider in the form: example@example.com
django_cyverse_auth/protocol/globus.py
_extract_user_from_email
simpsonw/django-cyverse-auth
1
python
def _extract_user_from_email(raw_username): '\n Usernames come from the globus provider in the form:\n example@example.com\n ' if (not raw_username): return None return raw_username.split('@')[0]
def _extract_user_from_email(raw_username): '\n Usernames come from the globus provider in the form:\n example@example.com\n ' if (not raw_username): return None return raw_username.split('@')[0]<|docstring|>Usernames come from the globus provider in the form: example@example.com<|endoftext...
2a8f612b8c2c35bc6eee227d0553c6636f997932ac4bfad3319915f082ca55f5
def _map_email_to_user(raw_username): '\n Input: example@example.com\n Output: test\n ' if (not auth_settings.GLOBUS_MAPPING_FILE): logger.info('GLOBUS_MAPPING_FILE NOT defined. Check your auth settings!!') return raw_username if (not os.path.exists(auth_settings.GLOBUS_MAPPING_FIL...
Input: example@example.com Output: test
django_cyverse_auth/protocol/globus.py
_map_email_to_user
simpsonw/django-cyverse-auth
1
python
def _map_email_to_user(raw_username): '\n Input: example@example.com\n Output: test\n ' if (not auth_settings.GLOBUS_MAPPING_FILE): logger.info('GLOBUS_MAPPING_FILE NOT defined. Check your auth settings!!') return raw_username if (not os.path.exists(auth_settings.GLOBUS_MAPPING_FIL...
def _map_email_to_user(raw_username): '\n Input: example@example.com\n Output: test\n ' if (not auth_settings.GLOBUS_MAPPING_FILE): logger.info('GLOBUS_MAPPING_FILE NOT defined. Check your auth settings!!') return raw_username if (not os.path.exists(auth_settings.GLOBUS_MAPPING_FIL...
178258e8b5201fc9603449f53b76b874ab3b0c6cc4e63eeadb94043f909952f9
def globus_validate_code(request): "\n This flow is used to create a new Token on behalf of a Service Client\n (Like Troposphere)\n Validates 'code' returned from the IdP\n If valid: Return new AuthToken to be passed to the Resource Provider.\n else: Return None\n " code = request.GET.get(...
This flow is used to create a new Token on behalf of a Service Client (Like Troposphere) Validates 'code' returned from the IdP If valid: Return new AuthToken to be passed to the Resource Provider. else: Return None
django_cyverse_auth/protocol/globus.py
globus_validate_code
simpsonw/django-cyverse-auth
1
python
def globus_validate_code(request): "\n This flow is used to create a new Token on behalf of a Service Client\n (Like Troposphere)\n Validates 'code' returned from the IdP\n If valid: Return new AuthToken to be passed to the Resource Provider.\n else: Return None\n " code = request.GET.get(...
def globus_validate_code(request): "\n This flow is used to create a new Token on behalf of a Service Client\n (Like Troposphere)\n Validates 'code' returned from the IdP\n If valid: Return new AuthToken to be passed to the Resource Provider.\n else: Return None\n " code = request.GET.get(...
d2288a60ac3cf094c3f0c1023f40dd14b44376e9f76f4f7b52e3eead0e87a79f
def create_user_token_from_globus_profile(profile, access_token): "\n Use this method on your Resource Provider (Like Atmosphere)\n to exchange a profile (that was retrieved via a tokeninfo endpoint)\n for a UserToken that can then be internally validated in an 'authorize' authBackend step..\n " log...
Use this method on your Resource Provider (Like Atmosphere) to exchange a profile (that was retrieved via a tokeninfo endpoint) for a UserToken that can then be internally validated in an 'authorize' authBackend step..
django_cyverse_auth/protocol/globus.py
create_user_token_from_globus_profile
simpsonw/django-cyverse-auth
1
python
def create_user_token_from_globus_profile(profile, access_token): "\n Use this method on your Resource Provider (Like Atmosphere)\n to exchange a profile (that was retrieved via a tokeninfo endpoint)\n for a UserToken that can then be internally validated in an 'authorize' authBackend step..\n " log...
def create_user_token_from_globus_profile(profile, access_token): "\n Use this method on your Resource Provider (Like Atmosphere)\n to exchange a profile (that was retrieved via a tokeninfo endpoint)\n for a UserToken that can then be internally validated in an 'authorize' authBackend step..\n " log...
2e5eeeda409a8c07640bed9b353d546016c6b031a8463107ab1f6d2073676277
def analyze(model, force_warning=False, num_error_samples=1000, pre_equilibrium_approx=False, skip_checks=False, min_time=0.0, max_time=None): 'Perform all the analysis steps at once.' curdir = os.getcwd() analysis = Analysis(model, force_warning, num_error_samples) analysis.extract_data(min_time=min_ti...
Perform all the analysis steps at once.
seekr2/analyze.py
analyze
seekrcentral/seekr2
1
python
def analyze(model, force_warning=False, num_error_samples=1000, pre_equilibrium_approx=False, skip_checks=False, min_time=0.0, max_time=None): curdir = os.getcwd() analysis = Analysis(model, force_warning, num_error_samples) analysis.extract_data(min_time=min_time, max_time=max_time) if (not skip_c...
def analyze(model, force_warning=False, num_error_samples=1000, pre_equilibrium_approx=False, skip_checks=False, min_time=0.0, max_time=None): curdir = os.getcwd() analysis = Analysis(model, force_warning, num_error_samples) analysis.extract_data(min_time=min_time, max_time=max_time) if (not skip_c...
45453bce1550f82eb976ab0029c9bbd313e355d215584423b4a873079d37e28b
def __init__(self, model, force_warning=False, num_error_samples=0): '\n Creates the Analyze() object, which applies transition \n statistics and times, as well as MMVT theory, to compute \n kinetics and thermodynamics quantities.\n ' self.model = model self.anchor_stats_list = [...
Creates the Analyze() object, which applies transition statistics and times, as well as MMVT theory, to compute kinetics and thermodynamics quantities.
seekr2/analyze.py
__init__
seekrcentral/seekr2
1
python
def __init__(self, model, force_warning=False, num_error_samples=0): '\n Creates the Analyze() object, which applies transition \n statistics and times, as well as MMVT theory, to compute \n kinetics and thermodynamics quantities.\n ' self.model = model self.anchor_stats_list = [...
def __init__(self, model, force_warning=False, num_error_samples=0): '\n Creates the Analyze() object, which applies transition \n statistics and times, as well as MMVT theory, to compute \n kinetics and thermodynamics quantities.\n ' self.model = model self.anchor_stats_list = [...
13b700c2ccf45841ae8a69d7a71e614eba5322a315c47cf8cc053ab7f81b72f4
def elber_check_anchor_stats(self, silent=False): '\n Check the anchor statistics to make sure that enough bounces\n have been observed to perform the analysis\n ' anchors_missing_statistics = [] for (i, anchor) in enumerate(self.model.anchors): if anchor.bulkstate: ...
Check the anchor statistics to make sure that enough bounces have been observed to perform the analysis
seekr2/analyze.py
elber_check_anchor_stats
seekrcentral/seekr2
1
python
def elber_check_anchor_stats(self, silent=False): '\n Check the anchor statistics to make sure that enough bounces\n have been observed to perform the analysis\n ' anchors_missing_statistics = [] for (i, anchor) in enumerate(self.model.anchors): if anchor.bulkstate: ...
def elber_check_anchor_stats(self, silent=False): '\n Check the anchor statistics to make sure that enough bounces\n have been observed to perform the analysis\n ' anchors_missing_statistics = [] for (i, anchor) in enumerate(self.model.anchors): if anchor.bulkstate: ...
76e92edbad392b7b8b71a992b048720fdbc93f7d160be48cd26a7c1f17d3b96d
def mmvt_check_anchor_stats(self, silent=False): '\n Check the anchor statistics to make sure that enough transitions\n have been observed to perform the analysis\n ' anchors_missing_statistics = [] for (i, anchor) in enumerate(self.model.anchors): if anchor.bulkstate: ...
Check the anchor statistics to make sure that enough transitions have been observed to perform the analysis
seekr2/analyze.py
mmvt_check_anchor_stats
seekrcentral/seekr2
1
python
def mmvt_check_anchor_stats(self, silent=False): '\n Check the anchor statistics to make sure that enough transitions\n have been observed to perform the analysis\n ' anchors_missing_statistics = [] for (i, anchor) in enumerate(self.model.anchors): if anchor.bulkstate: ...
def mmvt_check_anchor_stats(self, silent=False): '\n Check the anchor statistics to make sure that enough transitions\n have been observed to perform the analysis\n ' anchors_missing_statistics = [] for (i, anchor) in enumerate(self.model.anchors): if anchor.bulkstate: ...
7b8493c4d09a31fc212fd844c2171df2f3c8a99e3ce662266cb1b5fb40e6befc
def extract_data(self, min_time=None, max_time=None, max_step_list=None, silence_errors=True): '\n Extract the data from simulations used in this analysis.\n ' files_already_read = False if (len(self.anchor_stats_list) > 0): files_already_read = True if (self.model.openmm_settings ...
Extract the data from simulations used in this analysis.
seekr2/analyze.py
extract_data
seekrcentral/seekr2
1
python
def extract_data(self, min_time=None, max_time=None, max_step_list=None, silence_errors=True): '\n \n ' files_already_read = False if (len(self.anchor_stats_list) > 0): files_already_read = True if (self.model.openmm_settings is not None): timestep = self.model.openmm_setti...
def extract_data(self, min_time=None, max_time=None, max_step_list=None, silence_errors=True): '\n \n ' files_already_read = False if (len(self.anchor_stats_list) > 0): files_already_read = True if (self.model.openmm_settings is not None): timestep = self.model.openmm_setti...
a0d8afd58160615446cf60049bb2bb637cc640f5d31f54d96895f17aee96e71b
def check_extraction(self, silent=False): '\n Check whether sufficient and correct anchor statistics can \n be used for analysis.\n ' if (self.model.get_type() == 'mmvt'): result = self.mmvt_check_anchor_stats(silent) if (self.model.get_type() == 'elber'): result = self....
Check whether sufficient and correct anchor statistics can be used for analysis.
seekr2/analyze.py
check_extraction
seekrcentral/seekr2
1
python
def check_extraction(self, silent=False): '\n Check whether sufficient and correct anchor statistics can \n be used for analysis.\n ' if (self.model.get_type() == 'mmvt'): result = self.mmvt_check_anchor_stats(silent) if (self.model.get_type() == 'elber'): result = self....
def check_extraction(self, silent=False): '\n Check whether sufficient and correct anchor statistics can \n be used for analysis.\n ' if (self.model.get_type() == 'mmvt'): result = self.mmvt_check_anchor_stats(silent) if (self.model.get_type() == 'elber'): result = self....
fc5043d35a61bf954f5a3b37d3018ec9fa25c219b63aaf1af148665c65c515da
def fill_out_data_samples_mmvt(self): '\n Now that the statistics for each anchor have been extracted\n from the output files, construct the global transition\n statistics objects. Applies to systems using MMVT milestoning.\n ' N_alpha_beta = defaultdict(int) k_alpha_beta = defau...
Now that the statistics for each anchor have been extracted from the output files, construct the global transition statistics objects. Applies to systems using MMVT milestoning.
seekr2/analyze.py
fill_out_data_samples_mmvt
seekrcentral/seekr2
1
python
def fill_out_data_samples_mmvt(self): '\n Now that the statistics for each anchor have been extracted\n from the output files, construct the global transition\n statistics objects. Applies to systems using MMVT milestoning.\n ' N_alpha_beta = defaultdict(int) k_alpha_beta = defau...
def fill_out_data_samples_mmvt(self): '\n Now that the statistics for each anchor have been extracted\n from the output files, construct the global transition\n statistics objects. Applies to systems using MMVT milestoning.\n ' N_alpha_beta = defaultdict(int) k_alpha_beta = defau...
c9ac71397771c10fcb19c6468bac89e794cc743d71b949071aec13b0e3cce755
def process_data_samples_mmvt(self, pre_equilibrium_approx=False): '\n Since the global, system-side statistics have been gathered, \n compute the thermodynamic and kinetic quantities and their\n uncertainties. Applies to systems using MMVT milestoning.\n ' self.main_data_sample.calc...
Since the global, system-side statistics have been gathered, compute the thermodynamic and kinetic quantities and their uncertainties. Applies to systems using MMVT milestoning.
seekr2/analyze.py
process_data_samples_mmvt
seekrcentral/seekr2
1
python
def process_data_samples_mmvt(self, pre_equilibrium_approx=False): '\n Since the global, system-side statistics have been gathered, \n compute the thermodynamic and kinetic quantities and their\n uncertainties. Applies to systems using MMVT milestoning.\n ' self.main_data_sample.calc...
def process_data_samples_mmvt(self, pre_equilibrium_approx=False): '\n Since the global, system-side statistics have been gathered, \n compute the thermodynamic and kinetic quantities and their\n uncertainties. Applies to systems using MMVT milestoning.\n ' self.main_data_sample.calc...
cbdf63bfc005dcafcf3fae2272dc2c15206591faa99dab590d0c557b7a5e3004
def fill_out_data_samples_elber(self): '\n Now that the statistics for each anchor have been extracted\n from the output files, construct the global transition\n statistics objects. Applies to systems using Elber milestoning.\n ' N_i_j_list = [] R_i_total = [] R_i_average = [...
Now that the statistics for each anchor have been extracted from the output files, construct the global transition statistics objects. Applies to systems using Elber milestoning.
seekr2/analyze.py
fill_out_data_samples_elber
seekrcentral/seekr2
1
python
def fill_out_data_samples_elber(self): '\n Now that the statistics for each anchor have been extracted\n from the output files, construct the global transition\n statistics objects. Applies to systems using Elber milestoning.\n ' N_i_j_list = [] R_i_total = [] R_i_average = [...
def fill_out_data_samples_elber(self): '\n Now that the statistics for each anchor have been extracted\n from the output files, construct the global transition\n statistics objects. Applies to systems using Elber milestoning.\n ' N_i_j_list = [] R_i_total = [] R_i_average = [...
ab71766e0d9de83ad5210f11a21b36a4873d67ac8e163cc6c7a4619a81fe935d
def process_data_samples_elber(self, pre_equilibrium_approx=False): '\n Since the global, system-side statistics have been gathered, \n compute the thermodynamic and kinetic quantities and their\n uncertainties. Applies to systems using Elber milestoning.\n ' if (self.model.k_on_info...
Since the global, system-side statistics have been gathered, compute the thermodynamic and kinetic quantities and their uncertainties. Applies to systems using Elber milestoning.
seekr2/analyze.py
process_data_samples_elber
seekrcentral/seekr2
1
python
def process_data_samples_elber(self, pre_equilibrium_approx=False): '\n Since the global, system-side statistics have been gathered, \n compute the thermodynamic and kinetic quantities and their\n uncertainties. Applies to systems using Elber milestoning.\n ' if (self.model.k_on_info...
def process_data_samples_elber(self, pre_equilibrium_approx=False): '\n Since the global, system-side statistics have been gathered, \n compute the thermodynamic and kinetic quantities and their\n uncertainties. Applies to systems using Elber milestoning.\n ' if (self.model.k_on_info...
cfe765b37af9e0ecb84861318a9b0d223974c7971440b14228a568cfaac1d167
def fill_out_data_samples(self): '\n Based on the type of milestoning, construct the data samples\n and fill out their statistics.\n ' if (self.model.get_type() == 'mmvt'): self.fill_out_data_samples_mmvt() elif (self.model.get_type() == 'elber'): self.fill_out_data_samp...
Based on the type of milestoning, construct the data samples and fill out their statistics.
seekr2/analyze.py
fill_out_data_samples
seekrcentral/seekr2
1
python
def fill_out_data_samples(self): '\n Based on the type of milestoning, construct the data samples\n and fill out their statistics.\n ' if (self.model.get_type() == 'mmvt'): self.fill_out_data_samples_mmvt() elif (self.model.get_type() == 'elber'): self.fill_out_data_samp...
def fill_out_data_samples(self): '\n Based on the type of milestoning, construct the data samples\n and fill out their statistics.\n ' if (self.model.get_type() == 'mmvt'): self.fill_out_data_samples_mmvt() elif (self.model.get_type() == 'elber'): self.fill_out_data_samp...
4b709d52f970f13a9c96e2b2aff392d7cce490d45ba6cc7687db069798a30865
def process_data_samples(self, pre_equilibrium_approx=False): '\n Based on the type of milestoning, use the data samples to \n compute thermo and kinetics quantities and their uncertainties.\n ' if (self.model.get_type() == 'mmvt'): self.process_data_samples_mmvt(pre_equilibrium_app...
Based on the type of milestoning, use the data samples to compute thermo and kinetics quantities and their uncertainties.
seekr2/analyze.py
process_data_samples
seekrcentral/seekr2
1
python
def process_data_samples(self, pre_equilibrium_approx=False): '\n Based on the type of milestoning, use the data samples to \n compute thermo and kinetics quantities and their uncertainties.\n ' if (self.model.get_type() == 'mmvt'): self.process_data_samples_mmvt(pre_equilibrium_app...
def process_data_samples(self, pre_equilibrium_approx=False): '\n Based on the type of milestoning, use the data samples to \n compute thermo and kinetics quantities and their uncertainties.\n ' if (self.model.get_type() == 'mmvt'): self.process_data_samples_mmvt(pre_equilibrium_app...
376aa3de636f99068f01b66254b97e6a1ed1b31b583177dedd9112de41d5e582
def resample_k_N_R_T(self, N_alpha_beta, N_i_j_alpha, R_i_alpha_total, R_i_alpha_average, R_i_alpha_std_dev, R_i_alpha_count, T_alpha_total, T_alpha_average, T_alpha_std_dev, T_alpha_count): '\n Create data samples from a distribution for computing the\n uncertainties of the thermo and kinetics.\n ...
Create data samples from a distribution for computing the uncertainties of the thermo and kinetics.
seekr2/analyze.py
resample_k_N_R_T
seekrcentral/seekr2
1
python
def resample_k_N_R_T(self, N_alpha_beta, N_i_j_alpha, R_i_alpha_total, R_i_alpha_average, R_i_alpha_std_dev, R_i_alpha_count, T_alpha_total, T_alpha_average, T_alpha_std_dev, T_alpha_count): '\n Create data samples from a distribution for computing the\n uncertainties of the thermo and kinetics.\n ...
def resample_k_N_R_T(self, N_alpha_beta, N_i_j_alpha, R_i_alpha_total, R_i_alpha_average, R_i_alpha_std_dev, R_i_alpha_count, T_alpha_total, T_alpha_average, T_alpha_std_dev, T_alpha_count): '\n Create data samples from a distribution for computing the\n uncertainties of the thermo and kinetics.\n ...
154c86fd1fe266a4ba04a727c84350e93099ad8fa85eff12e03dd80260a14483
def print_results(self): 'Print all results of the analysis calculation.' print('Printing results from MMVT SEEKR calculation') print('k_off (1/s):', common_analyze.pretty_string_value_error(self.k_off, self.k_off_error)) print('k_ons :') for key in self.k_ons: k_on = float(self.k_ons[key]) ...
Print all results of the analysis calculation.
seekr2/analyze.py
print_results
seekrcentral/seekr2
1
python
def print_results(self): print('Printing results from MMVT SEEKR calculation') print('k_off (1/s):', common_analyze.pretty_string_value_error(self.k_off, self.k_off_error)) print('k_ons :') for key in self.k_ons: k_on = float(self.k_ons[key]) diss_constant = (self.k_off / k_on) ...
def print_results(self): print('Printing results from MMVT SEEKR calculation') print('k_off (1/s):', common_analyze.pretty_string_value_error(self.k_off, self.k_off_error)) print('k_ons :') for key in self.k_ons: k_on = float(self.k_ons[key]) diss_constant = (self.k_off / k_on) ...
b94b22d3bb36da4e3005f7ee3d0d0b7750d7a188865e706f1e135ba8aff697b6
def save_plots(self, image_directory): '\n Save a potentially useful series of plots of some quantities\n obtained during the analysis.\n \n TODO: interact with model, because the way these plots are saved\n depends on the structure of the CVs.\n ' anchor_indices = np.z...
Save a potentially useful series of plots of some quantities obtained during the analysis. TODO: interact with model, because the way these plots are saved depends on the structure of the CVs.
seekr2/analyze.py
save_plots
seekrcentral/seekr2
1
python
def save_plots(self, image_directory): '\n Save a potentially useful series of plots of some quantities\n obtained during the analysis.\n \n TODO: interact with model, because the way these plots are saved\n depends on the structure of the CVs.\n ' anchor_indices = np.z...
def save_plots(self, image_directory): '\n Save a potentially useful series of plots of some quantities\n obtained during the analysis.\n \n TODO: interact with model, because the way these plots are saved\n depends on the structure of the CVs.\n ' anchor_indices = np.z...
6f3922edcd56da93c12ba7594f0cf18764fc9dbce02b1be41e11505a9be9e680
def lowestCommonAncestor(self, root, p, q): '\n :type root: TreeNode\n :type p: TreeNode\n :type q: TreeNode\n :rtype: TreeNode\n ' self.pre_order(root, p, q) return self.ret
:type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode
leetcode/python/lca_bt.py
lowestCommonAncestor
haonancool/OnlineJudge
0
python
def lowestCommonAncestor(self, root, p, q): '\n :type root: TreeNode\n :type p: TreeNode\n :type q: TreeNode\n :rtype: TreeNode\n ' self.pre_order(root, p, q) return self.ret
def lowestCommonAncestor(self, root, p, q): '\n :type root: TreeNode\n :type p: TreeNode\n :type q: TreeNode\n :rtype: TreeNode\n ' self.pre_order(root, p, q) return self.ret<|docstring|>:type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode<|endoftext|>
10c3f85824158a27db612162fca14242efd4600c6bce5e582b8b12cbe31acf37
def load_calib(): '\n 读取内参矩阵\n ' def intrinsics(date): calib = open((('dataloaders/' + str(date)) + '.txt'), 'r') lines = calib.readlines() P_rect_line = lines[25] Proj_str = P_rect_line.split(':')[1].split(' ')[1:] Proj = np.reshape(np.array([float(p) for p in Pro...
读取内参矩阵
dataloaders/kitti_loader.py
load_calib
Hansry/Semi-supervised-depth-estimation
0
python
def load_calib(): '\n \n ' def intrinsics(date): calib = open((('dataloaders/' + str(date)) + '.txt'), 'r') lines = calib.readlines() P_rect_line = lines[25] Proj_str = P_rect_line.split(':')[1].split(' ')[1:] Proj = np.reshape(np.array([float(p) for p in Proj_str]...
def load_calib(): '\n \n ' def intrinsics(date): calib = open((('dataloaders/' + str(date)) + '.txt'), 'r') lines = calib.readlines() P_rect_line = lines[25] Proj_str = P_rect_line.split(':')[1].split(' ')[1:] Proj = np.reshape(np.array([float(p) for p in Proj_str]...
4d10cf9f23350c1b65804207ae46e70314ad4c96f253b28b1bb6afe7891019e3
def load_transfrom(): '\n 读取左右相机的转换关系\n ' def load_R_t(date): calib_t = open((('dataloaders/' + str(date)) + '.txt'), 'r') transforms = calib_t.readlines() lines_R_0to2 = transforms[21] R_0to2_str = lines_R_0to2.split(':')[1].split(' ')[1:] R_0to2 = np.reshape(np.a...
读取左右相机的转换关系
dataloaders/kitti_loader.py
load_transfrom
Hansry/Semi-supervised-depth-estimation
0
python
def load_transfrom(): '\n \n ' def load_R_t(date): calib_t = open((('dataloaders/' + str(date)) + '.txt'), 'r') transforms = calib_t.readlines() lines_R_0to2 = transforms[21] R_0to2_str = lines_R_0to2.split(':')[1].split(' ')[1:] R_0to2 = np.reshape(np.array([float...
def load_transfrom(): '\n \n ' def load_R_t(date): calib_t = open((('dataloaders/' + str(date)) + '.txt'), 'r') transforms = calib_t.readlines() lines_R_0to2 = transforms[21] R_0to2_str = lines_R_0to2.split(':')[1].split(' ')[1:] R_0to2 = np.reshape(np.array([float...
fef4bd5e660cc670bdb3b81896592f31ee4f766bbe594c92a38116e26a9386d7
def sortby(tree, col, descending): 'sort tree contents when a column header is clicked on' data = [(tree.set(child, col), child) for child in tree.get_children('')] data.sort(reverse=descending) for (ix, item) in enumerate(data): tree.move(item[1], '', ix) tree.heading(col, command=(lambda c...
sort tree contents when a column header is clicked on
tkinter/basic/test/test10.py
sortby
sdyz5210/python
0
python
def sortby(tree, col, descending): data = [(tree.set(child, col), child) for child in tree.get_children()] data.sort(reverse=descending) for (ix, item) in enumerate(data): tree.move(item[1], , ix) tree.heading(col, command=(lambda col=col: sortby(tree, col, int((not descending)))))
def sortby(tree, col, descending): data = [(tree.set(child, col), child) for child in tree.get_children()] data.sort(reverse=descending) for (ix, item) in enumerate(data): tree.move(item[1], , ix) tree.heading(col, command=(lambda col=col: sortby(tree, col, int((not descending)))))<|docstri...
26fc7d8b413b547a0df20a5b9d3140c8888378460af497819b761dbce504ec54
def create_lat_lon_features(constant_maps): '\n create latitude and longitude as additional feature for data\n\n Parameters\n ----------\n data: xarray dataarray, with dimensions including latitude and longitude\n\n Returns\n ----------\n latitude_arr\n longitude_arr\n ' (londata, lat...
create latitude and longitude as additional feature for data Parameters ---------- data: xarray dataarray, with dimensions including latitude and longitude Returns ---------- latitude_arr longitude_arr
climfill/feature_engineering.py
create_lat_lon_features
climachine/climfill
10
python
def create_lat_lon_features(constant_maps): '\n create latitude and longitude as additional feature for data\n\n Parameters\n ----------\n data: xarray dataarray, with dimensions including latitude and longitude\n\n Returns\n ----------\n latitude_arr\n longitude_arr\n ' (londata, lat...
def create_lat_lon_features(constant_maps): '\n create latitude and longitude as additional feature for data\n\n Parameters\n ----------\n data: xarray dataarray, with dimensions including latitude and longitude\n\n Returns\n ----------\n latitude_arr\n longitude_arr\n ' (londata, lat...
e3cd6388b76f6893be8a2b6430b20a570051e030518fa110112a0c9d3c884e8e
def create_time_feature(data): '\n create timestep as additional feature for data\n\n Parameters\n ----------\n data: xarray dataarray, with dimensions including landpoints, time\n\n Returns\n ----------\n time_arr: xarray with same dimensions as one feature in array describing\n time st...
create timestep as additional feature for data Parameters ---------- data: xarray dataarray, with dimensions including landpoints, time Returns ---------- time_arr: xarray with same dimensions as one feature in array describing time step
climfill/feature_engineering.py
create_time_feature
climachine/climfill
10
python
def create_time_feature(data): '\n create timestep as additional feature for data\n\n Parameters\n ----------\n data: xarray dataarray, with dimensions including landpoints, time\n\n Returns\n ----------\n time_arr: xarray with same dimensions as one feature in array describing\n time st...
def create_time_feature(data): '\n create timestep as additional feature for data\n\n Parameters\n ----------\n data: xarray dataarray, with dimensions including landpoints, time\n\n Returns\n ----------\n time_arr: xarray with same dimensions as one feature in array describing\n time st...
cc878b9b12c28276a295d84da5b7dea0fb4e14e1c490625735bb7e34caca01ec
def create_embedded_feature(data, start=(- 7), end=0, name='lag_7b'): "\n create moving window mean along time axis from day 'start' until\n day 'end' relative to current day using xr.DataArray.rolling\n\n Parameters\n ----------\n data: xarray dataarray, with dimensions including variable, time\n\n ...
create moving window mean along time axis from day 'start' until day 'end' relative to current day using xr.DataArray.rolling Parameters ---------- data: xarray dataarray, with dimensions including variable, time start: int, start of moving average in days from current day end: int, end of moving average in days fro...
climfill/feature_engineering.py
create_embedded_feature
climachine/climfill
10
python
def create_embedded_feature(data, start=(- 7), end=0, name='lag_7b'): "\n create moving window mean along time axis from day 'start' until\n day 'end' relative to current day using xr.DataArray.rolling\n\n Parameters\n ----------\n data: xarray dataarray, with dimensions including variable, time\n\n ...
def create_embedded_feature(data, start=(- 7), end=0, name='lag_7b'): "\n create moving window mean along time axis from day 'start' until\n day 'end' relative to current day using xr.DataArray.rolling\n\n Parameters\n ----------\n data: xarray dataarray, with dimensions including variable, time\n\n ...
6e08697447a51412842041aa6ec8313623645ce4c5b2e3406fd02d4c95b8bca6
def format_submitter_id(node, args): '\n Generates "submitter_id" for node with additional identificator values.\n Resulting "submitter_id" only contains lowercase letters, digits, underscore and dash.\n\n Args:\n node (str): node name for "submitter_id"\n args (dict): additional arguments to...
Generates "submitter_id" for node with additional identificator values. Resulting "submitter_id" only contains lowercase letters, digits, underscore and dash. Args: node (str): node name for "submitter_id" args (dict): additional arguments to add to "submitter_id" Returns: str: generated "submitter_id"
covid19-etl/utils/format_helper.py
format_submitter_id
uc-cdis/covid19-tools
2
python
def format_submitter_id(node, args): '\n Generates "submitter_id" for node with additional identificator values.\n Resulting "submitter_id" only contains lowercase letters, digits, underscore and dash.\n\n Args:\n node (str): node name for "submitter_id"\n args (dict): additional arguments to...
def format_submitter_id(node, args): '\n Generates "submitter_id" for node with additional identificator values.\n Resulting "submitter_id" only contains lowercase letters, digits, underscore and dash.\n\n Args:\n node (str): node name for "submitter_id"\n args (dict): additional arguments to...
ef1a92ed7359445f07c31a6ae92d62174fa0cd788cfac41ed6d733ab675eb2c1
def derived_submitter_id(submitter_id, original_node, derived_node, args): '\n Derive "submitter_id" for other node.\n\n Args:\n submitter_id (str): "submitter_id" to derive from\n original_node (str): name of original node\n derived_node (str): name of derived node\n args (dict): ...
Derive "submitter_id" for other node. Args: submitter_id (str): "submitter_id" to derive from original_node (str): name of original node derived_node (str): name of derived node args (dict): additional arguments to add to "derived_submitter_id" Returns: str: generated "derived_submitter_id"
covid19-etl/utils/format_helper.py
derived_submitter_id
uc-cdis/covid19-tools
2
python
def derived_submitter_id(submitter_id, original_node, derived_node, args): '\n Derive "submitter_id" for other node.\n\n Args:\n submitter_id (str): "submitter_id" to derive from\n original_node (str): name of original node\n derived_node (str): name of derived node\n args (dict): ...
def derived_submitter_id(submitter_id, original_node, derived_node, args): '\n Derive "submitter_id" for other node.\n\n Args:\n submitter_id (str): "submitter_id" to derive from\n original_node (str): name of original node\n derived_node (str): name of derived node\n args (dict): ...
a6d018b0d2a770c6b832faedbbd942a0811cb62102a35538e662da26c9dbbbd5
def idph_get_date(date_json): '\n Get date from IDPH JSON\n\n Args:\n date_json (dict): JSON date with "year", "month", "date" fields\n\n Returns:\n str: datetime in "%Y-%m-%d" format\n ' date = datetime.date(**date_json) return date.strftime('%Y-%m-%d')
Get date from IDPH JSON Args: date_json (dict): JSON date with "year", "month", "date" fields Returns: str: datetime in "%Y-%m-%d" format
covid19-etl/utils/format_helper.py
idph_get_date
uc-cdis/covid19-tools
2
python
def idph_get_date(date_json): '\n Get date from IDPH JSON\n\n Args:\n date_json (dict): JSON date with "year", "month", "date" fields\n\n Returns:\n str: datetime in "%Y-%m-%d" format\n ' date = datetime.date(**date_json) return date.strftime('%Y-%m-%d')
def idph_get_date(date_json): '\n Get date from IDPH JSON\n\n Args:\n date_json (dict): JSON date with "year", "month", "date" fields\n\n Returns:\n str: datetime in "%Y-%m-%d" format\n ' date = datetime.date(**date_json) return date.strftime('%Y-%m-%d')<|docstring|>Get date from I...
f6d0fcd870212350a665d8680ffe7cc7aea4e0769051c27258e2e2d62fe74146
def idph_last_reported_date(utilization_records): '\n Fetches the "ReportDate" value from the last record of the utilization array\n\n Args:\n utilization_records (list) : List of all historical hospital utilization records\n\n Returns:\n str: last reported date of the data in "%Y-%m-%d" form...
Fetches the "ReportDate" value from the last record of the utilization array Args: utilization_records (list) : List of all historical hospital utilization records Returns: str: last reported date of the data in "%Y-%m-%d" format
covid19-etl/utils/format_helper.py
idph_last_reported_date
uc-cdis/covid19-tools
2
python
def idph_last_reported_date(utilization_records): '\n Fetches the "ReportDate" value from the last record of the utilization array\n\n Args:\n utilization_records (list) : List of all historical hospital utilization records\n\n Returns:\n str: last reported date of the data in "%Y-%m-%d" form...
def idph_last_reported_date(utilization_records): '\n Fetches the "ReportDate" value from the last record of the utilization array\n\n Args:\n utilization_records (list) : List of all historical hospital utilization records\n\n Returns:\n str: last reported date of the data in "%Y-%m-%d" form...
c81961d68d820dd5a5944488f1ac56955d7204b5e5d2a86dce14370930e59aad
def get_date_from_str(date_str): "\n Receives a date string in %Y-%m-%d format and returns a 'datetime.date' object\n " return datetime.datetime.strptime(remove_time_from_date_time(date_str), '%Y-%m-%d').date()
Receives a date string in %Y-%m-%d format and returns a 'datetime.date' object
covid19-etl/utils/format_helper.py
get_date_from_str
uc-cdis/covid19-tools
2
python
def get_date_from_str(date_str): "\n \n " return datetime.datetime.strptime(remove_time_from_date_time(date_str), '%Y-%m-%d').date()
def get_date_from_str(date_str): "\n \n " return datetime.datetime.strptime(remove_time_from_date_time(date_str), '%Y-%m-%d').date()<|docstring|>Receives a date string in %Y-%m-%d format and returns a 'datetime.date' object<|endoftext|>
5b6b7fd834d5fb369ab7ffaed3d6efdd04fddfb4507e13cc66169cb22affb1b0
def __init__(self, file_name='data.csv', transport=True): 'Computes the aircraft center of gravity at operational empty weight' self.data = load_data(file_name) if transport: self.factors = {'wing': 12.2, 'fuselage': 6.8, 'horizontal_tail': 9.8, 'vertical_tail': 9.8, 'nose_gear': 0.009, 'main_gear':...
Computes the aircraft center of gravity at operational empty weight
aircraft/cg_calculation.py
__init__
iamlucassantos/tutorial-systems-engineering
1
python
def __init__(self, file_name='data.csv', transport=True): self.data = load_data(file_name) if transport: self.factors = {'wing': 12.2, 'fuselage': 6.8, 'horizontal_tail': 9.8, 'vertical_tail': 9.8, 'nose_gear': 0.009, 'main_gear': 0.048, 'power_plant': 1.4, 'systems': 0.1} else: self.fa...
def __init__(self, file_name='data.csv', transport=True): self.data = load_data(file_name) if transport: self.factors = {'wing': 12.2, 'fuselage': 6.8, 'horizontal_tail': 9.8, 'vertical_tail': 9.8, 'nose_gear': 0.009, 'main_gear': 0.048, 'power_plant': 1.4, 'systems': 0.1} else: self.fa...
5403d4307d2846cbb20192013b25797aa958b581ad655286da2a818b169cd3ad
def get_cr(self): 'Computes the chord length at the rooot for wing, vertica tail and horizontal tail' self.cr = ((2 * self.data['S']) / ((self.data['taper'] + 1) * self.data['b'])) self.cr_h = ((2 * self.data['S_h']) / ((self.data['taper_h'] + 1) * self.data['b_h'])) self.cr_v = ((2 * self.data['S_v']) ...
Computes the chord length at the rooot for wing, vertica tail and horizontal tail
aircraft/cg_calculation.py
get_cr
iamlucassantos/tutorial-systems-engineering
1
python
def get_cr(self): self.cr = ((2 * self.data['S']) / ((self.data['taper'] + 1) * self.data['b'])) self.cr_h = ((2 * self.data['S_h']) / ((self.data['taper_h'] + 1) * self.data['b_h'])) self.cr_v = ((2 * self.data['S_v']) / (((self.data['taper_v'] + 1) * self.data['b_half_v']) * 2))
def get_cr(self): self.cr = ((2 * self.data['S']) / ((self.data['taper'] + 1) * self.data['b'])) self.cr_h = ((2 * self.data['S_h']) / ((self.data['taper_h'] + 1) * self.data['b_h'])) self.cr_v = ((2 * self.data['S_v']) / (((self.data['taper_v'] + 1) * self.data['b_half_v']) * 2))<|docstring|>Computes ...
e9ec2c67176623b221a25fdd91732c785427c4276cb124a60e1cdb4fe0c1c37c
def get_areas(self): 'Returns the areas of each group to estimate their mass' areas = {} S = self.data['S'] d_fus = self.data['l_h'] b = self.data['b'] (chord_fuselage, _) = self.chord_at_pctg((d_fus / b), surface='w') area_w = (S - (d_fus * chord_fuselage)) areas['wing'] = area_w ar...
Returns the areas of each group to estimate their mass
aircraft/cg_calculation.py
get_areas
iamlucassantos/tutorial-systems-engineering
1
python
def get_areas(self): areas = {} S = self.data['S'] d_fus = self.data['l_h'] b = self.data['b'] (chord_fuselage, _) = self.chord_at_pctg((d_fus / b), surface='w') area_w = (S - (d_fus * chord_fuselage)) areas['wing'] = area_w area_v = self.data['S_v'] areas['vertical_tail'] = are...
def get_areas(self): areas = {} S = self.data['S'] d_fus = self.data['l_h'] b = self.data['b'] (chord_fuselage, _) = self.chord_at_pctg((d_fus / b), surface='w') area_w = (S - (d_fus * chord_fuselage)) areas['wing'] = area_w area_v = self.data['S_v'] areas['vertical_tail'] = are...