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 |
|---|---|---|---|---|---|---|---|---|---|
0eeb6ed1fec646ea9834661ae1fd15fc7d2dbb729b6e1f013155448e47921428 | def parse_table(table, idx_map: dict):
'\n Remove unneccessary rows and convert\n undesirable string format to float\n '
nan_rows = table.isnull().all(axis=1)
table = table.loc[(~ nan_rows)]
idx = table.index.to_list()
idx = DBC2SBC(idx)
for (i, ix) in enumerate(idx):
if (ix in ... | Remove unneccessary rows and convert
undesirable string format to float | industry/industry.py | parse_table | linusqzdeng/macroind-crawler | 0 | python | def parse_table(table, idx_map: dict):
'\n Remove unneccessary rows and convert\n undesirable string format to float\n '
nan_rows = table.isnull().all(axis=1)
table = table.loc[(~ nan_rows)]
idx = table.index.to_list()
idx = DBC2SBC(idx)
for (i, ix) in enumerate(idx):
if (ix in ... | def parse_table(table, idx_map: dict):
'\n Remove unneccessary rows and convert\n undesirable string format to float\n '
nan_rows = table.isnull().all(axis=1)
table = table.loc[(~ nan_rows)]
idx = table.index.to_list()
idx = DBC2SBC(idx)
for (i, ix) in enumerate(idx):
if (ix in ... |
d95c5656419f741b1052006a88179e44bd6d22883a0ff5724d5d2fc86122242a | def DBC2SBC(ustring_list):
'全角转半角'
ustring_list = list(map((lambda x: x.strip()), ustring_list))
normal_str_list = []
for i in range(len(ustring_list)):
rstring = ''
for uchar in ustring_list[i]:
if (uchar == ' '):
continue
inside_code = ord(uchar)... | 全角转半角 | industry/industry.py | DBC2SBC | linusqzdeng/macroind-crawler | 0 | python | def DBC2SBC(ustring_list):
ustring_list = list(map((lambda x: x.strip()), ustring_list))
normal_str_list = []
for i in range(len(ustring_list)):
rstring =
for uchar in ustring_list[i]:
if (uchar == ' '):
continue
inside_code = ord(uchar)
... | def DBC2SBC(ustring_list):
ustring_list = list(map((lambda x: x.strip()), ustring_list))
normal_str_list = []
for i in range(len(ustring_list)):
rstring =
for uchar in ustring_list[i]:
if (uchar == ' '):
continue
inside_code = ord(uchar)
... |
01a4885f0f1e8b85ecc06c3d8ac8ef43e697a8fcc69e28475a7dd54f8fd7a55c | def main(page_num: int, bypass_pages: list=None):
'\n Main loop of the crawler\n\n Params\n ------\n - page_num: int\n Total number of page to scrape \n - bypass_pages: list\n List of page number that you widh the program to ignore \n '
ua = UserAgent()
headers = {'User-Agent... | Main loop of the crawler
Params
------
- page_num: int
Total number of page to scrape
- bypass_pages: list
List of page number that you widh the program to ignore | industry/industry.py | main | linusqzdeng/macroind-crawler | 0 | python | def main(page_num: int, bypass_pages: list=None):
'\n Main loop of the crawler\n\n Params\n ------\n - page_num: int\n Total number of page to scrape \n - bypass_pages: list\n List of page number that you widh the program to ignore \n '
ua = UserAgent()
headers = {'User-Agent... | def main(page_num: int, bypass_pages: list=None):
'\n Main loop of the crawler\n\n Params\n ------\n - page_num: int\n Total number of page to scrape \n - bypass_pages: list\n List of page number that you widh the program to ignore \n '
ua = UserAgent()
headers = {'User-Agent... |
3684315eb7b5ba7b26320dac54e161c5c4584632cda87b0043f7b076af2a8815 | def _create_mesh_motion_solving_strategy(self):
'Create the mesh motion solving strategy.\n\n The mesh motion solving strategy must provide the functions defined in SolutionStrategy.\n '
raise Exception('Mesh motion solving strategy must be created by the derived class.') | Create the mesh motion solving strategy.
The mesh motion solving strategy must provide the functions defined in SolutionStrategy. | applications/MeshMovingApplication/python_scripts/mesh_solver_base.py | _create_mesh_motion_solving_strategy | lkusch/Kratos | 778 | python | def _create_mesh_motion_solving_strategy(self):
'Create the mesh motion solving strategy.\n\n The mesh motion solving strategy must provide the functions defined in SolutionStrategy.\n '
raise Exception('Mesh motion solving strategy must be created by the derived class.') | def _create_mesh_motion_solving_strategy(self):
'Create the mesh motion solving strategy.\n\n The mesh motion solving strategy must provide the functions defined in SolutionStrategy.\n '
raise Exception('Mesh motion solving strategy must be created by the derived class.')<|docstring|>Create the me... |
08b3ee57d10d44e14d598f357a25d9e58b85012ada840dc8ba8d0ecca9925a7f | def _set_and_fill_buffer(self):
'Prepare nodal solution step data containers and time step information. '
buffer_size = self.GetMinimumBufferSize()
self.mesh_model_part.SetBufferSize(buffer_size)
delta_time = self.mesh_model_part.ProcessInfo[KratosMultiphysics.DELTA_TIME]
time = self.mesh_model_part... | Prepare nodal solution step data containers and time step information. | applications/MeshMovingApplication/python_scripts/mesh_solver_base.py | _set_and_fill_buffer | lkusch/Kratos | 778 | python | def _set_and_fill_buffer(self):
' '
buffer_size = self.GetMinimumBufferSize()
self.mesh_model_part.SetBufferSize(buffer_size)
delta_time = self.mesh_model_part.ProcessInfo[KratosMultiphysics.DELTA_TIME]
time = self.mesh_model_part.ProcessInfo[KratosMultiphysics.TIME]
step = (- buffer_size)
t... | def _set_and_fill_buffer(self):
' '
buffer_size = self.GetMinimumBufferSize()
self.mesh_model_part.SetBufferSize(buffer_size)
delta_time = self.mesh_model_part.ProcessInfo[KratosMultiphysics.DELTA_TIME]
time = self.mesh_model_part.ProcessInfo[KratosMultiphysics.TIME]
step = (- buffer_size)
t... |
ae3d1a5b28a20e919984313d7d449f6213510550f7c03a4a1b266f8a2c2f3954 | def __CreateTimeIntegratorHelper(self):
'Initializing the helper-class for the time-integration\n '
mesh_vel_calc_setting = self.settings['mesh_velocity_calculation']
time_scheme = mesh_vel_calc_setting['time_scheme'].GetString()
if (time_scheme == 'bdf1'):
self.time_int_helper = KratosMu... | Initializing the helper-class for the time-integration | applications/MeshMovingApplication/python_scripts/mesh_solver_base.py | __CreateTimeIntegratorHelper | lkusch/Kratos | 778 | python | def __CreateTimeIntegratorHelper(self):
'\n '
mesh_vel_calc_setting = self.settings['mesh_velocity_calculation']
time_scheme = mesh_vel_calc_setting['time_scheme'].GetString()
if (time_scheme == 'bdf1'):
self.time_int_helper = KratosMultiphysics.TimeDiscretization.BDF1()
elif (time_sc... | def __CreateTimeIntegratorHelper(self):
'\n '
mesh_vel_calc_setting = self.settings['mesh_velocity_calculation']
time_scheme = mesh_vel_calc_setting['time_scheme'].GetString()
if (time_scheme == 'bdf1'):
self.time_int_helper = KratosMultiphysics.TimeDiscretization.BDF1()
elif (time_sc... |
59761d93770f6cf7c62d5d5383bfa3dd028b658040eb336c8b303b7a14af819d | def urlopen(url, params=None, **kwargs):
'Thin wrapper around requests get content.\n\n See requests.get docs for the `params` and `kwargs` options.\n\n '
return io.BytesIO(requests.get(url, params=params, **kwargs).content) | Thin wrapper around requests get content.
See requests.get docs for the `params` and `kwargs` options. | erddapy/utilities.py | urlopen | jmunroe/erddapy | 0 | python | def urlopen(url, params=None, **kwargs):
'Thin wrapper around requests get content.\n\n See requests.get docs for the `params` and `kwargs` options.\n\n '
return io.BytesIO(requests.get(url, params=params, **kwargs).content) | def urlopen(url, params=None, **kwargs):
'Thin wrapper around requests get content.\n\n See requests.get docs for the `params` and `kwargs` options.\n\n '
return io.BytesIO(requests.get(url, params=params, **kwargs).content)<|docstring|>Thin wrapper around requests get content.
See requests.get docs for ... |
4b645b62d96812221995c4176d4062559f86bacc082f40ab50abccc662a441d2 | @functools.lru_cache(maxsize=None)
def _check_url_response(url):
'Shortcut to `raise_for_status` instead of fetching the whole content.'
r = requests.head(url)
r.raise_for_status()
return url | Shortcut to `raise_for_status` instead of fetching the whole content. | erddapy/utilities.py | _check_url_response | jmunroe/erddapy | 0 | python | @functools.lru_cache(maxsize=None)
def _check_url_response(url):
r = requests.head(url)
r.raise_for_status()
return url | @functools.lru_cache(maxsize=None)
def _check_url_response(url):
r = requests.head(url)
r.raise_for_status()
return url<|docstring|>Shortcut to `raise_for_status` instead of fetching the whole content.<|endoftext|> |
cc48637b25c2c9d5e9afbbfd387552ff1d74743fce1e4a377efe03c85fe66002 | def _clean_response(response):
'Allow for `ext` or `.ext` format.\n\n The user can, for example, use either `.csv` or `csv` in the response kwarg.\n\n '
return response.lstrip('.') | Allow for `ext` or `.ext` format.
The user can, for example, use either `.csv` or `csv` in the response kwarg. | erddapy/utilities.py | _clean_response | jmunroe/erddapy | 0 | python | def _clean_response(response):
'Allow for `ext` or `.ext` format.\n\n The user can, for example, use either `.csv` or `csv` in the response kwarg.\n\n '
return response.lstrip('.') | def _clean_response(response):
'Allow for `ext` or `.ext` format.\n\n The user can, for example, use either `.csv` or `csv` in the response kwarg.\n\n '
return response.lstrip('.')<|docstring|>Allow for `ext` or `.ext` format.
The user can, for example, use either `.csv` or `csv` in the response kwarg.<|... |
c9175f1e5cba725fc0fac5ae99acfeff88c2db98ab10b9143ca03a29c97a70cb | def parse_dates(date_time):
'\n ERDDAP ReSTful API standardizes the representation of dates as either ISO\n strings or seconds since 1970, but internally ERDDAPY uses datetime-like\n objects. `timestamp` returns the expected strings in seconds since 1970.\n\n '
date_time = parse_time_string(date_tim... | ERDDAP ReSTful API standardizes the representation of dates as either ISO
strings or seconds since 1970, but internally ERDDAPY uses datetime-like
objects. `timestamp` returns the expected strings in seconds since 1970. | erddapy/utilities.py | parse_dates | jmunroe/erddapy | 0 | python | def parse_dates(date_time):
'\n ERDDAP ReSTful API standardizes the representation of dates as either ISO\n strings or seconds since 1970, but internally ERDDAPY uses datetime-like\n objects. `timestamp` returns the expected strings in seconds since 1970.\n\n '
date_time = parse_time_string(date_tim... | def parse_dates(date_time):
'\n ERDDAP ReSTful API standardizes the representation of dates as either ISO\n strings or seconds since 1970, but internally ERDDAPY uses datetime-like\n objects. `timestamp` returns the expected strings in seconds since 1970.\n\n '
date_time = parse_time_string(date_tim... |
404021ef0fa8436b1ecdd6248cf1056a8a33cf8a7798853d0ae68d61b85745a5 | def quote_string_constraints(kwargs):
'\n For constraints of String variables,\n the right-hand-side value must be surrounded by double quotes.\n\n '
return {k: (f'"{v}"' if isinstance(v, str) else v) for (k, v) in kwargs.items()} | For constraints of String variables,
the right-hand-side value must be surrounded by double quotes. | erddapy/utilities.py | quote_string_constraints | jmunroe/erddapy | 0 | python | def quote_string_constraints(kwargs):
'\n For constraints of String variables,\n the right-hand-side value must be surrounded by double quotes.\n\n '
return {k: (f'"{v}"' if isinstance(v, str) else v) for (k, v) in kwargs.items()} | def quote_string_constraints(kwargs):
'\n For constraints of String variables,\n the right-hand-side value must be surrounded by double quotes.\n\n '
return {k: (f'"{v}"' if isinstance(v, str) else v) for (k, v) in kwargs.items()}<|docstring|>For constraints of String variables,
the right-hand-side val... |
b50aaaa1b9539cab047f56d22efd2986e065c8926491b0723030ee8dc3201598 | def __init__(self, env):
' YOUR CODE HERE '
super().__init__()
self.env = env | YOUR CODE HERE | hw4/controllers.py | __init__ | zhenghaoz/cs294 | 4 | python | def __init__(self, env):
' '
super().__init__()
self.env = env | def __init__(self, env):
' '
super().__init__()
self.env = env<|docstring|>YOUR CODE HERE<|endoftext|> |
76c48bc864efb36b3e7a28c8bd5a55c880d0e525b51c49021feed67b98f886e1 | def get_action(self, state):
' YOUR CODE HERE '
' Your code should randomly sample an action uniformly from the action space '
return self.env.action_space.sample() | YOUR CODE HERE | hw4/controllers.py | get_action | zhenghaoz/cs294 | 4 | python | def get_action(self, state):
' '
' Your code should randomly sample an action uniformly from the action space '
return self.env.action_space.sample() | def get_action(self, state):
' '
' Your code should randomly sample an action uniformly from the action space '
return self.env.action_space.sample()<|docstring|>YOUR CODE HERE<|endoftext|> |
9f0289c112b603e90f632082f3c8968933d0499756fc905dd89eda952736c3c1 | def get_action(self, state):
' YOUR CODE HERE '
' Note: be careful to batch your simulations through the model for speed '
action_dim = self.env.action_space.shape[0]
state_dim = self.env.observation_space.shape[0]
path_actions = np.zeros([self.horizon, self.num_simulated_paths, action_dim])
pat... | YOUR CODE HERE | hw4/controllers.py | get_action | zhenghaoz/cs294 | 4 | python | def get_action(self, state):
' '
' Note: be careful to batch your simulations through the model for speed '
action_dim = self.env.action_space.shape[0]
state_dim = self.env.observation_space.shape[0]
path_actions = np.zeros([self.horizon, self.num_simulated_paths, action_dim])
path_states = np.... | def get_action(self, state):
' '
' Note: be careful to batch your simulations through the model for speed '
action_dim = self.env.action_space.shape[0]
state_dim = self.env.observation_space.shape[0]
path_actions = np.zeros([self.horizon, self.num_simulated_paths, action_dim])
path_states = np.... |
c810c4178dfbd489e2591001b6fe3ace18c87675a19109e571c33bff8de4f168 | def process_sentence(self, sentence):
'\n 处理句子,返回分词和词性标注结果\n 返回格式:[(word, pos), (word, pos) ...(word, pos)]\n '
seg = Segment(sentence, d_store=self.d_store)
seg.atom_segment()
seg.word_match()
words_graph = seg.get_words_graph()
detection = OOVDetection(words_graph, self.d_... | 处理句子,返回分词和词性标注结果
返回格式:[(word, pos), (word, pos) ...(word, pos)] | pycseg/__init__.py | process_sentence | lizonghai/pycseg | 4 | python | def process_sentence(self, sentence):
'\n 处理句子,返回分词和词性标注结果\n 返回格式:[(word, pos), (word, pos) ...(word, pos)]\n '
seg = Segment(sentence, d_store=self.d_store)
seg.atom_segment()
seg.word_match()
words_graph = seg.get_words_graph()
detection = OOVDetection(words_graph, self.d_... | def process_sentence(self, sentence):
'\n 处理句子,返回分词和词性标注结果\n 返回格式:[(word, pos), (word, pos) ...(word, pos)]\n '
seg = Segment(sentence, d_store=self.d_store)
seg.atom_segment()
seg.word_match()
words_graph = seg.get_words_graph()
detection = OOVDetection(words_graph, self.d_... |
dec84e664d9fe00551a5558c7db61d407bce93450d755316a3fc0cfad8bc9f11 | def process(self, content):
'\n 处理文本,返回分词和词性标注结果\n 返回格式:[(word, pos), (word, pos) ...(word, pos)]\n '
sentences = self._split_by(content, definitions.SEPERATOR_C_SENTENCE, contains_delimiter=True)
results = {'words': [], 'tags': []}
for sentence in sentences:
result = self.p... | 处理文本,返回分词和词性标注结果
返回格式:[(word, pos), (word, pos) ...(word, pos)] | pycseg/__init__.py | process | lizonghai/pycseg | 4 | python | def process(self, content):
'\n 处理文本,返回分词和词性标注结果\n 返回格式:[(word, pos), (word, pos) ...(word, pos)]\n '
sentences = self._split_by(content, definitions.SEPERATOR_C_SENTENCE, contains_delimiter=True)
results = {'words': [], 'tags': []}
for sentence in sentences:
result = self.p... | def process(self, content):
'\n 处理文本,返回分词和词性标注结果\n 返回格式:[(word, pos), (word, pos) ...(word, pos)]\n '
sentences = self._split_by(content, definitions.SEPERATOR_C_SENTENCE, contains_delimiter=True)
results = {'words': [], 'tags': []}
for sentence in sentences:
result = self.p... |
49ebd6712111c4046d7daa7576c9749e3137470210a3456689c0248d79c43f58 | def process_file(self, filename, out_filename=None):
'\n 处理文件,结果写入文件或将结果返回\n '
results = {'words': [], 'tags': []}
with codecs.open(filename, 'r', 'utf-8') as input_file:
for line in input_file:
print('PROCESS LINE:{}'.format(line))
result = self.process(line.st... | 处理文件,结果写入文件或将结果返回 | pycseg/__init__.py | process_file | lizonghai/pycseg | 4 | python | def process_file(self, filename, out_filename=None):
'\n \n '
results = {'words': [], 'tags': []}
with codecs.open(filename, 'r', 'utf-8') as input_file:
for line in input_file:
print('PROCESS LINE:{}'.format(line))
result = self.process(line.strip())
... | def process_file(self, filename, out_filename=None):
'\n \n '
results = {'words': [], 'tags': []}
with codecs.open(filename, 'r', 'utf-8') as input_file:
for line in input_file:
print('PROCESS LINE:{}'.format(line))
result = self.process(line.strip())
... |
4ed3677338d1738588e3b8026d04429dc95e6b2b13650c00311395ba52497c23 | def __init__(self, rootDirectory, filesToContents, rootModuleNames):
"Initialize a codebase.\n\n Args:\n rootDirectory - the path to the root where the filesystem lives.\n For instance, if the code is in /home/ubuntu/code/typed_python,\n this would be '/home/ubuntu/co... | Initialize a codebase.
Args:
rootDirectory - the path to the root where the filesystem lives.
For instance, if the code is in /home/ubuntu/code/typed_python,
this would be '/home/ubuntu/code'
filesToContents - a dict containing the filename (relative to
rootDirectory) of each file, mapp... | typed_python/Codebase.py | __init__ | APrioriInvestments/typed_python | 105 | python | def __init__(self, rootDirectory, filesToContents, rootModuleNames):
"Initialize a codebase.\n\n Args:\n rootDirectory - the path to the root where the filesystem lives.\n For instance, if the code is in /home/ubuntu/code/typed_python,\n this would be '/home/ubuntu/co... | def __init__(self, rootDirectory, filesToContents, rootModuleNames):
"Initialize a codebase.\n\n Args:\n rootDirectory - the path to the root where the filesystem lives.\n For instance, if the code is in /home/ubuntu/code/typed_python,\n this would be '/home/ubuntu/co... |
e5bb064c4e8057da73ac6eb6e56c76cf30b38e7c6bcfc8f2e78c154bcadc5437 | def allModuleLevelValues(self):
'Iterate over all module-level values. Yields (name, object) pairs.'
for (moduleName, module) in self.importModulesByName(self.moduleNames).items():
for item in dir(module):
(yield (((moduleName + '.') + item), getattr(module, item))) | Iterate over all module-level values. Yields (name, object) pairs. | typed_python/Codebase.py | allModuleLevelValues | APrioriInvestments/typed_python | 105 | python | def allModuleLevelValues(self):
for (moduleName, module) in self.importModulesByName(self.moduleNames).items():
for item in dir(module):
(yield (((moduleName + '.') + item), getattr(module, item))) | def allModuleLevelValues(self):
for (moduleName, module) in self.importModulesByName(self.moduleNames).items():
for item in dir(module):
(yield (((moduleName + '.') + item), getattr(module, item)))<|docstring|>Iterate over all module-level values. Yields (name, object) pairs.<|endoftext|> |
8ec0411523affbbc996ec1e0097fbed6afa1bcb95e85fb8ad7afff2d876d1cce | def markNative(self):
'Indicate that this codebase is already instantiated.'
with _lock:
for mname in self.rootModuleNames:
_installed_rootlevel_modules[mname] = self
_installed_codebases[self.sha_hash] = self | Indicate that this codebase is already instantiated. | typed_python/Codebase.py | markNative | APrioriInvestments/typed_python | 105 | python | def markNative(self):
with _lock:
for mname in self.rootModuleNames:
_installed_rootlevel_modules[mname] = self
_installed_codebases[self.sha_hash] = self | def markNative(self):
with _lock:
for mname in self.rootModuleNames:
_installed_rootlevel_modules[mname] = self
_installed_codebases[self.sha_hash] = self<|docstring|>Indicate that this codebase is already instantiated.<|endoftext|> |
e09327afed0b7845ae87a20ed9822b07af9aea3aa651aaf3c756434ca309652a | @staticmethod
def FromRootlevelPath(rootPath, prefix=None, extensions=('.py',), maxTotalBytes=((100 * 1024) * 1024), suppressFun=None):
"Build a codebase from the path to the root directory containing a module.\n\n Args:\n rootPath (str) - the root path we're going to pull in. This should point\n ... | Build a codebase from the path to the root directory containing a module.
Args:
rootPath (str) - the root path we're going to pull in. This should point
to a directory with the name of the python module this codebase
will represent.
extensions (tuple of strings) - a list of file extensions with... | typed_python/Codebase.py | FromRootlevelPath | APrioriInvestments/typed_python | 105 | python | @staticmethod
def FromRootlevelPath(rootPath, prefix=None, extensions=('.py',), maxTotalBytes=((100 * 1024) * 1024), suppressFun=None):
"Build a codebase from the path to the root directory containing a module.\n\n Args:\n rootPath (str) - the root path we're going to pull in. This should point\n ... | @staticmethod
def FromRootlevelPath(rootPath, prefix=None, extensions=('.py',), maxTotalBytes=((100 * 1024) * 1024), suppressFun=None):
"Build a codebase from the path to the root directory containing a module.\n\n Args:\n rootPath (str) - the root path we're going to pull in. This should point\n ... |
813a53da7dc2d08523a72d5eb117b0268dbb44b16441bbfb2967bda76929cfca | @staticmethod
def _walkDiskRepresentation(rootPath, prefix=None, extensions=('.py',), maxTotalBytes=((100 * 1024) * 1024), suppressFun=None):
" Utility method that collects the code for a given root module.\n\n Parameters:\n -----------\n rootPath : str\n the root pat... | Utility method that collects the code for a given root module.
Parameters:
-----------
rootPath : str
the root path for which to gather code
suppressFun : a function(path) that returns True if the module path shouldn't
be included in the codebase.
Returns:
--------
tuple(parentDir:str, files:dict(str->str), ... | typed_python/Codebase.py | _walkDiskRepresentation | APrioriInvestments/typed_python | 105 | python | @staticmethod
def _walkDiskRepresentation(rootPath, prefix=None, extensions=('.py',), maxTotalBytes=((100 * 1024) * 1024), suppressFun=None):
" Utility method that collects the code for a given root module.\n\n Parameters:\n -----------\n rootPath : str\n the root pat... | @staticmethod
def _walkDiskRepresentation(rootPath, prefix=None, extensions=('.py',), maxTotalBytes=((100 * 1024) * 1024), suppressFun=None):
" Utility method that collects the code for a given root module.\n\n Parameters:\n -----------\n rootPath : str\n the root pat... |
2719045f456f2ef91e0976ec227ff10a43dbde4670c52e0399574c050b45c269 | def instantiate(self, rootDirectory=None):
'Instantiate a codebase on disk\n\n Args:\n rootDirectory - if None, then pick a directory. otherwise,\n this is where to put the code. This directory must be\n persistent for the life of the process.\n '
if self.i... | Instantiate a codebase on disk
Args:
rootDirectory - if None, then pick a directory. otherwise,
this is where to put the code. This directory must be
persistent for the life of the process. | typed_python/Codebase.py | instantiate | APrioriInvestments/typed_python | 105 | python | def instantiate(self, rootDirectory=None):
'Instantiate a codebase on disk\n\n Args:\n rootDirectory - if None, then pick a directory. otherwise,\n this is where to put the code. This directory must be\n persistent for the life of the process.\n '
if self.i... | def instantiate(self, rootDirectory=None):
'Instantiate a codebase on disk\n\n Args:\n rootDirectory - if None, then pick a directory. otherwise,\n this is where to put the code. This directory must be\n persistent for the life of the process.\n '
if self.i... |
a4e9c5a6d29944f523fa7a1b217ba9548a7780803f80884e5902fe94f0ba472a | @staticmethod
def importModulesByName(modules_by_name):
' Returns a dict mapping module names (str) to modules. '
modules = {}
for mname in sorted(modules_by_name):
try:
modules[mname] = importlib.import_module(mname)
except Exception as e:
logging.getLogger(__name__)... | Returns a dict mapping module names (str) to modules. | typed_python/Codebase.py | importModulesByName | APrioriInvestments/typed_python | 105 | python | @staticmethod
def importModulesByName(modules_by_name):
' '
modules = {}
for mname in sorted(modules_by_name):
try:
modules[mname] = importlib.import_module(mname)
except Exception as e:
logging.getLogger(__name__).warn("Error importing module '%s' from codebase: %s"... | @staticmethod
def importModulesByName(modules_by_name):
' '
modules = {}
for mname in sorted(modules_by_name):
try:
modules[mname] = importlib.import_module(mname)
except Exception as e:
logging.getLogger(__name__).warn("Error importing module '%s' from codebase: %s"... |
a794ab8e7f09338ba237a2b808c1dae3a203b08213c784e8774ab80b982ddc18 | def sample_gaussian(mu, Sigma, N=1):
'\n Draw N random row vectors from a Gaussian distribution\n\n Args:\n mu (numpy array [n x 1]): expected value vector\n Sigma (numpy array [n x n]): covariance matrix\n N (int): scalar number of samples\n\n Returns:\n M (numpy array [n x N])... | Draw N random row vectors from a Gaussian distribution
Args:
mu (numpy array [n x 1]): expected value vector
Sigma (numpy array [n x n]): covariance matrix
N (int): scalar number of samples
Returns:
M (numpy array [n x N]): samples from Gaussian distribtion | estimators.py | sample_gaussian | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def sample_gaussian(mu, Sigma, N=1):
'\n Draw N random row vectors from a Gaussian distribution\n\n Args:\n mu (numpy array [n x 1]): expected value vector\n Sigma (numpy array [n x n]): covariance matrix\n N (int): scalar number of samples\n\n Returns:\n M (numpy array [n x N])... | def sample_gaussian(mu, Sigma, N=1):
'\n Draw N random row vectors from a Gaussian distribution\n\n Args:\n mu (numpy array [n x 1]): expected value vector\n Sigma (numpy array [n x n]): covariance matrix\n N (int): scalar number of samples\n\n Returns:\n M (numpy array [n x N])... |
9a2587ac779f761b87cb6cabed6cecd6fa8f65ad61c1b82997f08aa640a43212 | def kinematic_state_observer(initial_cond, yaw_rates, inertial_accs, long_vs, T, alpha):
'\n Not working yet!\n '
num_sol = len(T)
states = np.zeros((2, num_sol))
states[(:, 0)] = np.squeeze(initial_cond[3:5])
C = np.array([1, 0])
B = np.identity(2)
A = np.zeros((2, 2))
for i in ra... | Not working yet! | estimators.py | kinematic_state_observer | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def kinematic_state_observer(initial_cond, yaw_rates, inertial_accs, long_vs, T, alpha):
'\n \n '
num_sol = len(T)
states = np.zeros((2, num_sol))
states[(:, 0)] = np.squeeze(initial_cond[3:5])
C = np.array([1, 0])
B = np.identity(2)
A = np.zeros((2, 2))
for i in range(1, num_sol):... | def kinematic_state_observer(initial_cond, yaw_rates, inertial_accs, long_vs, T, alpha):
'\n \n '
num_sol = len(T)
states = np.zeros((2, num_sol))
states[(:, 0)] = np.squeeze(initial_cond[3:5])
C = np.array([1, 0])
B = np.identity(2)
A = np.zeros((2, 2))
for i in range(1, num_sol):... |
ef8048f2947caa0f23aafa5763edd23cb9be7a0574b5425f6b50aa0efc14ab04 | def findCombinationsUtil(arr, index, num, reducedNum, output):
'\n Find all combinations of < n numbers from 1 to num with repetition that add up to reducedNum \n\n Args:\n arr (list size n): current items that add up to <= reducedNum (in the 0th recursion)\n index (int): index of the next slot ... | Find all combinations of < n numbers from 1 to num with repetition that add up to reducedNum
Args:
arr (list size n): current items that add up to <= reducedNum (in the 0th recursion)
index (int): index of the next slot of arr list
num (int): limit of what numbers to be chosen from -> [1, num]
reduced... | estimators.py | findCombinationsUtil | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def findCombinationsUtil(arr, index, num, reducedNum, output):
'\n Find all combinations of < n numbers from 1 to num with repetition that add up to reducedNum \n\n Args:\n arr (list size n): current items that add up to <= reducedNum (in the 0th recursion)\n index (int): index of the next slot ... | def findCombinationsUtil(arr, index, num, reducedNum, output):
'\n Find all combinations of < n numbers from 1 to num with repetition that add up to reducedNum \n\n Args:\n arr (list size n): current items that add up to <= reducedNum (in the 0th recursion)\n index (int): index of the next slot ... |
dba86f3e1c143f0e7fff8105a601631c65508d427934a617ac5958d756676e83 | def fit_data_rover_dynobj(dynamic_obj, vy=np.array([]), back_rotate=False):
'\n Perform LS and NLS fitting parameters estimation for the rover dynamics (c1-c9) using dynamic object.\n\n Args:\n dynamic_obj (RoverPartialDynEst or RoverDyn obj): dynamic object\n vy (numpy array [nt]): optionally, ... | Perform LS and NLS fitting parameters estimation for the rover dynamics (c1-c9) using dynamic object.
Args:
dynamic_obj (RoverPartialDynEst or RoverDyn obj): dynamic object
vy (numpy array [nt]): optionally, lateral velocity if observed; defaults to empty
back_rotate (bool): produce linear and lateral velo... | estimators.py | fit_data_rover_dynobj | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def fit_data_rover_dynobj(dynamic_obj, vy=np.array([]), back_rotate=False):
'\n Perform LS and NLS fitting parameters estimation for the rover dynamics (c1-c9) using dynamic object.\n\n Args:\n dynamic_obj (RoverPartialDynEst or RoverDyn obj): dynamic object\n vy (numpy array [nt]): optionally, ... | def fit_data_rover_dynobj(dynamic_obj, vy=np.array([]), back_rotate=False):
'\n Perform LS and NLS fitting parameters estimation for the rover dynamics (c1-c9) using dynamic object.\n\n Args:\n dynamic_obj (RoverPartialDynEst or RoverDyn obj): dynamic object\n vy (numpy array [nt]): optionally, ... |
17aeede8a37b93e2a669bad974a9c0cc25d65c14a5606595d93ec973c5c06995 | def fit_data_rover(states, U, dt, vxdot=np.array([]), yawrate=np.array([]), vy=np.array([])):
'\n Perform LS and NLS fitting parameters estimation for the rover dynamics (c1-c9).\n\n Args:\n states (numpy array [4 x nt]): rover states consisting of x, y, theta and vx at different time instances\n ... | Perform LS and NLS fitting parameters estimation for the rover dynamics (c1-c9).
Args:
states (numpy array [4 x nt]): rover states consisting of x, y, theta and vx at different time instances
U (numpy array [2 x nt]): input to the model at different time instances consisting of steering angle and commanded vel... | estimators.py | fit_data_rover | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def fit_data_rover(states, U, dt, vxdot=np.array([]), yawrate=np.array([]), vy=np.array([])):
'\n Perform LS and NLS fitting parameters estimation for the rover dynamics (c1-c9).\n\n Args:\n states (numpy array [4 x nt]): rover states consisting of x, y, theta and vx at different time instances\n ... | def fit_data_rover(states, U, dt, vxdot=np.array([]), yawrate=np.array([]), vy=np.array([])):
'\n Perform LS and NLS fitting parameters estimation for the rover dynamics (c1-c9).\n\n Args:\n states (numpy array [4 x nt]): rover states consisting of x, y, theta and vx at different time instances\n ... |
def196033f688bf0d8256afb0b0089d900bcfaadacf1ae013069abd74d1384e2 | def sample_nlds(z0, U, nt, f, h, num_out, Q=None, P0=None, R=None, Qu=None, additional_args_pm=[], additional_args_om=[], overwrite_inds=[], overwrite_vals=[]):
'\n Retrieve ground truth, initial and output data (SNLDS: Stochastic non-linear dynamic system)\n\n Args:\n z0 (numpy array [n x 1]): initial... | Retrieve ground truth, initial and output data (SNLDS: Stochastic non-linear dynamic system)
Args:
z0 (numpy array [n x 1]): initial ground truth condition
U (numpy array [nu x nt]): inputs for the process and observation model
nt (int): number of simulation steps
f (function): function handle for one-... | estimators.py | sample_nlds | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def sample_nlds(z0, U, nt, f, h, num_out, Q=None, P0=None, R=None, Qu=None, additional_args_pm=[], additional_args_om=[], overwrite_inds=[], overwrite_vals=[]):
'\n Retrieve ground truth, initial and output data (SNLDS: Stochastic non-linear dynamic system)\n\n Args:\n z0 (numpy array [n x 1]): initial... | def sample_nlds(z0, U, nt, f, h, num_out, Q=None, P0=None, R=None, Qu=None, additional_args_pm=[], additional_args_om=[], overwrite_inds=[], overwrite_vals=[]):
'\n Retrieve ground truth, initial and output data (SNLDS: Stochastic non-linear dynamic system)\n\n Args:\n z0 (numpy array [n x 1]): initial... |
d143079353303749c0a3f0787b75fe5776dfc1c57871ecc831f09b93da2ba4e7 | def test_pbgf_linear(n=10, m=5, nt=10):
'\n Test the PointBasedFilter against KF when problem is linear. Raises error when mean and covariance from\n PBGF differs from that of KF.\n\n Args:\n n (int): dimensionality of problem; defaults to 10\n m (int): number of outputs which are randomly se... | Test the PointBasedFilter against KF when problem is linear. Raises error when mean and covariance from
PBGF differs from that of KF.
Args:
n (int): dimensionality of problem; defaults to 10
m (int): number of outputs which are randomly selected from the states; defaults to 5
nt (int): number of filtering ... | estimators.py | test_pbgf_linear | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def test_pbgf_linear(n=10, m=5, nt=10):
'\n Test the PointBasedFilter against KF when problem is linear. Raises error when mean and covariance from\n PBGF differs from that of KF.\n\n Args:\n n (int): dimensionality of problem; defaults to 10\n m (int): number of outputs which are randomly se... | def test_pbgf_linear(n=10, m=5, nt=10):
'\n Test the PointBasedFilter against KF when problem is linear. Raises error when mean and covariance from\n PBGF differs from that of KF.\n\n Args:\n n (int): dimensionality of problem; defaults to 10\n m (int): number of outputs which are randomly se... |
ccbd9b4e442c2dcbb6f839fae5b5538f2f2f655411945343431f032951430590 | def test_pbgf_1d_linear(gt_const=10.0, initial_cov=10.0, q_cov=0.01, r_cov=1.0, nt=50):
'\n Test the PBGF against KF when problem is linear. This problem is one-dimensional estimate of a random constant.\n\n Args:\n gt_const (float): parameter to be estimated; defaults to 10.0\n initial_cov (flo... | Test the PBGF against KF when problem is linear. This problem is one-dimensional estimate of a random constant.
Args:
gt_const (float): parameter to be estimated; defaults to 10.0
initial_cov (float): initial uncertainty of gt_const; defaults to 10.0
q_cov (float): stochastic noise for evolution of the par... | estimators.py | test_pbgf_1d_linear | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def test_pbgf_1d_linear(gt_const=10.0, initial_cov=10.0, q_cov=0.01, r_cov=1.0, nt=50):
'\n Test the PBGF against KF when problem is linear. This problem is one-dimensional estimate of a random constant.\n\n Args:\n gt_const (float): parameter to be estimated; defaults to 10.0\n initial_cov (flo... | def test_pbgf_1d_linear(gt_const=10.0, initial_cov=10.0, q_cov=0.01, r_cov=1.0, nt=50):
'\n Test the PBGF against KF when problem is linear. This problem is one-dimensional estimate of a random constant.\n\n Args:\n gt_const (float): parameter to be estimated; defaults to 10.0\n initial_cov (flo... |
05b3fd24879b4342d456d9c879be399145cfc7beb2f0fcc0ca87cd13e90a2144 | def test_pbgf_fixed_lag_smoothing_linear(n=10, m=5, nt=10, lag_interval=5):
'\n Test the PBGF smoothed estimate against filtered estimate. This problem is the same as that of test_pbgf_linear.\n\n Args:\n n (int): dimensionality of problem; defaults to 10\n m (int): number of outputs which are r... | Test the PBGF smoothed estimate against filtered estimate. This problem is the same as that of test_pbgf_linear.
Args:
n (int): dimensionality of problem; defaults to 10
m (int): number of outputs which are randomly selected from the states; defaults to 5
nt (int): number of filtering iterations; defaults ... | estimators.py | test_pbgf_fixed_lag_smoothing_linear | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def test_pbgf_fixed_lag_smoothing_linear(n=10, m=5, nt=10, lag_interval=5):
'\n Test the PBGF smoothed estimate against filtered estimate. This problem is the same as that of test_pbgf_linear.\n\n Args:\n n (int): dimensionality of problem; defaults to 10\n m (int): number of outputs which are r... | def test_pbgf_fixed_lag_smoothing_linear(n=10, m=5, nt=10, lag_interval=5):
'\n Test the PBGF smoothed estimate against filtered estimate. This problem is the same as that of test_pbgf_linear.\n\n Args:\n n (int): dimensionality of problem; defaults to 10\n m (int): number of outputs which are r... |
b6c200801a91d433ac12624956004c85406a4cf5b36ca3b536faaad31f455a77 | def predict_and_or_update(self, X, P, f, h, Q, R, u, y, u_next=None, Qu=None, additional_args_pm=[], additional_args_om=[], innovation_bound_func={}, predict_flag=True):
'\n Perform one iteration of prediction and/or update.\n algorithm reference: Algorithm 5.1, page 104 of "Compressed Estimation in C... | Perform one iteration of prediction and/or update.
algorithm reference: Algorithm 5.1, page 104 of "Compressed Estimation in Coupled High-dimensional Processes"
Args:
X (numpy array [n x 1]): expected value of the states
P (numpy array [n x n]): covariance of the states
f (function): function handle for th... | estimators.py | predict_and_or_update | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def predict_and_or_update(self, X, P, f, h, Q, R, u, y, u_next=None, Qu=None, additional_args_pm=[], additional_args_om=[], innovation_bound_func={}, predict_flag=True):
'\n Perform one iteration of prediction and/or update.\n algorithm reference: Algorithm 5.1, page 104 of "Compressed Estimation in C... | def predict_and_or_update(self, X, P, f, h, Q, R, u, y, u_next=None, Qu=None, additional_args_pm=[], additional_args_om=[], innovation_bound_func={}, predict_flag=True):
'\n Perform one iteration of prediction and/or update.\n algorithm reference: Algorithm 5.1, page 104 of "Compressed Estimation in C... |
f020104f7d90076d0c3159a7dc9b31b3c7560b0dd99de0c3c1642884707c1ad2 | def unscented_transformH(self, x, W, WeightMat, L, f, u, ia, iq, n, additional_args):
'\n Function to propagate sigma/cubature points through observation function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight array\n ... | Function to propagate sigma/cubature points through observation function.
Args:
x (numpy array [n_a x L]): sigma/cubature points
W (numpy array [L x 1 or 1 x L]: 1D Weight array
WeightMat (numpy array [L x L]): weight matrix with weights of the points on the diagonal
L (int): number of points
f (fu... | estimators.py | unscented_transformH | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def unscented_transformH(self, x, W, WeightMat, L, f, u, ia, iq, n, additional_args):
'\n Function to propagate sigma/cubature points through observation function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight array\n ... | def unscented_transformH(self, x, W, WeightMat, L, f, u, ia, iq, n, additional_args):
'\n Function to propagate sigma/cubature points through observation function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight array\n ... |
a6a4e09e5d2cc14a4ca89cd6126d08606b66c6d757282558f8b7a55fd2830a83 | def unscented_transformF(self, x, W, WeightMat, L, f, u, ia, iq, iqu, additional_args):
'\n Function to propagate sigma/cubature points through process model function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight array ... | Function to propagate sigma/cubature points through process model function.
Args:
x (numpy array [n_a x L]): sigma/cubature points
W (numpy array [L x 1 or 1 x L]: 1D Weight array of the sigma/cubature points
WeightMat (numpy array [L x L]): weight matrix with weights in W of the points on the diagonal
... | estimators.py | unscented_transformF | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def unscented_transformF(self, x, W, WeightMat, L, f, u, ia, iq, iqu, additional_args):
'\n Function to propagate sigma/cubature points through process model function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight array ... | def unscented_transformF(self, x, W, WeightMat, L, f, u, ia, iq, iqu, additional_args):
'\n Function to propagate sigma/cubature points through process model function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight array ... |
0c9d931e3464c9c48c00143da1fff0b9f531c192f95dbdcf0be804f155d2ad35 | def sigmas2(self, X, P):
'\n function to generate second order sigma points\n reference: Appendix G.1 of "Compressed Estimation in Coupled High-dimensional Processes"\n\n Args:\n X (numpy array [n x 1]): mean of Gaussian distribution\n P (numpy array [n x n]): covariance m... | function to generate second order sigma points
reference: Appendix G.1 of "Compressed Estimation in Coupled High-dimensional Processes"
Args:
X (numpy array [n x 1]): mean of Gaussian distribution
P (numpy array [n x n]): covariance matrix of Gaussian distribution
Returns:
x (numpy array [n x L]): second ... | estimators.py | sigmas2 | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def sigmas2(self, X, P):
'\n function to generate second order sigma points\n reference: Appendix G.1 of "Compressed Estimation in Coupled High-dimensional Processes"\n\n Args:\n X (numpy array [n x 1]): mean of Gaussian distribution\n P (numpy array [n x n]): covariance m... | def sigmas2(self, X, P):
'\n function to generate second order sigma points\n reference: Appendix G.1 of "Compressed Estimation in Coupled High-dimensional Processes"\n\n Args:\n X (numpy array [n x 1]): mean of Gaussian distribution\n P (numpy array [n x n]): covariance m... |
d9dd836d9c11c0cc6b8fbb3ab0ce89caf0f935f6d5d2cc7464e74ce23c39ad7a | def sigmas4(self, X, P):
'\n function to generate fourth order sigma points\n Note: No analytical results exist for generating 4th order sigma points as it requires performing\n non-linear least square (see Appendix G.2 of "Compressed Estimation in Coupled High-dimensional Processes".\n\n ... | function to generate fourth order sigma points
Note: No analytical results exist for generating 4th order sigma points as it requires performing
non-linear least square (see Appendix G.2 of "Compressed Estimation in Coupled High-dimensional Processes".
A separate scheme is used here, see equation 5.20 instead.
Args:
... | estimators.py | sigmas4 | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def sigmas4(self, X, P):
'\n function to generate fourth order sigma points\n Note: No analytical results exist for generating 4th order sigma points as it requires performing\n non-linear least square (see Appendix G.2 of "Compressed Estimation in Coupled High-dimensional Processes".\n\n ... | def sigmas4(self, X, P):
'\n function to generate fourth order sigma points\n Note: No analytical results exist for generating 4th order sigma points as it requires performing\n non-linear least square (see Appendix G.2 of "Compressed Estimation in Coupled High-dimensional Processes".\n\n ... |
75c859d89cab1165e3822cf545207380f863ced94a82d294c2baf9799117c223 | def cubature2(self, X, P):
'\n function to generate second order cubature points\n reference: paper "Cubature Kalman Fitlers"\n\n Args:\n X (numpy array [n x 1]): mean of Gaussian distribution\n P (numpy array [n x n]): covariance matrix of Gaussian distribution\n\n ... | function to generate second order cubature points
reference: paper "Cubature Kalman Fitlers"
Args:
X (numpy array [n x 1]): mean of Gaussian distribution
P (numpy array [n x n]): covariance matrix of Gaussian distribution
Returns:
x (numpy array [n x L]): second order cubature point
L (int): number of... | estimators.py | cubature2 | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def cubature2(self, X, P):
'\n function to generate second order cubature points\n reference: paper "Cubature Kalman Fitlers"\n\n Args:\n X (numpy array [n x 1]): mean of Gaussian distribution\n P (numpy array [n x n]): covariance matrix of Gaussian distribution\n\n ... | def cubature2(self, X, P):
'\n function to generate second order cubature points\n reference: paper "Cubature Kalman Fitlers"\n\n Args:\n X (numpy array [n x 1]): mean of Gaussian distribution\n P (numpy array [n x n]): covariance matrix of Gaussian distribution\n\n ... |
f104d71b06cc4a8d95ab56bb845dc435bd75d5b1494d8ca29029e9db900c65d1 | def cubature4(self, X, P):
'\n function to generate fourth order cubature points\n reference: paper "High-degree cubature kalman filter"\n\n Args:\n X (numpy array [n x 1]): mean of Gaussian distribution\n P (numpy array [n x n]): covariance matrix of Gaussian distribution... | function to generate fourth order cubature points
reference: paper "High-degree cubature kalman filter"
Args:
X (numpy array [n x 1]): mean of Gaussian distribution
P (numpy array [n x n]): covariance matrix of Gaussian distribution
Returns:
x (numpy array [n x L]): fourth order cubature point
L (int)... | estimators.py | cubature4 | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def cubature4(self, X, P):
'\n function to generate fourth order cubature points\n reference: paper "High-degree cubature kalman filter"\n\n Args:\n X (numpy array [n x 1]): mean of Gaussian distribution\n P (numpy array [n x n]): covariance matrix of Gaussian distribution... | def cubature4(self, X, P):
'\n function to generate fourth order cubature points\n reference: paper "High-degree cubature kalman filter"\n\n Args:\n X (numpy array [n x 1]): mean of Gaussian distribution\n P (numpy array [n x n]): covariance matrix of Gaussian distribution... |
079abdc9d99a5d03c1d105524f53abbcacda9c4280b4e89324f80d0df9b5ec0f | def verifyTransformedSigma(self, x, WeightMat, X, P):
'\n Verify if the transformed sigma/cubature point captures the mean and covariance of the \n target Gaussian distribution\n\n Args:\n x (numpy array [n x L]): sigma/cubature points\n WeightMat (numpy array [L x L]): we... | Verify if the transformed sigma/cubature point captures the mean and covariance of the
target Gaussian distribution
Args:
x (numpy array [n x L]): sigma/cubature points
WeightMat (numpy array [L x L]): weight matrix with weights of the points on the diagonal
X (numpy array [n x 1]): mean of Gaussian distr... | estimators.py | verifyTransformedSigma | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def verifyTransformedSigma(self, x, WeightMat, X, P):
'\n Verify if the transformed sigma/cubature point captures the mean and covariance of the \n target Gaussian distribution\n\n Args:\n x (numpy array [n x L]): sigma/cubature points\n WeightMat (numpy array [L x L]): we... | def verifyTransformedSigma(self, x, WeightMat, X, P):
'\n Verify if the transformed sigma/cubature point captures the mean and covariance of the \n target Gaussian distribution\n\n Args:\n x (numpy array [n x L]): sigma/cubature points\n WeightMat (numpy array [L x L]): we... |
66d4a33434802d1f41d9c42808d590b463baf559930db102ea331f8c3481c2ca | def verifySigma(self, x, W, order=2):
'\n Since originally the points of PBGF are generated from standard Gaussian distribution,\n check if moments up to specified order are being captured. Raises error when mismatch is found.\n\n Args:\n x (numpy array [n x L]): sigma/cubature point... | Since originally the points of PBGF are generated from standard Gaussian distribution,
check if moments up to specified order are being captured. Raises error when mismatch is found.
Args:
x (numpy array [n x L]): sigma/cubature points
W (numpy array [1 x L or L x 1]): 1D Weight array of sigma/cubature points
... | estimators.py | verifySigma | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def verifySigma(self, x, W, order=2):
'\n Since originally the points of PBGF are generated from standard Gaussian distribution,\n check if moments up to specified order are being captured. Raises error when mismatch is found.\n\n Args:\n x (numpy array [n x L]): sigma/cubature point... | def verifySigma(self, x, W, order=2):
'\n Since originally the points of PBGF are generated from standard Gaussian distribution,\n check if moments up to specified order are being captured. Raises error when mismatch is found.\n\n Args:\n x (numpy array [n x L]): sigma/cubature point... |
71450965e5fc49f17e5c0dd365d02957cabf3cf3c75b6defc78625b196c94612 | def stdGaussMoment(self, order):
'\n Calculate order-th moment of univariate standard Gaussian distribution (zero mean, 1 std)\n\n Args:\n order (int): scalar moment order\n\n Returns:\n prod (int): requested order-th moment of standard Gaussian distribution\n\n '
... | Calculate order-th moment of univariate standard Gaussian distribution (zero mean, 1 std)
Args:
order (int): scalar moment order
Returns:
prod (int): requested order-th moment of standard Gaussian distribution | estimators.py | stdGaussMoment | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def stdGaussMoment(self, order):
'\n Calculate order-th moment of univariate standard Gaussian distribution (zero mean, 1 std)\n\n Args:\n order (int): scalar moment order\n\n Returns:\n prod (int): requested order-th moment of standard Gaussian distribution\n\n '
... | def stdGaussMoment(self, order):
'\n Calculate order-th moment of univariate standard Gaussian distribution (zero mean, 1 std)\n\n Args:\n order (int): scalar moment order\n\n Returns:\n prod (int): requested order-th moment of standard Gaussian distribution\n\n '
... |
f4504ccf0a9c4e9df1369949c10f25349714974f90f2dc66a1806f32fbee66ba | def set_initial_cond(self, X, P):
'\n Set the initial condition of the smoother, i.e. the distribution at time zero.\n\n Args:\n X (numpy array [n x 1]): expected value of the states\n P (numpy array [n x n]): covariance of the states\n\n '
self.init_cond_set = True
... | Set the initial condition of the smoother, i.e. the distribution at time zero.
Args:
X (numpy array [n x 1]): expected value of the states
P (numpy array [n x n]): covariance of the states | estimators.py | set_initial_cond | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def set_initial_cond(self, X, P):
'\n Set the initial condition of the smoother, i.e. the distribution at time zero.\n\n Args:\n X (numpy array [n x 1]): expected value of the states\n P (numpy array [n x n]): covariance of the states\n\n '
self.init_cond_set = True
... | def set_initial_cond(self, X, P):
'\n Set the initial condition of the smoother, i.e. the distribution at time zero.\n\n Args:\n X (numpy array [n x 1]): expected value of the states\n P (numpy array [n x n]): covariance of the states\n\n '
self.init_cond_set = True
... |
396be7fc702205c44ef00d09c9a92b6d82e60066925dff19d0b65749ffdde6fc | def predict_and_or_update(self, f, h, Q, R, u, y, u_next=None, Qu=None, additional_args_pm=[], additional_args_om=[], innovation_bound_func={}, predict_flag=True):
'\n Perform one iteration of prediction and/or update + backward pass to produce smoothed estimate when applicable.\n algorithm reference:... | Perform one iteration of prediction and/or update + backward pass to produce smoothed estimate when applicable.
algorithm reference: Algorithm 10.6, page 162 of "Bayesian Filtering and Smoothing"
Args:
f (function): function handle for the process model; expected signature f(state, input, model noise, input noise,... | estimators.py | predict_and_or_update | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def predict_and_or_update(self, f, h, Q, R, u, y, u_next=None, Qu=None, additional_args_pm=[], additional_args_om=[], innovation_bound_func={}, predict_flag=True):
'\n Perform one iteration of prediction and/or update + backward pass to produce smoothed estimate when applicable.\n algorithm reference:... | def predict_and_or_update(self, f, h, Q, R, u, y, u_next=None, Qu=None, additional_args_pm=[], additional_args_om=[], innovation_bound_func={}, predict_flag=True):
'\n Perform one iteration of prediction and/or update + backward pass to produce smoothed estimate when applicable.\n algorithm reference:... |
742448c9b7dc6eef5df2445166d8784b6fe17c8e26ee0013d65bce2a08404f66 | def unscented_transformF(self, x, W, WeightMat, L, f, u, ia, ib, iq, iqu, additional_args):
'\n Function to propagate sigma/cubature points through process model function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight ar... | Function to propagate sigma/cubature points through process model function.
Args:
x (numpy array [n_a x L]): sigma/cubature points
W (numpy array [L x 1 or 1 x L]: 1D Weight array of the sigma/cubature points
WeightMat (numpy array [L x L]): weight matrix with weights in W of the points on the diagonal
... | estimators.py | unscented_transformF | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def unscented_transformF(self, x, W, WeightMat, L, f, u, ia, ib, iq, iqu, additional_args):
'\n Function to propagate sigma/cubature points through process model function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight ar... | def unscented_transformF(self, x, W, WeightMat, L, f, u, ia, ib, iq, iqu, additional_args):
'\n Function to propagate sigma/cubature points through process model function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight ar... |
101e800977e4d7dd3bd420e330d7411080395247fc38e6576262890e35613200 | def set_initial_cond(self, X, P):
'\n Set the initial condition of the smoother, i.e. the distribution at time zero.\n\n Args:\n X (numpy array [n x 1]): expected value of the states\n P (numpy array [n x n]): covariance of the states\n\n '
self.init_cond_set = True
... | Set the initial condition of the smoother, i.e. the distribution at time zero.
Args:
X (numpy array [n x 1]): expected value of the states
P (numpy array [n x n]): covariance of the states | estimators.py | set_initial_cond | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def set_initial_cond(self, X, P):
'\n Set the initial condition of the smoother, i.e. the distribution at time zero.\n\n Args:\n X (numpy array [n x 1]): expected value of the states\n P (numpy array [n x n]): covariance of the states\n\n '
self.init_cond_set = True
... | def set_initial_cond(self, X, P):
'\n Set the initial condition of the smoother, i.e. the distribution at time zero.\n\n Args:\n X (numpy array [n x 1]): expected value of the states\n P (numpy array [n x n]): covariance of the states\n\n '
self.init_cond_set = True
... |
a033fc1699f484b05eb623c1b88c6f9d272a0d3aac164e3f685b49dee23c32ef | def predict_and_or_update(self, f, h, Q, R, u, y, Qu=None, additional_args_pm=[], additional_args_om=[], innovation_bound_func={}, predict_flag=True):
'\n Perform one iteration of prediction and/or update + backward pass to produce smoothed estimate when applicable.\n\n Args:\n f (function)... | Perform one iteration of prediction and/or update + backward pass to produce smoothed estimate when applicable.
Args:
f (function): function handle for the process model; expected signature f(state, input, model noise, input noise, ...)
h (function): function handle for the observation model; expected signatur... | estimators.py | predict_and_or_update | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def predict_and_or_update(self, f, h, Q, R, u, y, Qu=None, additional_args_pm=[], additional_args_om=[], innovation_bound_func={}, predict_flag=True):
'\n Perform one iteration of prediction and/or update + backward pass to produce smoothed estimate when applicable.\n\n Args:\n f (function)... | def predict_and_or_update(self, f, h, Q, R, u, y, Qu=None, additional_args_pm=[], additional_args_om=[], innovation_bound_func={}, predict_flag=True):
'\n Perform one iteration of prediction and/or update + backward pass to produce smoothed estimate when applicable.\n\n Args:\n f (function)... |
e9fc1fbf687a1bcdc9f49594de31c87ec92f79a060a5a5651849536f3199788d | def unscented_transformF(self, x, W, WeightMat, L, f, u, iq, iqu, additional_args):
'\n Function to propagate sigma/cubature points through process model function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight array of t... | Function to propagate sigma/cubature points through process model function.
Args:
x (numpy array [n_a x L]): sigma/cubature points
W (numpy array [L x 1 or 1 x L]: 1D Weight array of the sigma/cubature points
WeightMat (numpy array [L x L]): weight matrix with weights in W of the points on the diagonal
... | estimators.py | unscented_transformF | karan-narula/System-Identification-Tools-for-Dynamic-System | 5 | python | def unscented_transformF(self, x, W, WeightMat, L, f, u, iq, iqu, additional_args):
'\n Function to propagate sigma/cubature points through process model function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight array of t... | def unscented_transformF(self, x, W, WeightMat, L, f, u, iq, iqu, additional_args):
'\n Function to propagate sigma/cubature points through process model function.\n\n Args:\n x (numpy array [n_a x L]): sigma/cubature points\n W (numpy array [L x 1 or 1 x L]: 1D Weight array of t... |
1988b3aec96e789a6374d4030eb1b8c828982129fbb43c3a145fe6b335fa1329 | def from_name_to_parton(name_parton):
'\n from string name, to parton object\n '
for parton in list_partons:
if (name_parton == parton.name):
return parton | from string name, to parton object | EoS_HRG/HRG.py | from_name_to_parton | pierre-moreau/EoS_HRG | 0 | python | def from_name_to_parton(name_parton):
'\n \n '
for parton in list_partons:
if (name_parton == parton.name):
return parton | def from_name_to_parton(name_parton):
'\n \n '
for parton in list_partons:
if (name_parton == parton.name):
return parton<|docstring|>from string name, to parton object<|endoftext|> |
624853655aa591266f716e549997b5d6d89a8fd58b3f0cbf62d600dff9f92e73 | def Bcharge(particle):
'\n Return Baryon charge of the particle object\n '
if is_baryon(particle):
pdg = particle.pdgid
if (pdg > 0):
Bcharge = 1
elif (pdg < 0):
Bcharge = (- 1)
else:
Bcharge = 0
return Bcharge | Return Baryon charge of the particle object | EoS_HRG/HRG.py | Bcharge | pierre-moreau/EoS_HRG | 0 | python | def Bcharge(particle):
'\n \n '
if is_baryon(particle):
pdg = particle.pdgid
if (pdg > 0):
Bcharge = 1
elif (pdg < 0):
Bcharge = (- 1)
else:
Bcharge = 0
return Bcharge | def Bcharge(particle):
'\n \n '
if is_baryon(particle):
pdg = particle.pdgid
if (pdg > 0):
Bcharge = 1
elif (pdg < 0):
Bcharge = (- 1)
else:
Bcharge = 0
return Bcharge<|docstring|>Return Baryon charge of the particle object<|endoftext|> |
c94926b1c48250c12a850d67bed87ae938dc691fb3d0653b0886dfeaa55ba5df | def Qcharge(particle):
'\n Return electric charge of the paricle object\n '
Qcharge = particle.charge
return int(Qcharge) | Return electric charge of the paricle object | EoS_HRG/HRG.py | Qcharge | pierre-moreau/EoS_HRG | 0 | python | def Qcharge(particle):
'\n \n '
Qcharge = particle.charge
return int(Qcharge) | def Qcharge(particle):
'\n \n '
Qcharge = particle.charge
return int(Qcharge)<|docstring|>Return electric charge of the paricle object<|endoftext|> |
5a433b05da1bdf27093cc057bd57384165ff5b241e4fcc0c011be2ef02802182 | def Scharge(particle):
'\n Return strangeness of the particle object\n '
pdg = particle.pdgid
if (pdg.has_strange or (not pdg.is_valid)):
if is_meson(particle):
try:
match = re.match('([A-Z,a-z]?)([A-Z,a-z]?)', particle.quarks)
quark1 = from_name_to_... | Return strangeness of the particle object | EoS_HRG/HRG.py | Scharge | pierre-moreau/EoS_HRG | 0 | python | def Scharge(particle):
'\n \n '
pdg = particle.pdgid
if (pdg.has_strange or (not pdg.is_valid)):
if is_meson(particle):
try:
match = re.match('([A-Z,a-z]?)([A-Z,a-z]?)', particle.quarks)
quark1 = from_name_to_parton(match.group(1))
qu... | def Scharge(particle):
'\n \n '
pdg = particle.pdgid
if (pdg.has_strange or (not pdg.is_valid)):
if is_meson(particle):
try:
match = re.match('([A-Z,a-z]?)([A-Z,a-z]?)', particle.quarks)
quark1 = from_name_to_parton(match.group(1))
qu... |
3deec668f6f0633d55efa8b726d153755fa1f795b4eba68c170204490212f40b | def muk(particle, muB, muQ, muS):
'\n Return the chemical potential of the particle object\n \\mu = B*_mu_B + Q*_mu_Q + S*_mu_S\n '
muk = (((Bcharge(particle) * muB) + (Qcharge(particle) * muQ)) + (Scharge(particle) * muS))
return muk | Return the chemical potential of the particle object
\mu = B*_mu_B + Q*_mu_Q + S*_mu_S | EoS_HRG/HRG.py | muk | pierre-moreau/EoS_HRG | 0 | python | def muk(particle, muB, muQ, muS):
'\n Return the chemical potential of the particle object\n \\mu = B*_mu_B + Q*_mu_Q + S*_mu_S\n '
muk = (((Bcharge(particle) * muB) + (Qcharge(particle) * muQ)) + (Scharge(particle) * muS))
return muk | def muk(particle, muB, muQ, muS):
'\n Return the chemical potential of the particle object\n \\mu = B*_mu_B + Q*_mu_Q + S*_mu_S\n '
muk = (((Bcharge(particle) * muB) + (Qcharge(particle) * muQ)) + (Scharge(particle) * muS))
return muk<|docstring|>Return the chemical potential of the particle object... |
2a42544646265e24dd5b595ba047a587091b4756c301ab21d524e4070eb9cb5c | def J(particle):
'\n spin of the particle object\n '
xJ = particle.J
if (xJ == None):
if (('N(22' in particle.name) or ('Lambda(2350)' in particle.name)):
xJ = (9 / 2)
if (('Delta(2420)' in particle.name) or ('N(2600)' in particle.name)):
xJ = (11 / 2)
retur... | spin of the particle object | EoS_HRG/HRG.py | J | pierre-moreau/EoS_HRG | 0 | python | def J(particle):
'\n \n '
xJ = particle.J
if (xJ == None):
if (('N(22' in particle.name) or ('Lambda(2350)' in particle.name)):
xJ = (9 / 2)
if (('Delta(2420)' in particle.name) or ('N(2600)' in particle.name)):
xJ = (11 / 2)
return xJ | def J(particle):
'\n \n '
xJ = particle.J
if (xJ == None):
if (('N(22' in particle.name) or ('Lambda(2350)' in particle.name)):
xJ = (9 / 2)
if (('Delta(2420)' in particle.name) or ('N(2600)' in particle.name)):
xJ = (11 / 2)
return xJ<|docstring|>spin of th... |
53f69a6a8f43f5e58ab982752180ac148725b186b2bd956320c07c61e8c9bcf9 | def d_spin(particle):
'\n degeneracy factor of the particle object\n d = 2*J+1\n '
return ((2 * J(particle)) + 1) | degeneracy factor of the particle object
d = 2*J+1 | EoS_HRG/HRG.py | d_spin | pierre-moreau/EoS_HRG | 0 | python | def d_spin(particle):
'\n degeneracy factor of the particle object\n d = 2*J+1\n '
return ((2 * J(particle)) + 1) | def d_spin(particle):
'\n degeneracy factor of the particle object\n d = 2*J+1\n '
return ((2 * J(particle)) + 1)<|docstring|>degeneracy factor of the particle object
d = 2*J+1<|endoftext|> |
703218607001464aea0a94daf9c8541e3de5dc60d4c819986f3e1660d5620efc | def BW(m, M0, gamma):
'\n Breit-Wigner spectral function\n PHYSICAL REVIEW C 98, 034906 (2018)\n '
BW = (((((2.0 * gamma) * M0) * m) / ((((m ** 2.0) - (M0 ** 2.0)) ** 2.0) + ((M0 * gamma) ** 2.0))) / pi)
return BW | Breit-Wigner spectral function
PHYSICAL REVIEW C 98, 034906 (2018) | EoS_HRG/HRG.py | BW | pierre-moreau/EoS_HRG | 0 | python | def BW(m, M0, gamma):
'\n Breit-Wigner spectral function\n PHYSICAL REVIEW C 98, 034906 (2018)\n '
BW = (((((2.0 * gamma) * M0) * m) / ((((m ** 2.0) - (M0 ** 2.0)) ** 2.0) + ((M0 * gamma) ** 2.0))) / pi)
return BW | def BW(m, M0, gamma):
'\n Breit-Wigner spectral function\n PHYSICAL REVIEW C 98, 034906 (2018)\n '
BW = (((((2.0 * gamma) * M0) * m) / ((((m ** 2.0) - (M0 ** 2.0)) ** 2.0) + ((M0 * gamma) ** 2.0))) / pi)
return BW<|docstring|>Breit-Wigner spectral function
PHYSICAL REVIEW C 98, 034906 (2018)<|endof... |
003fce627e4c6389c9ecbc9d070fd6b861fd513c24b0610353074359e0579ee2 | def print_info(part):
'\n Print info of a particle object\n '
if (not isinstance(part, list)):
print(f'{part} {part.pdgid}; mass {mass(part)} [GeV]; width {width(part)} [GeV]; J = {J(part)}; {part.quarks}; B,Q,S = {Bcharge(part)},{Qcharge(part)},{Scharge(part)}; anti = {(to_antiparticle(part) if h... | Print info of a particle object | EoS_HRG/HRG.py | print_info | pierre-moreau/EoS_HRG | 0 | python | def print_info(part):
'\n \n '
if (not isinstance(part, list)):
print(f'{part} {part.pdgid}; mass {mass(part)} [GeV]; width {width(part)} [GeV]; J = {J(part)}; {part.quarks}; B,Q,S = {Bcharge(part)},{Qcharge(part)},{Scharge(part)}; anti = {(to_antiparticle(part) if has_anti(part) else False)}')
... | def print_info(part):
'\n \n '
if (not isinstance(part, list)):
print(f'{part} {part.pdgid}; mass {mass(part)} [GeV]; width {width(part)} [GeV]; J = {J(part)}; {part.quarks}; B,Q,S = {Bcharge(part)},{Qcharge(part)},{Scharge(part)}; anti = {(to_antiparticle(part) if has_anti(part) else False)}')
... |
78aa0d6ef5ef04c79cef69622056dc088fdff55d6e6dfc0bce84e4c056abc0b7 | def threshold(list_part):
'\n Average threshold energy for the particle\n sum of decay products weighted by the corresponding branching ratios (branch)\n '
mth_dict = {}
for hadron in list_part:
thres = 0.0
list_decays = part_decay(hadron)
if (list_decays != None):
... | Average threshold energy for the particle
sum of decay products weighted by the corresponding branching ratios (branch) | EoS_HRG/HRG.py | threshold | pierre-moreau/EoS_HRG | 0 | python | def threshold(list_part):
'\n Average threshold energy for the particle\n sum of decay products weighted by the corresponding branching ratios (branch)\n '
mth_dict = {}
for hadron in list_part:
thres = 0.0
list_decays = part_decay(hadron)
if (list_decays != None):
... | def threshold(list_part):
'\n Average threshold energy for the particle\n sum of decay products weighted by the corresponding branching ratios (branch)\n '
mth_dict = {}
for hadron in list_part:
thres = 0.0
list_decays = part_decay(hadron)
if (list_decays != None):
... |
0426ac0227211bde17880eb58486ffd8152471108d42b92eea2771d2c55b18dc | def norm_BW():
'\n Normalization factor for the spectral function of each particle\n '
norm = np.zeros(len((HRG_mesons + HRG_baryons)))
for (ip, part) in enumerate((HRG_mesons + HRG_baryons)):
xmass = mass(part)
xwidth = width(part)
if ((xwidth / xmass) <= thres_off):
... | Normalization factor for the spectral function of each particle | EoS_HRG/HRG.py | norm_BW | pierre-moreau/EoS_HRG | 0 | python | def norm_BW():
'\n \n '
norm = np.zeros(len((HRG_mesons + HRG_baryons)))
for (ip, part) in enumerate((HRG_mesons + HRG_baryons)):
xmass = mass(part)
xwidth = width(part)
if ((xwidth / xmass) <= thres_off):
continue
try:
mthres = mth_all[part.name... | def norm_BW():
'\n \n '
norm = np.zeros(len((HRG_mesons + HRG_baryons)))
for (ip, part) in enumerate((HRG_mesons + HRG_baryons)):
xmass = mass(part)
xwidth = width(part)
if ((xwidth / xmass) <= thres_off):
continue
try:
mthres = mth_all[part.name... |
46e34d0121ba5392a520472eb35d81d1a714eabc25e3a4cdef397eab533dd632 | def HRG(T, muB, muQ, muS, **kwargs):
'\n Calculation of the HRG EoS as a function of T,muB,muQ,muS\n kwargs:\n species = all, mesons, baryons -> which particles to include?\n offshell = True, False -> integration over mass for unstable particles?\n '
try:
offshell = kwargs['offshe... | Calculation of the HRG EoS as a function of T,muB,muQ,muS
kwargs:
species = all, mesons, baryons -> which particles to include?
offshell = True, False -> integration over mass for unstable particles? | EoS_HRG/HRG.py | HRG | pierre-moreau/EoS_HRG | 0 | python | def HRG(T, muB, muQ, muS, **kwargs):
'\n Calculation of the HRG EoS as a function of T,muB,muQ,muS\n kwargs:\n species = all, mesons, baryons -> which particles to include?\n offshell = True, False -> integration over mass for unstable particles?\n '
try:
offshell = kwargs['offshe... | def HRG(T, muB, muQ, muS, **kwargs):
'\n Calculation of the HRG EoS as a function of T,muB,muQ,muS\n kwargs:\n species = all, mesons, baryons -> which particles to include?\n offshell = True, False -> integration over mass for unstable particles?\n '
try:
offshell = kwargs['offshe... |
db1cfb66a2dd2478498e6707f8aeee190bd512fb70ad6517fd77d0100fd591cf | def HRG_freezout(T, muB, muQ, muS, gammaS, EoS='full', **kwargs):
'\n Calculate all particle number densities from HRG\n Includes decays as well.\n '
list_particles = (((HRG_mesons + HRG_baryons) + to_antiparticle(HRG_mesons)) + to_antiparticle(HRG_baryons))
list_particles.sort(reverse=True, key=(l... | Calculate all particle number densities from HRG
Includes decays as well. | EoS_HRG/HRG.py | HRG_freezout | pierre-moreau/EoS_HRG | 0 | python | def HRG_freezout(T, muB, muQ, muS, gammaS, EoS='full', **kwargs):
'\n Calculate all particle number densities from HRG\n Includes decays as well.\n '
list_particles = (((HRG_mesons + HRG_baryons) + to_antiparticle(HRG_mesons)) + to_antiparticle(HRG_baryons))
list_particles.sort(reverse=True, key=(l... | def HRG_freezout(T, muB, muQ, muS, gammaS, EoS='full', **kwargs):
'\n Calculate all particle number densities from HRG\n Includes decays as well.\n '
list_particles = (((HRG_mesons + HRG_baryons) + to_antiparticle(HRG_mesons)) + to_antiparticle(HRG_baryons))
list_particles.sort(reverse=True, key=(l... |
459fa0e26f826170fa677ee484d466902d2aafd8e7af84415e75eaefe533a95e | def fit_freezeout(dict_yield, **kwargs):
'\n Extract freeze out parameters by fitting final heavy ion data (dN/dy)\n given in dict_yield. Construct ratios of different particles.\n '
try:
chi2_plot = kwargs['chi2_plot']
except:
chi2_plot = False
try:
freezeout_decay = kw... | Extract freeze out parameters by fitting final heavy ion data (dN/dy)
given in dict_yield. Construct ratios of different particles. | EoS_HRG/HRG.py | fit_freezeout | pierre-moreau/EoS_HRG | 0 | python | def fit_freezeout(dict_yield, **kwargs):
'\n Extract freeze out parameters by fitting final heavy ion data (dN/dy)\n given in dict_yield. Construct ratios of different particles.\n '
try:
chi2_plot = kwargs['chi2_plot']
except:
chi2_plot = False
try:
freezeout_decay = kw... | def fit_freezeout(dict_yield, **kwargs):
'\n Extract freeze out parameters by fitting final heavy ion data (dN/dy)\n given in dict_yield. Construct ratios of different particles.\n '
try:
chi2_plot = kwargs['chi2_plot']
except:
chi2_plot = False
try:
freezeout_decay = kw... |
8b73ee787db6a961b8ba2b7c6069e5b24aeeb91f6a482f7d759132f754856b52 | def f_yields(x, T, muB, muQ, muS, gammaS, dVdy):
'\n Calculate the particle yields for fixed T,muB,muQ,muS,gammaS,volume\n x is a dummy argument\n '
result = np.zeros(len(final_part))
result_HRG = HRG_freezout(T, muB, muQ, muS, gammaS, EoS='full', **kwargs)
for (i, part) in enumerat... | Calculate the particle yields for fixed T,muB,muQ,muS,gammaS,volume
x is a dummy argument | EoS_HRG/HRG.py | f_yields | pierre-moreau/EoS_HRG | 0 | python | def f_yields(x, T, muB, muQ, muS, gammaS, dVdy):
'\n Calculate the particle yields for fixed T,muB,muQ,muS,gammaS,volume\n x is a dummy argument\n '
result = np.zeros(len(final_part))
result_HRG = HRG_freezout(T, muB, muQ, muS, gammaS, EoS='full', **kwargs)
for (i, part) in enumerat... | def f_yields(x, T, muB, muQ, muS, gammaS, dVdy):
'\n Calculate the particle yields for fixed T,muB,muQ,muS,gammaS,volume\n x is a dummy argument\n '
result = np.zeros(len(final_part))
result_HRG = HRG_freezout(T, muB, muQ, muS, gammaS, EoS='full', **kwargs)
for (i, part) in enumerat... |
f284ede6122ce4e15a0cf60f1d54f96e38e5e62003bf1c45d7db317ff405ac29 | def f_yields_nS0(x, T, muB, gammaS, dVdy):
'\n Calculate the particle yields for fixed T,muB,gammaS,volume\n x is a dummy argument\n '
result = np.zeros(len(final_part))
result_HRG = HRG_freezout(T, muB, 0.0, 0.0, gammaS, EoS='nS0', **kwargs)
for (i, part) in enumerate(final_part):
... | Calculate the particle yields for fixed T,muB,gammaS,volume
x is a dummy argument | EoS_HRG/HRG.py | f_yields_nS0 | pierre-moreau/EoS_HRG | 0 | python | def f_yields_nS0(x, T, muB, gammaS, dVdy):
'\n Calculate the particle yields for fixed T,muB,gammaS,volume\n x is a dummy argument\n '
result = np.zeros(len(final_part))
result_HRG = HRG_freezout(T, muB, 0.0, 0.0, gammaS, EoS='nS0', **kwargs)
for (i, part) in enumerate(final_part):
... | def f_yields_nS0(x, T, muB, gammaS, dVdy):
'\n Calculate the particle yields for fixed T,muB,gammaS,volume\n x is a dummy argument\n '
result = np.zeros(len(final_part))
result_HRG = HRG_freezout(T, muB, 0.0, 0.0, gammaS, EoS='nS0', **kwargs)
for (i, part) in enumerate(final_part):
... |
d6322a5077366b8e4b3127596d2dd5da9389fb1ee722136f74dedaf32252f594 | def f_ratios(x, T, muB, muQ, muS, gammaS):
'\n Calculate the ratios of particle yields for fixed T,muB,muQ,muS,gammaS\n x is a dummy argument\n '
result = np.zeros(len(data_ratios))
result_HRG = HRG_freezout(T, muB, muQ, muS, gammaS, EoS='full', **kwargs)
for (i, (part1, part2)) in ... | Calculate the ratios of particle yields for fixed T,muB,muQ,muS,gammaS
x is a dummy argument | EoS_HRG/HRG.py | f_ratios | pierre-moreau/EoS_HRG | 0 | python | def f_ratios(x, T, muB, muQ, muS, gammaS):
'\n Calculate the ratios of particle yields for fixed T,muB,muQ,muS,gammaS\n x is a dummy argument\n '
result = np.zeros(len(data_ratios))
result_HRG = HRG_freezout(T, muB, muQ, muS, gammaS, EoS='full', **kwargs)
for (i, (part1, part2)) in ... | def f_ratios(x, T, muB, muQ, muS, gammaS):
'\n Calculate the ratios of particle yields for fixed T,muB,muQ,muS,gammaS\n x is a dummy argument\n '
result = np.zeros(len(data_ratios))
result_HRG = HRG_freezout(T, muB, muQ, muS, gammaS, EoS='full', **kwargs)
for (i, (part1, part2)) in ... |
c449985e82872b80be7c14c873883c114678a139daa1f0c36e8d6973cf776958 | def f_ratios_nS0(x, T, muB, gammaS):
'\n Calculate the ratios of particle yields for fixed T,muB,gammaS\n x is a dummy argument\n '
result = np.zeros(len(data_ratios))
result_HRG = HRG_freezout(T, muB, 0.0, 0.0, gammaS, EoS='nS0', **kwargs)
for (i, (part1, part2)) in enumerate(zip(f... | Calculate the ratios of particle yields for fixed T,muB,gammaS
x is a dummy argument | EoS_HRG/HRG.py | f_ratios_nS0 | pierre-moreau/EoS_HRG | 0 | python | def f_ratios_nS0(x, T, muB, gammaS):
'\n Calculate the ratios of particle yields for fixed T,muB,gammaS\n x is a dummy argument\n '
result = np.zeros(len(data_ratios))
result_HRG = HRG_freezout(T, muB, 0.0, 0.0, gammaS, EoS='nS0', **kwargs)
for (i, (part1, part2)) in enumerate(zip(f... | def f_ratios_nS0(x, T, muB, gammaS):
'\n Calculate the ratios of particle yields for fixed T,muB,gammaS\n x is a dummy argument\n '
result = np.zeros(len(data_ratios))
result_HRG = HRG_freezout(T, muB, 0.0, 0.0, gammaS, EoS='nS0', **kwargs)
for (i, (part1, part2)) in enumerate(zip(f... |
51562280363fc6efd9789ec179b5b5876f14a0b55fb178f925167327101e810e | def write_output_dirs(labels2_map, seqdict, weightdict, output_dir, output_prefix):
'\n For each partition, create <output_dir>/<output_prefix>_<partition>/in.fa and in.weights\n '
output_dirs = []
if (not os.path.exists(output_dir)):
os.makedirs(output_dir)
for (ncut_label, members) in la... | For each partition, create <output_dir>/<output_prefix>_<partition>/in.fa and in.weights | Cogent/process_kmer_to_graph.py | write_output_dirs | Zuhayr-PacBio/Cogent | 60 | python | def write_output_dirs(labels2_map, seqdict, weightdict, output_dir, output_prefix):
'\n \n '
output_dirs = []
if (not os.path.exists(output_dir)):
os.makedirs(output_dir)
for (ncut_label, members) in labels2_map.items():
d2 = os.path.join(output_dir, ((output_prefix + '_') + str(nc... | def write_output_dirs(labels2_map, seqdict, weightdict, output_dir, output_prefix):
'\n \n '
output_dirs = []
if (not os.path.exists(output_dir)):
os.makedirs(output_dir)
for (ncut_label, members) in labels2_map.items():
d2 = os.path.join(output_dir, ((output_prefix + '_') + str(nc... |
820a6cb15e44fde1b92362dc5667bc911f556967234768b56eb68d197fe10e89 | def family_finding(dist_filename, seqdict, output_prefix, has_pbid=False, weight_threshold=0.05, ncut_threshold=0.2):
'\n Make a weighted (undirected) graph where each node is a sequence, each edge is k-mer similarity\n Then do normalized cut to find the family partitions\n\n For each partition, make <outp... | Make a weighted (undirected) graph where each node is a sequence, each edge is k-mer similarity
Then do normalized cut to find the family partitions
For each partition, make <output_prefix>/<partition_number>/in.fa
If the IDs are in PB id format (has genome answer), like PB.1.3
then write that out as the "gene" (grou... | Cogent/process_kmer_to_graph.py | family_finding | Zuhayr-PacBio/Cogent | 60 | python | def family_finding(dist_filename, seqdict, output_prefix, has_pbid=False, weight_threshold=0.05, ncut_threshold=0.2):
'\n Make a weighted (undirected) graph where each node is a sequence, each edge is k-mer similarity\n Then do normalized cut to find the family partitions\n\n For each partition, make <outp... | def family_finding(dist_filename, seqdict, output_prefix, has_pbid=False, weight_threshold=0.05, ncut_threshold=0.2):
'\n Make a weighted (undirected) graph where each node is a sequence, each edge is k-mer similarity\n Then do normalized cut to find the family partitions\n\n For each partition, make <outp... |
a52ce826a55cff7ddd3121b53eaecc3527ca7d621e448b9b4700b65cff642629 | @classmethod
def validate(cls, value, allow_tuple=True):
'\n Valid examples:\n\n all\n instances\n (suites, instances)\n '
def validate_single(v):
if isinstance(v, str):
return SortType(v.lower()).value
if isinstance(v, ... | Valid examples:
all
instances
(suites, instances) | testplan/testing/ordering.py | validate | ymn1k/testplan | 0 | python | @classmethod
def validate(cls, value, allow_tuple=True):
'\n Valid examples:\n\n all\n instances\n (suites, instances)\n '
def validate_single(v):
if isinstance(v, str):
return SortType(v.lower()).value
if isinstance(v, ... | @classmethod
def validate(cls, value, allow_tuple=True):
'\n Valid examples:\n\n all\n instances\n (suites, instances)\n '
def validate_single(v):
if isinstance(v, str):
return SortType(v.lower()).value
if isinstance(v, ... |
637fe6b2f158aa4518e23404c94f4307490a6869fd91b5fab1049706a3a64abb | def apply_mask(image, mask):
'apply mask to image'
redImg = np.zeros(image.shape, image.dtype)
redImg[(:, :)] = (0, 0, 255)
redMask = cv2.bitwise_and(redImg, redImg, mask=mask)
cv2.addWeighted(redMask, 1, image, 1, 0, image)
return image | apply mask to image | gen_mask.py | apply_mask | mathiasaap/SegCaps | 65 | python | def apply_mask(image, mask):
redImg = np.zeros(image.shape, image.dtype)
redImg[(:, :)] = (0, 0, 255)
redMask = cv2.bitwise_and(redImg, redImg, mask=mask)
cv2.addWeighted(redMask, 1, image, 1, 0, image)
return image | def apply_mask(image, mask):
redImg = np.zeros(image.shape, image.dtype)
redImg[(:, :)] = (0, 0, 255)
redMask = cv2.bitwise_and(redImg, redImg, mask=mask)
cv2.addWeighted(redMask, 1, image, 1, 0, image)
return image<|docstring|>apply mask to image<|endoftext|> |
592613fe5210a8cf610b234ecb303cf0ada7df0b08541f1010c79f0b35153fd3 | def __init__(self, args, net_input_shape):
'\n Create evaluation model and load the pre-train weights for inference.\n '
self.net_input_shape = net_input_shape
weights_path = join(args.weights_path)
(_, eval_model, _) = create_model(args, net_input_shape, enable_decoder=False)
eval_mod... | Create evaluation model and load the pre-train weights for inference. | gen_mask.py | __init__ | mathiasaap/SegCaps | 65 | python | def __init__(self, args, net_input_shape):
'\n \n '
self.net_input_shape = net_input_shape
weights_path = join(args.weights_path)
(_, eval_model, _) = create_model(args, net_input_shape, enable_decoder=False)
eval_model.load_weights(weights_path, by_name=True)
self.model = eval_mod... | def __init__(self, args, net_input_shape):
'\n \n '
self.net_input_shape = net_input_shape
weights_path = join(args.weights_path)
(_, eval_model, _) = create_model(args, net_input_shape, enable_decoder=False)
eval_model.load_weights(weights_path, by_name=True)
self.model = eval_mod... |
c52eef061696adb1b183c2e6e5c0cc1c7c6600c5bd44b0340cf5e8f6d57a1928 | def createUI(pWindowTitle, pApplyCallback):
'\n This is a function that creates the user interface, where users can input the shape and size of petals,\n number of petals, and petal angle to create varioius pine cone like shapes\n '
windowID = 'PineCone'
if cmds.window(windowID, exists=True):
... | This is a function that creates the user interface, where users can input the shape and size of petals,
number of petals, and petal angle to create varioius pine cone like shapes | Pine Cone.py | createUI | dannygelman1/Pine-Cone-Generator | 1 | python | def createUI(pWindowTitle, pApplyCallback):
'\n This is a function that creates the user interface, where users can input the shape and size of petals,\n number of petals, and petal angle to create varioius pine cone like shapes\n '
windowID = 'PineCone'
if cmds.window(windowID, exists=True):
... | def createUI(pWindowTitle, pApplyCallback):
'\n This is a function that creates the user interface, where users can input the shape and size of petals,\n number of petals, and petal angle to create varioius pine cone like shapes\n '
windowID = 'PineCone'
if cmds.window(windowID, exists=True):
... |
9164d8550281f2430a2e3c1a656384935abd9882fe9c791e1d17260855b1f458 | def applyCallback(pPetalShape, pNumPetals, pPetalHeight, pPetalRadius, pPetalAngle, *pArgs):
'\n This function generates pine cone like shapes from user input\n '
numberPetals = cmds.intField(pNumPetals, query=True, value=True)
startH = cmds.floatField(pPetalHeight, query=True, value=True)
startR ... | This function generates pine cone like shapes from user input | Pine Cone.py | applyCallback | dannygelman1/Pine-Cone-Generator | 1 | python | def applyCallback(pPetalShape, pNumPetals, pPetalHeight, pPetalRadius, pPetalAngle, *pArgs):
'\n \n '
numberPetals = cmds.intField(pNumPetals, query=True, value=True)
startH = cmds.floatField(pPetalHeight, query=True, value=True)
startR = cmds.floatField(pPetalRadius, query=True, value=True)
p... | def applyCallback(pPetalShape, pNumPetals, pPetalHeight, pPetalRadius, pPetalAngle, *pArgs):
'\n \n '
numberPetals = cmds.intField(pNumPetals, query=True, value=True)
startH = cmds.floatField(pPetalHeight, query=True, value=True)
startR = cmds.floatField(pPetalRadius, query=True, value=True)
p... |
af6227c45a366d109e963652a6f80e3ec5dcdc8b93491d5dce53900fe2cddcab | def nondimensional():
'\n Factory associated with NondimElasticQuasistatic.\n '
return NondimElasticQuasistatic() | Factory associated with NondimElasticQuasistatic. | spatialdata/units/NondimElasticQuasistatic.py | nondimensional | rwalkerlewis/spatialdata | 6 | python | def nondimensional():
'\n \n '
return NondimElasticQuasistatic() | def nondimensional():
'\n \n '
return NondimElasticQuasistatic()<|docstring|>Factory associated with NondimElasticQuasistatic.<|endoftext|> |
2f8ebecb8fa225b4c4aeb137fc092f9dec8d71c8d19d0f1a8eca64b0cd737738 | def __init__(self, name='nondimelasticquasistatic'):
'\n Constructor.\n '
Nondimensional.__init__(self, name) | Constructor. | spatialdata/units/NondimElasticQuasistatic.py | __init__ | rwalkerlewis/spatialdata | 6 | python | def __init__(self, name='nondimelasticquasistatic'):
'\n \n '
Nondimensional.__init__(self, name) | def __init__(self, name='nondimelasticquasistatic'):
'\n \n '
Nondimensional.__init__(self, name)<|docstring|>Constructor.<|endoftext|> |
e66799a58642b5e54956c4fb342920078b9134317970f9c0dfd7e3391a444a09 | def _configure(self):
'\n Setup members using inventory.\n '
Nondimensional._configure(self)
self.setLengthScale(self.inventory.lengthScale)
self.setPressureScale(self.inventory.shearModulus)
self.setTimeScale(self.inventory.relaxationTime)
self.computeDensityScale() | Setup members using inventory. | spatialdata/units/NondimElasticQuasistatic.py | _configure | rwalkerlewis/spatialdata | 6 | python | def _configure(self):
'\n \n '
Nondimensional._configure(self)
self.setLengthScale(self.inventory.lengthScale)
self.setPressureScale(self.inventory.shearModulus)
self.setTimeScale(self.inventory.relaxationTime)
self.computeDensityScale() | def _configure(self):
'\n \n '
Nondimensional._configure(self)
self.setLengthScale(self.inventory.lengthScale)
self.setPressureScale(self.inventory.shearModulus)
self.setTimeScale(self.inventory.relaxationTime)
self.computeDensityScale()<|docstring|>Setup members using inventory.<|... |
525dea784f8279a628629bf0f02b84fb50b8f7b7a5ce9bb246cdc19b3f69df64 | def write_database_integrity_violation(results, headers, reason_message, action_message=None):
'Emit a integrity violation warning and write the violating records to a log file in the current directory\n\n :param results: a list of tuples representing the violating records\n :param headers: a tuple of strings... | Emit a integrity violation warning and write the violating records to a log file in the current directory
:param results: a list of tuples representing the violating records
:param headers: a tuple of strings that will be used as a header for the log file. Should have the same length
as each tuple in the results l... | aiida/manage/database/integrity/utils.py | write_database_integrity_violation | azadoks/aiida-core | 180 | python | def write_database_integrity_violation(results, headers, reason_message, action_message=None):
'Emit a integrity violation warning and write the violating records to a log file in the current directory\n\n :param results: a list of tuples representing the violating records\n :param headers: a tuple of strings... | def write_database_integrity_violation(results, headers, reason_message, action_message=None):
'Emit a integrity violation warning and write the violating records to a log file in the current directory\n\n :param results: a list of tuples representing the violating records\n :param headers: a tuple of strings... |
65bc734b2a4f7cde654d79059594170d8b90c141417f3205f409ea9c5c89b499 | def test_next_first(self):
' Delete the next patch with only unapplied patches '
with tmp_series() as [dir, patches]:
patches.add_patch(Patch('patch'))
patches.save()
cmd = Delete(dir, quilt_pc=dir, quilt_patches=patches.dirname)
cmd.delete_next()
patches.read()
s... | Delete the next patch with only unapplied patches | tests/test_delete.py | test_next_first | jayvdb/python-quilt | 4 | python | def test_next_first(self):
' '
with tmp_series() as [dir, patches]:
patches.add_patch(Patch('patch'))
patches.save()
cmd = Delete(dir, quilt_pc=dir, quilt_patches=patches.dirname)
cmd.delete_next()
patches.read()
self.assertTrue(patches.is_empty()) | def test_next_first(self):
' '
with tmp_series() as [dir, patches]:
patches.add_patch(Patch('patch'))
patches.save()
cmd = Delete(dir, quilt_pc=dir, quilt_patches=patches.dirname)
cmd.delete_next()
patches.read()
self.assertTrue(patches.is_empty())<|docstring|>De... |
1cea31bcdc818d4eb4fb478d077e8a3dd38d3fa33990c2db7a236c5d5ba863a3 | def test_next_after(self):
' Delete the successor to the topmost patch '
with tmp_series() as [dir, series]:
series.add_patch(Patch('topmost'))
series.add_patch(Patch('unapplied'))
series.save()
db = Db(dir)
db.add_patch(Patch('topmost'))
db.save()
cmd = D... | Delete the successor to the topmost patch | tests/test_delete.py | test_next_after | jayvdb/python-quilt | 4 | python | def test_next_after(self):
' '
with tmp_series() as [dir, series]:
series.add_patch(Patch('topmost'))
series.add_patch(Patch('unapplied'))
series.save()
db = Db(dir)
db.add_patch(Patch('topmost'))
db.save()
cmd = Delete(dir, db.dirname, series.dirname)
... | def test_next_after(self):
' '
with tmp_series() as [dir, series]:
series.add_patch(Patch('topmost'))
series.add_patch(Patch('unapplied'))
series.save()
db = Db(dir)
db.add_patch(Patch('topmost'))
db.save()
cmd = Delete(dir, db.dirname, series.dirname)
... |
a4c4c6d2579ac6830bcd12bad189e576ccf4902f15370f36175f2f034ef582aa | def test_no_backup_next(self):
' Remove the next patch without leaving a backup '
with tmp_series() as [dir, patches]:
patches.add_patch(Patch('patch'))
patches.save()
patch = os.path.join(patches.dirname, 'patch')
make_file(b'', patch)
run_cli(DeleteCommand, dict(next=Tr... | Remove the next patch without leaving a backup | tests/test_delete.py | test_no_backup_next | jayvdb/python-quilt | 4 | python | def test_no_backup_next(self):
' '
with tmp_series() as [dir, patches]:
patches.add_patch(Patch('patch'))
patches.save()
patch = os.path.join(patches.dirname, 'patch')
make_file(b, patch)
run_cli(DeleteCommand, dict(next=True, patch=None, remove=True, backup=False), patc... | def test_no_backup_next(self):
' '
with tmp_series() as [dir, patches]:
patches.add_patch(Patch('patch'))
patches.save()
patch = os.path.join(patches.dirname, 'patch')
make_file(b, patch)
run_cli(DeleteCommand, dict(next=True, patch=None, remove=True, backup=False), patc... |
6026d4dc99da5b45e69b6fc7beb62804736fbe30264ffc852ff424cab3ae2223 | def test_no_backup_named(self):
' Remove a specified patch without leaving a backup '
with tmp_series() as [dir, patches]:
patches.add_patch(Patch('patch'))
patches.save()
patch = os.path.join(patches.dirname, 'patch')
make_file(b'', patch)
run_cli(DeleteCommand, dict(pat... | Remove a specified patch without leaving a backup | tests/test_delete.py | test_no_backup_named | jayvdb/python-quilt | 4 | python | def test_no_backup_named(self):
' '
with tmp_series() as [dir, patches]:
patches.add_patch(Patch('patch'))
patches.save()
patch = os.path.join(patches.dirname, 'patch')
make_file(b, patch)
run_cli(DeleteCommand, dict(patch='patch', next=False, remove=True, backup=False),... | def test_no_backup_named(self):
' '
with tmp_series() as [dir, patches]:
patches.add_patch(Patch('patch'))
patches.save()
patch = os.path.join(patches.dirname, 'patch')
make_file(b, patch)
run_cli(DeleteCommand, dict(patch='patch', next=False, remove=True, backup=False),... |
6b08d6af9354705e967472d1581f026fe81898524527344d536685b9607245dd | async def create(self, **kwargs):
'\n\n :param kwargs:\n :return:\n '
endpoint = 'dedicated_account'
return (await self.req.post(endpoint=endpoint, json=kwargs)) | :param kwargs:
:return: | paystackapi/dedicated_virtual_account.py | create | Ichinga-Samuel/async-paystackapi | 0 | python | async def create(self, **kwargs):
'\n\n :param kwargs:\n :return:\n '
endpoint = 'dedicated_account'
return (await self.req.post(endpoint=endpoint, json=kwargs)) | async def create(self, **kwargs):
'\n\n :param kwargs:\n :return:\n '
endpoint = 'dedicated_account'
return (await self.req.post(endpoint=endpoint, json=kwargs))<|docstring|>:param kwargs:
:return:<|endoftext|> |
cdbd29c43f721b6da1381cfeb7b25e6a60f6f9d215eb45ad5641bbeda4dd3cc3 | async def list(self, **kwargs):
'\n\n :param kwargs:\n :return:\n '
endpoint = 'dedicated_account'
return ((await self.req.get(endpoint=endpoint, params=kwargs)) if kwargs else (await self.req.get(endpoint=endpoint))) | :param kwargs:
:return: | paystackapi/dedicated_virtual_account.py | list | Ichinga-Samuel/async-paystackapi | 0 | python | async def list(self, **kwargs):
'\n\n :param kwargs:\n :return:\n '
endpoint = 'dedicated_account'
return ((await self.req.get(endpoint=endpoint, params=kwargs)) if kwargs else (await self.req.get(endpoint=endpoint))) | async def list(self, **kwargs):
'\n\n :param kwargs:\n :return:\n '
endpoint = 'dedicated_account'
return ((await self.req.get(endpoint=endpoint, params=kwargs)) if kwargs else (await self.req.get(endpoint=endpoint)))<|docstring|>:param kwargs:
:return:<|endoftext|> |
36d0c8c9a9d3af4d69611f9501286e28dac90484a600345e52affe6cfd6f7eaa | async def fetch(self, *, _id):
'\n\n :param _id:\n :return:\n '
endpoint = f'dedicated_account/{_id}'
return (await self.req.get(endpoint=endpoint)) | :param _id:
:return: | paystackapi/dedicated_virtual_account.py | fetch | Ichinga-Samuel/async-paystackapi | 0 | python | async def fetch(self, *, _id):
'\n\n :param _id:\n :return:\n '
endpoint = f'dedicated_account/{_id}'
return (await self.req.get(endpoint=endpoint)) | async def fetch(self, *, _id):
'\n\n :param _id:\n :return:\n '
endpoint = f'dedicated_account/{_id}'
return (await self.req.get(endpoint=endpoint))<|docstring|>:param _id:
:return:<|endoftext|> |
00e36f1638c0ced2ea71634319508641ef9796467dfc73e121d7869220b2dc0a | async def deactivate(self, *, _id):
'\n\n :param _id:\n :return:\n '
endpoint = f'dedicated_account/{_id}'
return (await self.req.delete(endpoint=endpoint)) | :param _id:
:return: | paystackapi/dedicated_virtual_account.py | deactivate | Ichinga-Samuel/async-paystackapi | 0 | python | async def deactivate(self, *, _id):
'\n\n :param _id:\n :return:\n '
endpoint = f'dedicated_account/{_id}'
return (await self.req.delete(endpoint=endpoint)) | async def deactivate(self, *, _id):
'\n\n :param _id:\n :return:\n '
endpoint = f'dedicated_account/{_id}'
return (await self.req.delete(endpoint=endpoint))<|docstring|>:param _id:
:return:<|endoftext|> |
f611d032afa79ea5c6b0f336b368aea706670891c8db60e07bb589bcbc15c776 | async def split(self, **kwargs):
'\n\n :param kwargs:\n :return:\n '
endpoint = 'dedicated_account/split'
return (await self.req.post(endpoint=endpoint, json=kwargs)) | :param kwargs:
:return: | paystackapi/dedicated_virtual_account.py | split | Ichinga-Samuel/async-paystackapi | 0 | python | async def split(self, **kwargs):
'\n\n :param kwargs:\n :return:\n '
endpoint = 'dedicated_account/split'
return (await self.req.post(endpoint=endpoint, json=kwargs)) | async def split(self, **kwargs):
'\n\n :param kwargs:\n :return:\n '
endpoint = 'dedicated_account/split'
return (await self.req.post(endpoint=endpoint, json=kwargs))<|docstring|>:param kwargs:
:return:<|endoftext|> |
7124f9df24250bc55a0ee60cb9d2ffc0b33357acb8531cbaeec1f361739b456c | async def remove_split(self, *, account_number):
'\n\n :param account_number:\n :return:\n '
endpoint = 'dedicated_account/split'
return (await self.req.delete(endpoint=endpoint, json={'account_number': account_number})) | :param account_number:
:return: | paystackapi/dedicated_virtual_account.py | remove_split | Ichinga-Samuel/async-paystackapi | 0 | python | async def remove_split(self, *, account_number):
'\n\n :param account_number:\n :return:\n '
endpoint = 'dedicated_account/split'
return (await self.req.delete(endpoint=endpoint, json={'account_number': account_number})) | async def remove_split(self, *, account_number):
'\n\n :param account_number:\n :return:\n '
endpoint = 'dedicated_account/split'
return (await self.req.delete(endpoint=endpoint, json={'account_number': account_number}))<|docstring|>:param account_number:
:return:<|endoftext|> |
948aecf7c1aed9ca251b02a111fa7b45ac19d29ef016d765d72ba6617688d61e | async def providers(self):
'\n\n :return:\n '
endpoint = 'dedicated_account/available_providers'
return (await self.req.get(endpoint=endpoint)) | :return: | paystackapi/dedicated_virtual_account.py | providers | Ichinga-Samuel/async-paystackapi | 0 | python | async def providers(self):
'\n\n \n '
endpoint = 'dedicated_account/available_providers'
return (await self.req.get(endpoint=endpoint)) | async def providers(self):
'\n\n \n '
endpoint = 'dedicated_account/available_providers'
return (await self.req.get(endpoint=endpoint))<|docstring|>:return:<|endoftext|> |
ba7353bb99893b61c0936fb1abb45b842b1c44e1f94c1b5e1ba73f17f6231ef5 | def parse_cfg_file(cfg_file: str):
'Read configuration file and parse it into list of blocks'
lines = read_uncommented_lines(cfg_file)
blocks = parse_cfg_list(lines)
return blocks | Read configuration file and parse it into list of blocks | yolov3.py | parse_cfg_file | TalHadad/yolov3_tf2 | 0 | python | def parse_cfg_file(cfg_file: str):
lines = read_uncommented_lines(cfg_file)
blocks = parse_cfg_list(lines)
return blocks | def parse_cfg_file(cfg_file: str):
lines = read_uncommented_lines(cfg_file)
blocks = parse_cfg_list(lines)
return blocks<|docstring|>Read configuration file and parse it into list of blocks<|endoftext|> |
573849d54724dca4da6dddd6c4e653f065af93b3d2056f3387a2391728e9d8c7 | def read_uncommented_lines(cfg_file: str) -> List:
'Read file lines to list and remove unnecessary characters like ‘\n’ and ‘#’.'
with open(cfg_file, 'r') as file:
lines = [line.rstrip('\n') for line in file if ((line != '\n') and (line[0] != '#'))]
return lines | Read file lines to list and remove unnecessary characters like ‘
’ and ‘#’. | yolov3.py | read_uncommented_lines | TalHadad/yolov3_tf2 | 0 | python | def read_uncommented_lines(cfg_file: str) -> List:
'Read file lines to list and remove unnecessary characters like ‘\n’ and ‘#’.'
with open(cfg_file, 'r') as file:
lines = [line.rstrip('\n') for line in file if ((line != '\n') and (line[0] != '#'))]
return lines | def read_uncommented_lines(cfg_file: str) -> List:
'Read file lines to list and remove unnecessary characters like ‘\n’ and ‘#’.'
with open(cfg_file, 'r') as file:
lines = [line.rstrip('\n') for line in file if ((line != '\n') and (line[0] != '#'))]
return lines<|docstring|>Read file lines to list a... |
41646817b764f06b075b7f094a52ea27f9c48b5d18db950d0f892f6d90ab6240 | def parse_cfg_list(cfg_list: List) -> List:
'Read attributes list and store them as key, value pairs in list blocks'
holder = {}
blocks = []
for cfg_item in cfg_list:
if (cfg_item[0] == '['):
cfg_item = ('type=' + cfg_item[1:(- 1)].rstrip())
if (len(holder) != 0):
... | Read attributes list and store them as key, value pairs in list blocks | yolov3.py | parse_cfg_list | TalHadad/yolov3_tf2 | 0 | python | def parse_cfg_list(cfg_list: List) -> List:
holder = {}
blocks = []
for cfg_item in cfg_list:
if (cfg_item[0] == '['):
cfg_item = ('type=' + cfg_item[1:(- 1)].rstrip())
if (len(holder) != 0):
blocks.append(holder)
holder = {}
(key,... | def parse_cfg_list(cfg_list: List) -> List:
holder = {}
blocks = []
for cfg_item in cfg_list:
if (cfg_item[0] == '['):
cfg_item = ('type=' + cfg_item[1:(- 1)].rstrip())
if (len(holder) != 0):
blocks.append(holder)
holder = {}
(key,... |
4106f396554b819497ac9c578f59a20c2e3d482c990e339e41ac43e0bde04ecf | def scan(self) -> bool:
'Find a device advertising the environmental sensor service.'
found = None
def callback(_found):
nonlocal found
found = _found
self._addr_type = None
self._addr = None
self._scan_callback = callback
self._ble.gap_scan(5000, 100000, 10000, True)
wh... | Find a device advertising the environmental sensor service. | tepra.py | scan | nnabeyang/tepra-lite-esp32 | 33 | python | def scan(self) -> bool:
found = None
def callback(_found):
nonlocal found
found = _found
self._addr_type = None
self._addr = None
self._scan_callback = callback
self._ble.gap_scan(5000, 100000, 10000, True)
while (found is None):
time.sleep_ms(10)
self._scan... | def scan(self) -> bool:
found = None
def callback(_found):
nonlocal found
found = _found
self._addr_type = None
self._addr = None
self._scan_callback = callback
self._ble.gap_scan(5000, 100000, 10000, True)
while (found is None):
time.sleep_ms(10)
self._scan... |
44dcf4fd7b6bb86092d0985576641a2c8c55c411f101f7c793f202edddf63343 | def connect(self):
'Connect to the specified device (otherwise use cached address from a scan).'
if ((self._addr_type is None) or (self._addr is None)):
return False
self._ble.gap_connect(self._addr_type, self._addr)
while (self._conn_handle is None):
time.sleep_ms(10)
return True | Connect to the specified device (otherwise use cached address from a scan). | tepra.py | connect | nnabeyang/tepra-lite-esp32 | 33 | python | def connect(self):
if ((self._addr_type is None) or (self._addr is None)):
return False
self._ble.gap_connect(self._addr_type, self._addr)
while (self._conn_handle is None):
time.sleep_ms(10)
return True | def connect(self):
if ((self._addr_type is None) or (self._addr is None)):
return False
self._ble.gap_connect(self._addr_type, self._addr)
while (self._conn_handle is None):
time.sleep_ms(10)
return True<|docstring|>Connect to the specified device (otherwise use cached address from ... |
11d6f469b1bd1d1f49573e318e9868d0d8d07aa7b1aeb6495f7dd480a3153ee5 | def disconnect(self):
'Disconnect from current device.'
if (not self._conn_handle):
return
self._ble.gap_disconnect(self._conn_handle)
self._reset() | Disconnect from current device. | tepra.py | disconnect | nnabeyang/tepra-lite-esp32 | 33 | python | def disconnect(self):
if (not self._conn_handle):
return
self._ble.gap_disconnect(self._conn_handle)
self._reset() | def disconnect(self):
if (not self._conn_handle):
return
self._ble.gap_disconnect(self._conn_handle)
self._reset()<|docstring|>Disconnect from current device.<|endoftext|> |
f130263b1685090654939737df2e87d139793d9f268c61d157f9a7a68eb4dff1 | def write(self, c: Characteristic, data: bytes):
'Send data without response.'
if (not c.prop_write_without_response()):
return
if (self._conn_handle is None):
return
self._log('Writing without response: {}', hexstr(data))
self._ble.gattc_write(self._conn_handle, c.value_handle, data... | Send data without response. | tepra.py | write | nnabeyang/tepra-lite-esp32 | 33 | python | def write(self, c: Characteristic, data: bytes):
if (not c.prop_write_without_response()):
return
if (self._conn_handle is None):
return
self._log('Writing without response: {}', hexstr(data))
self._ble.gattc_write(self._conn_handle, c.value_handle, data, 0)
return | def write(self, c: Characteristic, data: bytes):
if (not c.prop_write_without_response()):
return
if (self._conn_handle is None):
return
self._log('Writing without response: {}', hexstr(data))
self._ble.gattc_write(self._conn_handle, c.value_handle, data, 0)
return<|docstring|>S... |
56c952c25ad486aee48b8aa6482b2b53d7cb0d76d3ed4dece871fc916f932a4a | def write_request(self, c: Characteristic, data: bytes, callback):
'Send data with response.'
done = False
if (not c.prop_write()):
return
if (self._conn_handle is None):
return
def callback_done(handle, status):
nonlocal done
done = True
callback(handle, sta... | Send data with response. | tepra.py | write_request | nnabeyang/tepra-lite-esp32 | 33 | python | def write_request(self, c: Characteristic, data: bytes, callback):
done = False
if (not c.prop_write()):
return
if (self._conn_handle is None):
return
def callback_done(handle, status):
nonlocal done
done = True
callback(handle, status)
self._write_done_... | def write_request(self, c: Characteristic, data: bytes, callback):
done = False
if (not c.prop_write()):
return
if (self._conn_handle is None):
return
def callback_done(handle, status):
nonlocal done
done = True
callback(handle, status)
self._write_done_... |
5cc1371512180af45aa28756bd19827775ca8a0778ed2cccb0c31995946e2190 | def write_cccd(self, c: Characteristic, indication=False, notification=False):
'Write the Client Characteristic Configuration Descriptor of a characteristic.'
done = False
if ((not c.prop_indicate()) and (not c.prop_notify())):
return
if (self._conn_handle is None):
return
def callb... | Write the Client Characteristic Configuration Descriptor of a characteristic. | tepra.py | write_cccd | nnabeyang/tepra-lite-esp32 | 33 | python | def write_cccd(self, c: Characteristic, indication=False, notification=False):
done = False
if ((not c.prop_indicate()) and (not c.prop_notify())):
return
if (self._conn_handle is None):
return
def callback_done(*_):
nonlocal done
done = True
self._write_done_ca... | def write_cccd(self, c: Characteristic, indication=False, notification=False):
done = False
if ((not c.prop_indicate()) and (not c.prop_notify())):
return
if (self._conn_handle is None):
return
def callback_done(*_):
nonlocal done
done = True
self._write_done_ca... |
885dd4f837e17eabeb55d0e0ee243f5f5e2b91563fe14704b6a0424b9f438311 | def write_wait_notification(self, tx: Characteristic, tx_data: bytes, rx: Characteristic) -> Optional[bytes]:
'Write without response and wait for a notification'
rx_data = None
if ((not tx.prop_write_without_response()) or (not rx.prop_notify())):
return rx_data
if (self._conn_handle is None):
... | Write without response and wait for a notification | tepra.py | write_wait_notification | nnabeyang/tepra-lite-esp32 | 33 | python | def write_wait_notification(self, tx: Characteristic, tx_data: bytes, rx: Characteristic) -> Optional[bytes]:
rx_data = None
if ((not tx.prop_write_without_response()) or (not rx.prop_notify())):
return rx_data
if (self._conn_handle is None):
return rx_data
def callback(handle, d):... | def write_wait_notification(self, tx: Characteristic, tx_data: bytes, rx: Characteristic) -> Optional[bytes]:
rx_data = None
if ((not tx.prop_write_without_response()) or (not rx.prop_notify())):
return rx_data
if (self._conn_handle is None):
return rx_data
def callback(handle, d):... |
8ed09a93fa56ac9fd14abf82a55ccb5473d3adb1a9b724abbb5be30d415b0a91 | def wait_notification(self, rx: Characteristic) -> Optional[bytes]:
'Wait for a notification from the characteristic'
rx_data = None
if (not rx.prop_notify()):
return
if (self._conn_handle is None):
return
def callback(handle, d):
nonlocal rx_data
if (handle == rx.va... | Wait for a notification from the characteristic | tepra.py | wait_notification | nnabeyang/tepra-lite-esp32 | 33 | python | def wait_notification(self, rx: Characteristic) -> Optional[bytes]:
rx_data = None
if (not rx.prop_notify()):
return
if (self._conn_handle is None):
return
def callback(handle, d):
nonlocal rx_data
if (handle == rx.value_handle):
rx_data = d
self._no... | def wait_notification(self, rx: Characteristic) -> Optional[bytes]:
rx_data = None
if (not rx.prop_notify()):
return
if (self._conn_handle is None):
return
def callback(handle, d):
nonlocal rx_data
if (handle == rx.value_handle):
rx_data = d
self._no... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.