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
a63258b796c598eef48c87700a5ef16bfbc688d45dc46e3ba78419c4cdbc27b8
def getWordSet(b): "build a dict of word objects\n keeps all apostrophes, even though a closing apos might be a close\n single quote. later, try to replace the apos with a letter (typ. 'g')\n to make a word.\n " a = b[:] wo = dict() for (i, _) in enumerate(a): t33 = a[i] t33 ...
build a dict of word objects keeps all apostrophes, even though a closing apos might be a close single quote. later, try to replace the apos with a letter (typ. 'g') to make a word.
pgspell.py
getWordSet
asylumcs/pgspell
0
python
def getWordSet(b): "build a dict of word objects\n keeps all apostrophes, even though a closing apos might be a close\n single quote. later, try to replace the apos with a letter (typ. 'g')\n to make a word.\n " a = b[:] wo = dict() for (i, _) in enumerate(a): t33 = a[i] t33 ...
def getWordSet(b): "build a dict of word objects\n keeps all apostrophes, even though a closing apos might be a close\n single quote. later, try to replace the apos with a letter (typ. 'g')\n to make a word.\n " a = b[:] wo = dict() for (i, _) in enumerate(a): t33 = a[i] t33 ...
91e0627062122ca384ff2357b66257cc03d32a5a01ab43c70b36dbd9065e712e
@pytest.mark.parametrize('factorization', ['CP', 'Tucker', 'TT']) def test_FactorizedTensor(factorization): 'Test for FactorizedTensor' shape = (4, 3, 2, 5) fact_tensor = FactorizedTensor.new(shape=shape, rank='same', factorization=factorization) fact_tensor.normal_() assert (fact_tensor._name.lower...
Test for FactorizedTensor
tltorch/factorized_tensors/tests/test_factorizations.py
test_FactorizedTensor
cassiofragadantas/torch
0
python
@pytest.mark.parametrize('factorization', ['CP', 'Tucker', 'TT']) def test_FactorizedTensor(factorization): shape = (4, 3, 2, 5) fact_tensor = FactorizedTensor.new(shape=shape, rank='same', factorization=factorization) fact_tensor.normal_() assert (fact_tensor._name.lower() == factorization.lower()...
@pytest.mark.parametrize('factorization', ['CP', 'Tucker', 'TT']) def test_FactorizedTensor(factorization): shape = (4, 3, 2, 5) fact_tensor = FactorizedTensor.new(shape=shape, rank='same', factorization=factorization) fact_tensor.normal_() assert (fact_tensor._name.lower() == factorization.lower()...
e7f9f93aeb212dbf4bfe8a5adfa200a1c1815a468e0ba1983a9199d4c2c04c69
@pytest.mark.parametrize('factorization', ['CP', 'TT']) def test_transduction(factorization): 'Test for transduction' shape = (3, 4, 5) new_dim = 2 for mode in range(3): fact_tensor = FactorizedTensor.new(shape=shape, rank=6, factorization=factorization) fact_tensor.normal_() ori...
Test for transduction
tltorch/factorized_tensors/tests/test_factorizations.py
test_transduction
cassiofragadantas/torch
0
python
@pytest.mark.parametrize('factorization', ['CP', 'TT']) def test_transduction(factorization): shape = (3, 4, 5) new_dim = 2 for mode in range(3): fact_tensor = FactorizedTensor.new(shape=shape, rank=6, factorization=factorization) fact_tensor.normal_() original_rec = fact_tensor...
@pytest.mark.parametrize('factorization', ['CP', 'TT']) def test_transduction(factorization): shape = (3, 4, 5) new_dim = 2 for mode in range(3): fact_tensor = FactorizedTensor.new(shape=shape, rank=6, factorization=factorization) fact_tensor.normal_() original_rec = fact_tensor...
60ce443d5f90ca2fe0a3ec972856285104a4c2372dc249449f76ba3f2b656187
@pytest.mark.parametrize('unsqueezed_init', ['average', 1.2]) def test_tucker_init_unsqueezed_modes(unsqueezed_init): 'Test for Tucker Factorization init from tensor with unsqueezed_modes\n ' tensor = FactorizedTensor.new((4, 4, 4), rank=(4, 1, 4), factorization='tucker') mat = torch.randn((4, 4)) te...
Test for Tucker Factorization init from tensor with unsqueezed_modes
tltorch/factorized_tensors/tests/test_factorizations.py
test_tucker_init_unsqueezed_modes
cassiofragadantas/torch
0
python
@pytest.mark.parametrize('unsqueezed_init', ['average', 1.2]) def test_tucker_init_unsqueezed_modes(unsqueezed_init): '\n ' tensor = FactorizedTensor.new((4, 4, 4), rank=(4, 1, 4), factorization='tucker') mat = torch.randn((4, 4)) tensor.init_from_tensor(mat, unsqueezed_modes=[1], unsqueezed_init=uns...
@pytest.mark.parametrize('unsqueezed_init', ['average', 1.2]) def test_tucker_init_unsqueezed_modes(unsqueezed_init): '\n ' tensor = FactorizedTensor.new((4, 4, 4), rank=(4, 1, 4), factorization='tucker') mat = torch.randn((4, 4)) tensor.init_from_tensor(mat, unsqueezed_modes=[1], unsqueezed_init=uns...
3b818c35a3ad7e21c57122bf281d6fe7007560709e63626f97146662cc293ba0
def word_matches(word): ' True when the word before the cursor matches. ' if self.ignore_case: word = word.lower() if self.match_middle: return (word_before_cursor in word) else: return word.startswith(word_before_cursor)
True when the word before the cursor matches.
questionary/completer.py
word_matches
ahmed-agiza/questionary
0
python
def word_matches(word): ' ' if self.ignore_case: word = word.lower() if self.match_middle: return (word_before_cursor in word) else: return word.startswith(word_before_cursor)
def word_matches(word): ' ' if self.ignore_case: word = word.lower() if self.match_middle: return (word_before_cursor in word) else: return word.startswith(word_before_cursor)<|docstring|>True when the word before the cursor matches.<|endoftext|>
e62885cbd35581b7b43b4a0bac264fea2e8181243078b247716326b59bf8df2f
def pullFile(self, path, relative=True, timeout=5.0, encoding=None): ' Downloads a file from a given path and returns its content as string.\n The path can be either relative to the remote repo, or absolute.\n ' if relative: path = path.replace('\\', '/') path = urljoin(self.remote_rep...
Downloads a file from a given path and returns its content as string. The path can be either relative to the remote repo, or absolute.
filmatyk/updater.py
pullFile
Noiredd/Filmatyk
2
python
def pullFile(self, path, relative=True, timeout=5.0, encoding=None): ' Downloads a file from a given path and returns its content as string.\n The path can be either relative to the remote repo, or absolute.\n ' if relative: path = path.replace('\\', '/') path = urljoin(self.remote_rep...
def pullFile(self, path, relative=True, timeout=5.0, encoding=None): ' Downloads a file from a given path and returns its content as string.\n The path can be either relative to the remote repo, or absolute.\n ' if relative: path = path.replace('\\', '/') path = urljoin(self.remote_rep...
4f8fb5d27f677a468b5ae67d2c3bf25925d4982409ac31fc19b1747ad8d713a6
def getExistingFiles(self): ' Reads the current version file and returns the dict of files. ' with open(self.local_meta_file_path, 'r') as current_ver_file: current_ver_data = json.loads(current_ver_file.read()) return current_ver_data['files']
Reads the current version file and returns the dict of files.
filmatyk/updater.py
getExistingFiles
Noiredd/Filmatyk
2
python
def getExistingFiles(self): ' ' with open(self.local_meta_file_path, 'r') as current_ver_file: current_ver_data = json.loads(current_ver_file.read()) return current_ver_data['files']
def getExistingFiles(self): ' ' with open(self.local_meta_file_path, 'r') as current_ver_file: current_ver_data = json.loads(current_ver_file.read()) return current_ver_data['files']<|docstring|>Reads the current version file and returns the dict of files.<|endoftext|>
81a4dd30d4186df00b7c53ab63bd2b3d2b8458b056815eefdc2d7fc8da5ebb94
def getDownloadFiles(self, existing): ' Returns dict of files to be downloaded (new or changed ones). ' download_list = [] for (new_file, new_sum) in self.updated_files.items(): if (not (new_file in existing.keys())): download_list.append((new_file, new_sum)) elif (new_sum != exi...
Returns dict of files to be downloaded (new or changed ones).
filmatyk/updater.py
getDownloadFiles
Noiredd/Filmatyk
2
python
def getDownloadFiles(self, existing): ' ' download_list = [] for (new_file, new_sum) in self.updated_files.items(): if (not (new_file in existing.keys())): download_list.append((new_file, new_sum)) elif (new_sum != existing[new_file]): download_list.append((new_file,...
def getDownloadFiles(self, existing): ' ' download_list = [] for (new_file, new_sum) in self.updated_files.items(): if (not (new_file in existing.keys())): download_list.append((new_file, new_sum)) elif (new_sum != existing[new_file]): download_list.append((new_file,...
bf96e47669e7c98d322592ce24cf75d546586cbf8acf0265fd3c05c704e1e4c9
def getDeletionFiles(self, existing): ' Returns list of files that are removed in the new version. ' return [ex_file for ex_file in existing.keys() if (ex_file not in self.updated_files.keys())]
Returns list of files that are removed in the new version.
filmatyk/updater.py
getDeletionFiles
Noiredd/Filmatyk
2
python
def getDeletionFiles(self, existing): ' ' return [ex_file for ex_file in existing.keys() if (ex_file not in self.updated_files.keys())]
def getDeletionFiles(self, existing): ' ' return [ex_file for ex_file in existing.keys() if (ex_file not in self.updated_files.keys())]<|docstring|>Returns list of files that are removed in the new version.<|endoftext|>
6a5a5baf5783a414045de4c080fb07c638fa7f3fac9fa5c6ab1029058c0b1791
def downloadFile(self, path, checksum, attempt=1): " Downloads a file from a repo-relative path to a temporary location.\n Retries if the checksum doesn't match (up to 3 attempts)." data = self.pullFile(path) target_path = os.path.join(self.temporary_directory, path.replace('\\', '--')) with open...
Downloads a file from a repo-relative path to a temporary location. Retries if the checksum doesn't match (up to 3 attempts).
filmatyk/updater.py
downloadFile
Noiredd/Filmatyk
2
python
def downloadFile(self, path, checksum, attempt=1): " Downloads a file from a repo-relative path to a temporary location.\n Retries if the checksum doesn't match (up to 3 attempts)." data = self.pullFile(path) target_path = os.path.join(self.temporary_directory, path.replace('\\', '--')) with open...
def downloadFile(self, path, checksum, attempt=1): " Downloads a file from a repo-relative path to a temporary location.\n Retries if the checksum doesn't match (up to 3 attempts)." data = self.pullFile(path) target_path = os.path.join(self.temporary_directory, path.replace('\\', '--')) with open...
ea500bc455a87ddbc634987fd7e22176f9006d8139887fadc5fa81e9513df0c9
def removeOldBackups(self, path=Paths.local_repo_path): ' Recursively traverses the app directory and removes any .bak files. ' folders = [] for item in os.listdir(path): ipath = os.path.join(path, item) if os.path.isdir(ipath): folders.append(ipath) elif ipath.endswith('...
Recursively traverses the app directory and removes any .bak files.
filmatyk/updater.py
removeOldBackups
Noiredd/Filmatyk
2
python
def removeOldBackups(self, path=Paths.local_repo_path): ' ' folders = [] for item in os.listdir(path): ipath = os.path.join(path, item) if os.path.isdir(ipath): folders.append(ipath) elif ipath.endswith('.bak'): os.remove(ipath) for folder in folders: ...
def removeOldBackups(self, path=Paths.local_repo_path): ' ' folders = [] for item in os.listdir(path): ipath = os.path.join(path, item) if os.path.isdir(ipath): folders.append(ipath) elif ipath.endswith('.bak'): os.remove(ipath) for folder in folders: ...
61820be706e8798fe2dfa612d5e45de8828c806cad56a9665f4672ab0368d441
def applyFile(self, path): ' Moves a file from a temp location overwriting the target file.\n Accepts repo-relative paths. Backs up the original file first.' source_path = os.path.join(self.temporary_directory, path.replace('\\', '--')) target_path = os.path.join('..', (path if (not self.linuxMode) e...
Moves a file from a temp location overwriting the target file. Accepts repo-relative paths. Backs up the original file first.
filmatyk/updater.py
applyFile
Noiredd/Filmatyk
2
python
def applyFile(self, path): ' Moves a file from a temp location overwriting the target file.\n Accepts repo-relative paths. Backs up the original file first.' source_path = os.path.join(self.temporary_directory, path.replace('\\', '--')) target_path = os.path.join('..', (path if (not self.linuxMode) e...
def applyFile(self, path): ' Moves a file from a temp location overwriting the target file.\n Accepts repo-relative paths. Backs up the original file first.' source_path = os.path.join(self.temporary_directory, path.replace('\\', '--')) target_path = os.path.join('..', (path if (not self.linuxMode) e...
d90e8eada25a649f885a38ebc329cb05d71397ec576015896e79c32e400f7a97
def _decode_os_value(self, value): 'Return the value of a dictionary based on its keys' if (not (self.use_os_keys and isinstance(value, dict))): return value os_keys = ['windows', 'linux', 'mac'] if (not [v_key for v_key in value.keys() if (v_key not in os_keys)]): if IS_WIN: ...
Return the value of a dictionary based on its keys
yamiconfig/__init__.py
_decode_os_value
mtik00/yamiconfig
0
python
def _decode_os_value(self, value): if (not (self.use_os_keys and isinstance(value, dict))): return value os_keys = ['windows', 'linux', 'mac'] if (not [v_key for v_key in value.keys() if (v_key not in os_keys)]): if IS_WIN: return value['windows'] elif IS_MAC: ...
def _decode_os_value(self, value): if (not (self.use_os_keys and isinstance(value, dict))): return value os_keys = ['windows', 'linux', 'mac'] if (not [v_key for v_key in value.keys() if (v_key not in os_keys)]): if IS_WIN: return value['windows'] elif IS_MAC: ...
7a807f505eba35ffa58f8d8c09fc445bcf1dfc9bdd38861d7c271975326695c7
def _validate(self, yaml_data): '\n Make sure the types of the data are the same types as the default.\n ' if self.schema: self.schema.validate(yaml_data)
Make sure the types of the data are the same types as the default.
yamiconfig/__init__.py
_validate
mtik00/yamiconfig
0
python
def _validate(self, yaml_data): '\n \n ' if self.schema: self.schema.validate(yaml_data)
def _validate(self, yaml_data): '\n \n ' if self.schema: self.schema.validate(yaml_data)<|docstring|>Make sure the types of the data are the same types as the default.<|endoftext|>
2213cdc2c96a3983617a5ce3856b718be6ae618432e7dafe8fa14ec995ee4015
def reset(self, path=None): '\n Resets all configuration settings to the default, ignoring any current\n user settings.\n\n :param str path: The path to the configuration file to write, if any\n ' self._calculated = copy.deepcopy(self._default) self.extra_data.clear() if path...
Resets all configuration settings to the default, ignoring any current user settings. :param str path: The path to the configuration file to write, if any
yamiconfig/__init__.py
reset
mtik00/yamiconfig
0
python
def reset(self, path=None): '\n Resets all configuration settings to the default, ignoring any current\n user settings.\n\n :param str path: The path to the configuration file to write, if any\n ' self._calculated = copy.deepcopy(self._default) self.extra_data.clear() if path...
def reset(self, path=None): '\n Resets all configuration settings to the default, ignoring any current\n user settings.\n\n :param str path: The path to the configuration file to write, if any\n ' self._calculated = copy.deepcopy(self._default) self.extra_data.clear() if path...
345090865048949048a56f1af679c203f03dd2ae07343ba390d7d35dd1164db1
def load_configs(self): 'Find all of the config files and load them in' self._default = self.loads(self._default_raw) self._calculated = copy.deepcopy(self._default) for fpath in self.user_files: temp = self.load_file(fpath) if temp: self._calculated.update(temp)
Find all of the config files and load them in
yamiconfig/__init__.py
load_configs
mtik00/yamiconfig
0
python
def load_configs(self): self._default = self.loads(self._default_raw) self._calculated = copy.deepcopy(self._default) for fpath in self.user_files: temp = self.load_file(fpath) if temp: self._calculated.update(temp)
def load_configs(self): self._default = self.loads(self._default_raw) self._calculated = copy.deepcopy(self._default) for fpath in self.user_files: temp = self.load_file(fpath) if temp: self._calculated.update(temp)<|docstring|>Find all of the config files and load them in<|...
3541a11d6510cd6db56d57b520a310f849e8a1e4642d9fed75bb1987633fd70e
def load_file(self, path): 'Load and validate a file, and return the data.' if os.path.isfile(path): with open(path) as fh: text = fh.read() data = (YAML().load(text) or {}) try: self._validate(data) except SchemaError: print(('ERROR: Configura...
Load and validate a file, and return the data.
yamiconfig/__init__.py
load_file
mtik00/yamiconfig
0
python
def load_file(self, path): if os.path.isfile(path): with open(path) as fh: text = fh.read() data = (YAML().load(text) or {}) try: self._validate(data) except SchemaError: print(('ERROR: Configuration file [%s] did not validate' % path)) ...
def load_file(self, path): if os.path.isfile(path): with open(path) as fh: text = fh.read() data = (YAML().load(text) or {}) try: self._validate(data) except SchemaError: print(('ERROR: Configuration file [%s] did not validate' % path)) ...
81520140f7c423767213708befc36207ea3abc286d811c5981291b67ebd05a43
def loads(self, yaml_string): 'Load a configuration from a string' data = (YAML().load(yaml_string) or {}) try: self._validate(data) except SchemaError: raise return data
Load a configuration from a string
yamiconfig/__init__.py
loads
mtik00/yamiconfig
0
python
def loads(self, yaml_string): data = (YAML().load(yaml_string) or {}) try: self._validate(data) except SchemaError: raise return data
def loads(self, yaml_string): data = (YAML().load(yaml_string) or {}) try: self._validate(data) except SchemaError: raise return data<|docstring|>Load a configuration from a string<|endoftext|>
5a210386e856706ba18547afe52457bc60398857c10d2b69be199f73f8aab8d3
def dump(self, obj=None): '\n Return the *calculated* configuration as a YAML-formatted string.\n\n NOTE: This only includes keys that are part of the default config.\n ' obj = (obj or self._calculated) d = StringIO() YAML().dump(obj, d) return d.getvalue()
Return the *calculated* configuration as a YAML-formatted string. NOTE: This only includes keys that are part of the default config.
yamiconfig/__init__.py
dump
mtik00/yamiconfig
0
python
def dump(self, obj=None): '\n Return the *calculated* configuration as a YAML-formatted string.\n\n NOTE: This only includes keys that are part of the default config.\n ' obj = (obj or self._calculated) d = StringIO() YAML().dump(obj, d) return d.getvalue()
def dump(self, obj=None): '\n Return the *calculated* configuration as a YAML-formatted string.\n\n NOTE: This only includes keys that are part of the default config.\n ' obj = (obj or self._calculated) d = StringIO() YAML().dump(obj, d) return d.getvalue()<|docstring|>Return th...
574c994339b919264e3e776bd9085ae2f09e9ca63f2152f1283198b366083044
def is_default(self, key): 'Returns True if the key has not been modified from the default' return bool(((key in self._calculated) and (key in self._default) and (self._calculated[key] == self._default[key])))
Returns True if the key has not been modified from the default
yamiconfig/__init__.py
is_default
mtik00/yamiconfig
0
python
def is_default(self, key): return bool(((key in self._calculated) and (key in self._default) and (self._calculated[key] == self._default[key])))
def is_default(self, key): return bool(((key in self._calculated) and (key in self._default) and (self._calculated[key] == self._default[key])))<|docstring|>Returns True if the key has not been modified from the default<|endoftext|>
48bd9108f39e41c26a155d0c26d16e2e058c2a5e8ecd5782e2549af46bd2eadb
def store_config(self, fpath): 'Stores the current configuration to the YAML file' with open(fpath, 'wb') as fh: fh.write(self.dump())
Stores the current configuration to the YAML file
yamiconfig/__init__.py
store_config
mtik00/yamiconfig
0
python
def store_config(self, fpath): with open(fpath, 'wb') as fh: fh.write(self.dump())
def store_config(self, fpath): with open(fpath, 'wb') as fh: fh.write(self.dump())<|docstring|>Stores the current configuration to the YAML file<|endoftext|>
6bdc94e1d1546910eea5dc713ac197b0a494491a851e6afefafda858b5555ec5
def store_defaults(self, fpath): 'Creates a new file with all default settings commented out' if self.default_file: default_text_lines = open(self.default_file).readlines() else: default_text_lines = self._default_raw.split('\n') new_lines = [USER_CONFIG_HEADER] for line in default_t...
Creates a new file with all default settings commented out
yamiconfig/__init__.py
store_defaults
mtik00/yamiconfig
0
python
def store_defaults(self, fpath): if self.default_file: default_text_lines = open(self.default_file).readlines() else: default_text_lines = self._default_raw.split('\n') new_lines = [USER_CONFIG_HEADER] for line in default_text_lines: line = line.strip() if (line and ...
def store_defaults(self, fpath): if self.default_file: default_text_lines = open(self.default_file).readlines() else: default_text_lines = self._default_raw.split('\n') new_lines = [USER_CONFIG_HEADER] for line in default_text_lines: line = line.strip() if (line and ...
45f9e9d7e506eed20f5136e033db0cbb9d64d7a26fb23433ed3e9a40f7a24446
def load_settings(self) -> Optional[dict]: '\n Load the settings.\n ' if (not file_m.does_exist(os_path=self.settings_file_full_path)): self.mac_logger.info('The settings file %s does not exist. Creating a new one...', self.settings_file_full_path) if (not file_m.does_exist(os_path...
Load the settings.
src/perspective_settings.py
load_settings
jmacgrillen/perspective
0
python
def load_settings(self) -> Optional[dict]: '\n \n ' if (not file_m.does_exist(os_path=self.settings_file_full_path)): self.mac_logger.info('The settings file %s does not exist. Creating a new one...', self.settings_file_full_path) if (not file_m.does_exist(os_path=self.settings_fil...
def load_settings(self) -> Optional[dict]: '\n \n ' if (not file_m.does_exist(os_path=self.settings_file_full_path)): self.mac_logger.info('The settings file %s does not exist. Creating a new one...', self.settings_file_full_path) if (not file_m.does_exist(os_path=self.settings_fil...
b35ef9377dd26eab3fe7629708b2761b6ee1333e1819917e12ee060832e6c44d
def save_settings(self) -> None: '\n Save all the settings back to the settings file.\n ' try: self.mac_logger.debug('Saving settings to {0}'.format(self.settings_file_full_path)) with open(file=self.settings_file_full_path, mode='w') as yml_file: yaml.dump(data=self.ap...
Save all the settings back to the settings file.
src/perspective_settings.py
save_settings
jmacgrillen/perspective
0
python
def save_settings(self) -> None: '\n \n ' try: self.mac_logger.debug('Saving settings to {0}'.format(self.settings_file_full_path)) with open(file=self.settings_file_full_path, mode='w') as yml_file: yaml.dump(data=self.app_settings, stream=yml_file, indent=4, default_f...
def save_settings(self) -> None: '\n \n ' try: self.mac_logger.debug('Saving settings to {0}'.format(self.settings_file_full_path)) with open(file=self.settings_file_full_path, mode='w') as yml_file: yaml.dump(data=self.app_settings, stream=yml_file, indent=4, default_f...
889372b978d6afdca652d86f0be4ca2e707c51a5328caeb3a92bd0df17fdb923
def key_exists(self, key_name: str) -> bool: '\n Check whether the key exists.\n ' if (key_name in self.app_settings.keys()): return True return False
Check whether the key exists.
src/perspective_settings.py
key_exists
jmacgrillen/perspective
0
python
def key_exists(self, key_name: str) -> bool: '\n \n ' if (key_name in self.app_settings.keys()): return True return False
def key_exists(self, key_name: str) -> bool: '\n \n ' if (key_name in self.app_settings.keys()): return True return False<|docstring|>Check whether the key exists.<|endoftext|>
66f2a9ad489289cc784f66964fa14da0883e87602ddc0910ee2956643ab3844a
def upper_codon_inframe(text_file, search_sequence=['tgg', 'cag', 'cga', 'caa']): '\n # TODO: Docstring\n ' file_path = text_file l = list(os.path.splitext(file_path)) l.insert(1, '_parsed') list_res = list() f = open(file_path, 'r+') s = f.read() f.close() for i in range(0, (l...
# TODO: Docstring
sequenceParser.py
upper_codon_inframe
FrancoisCzarny/BaseEditorSequenceParser
0
python
def upper_codon_inframe(text_file, search_sequence=['tgg', 'cag', 'cga', 'caa']): '\n \n ' file_path = text_file l = list(os.path.splitext(file_path)) l.insert(1, '_parsed') list_res = list() f = open(file_path, 'r+') s = f.read() f.close() for i in range(0, (len(s) - 1), 3): ...
def upper_codon_inframe(text_file, search_sequence=['tgg', 'cag', 'cga', 'caa']): '\n \n ' file_path = text_file l = list(os.path.splitext(file_path)) l.insert(1, '_parsed') list_res = list() f = open(file_path, 'r+') s = f.read() f.close() for i in range(0, (len(s) - 1), 3): ...
e1060e8ede1daf978ee0df8c9b14589e33af4c2fc8c1b58fd88c996999b0f22b
def main(): '\n Advbox demo which demonstrate how to use advbox.\n ' TOTAL_NUM = 500 IMG_NAME = 'img' LABEL_NAME = 'label' img = fluid.layers.data(name=IMG_NAME, shape=[1, 28, 28], dtype='float32') img.stop_gradient = False label = fluid.layers.data(name=LABEL_NAME, shape=[1], dtype='i...
Advbox demo which demonstrate how to use advbox.
tutorials/mnist_tutorial_jsma.py
main
StijnMatsHendriks/adversarial_attack_demo
819
python
def main(): '\n \n ' TOTAL_NUM = 500 IMG_NAME = 'img' LABEL_NAME = 'label' img = fluid.layers.data(name=IMG_NAME, shape=[1, 28, 28], dtype='float32') img.stop_gradient = False label = fluid.layers.data(name=LABEL_NAME, shape=[1], dtype='int64') logits = mnist_cnn_model(img) cos...
def main(): '\n \n ' TOTAL_NUM = 500 IMG_NAME = 'img' LABEL_NAME = 'label' img = fluid.layers.data(name=IMG_NAME, shape=[1, 28, 28], dtype='float32') img.stop_gradient = False label = fluid.layers.data(name=LABEL_NAME, shape=[1], dtype='int64') logits = mnist_cnn_model(img) cos...
d20eea5f878c311a7b598d363fdd8ee9d359f96727e796c4622c37788ebb1336
def __init__(self, image: numpy.ndarray): '\n Initializes the object that segments a given image into its main colours.\n\n Args:\n image: A three-dimensional numpy array, representing the image to be segmented, which entries are in 0...255\n range and the channels are BGR...
Initializes the object that segments a given image into its main colours. Args: image: A three-dimensional numpy array, representing the image to be segmented, which entries are in 0...255 range and the channels are BGR.
colour_segmentation/segmentator.py
__init__
mmunar97/colour-segmentation
0
python
def __init__(self, image: numpy.ndarray): '\n Initializes the object that segments a given image into its main colours.\n\n Args:\n image: A three-dimensional numpy array, representing the image to be segmented, which entries are in 0...255\n range and the channels are BGR...
def __init__(self, image: numpy.ndarray): '\n Initializes the object that segments a given image into its main colours.\n\n Args:\n image: A three-dimensional numpy array, representing the image to be segmented, which entries are in 0...255\n range and the channels are BGR...
b5e7840172bef22be479b7f7d325f1d8a9cafacc6b73a1f0d55e1d9db96bb2a0
def segment(self, method: SegmentationAlgorithm, **kwargs) -> SegmentationResult: '\n Segments the image with the selected method.\n\n Args:\n method: A SegmentationAlgorithm value, representing the method to be used.\n\n Returns:\n A SegmentationResult object, containing ...
Segments the image with the selected method. Args: method: A SegmentationAlgorithm value, representing the method to be used. Returns: A SegmentationResult object, containing the classification of each pixel and the elapsed time.
colour_segmentation/segmentator.py
segment
mmunar97/colour-segmentation
0
python
def segment(self, method: SegmentationAlgorithm, **kwargs) -> SegmentationResult: '\n Segments the image with the selected method.\n\n Args:\n method: A SegmentationAlgorithm value, representing the method to be used.\n\n Returns:\n A SegmentationResult object, containing ...
def segment(self, method: SegmentationAlgorithm, **kwargs) -> SegmentationResult: '\n Segments the image with the selected method.\n\n Args:\n method: A SegmentationAlgorithm value, representing the method to be used.\n\n Returns:\n A SegmentationResult object, containing ...
d1aebc2fff830e3a59c60e9c46f4eeb46418a14f19448f41dfbe055de24e7ebd
def __segment_with_amante_trapezoidal(self, **kwargs) -> SegmentationResult: '\n Segments the image with the Amante-Fonseca fuzzy sets.\n ' fuzzy_set_amante_segmentator = AmanteTrapezoidalSegmentator(image=self.__image) return fuzzy_set_amante_segmentator.segment(**kwargs)
Segments the image with the Amante-Fonseca fuzzy sets.
colour_segmentation/segmentator.py
__segment_with_amante_trapezoidal
mmunar97/colour-segmentation
0
python
def __segment_with_amante_trapezoidal(self, **kwargs) -> SegmentationResult: '\n \n ' fuzzy_set_amante_segmentator = AmanteTrapezoidalSegmentator(image=self.__image) return fuzzy_set_amante_segmentator.segment(**kwargs)
def __segment_with_amante_trapezoidal(self, **kwargs) -> SegmentationResult: '\n \n ' fuzzy_set_amante_segmentator = AmanteTrapezoidalSegmentator(image=self.__image) return fuzzy_set_amante_segmentator.segment(**kwargs)<|docstring|>Segments the image with the Amante-Fonseca fuzzy sets.<|endoft...
6910a8f7317aeb9bc9b0712bbe968f9984b0677b485b5588d56be6614ab31321
def __segment_with_chamorro_trapezoidal(self, **kwargs) -> SegmentationResult: '\n Segments the image with the Chamorro et al fuzzy sets.\n ' fuzzy_set_chamorro_segmentator = ChamorroTrapezoidalSegmentator(image=self.__image) return fuzzy_set_chamorro_segmentator.segment(**kwargs)
Segments the image with the Chamorro et al fuzzy sets.
colour_segmentation/segmentator.py
__segment_with_chamorro_trapezoidal
mmunar97/colour-segmentation
0
python
def __segment_with_chamorro_trapezoidal(self, **kwargs) -> SegmentationResult: '\n \n ' fuzzy_set_chamorro_segmentator = ChamorroTrapezoidalSegmentator(image=self.__image) return fuzzy_set_chamorro_segmentator.segment(**kwargs)
def __segment_with_chamorro_trapezoidal(self, **kwargs) -> SegmentationResult: '\n \n ' fuzzy_set_chamorro_segmentator = ChamorroTrapezoidalSegmentator(image=self.__image) return fuzzy_set_chamorro_segmentator.segment(**kwargs)<|docstring|>Segments the image with the Chamorro et al fuzzy sets....
b8f9a7b50790d3d1585d8c4d5632baa5bfa7eab7ee13d23f935bcb8c71ebb923
def __segment_with_liu_trapezoidal(self, **kwargs) -> SegmentationResult: '\n Segments the image with the Liu-Wang fuzzy sets.\n ' fuzzy_set_liu_segmentator = LiuWangTrapezoidalSegmentator(image=self.__image) return fuzzy_set_liu_segmentator.segment(**kwargs)
Segments the image with the Liu-Wang fuzzy sets.
colour_segmentation/segmentator.py
__segment_with_liu_trapezoidal
mmunar97/colour-segmentation
0
python
def __segment_with_liu_trapezoidal(self, **kwargs) -> SegmentationResult: '\n \n ' fuzzy_set_liu_segmentator = LiuWangTrapezoidalSegmentator(image=self.__image) return fuzzy_set_liu_segmentator.segment(**kwargs)
def __segment_with_liu_trapezoidal(self, **kwargs) -> SegmentationResult: '\n \n ' fuzzy_set_liu_segmentator = LiuWangTrapezoidalSegmentator(image=self.__image) return fuzzy_set_liu_segmentator.segment(**kwargs)<|docstring|>Segments the image with the Liu-Wang fuzzy sets.<|endoftext|>
4b962f4091f78ece0dc7ac35bc26acb17e8402ff0fce83b81ea7ba29448ec8ca
def __segment_with_shamir_triangular(self, **kwargs) -> SegmentationResult: '\n Segments the image with the Shamir fuzzy sets.\n ' fuzzy_set_shamir_segmentator = ShamirTriangularSegmentator(image=self.__image) return fuzzy_set_shamir_segmentator.segment(**kwargs)
Segments the image with the Shamir fuzzy sets.
colour_segmentation/segmentator.py
__segment_with_shamir_triangular
mmunar97/colour-segmentation
0
python
def __segment_with_shamir_triangular(self, **kwargs) -> SegmentationResult: '\n \n ' fuzzy_set_shamir_segmentator = ShamirTriangularSegmentator(image=self.__image) return fuzzy_set_shamir_segmentator.segment(**kwargs)
def __segment_with_shamir_triangular(self, **kwargs) -> SegmentationResult: '\n \n ' fuzzy_set_shamir_segmentator = ShamirTriangularSegmentator(image=self.__image) return fuzzy_set_shamir_segmentator.segment(**kwargs)<|docstring|>Segments the image with the Shamir fuzzy sets.<|endoftext|>
fc2a4f1e1ca1244581c6ae5bfbecbce0afb4fa6eafa090abb89fe1d6d3ed0c50
def stft(y, n_fft, hop_length, win_length): '\n Wrapper of the official torch.stft for single-channel and multi-channel\n\n Args:\n y: single- or multi-channel speech with shape of [B, C, T] or [B, T]\n n_fft: num of FFT\n hop_length: hop length\n win_length: hanning window size\n\...
Wrapper of the official torch.stft for single-channel and multi-channel Args: y: single- or multi-channel speech with shape of [B, C, T] or [B, T] n_fft: num of FFT hop_length: hop length win_length: hanning window size Shapes: mag: [B, F, T] if dims of input is [B, T], whereas [B, C, F, T] if dim...
audio_zen/acoustics/feature.py
stft
ShkarupaDC/FullSubNet
219
python
def stft(y, n_fft, hop_length, win_length): '\n Wrapper of the official torch.stft for single-channel and multi-channel\n\n Args:\n y: single- or multi-channel speech with shape of [B, C, T] or [B, T]\n n_fft: num of FFT\n hop_length: hop length\n win_length: hanning window size\n\...
def stft(y, n_fft, hop_length, win_length): '\n Wrapper of the official torch.stft for single-channel and multi-channel\n\n Args:\n y: single- or multi-channel speech with shape of [B, C, T] or [B, T]\n n_fft: num of FFT\n hop_length: hop length\n win_length: hanning window size\n\...
064d3c049e8439e1271c046e2c8920605686914656ca711faf213fc2466da3cf
def istft(features, n_fft, hop_length, win_length, length=None, input_type='complex'): '\n Wrapper of the official torch.istft\n\n Args:\n features: [B, F, T] (complex) or ([B, F, T], [B, F, T]) (mag and phase)\n n_fft: num of FFT\n hop_length: hop length\n win_length: hanning wind...
Wrapper of the official torch.istft Args: features: [B, F, T] (complex) or ([B, F, T], [B, F, T]) (mag and phase) n_fft: num of FFT hop_length: hop length win_length: hanning window size length: expected length of istft use_mag_phase: use mag and phase as the input ("features") Returns: si...
audio_zen/acoustics/feature.py
istft
ShkarupaDC/FullSubNet
219
python
def istft(features, n_fft, hop_length, win_length, length=None, input_type='complex'): '\n Wrapper of the official torch.istft\n\n Args:\n features: [B, F, T] (complex) or ([B, F, T], [B, F, T]) (mag and phase)\n n_fft: num of FFT\n hop_length: hop length\n win_length: hanning wind...
def istft(features, n_fft, hop_length, win_length, length=None, input_type='complex'): '\n Wrapper of the official torch.istft\n\n Args:\n features: [B, F, T] (complex) or ([B, F, T], [B, F, T]) (mag and phase)\n n_fft: num of FFT\n hop_length: hop length\n win_length: hanning wind...
ab97aee558a030a7a4fd84abaee5663b2cfe3ecc173991e096428db82e5fc19e
def aligned_subsample(data_a, data_b, sub_sample_length): '\n Start from a random position and take a fixed-length segment from two speech samples\n\n Notes\n Only support one-dimensional speech signal (T,) and two-dimensional spectrogram signal (F, T)\n\n Only support subsample in the last axis...
Start from a random position and take a fixed-length segment from two speech samples Notes Only support one-dimensional speech signal (T,) and two-dimensional spectrogram signal (F, T) Only support subsample in the last axis.
audio_zen/acoustics/feature.py
aligned_subsample
ShkarupaDC/FullSubNet
219
python
def aligned_subsample(data_a, data_b, sub_sample_length): '\n Start from a random position and take a fixed-length segment from two speech samples\n\n Notes\n Only support one-dimensional speech signal (T,) and two-dimensional spectrogram signal (F, T)\n\n Only support subsample in the last axis...
def aligned_subsample(data_a, data_b, sub_sample_length): '\n Start from a random position and take a fixed-length segment from two speech samples\n\n Notes\n Only support one-dimensional speech signal (T,) and two-dimensional spectrogram signal (F, T)\n\n Only support subsample in the last axis...
90ee9ebf26c1c7fdb32c3c81a29bccbbeb56b351447e8bbe6539c7c1036d5f55
def subsample(data, sub_sample_length, start_position: int=(- 1), return_start_position=False): '\n Randomly select fixed-length data from \n\n Args:\n data: **one-dimensional data**\n sub_sample_length: how long\n start_position: If start index smaller than 0, randomly generate one index...
Randomly select fixed-length data from Args: data: **one-dimensional data** sub_sample_length: how long start_position: If start index smaller than 0, randomly generate one index
audio_zen/acoustics/feature.py
subsample
ShkarupaDC/FullSubNet
219
python
def subsample(data, sub_sample_length, start_position: int=(- 1), return_start_position=False): '\n Randomly select fixed-length data from \n\n Args:\n data: **one-dimensional data**\n sub_sample_length: how long\n start_position: If start index smaller than 0, randomly generate one index...
def subsample(data, sub_sample_length, start_position: int=(- 1), return_start_position=False): '\n Randomly select fixed-length data from \n\n Args:\n data: **one-dimensional data**\n sub_sample_length: how long\n start_position: If start index smaller than 0, randomly generate one index...
8642993e13ed3ba98f6f078ff7d48bfacb73187de2b6d770df1f56b5ad81cdf6
def overlap_cat(chunk_list, dim=(- 1)): '\n 按照 50% 的 overlap 沿着最后一个维度对 chunk_list 进行拼接\n\n Args:\n dim: 需要拼接的维度\n chunk_list(list): [[B, T], [B, T], ...]\n\n Returns:\n overlap 拼接后\n ' overlap_output = [] for (i, chunk) in enumerate(chunk_list): (first_half, last_hal...
按照 50% 的 overlap 沿着最后一个维度对 chunk_list 进行拼接 Args: dim: 需要拼接的维度 chunk_list(list): [[B, T], [B, T], ...] Returns: overlap 拼接后
audio_zen/acoustics/feature.py
overlap_cat
ShkarupaDC/FullSubNet
219
python
def overlap_cat(chunk_list, dim=(- 1)): '\n 按照 50% 的 overlap 沿着最后一个维度对 chunk_list 进行拼接\n\n Args:\n dim: 需要拼接的维度\n chunk_list(list): [[B, T], [B, T], ...]\n\n Returns:\n overlap 拼接后\n ' overlap_output = [] for (i, chunk) in enumerate(chunk_list): (first_half, last_hal...
def overlap_cat(chunk_list, dim=(- 1)): '\n 按照 50% 的 overlap 沿着最后一个维度对 chunk_list 进行拼接\n\n Args:\n dim: 需要拼接的维度\n chunk_list(list): [[B, T], [B, T], ...]\n\n Returns:\n overlap 拼接后\n ' overlap_output = [] for (i, chunk) in enumerate(chunk_list): (first_half, last_hal...
3c9878cce86dca4180cdff4e6bc3e9f7ac09682b297da9e3dbc3b4d5b46060ed
def activity_detector(audio, fs=16000, activity_threshold=0.13, target_level=(- 25), eps=1e-06): '\n Return the percentage of the time the audio signal is above an energy threshold\n\n Args:\n audio:\n fs:\n activity_threshold:\n target_level:\n eps:\n\n Returns:\n\n '...
Return the percentage of the time the audio signal is above an energy threshold Args: audio: fs: activity_threshold: target_level: eps: Returns:
audio_zen/acoustics/feature.py
activity_detector
ShkarupaDC/FullSubNet
219
python
def activity_detector(audio, fs=16000, activity_threshold=0.13, target_level=(- 25), eps=1e-06): '\n Return the percentage of the time the audio signal is above an energy threshold\n\n Args:\n audio:\n fs:\n activity_threshold:\n target_level:\n eps:\n\n Returns:\n\n '...
def activity_detector(audio, fs=16000, activity_threshold=0.13, target_level=(- 25), eps=1e-06): '\n Return the percentage of the time the audio signal is above an energy threshold\n\n Args:\n audio:\n fs:\n activity_threshold:\n target_level:\n eps:\n\n Returns:\n\n '...
45acdcaab6547c4101d47d5ef8d0fba4836ec28f3b348f19ce01fcb2f23eb0db
def batch_shuffle_frequency(tensor, indices=None): '\n\n Randomly shuffle frequency of a spectrogram and return shuffle indices.\n\n Args:\n tensor: input tensor with batch dim\n indices:\n\n Examples:\n input =\n tensor([[[[1., 1., 1.],\n [2., 2., 2.],\...
Randomly shuffle frequency of a spectrogram and return shuffle indices. Args: tensor: input tensor with batch dim indices: Examples: input = tensor([[[[1., 1., 1.], [2., 2., 2.], [3., 3., 3.], [4., 4., 4.]]], [[[1., 1., 1.], ...
audio_zen/acoustics/feature.py
batch_shuffle_frequency
ShkarupaDC/FullSubNet
219
python
def batch_shuffle_frequency(tensor, indices=None): '\n\n Randomly shuffle frequency of a spectrogram and return shuffle indices.\n\n Args:\n tensor: input tensor with batch dim\n indices:\n\n Examples:\n input =\n tensor([[[[1., 1., 1.],\n [2., 2., 2.],\...
def batch_shuffle_frequency(tensor, indices=None): '\n\n Randomly shuffle frequency of a spectrogram and return shuffle indices.\n\n Args:\n tensor: input tensor with batch dim\n indices:\n\n Examples:\n input =\n tensor([[[[1., 1., 1.],\n [2., 2., 2.],\...
ade4e9b96d0fa96aef35727abd6d5e96984d35a4cf75780acbddfb7db5d1b444
def drop_band(input, num_groups=2): '\n Reduce computational complexity of the sub-band part in the FullSubNet model.\n\n Shapes:\n input: [B, C, F, T]\n return: [B, C, F // num_groups, T]\n ' (batch_size, _, num_freqs, _) = input.shape assert (batch_size > num_groups), f'Batch size =...
Reduce computational complexity of the sub-band part in the FullSubNet model. Shapes: input: [B, C, F, T] return: [B, C, F // num_groups, T]
audio_zen/acoustics/feature.py
drop_band
ShkarupaDC/FullSubNet
219
python
def drop_band(input, num_groups=2): '\n Reduce computational complexity of the sub-band part in the FullSubNet model.\n\n Shapes:\n input: [B, C, F, T]\n return: [B, C, F // num_groups, T]\n ' (batch_size, _, num_freqs, _) = input.shape assert (batch_size > num_groups), f'Batch size =...
def drop_band(input, num_groups=2): '\n Reduce computational complexity of the sub-band part in the FullSubNet model.\n\n Shapes:\n input: [B, C, F, T]\n return: [B, C, F // num_groups, T]\n ' (batch_size, _, num_freqs, _) = input.shape assert (batch_size > num_groups), f'Batch size =...
5c91a770efb4884b54cce8ba797333550f2e58a490a35a74533c4b934e7e5a85
def forward(self, x): '\n x: BS x N x K\n ' if (x.dim() != 3): raise RuntimeError('{} accept 3D tensor as input'.format(self.__name__)) x = torch.transpose(x, 1, 2) x = super(ChannelWiseLayerNorm, self).forward(x) x = torch.transpose(x, 1, 2) return x
x: BS x N x K
audio_zen/acoustics/feature.py
forward
ShkarupaDC/FullSubNet
219
python
def forward(self, x): '\n \n ' if (x.dim() != 3): raise RuntimeError('{} accept 3D tensor as input'.format(self.__name__)) x = torch.transpose(x, 1, 2) x = super(ChannelWiseLayerNorm, self).forward(x) x = torch.transpose(x, 1, 2) return x
def forward(self, x): '\n \n ' if (x.dim() != 3): raise RuntimeError('{} accept 3D tensor as input'.format(self.__name__)) x = torch.transpose(x, 1, 2) x = super(ChannelWiseLayerNorm, self).forward(x) x = torch.transpose(x, 1, 2) return x<|docstring|>x: BS x N x K<|endoftex...
75ec17ba2b1c7ab9da5585029e6ce5aca30b634c1d2c3d3c6f19389dbde96453
def compute_ipd(self, phase): '\n Args\n phase: phase of shape [B, M, F, K]\n Returns\n IPD of shape [B, I, F, K]\n ' cos_ipd = torch.cos((phase[(:, self.ipd_left)] - phase[(:, self.ipd_right)])) sin_ipd = torch.sin((phase[(:, self.ipd_left)] - phase[(:, self.ipd_...
Args phase: phase of shape [B, M, F, K] Returns IPD of shape [B, I, F, K]
audio_zen/acoustics/feature.py
compute_ipd
ShkarupaDC/FullSubNet
219
python
def compute_ipd(self, phase): '\n Args\n phase: phase of shape [B, M, F, K]\n Returns\n IPD of shape [B, I, F, K]\n ' cos_ipd = torch.cos((phase[(:, self.ipd_left)] - phase[(:, self.ipd_right)])) sin_ipd = torch.sin((phase[(:, self.ipd_left)] - phase[(:, self.ipd_...
def compute_ipd(self, phase): '\n Args\n phase: phase of shape [B, M, F, K]\n Returns\n IPD of shape [B, I, F, K]\n ' cos_ipd = torch.cos((phase[(:, self.ipd_left)] - phase[(:, self.ipd_right)])) sin_ipd = torch.sin((phase[(:, self.ipd_left)] - phase[(:, self.ipd_...
f8ee583d9436b5212441a45170a47f1b9cdcd0c3b5dd24f9cb2c69ec24eabd86
def forward(self, magnitude, phase, real, imag): '\n Args:\n y: input mixture waveform with shape [B, M, T]\n\n Notes:\n B - batch_size\n M - num_channels\n C - num_speakers\n F - num_freqs\n T - seq_len or num_samples\n K - ...
Args: y: input mixture waveform with shape [B, M, T] Notes: B - batch_size M - num_channels C - num_speakers F - num_freqs T - seq_len or num_samples K - num_frames I - IPD feature_size Returns: Spatial features and directional features of shape [B, ?, K]
audio_zen/acoustics/feature.py
forward
ShkarupaDC/FullSubNet
219
python
def forward(self, magnitude, phase, real, imag): '\n Args:\n y: input mixture waveform with shape [B, M, T]\n\n Notes:\n B - batch_size\n M - num_channels\n C - num_speakers\n F - num_freqs\n T - seq_len or num_samples\n K - ...
def forward(self, magnitude, phase, real, imag): '\n Args:\n y: input mixture waveform with shape [B, M, T]\n\n Notes:\n B - batch_size\n M - num_channels\n C - num_speakers\n F - num_freqs\n T - seq_len or num_samples\n K - ...
4e521fef8c9dd1dff744f1cabb4c8bc29afe3274be07c35e251b5f1a3824bffb
def compute_ipd(self, phase): '\n Args\n phase: phase of shape [B, M, F, K]\n Returns\n IPD pf shape [B, I, F, K]\n ' cos_ipd = torch.cos((phase[(:, self.ipd_left)] - phase[(:, self.ipd_right)])) sin_ipd = torch.sin((phase[(:, self.ipd_left)] - phase[(:, self.ipd_...
Args phase: phase of shape [B, M, F, K] Returns IPD pf shape [B, I, F, K]
audio_zen/acoustics/feature.py
compute_ipd
ShkarupaDC/FullSubNet
219
python
def compute_ipd(self, phase): '\n Args\n phase: phase of shape [B, M, F, K]\n Returns\n IPD pf shape [B, I, F, K]\n ' cos_ipd = torch.cos((phase[(:, self.ipd_left)] - phase[(:, self.ipd_right)])) sin_ipd = torch.sin((phase[(:, self.ipd_left)] - phase[(:, self.ipd_...
def compute_ipd(self, phase): '\n Args\n phase: phase of shape [B, M, F, K]\n Returns\n IPD pf shape [B, I, F, K]\n ' cos_ipd = torch.cos((phase[(:, self.ipd_left)] - phase[(:, self.ipd_right)])) sin_ipd = torch.sin((phase[(:, self.ipd_left)] - phase[(:, self.ipd_...
705bef48087c5e5dda8cd05033a57cbce266313f53bde52c342c4f10c2c909e3
def forward(self, y): '\n Args:\n y: input mixture waveform with shape [B, M, T]\n\n Notes:\n B - batch_size\n M - num_channels\n C - num_speakers\n F - num_freqs\n T - seq_len or num_samples\n K - num_frames\n I -...
Args: y: input mixture waveform with shape [B, M, T] Notes: B - batch_size M - num_channels C - num_speakers F - num_freqs T - seq_len or num_samples K - num_frames I - IPD feature_size Returns: Spatial features and directional features of shape [B, ?, K]
audio_zen/acoustics/feature.py
forward
ShkarupaDC/FullSubNet
219
python
def forward(self, y): '\n Args:\n y: input mixture waveform with shape [B, M, T]\n\n Notes:\n B - batch_size\n M - num_channels\n C - num_speakers\n F - num_freqs\n T - seq_len or num_samples\n K - num_frames\n I -...
def forward(self, y): '\n Args:\n y: input mixture waveform with shape [B, M, T]\n\n Notes:\n B - batch_size\n M - num_channels\n C - num_speakers\n F - num_freqs\n T - seq_len or num_samples\n K - num_frames\n I -...
48f4b9a89b4a0c3be7846c6ebfd6811e9581cfabd45d3efd401c1b3552fc6cfe
def find_path(start, goal, neighbors_fnct, reversePath=False, heuristic_cost_estimate_fnct=(lambda a, b: Infinite), distance_between_fnct=(lambda a, b: 1.0), is_goal_reached_fnct=(lambda a, b: (a == b))): 'A non-class version of the path finding algorithm' class FindPath(AStar): def heuristic_cost_est...
A non-class version of the path finding algorithm
astar/__init__.py
find_path
kopp/python-astar
133
python
def find_path(start, goal, neighbors_fnct, reversePath=False, heuristic_cost_estimate_fnct=(lambda a, b: Infinite), distance_between_fnct=(lambda a, b: 1.0), is_goal_reached_fnct=(lambda a, b: (a == b))): class FindPath(AStar): def heuristic_cost_estimate(self, current, goal): return heur...
def find_path(start, goal, neighbors_fnct, reversePath=False, heuristic_cost_estimate_fnct=(lambda a, b: Infinite), distance_between_fnct=(lambda a, b: 1.0), is_goal_reached_fnct=(lambda a, b: (a == b))): class FindPath(AStar): def heuristic_cost_estimate(self, current, goal): return heur...
b45de3d6f32dd357093d7eb869541a7ebb9f77f01e6b372d6a0515faae014447
@abstractmethod def heuristic_cost_estimate(self, current, goal): 'Computes the estimated (rough) distance between a node and the goal, this method must be implemented in a subclass. The second parameter is always the goal.' raise NotImplementedError
Computes the estimated (rough) distance between a node and the goal, this method must be implemented in a subclass. The second parameter is always the goal.
astar/__init__.py
heuristic_cost_estimate
kopp/python-astar
133
python
@abstractmethod def heuristic_cost_estimate(self, current, goal): raise NotImplementedError
@abstractmethod def heuristic_cost_estimate(self, current, goal): raise NotImplementedError<|docstring|>Computes the estimated (rough) distance between a node and the goal, this method must be implemented in a subclass. The second parameter is always the goal.<|endoftext|>
757b805ddeea1ea45bd2aafc56735e3165b7c14de27d9bf230e87e700a96834b
@abstractmethod def distance_between(self, n1, n2): "Gives the real distance between two adjacent nodes n1 and n2 (i.e n2 belongs to the list of n1's neighbors).\n n2 is guaranteed to belong to the list returned by the call to neighbors(n1).\n This method must be implemented in a subclass." ...
Gives the real distance between two adjacent nodes n1 and n2 (i.e n2 belongs to the list of n1's neighbors). n2 is guaranteed to belong to the list returned by the call to neighbors(n1). This method must be implemented in a subclass.
astar/__init__.py
distance_between
kopp/python-astar
133
python
@abstractmethod def distance_between(self, n1, n2): "Gives the real distance between two adjacent nodes n1 and n2 (i.e n2 belongs to the list of n1's neighbors).\n n2 is guaranteed to belong to the list returned by the call to neighbors(n1).\n This method must be implemented in a subclass." ...
@abstractmethod def distance_between(self, n1, n2): "Gives the real distance between two adjacent nodes n1 and n2 (i.e n2 belongs to the list of n1's neighbors).\n n2 is guaranteed to belong to the list returned by the call to neighbors(n1).\n This method must be implemented in a subclass." ...
9f23d473d0109103e5cfd9f125e397dd8e4ba4d28473e17b9d91a22504a529e0
@abstractmethod def neighbors(self, node): 'For a given node, returns (or yields) the list of its neighbors. this method must be implemented in a subclass' raise NotImplementedError
For a given node, returns (or yields) the list of its neighbors. this method must be implemented in a subclass
astar/__init__.py
neighbors
kopp/python-astar
133
python
@abstractmethod def neighbors(self, node): raise NotImplementedError
@abstractmethod def neighbors(self, node): raise NotImplementedError<|docstring|>For a given node, returns (or yields) the list of its neighbors. this method must be implemented in a subclass<|endoftext|>
3d42068a4ccb4ff69e085722fdd3278977c08c4706f61f30109c431247288177
def is_goal_reached(self, current, goal): " returns true when we can consider that 'current' is the goal" return (current == goal)
returns true when we can consider that 'current' is the goal
astar/__init__.py
is_goal_reached
kopp/python-astar
133
python
def is_goal_reached(self, current, goal): " " return (current == goal)
def is_goal_reached(self, current, goal): " " return (current == goal)<|docstring|>returns true when we can consider that 'current' is the goal<|endoftext|>
3396c99399eeff61077160f8b431274a437baff968518dba51612e4e99befa92
def clip(image: np.ndarray, k: int, lb: int, ub: int, b: int, c: str) -> np.ndarray: "Return the Netpbm image mod k.\n\n Args:\n image (np.ndarray): Image to mod.\n k (int): Number of gradients.\n lb (int): Lower bound of gradients to show.\n ub (int): Upper bound of gradients to show...
Return the Netpbm image mod k. Args: image (np.ndarray): Image to mod. k (int): Number of gradients. lb (int): Lower bound of gradients to show. ub (int): Upper bound of gradients to show. b (int): Width of the border. c (str): Color of the border {'white', 'black'} Returns: np.ndarray: Nu...
clip/src.py
clip
henryrobbins/artwork
0
python
def clip(image: np.ndarray, k: int, lb: int, ub: int, b: int, c: str) -> np.ndarray: "Return the Netpbm image mod k.\n\n Args:\n image (np.ndarray): Image to mod.\n k (int): Number of gradients.\n lb (int): Lower bound of gradients to show.\n ub (int): Upper bound of gradients to show...
def clip(image: np.ndarray, k: int, lb: int, ub: int, b: int, c: str) -> np.ndarray: "Return the Netpbm image mod k.\n\n Args:\n image (np.ndarray): Image to mod.\n k (int): Number of gradients.\n lb (int): Lower bound of gradients to show.\n ub (int): Upper bound of gradients to show...
03a2b130317bfe02b8dbbe595dc799086033d13b1964ebc3b97fa52384c91c9f
def batch_call(calls): "\n Similar interface but block height as last param. Uses JSON-RPC batch.\n\n [[contract, 'func', arg, block_identifier]]\n " jsonrpc_batch = [] fn_list = [] ids = count() for (contract, fn_name, *fn_inputs, block) in calls: fn = getattr(contract, fn_name) ...
Similar interface but block height as last param. Uses JSON-RPC batch. [[contract, 'func', arg, block_identifier]]
yearn/multicall2.py
batch_call
poolpitako/yearn-exporter
1
python
def batch_call(calls): "\n Similar interface but block height as last param. Uses JSON-RPC batch.\n\n [[contract, 'func', arg, block_identifier]]\n " jsonrpc_batch = [] fn_list = [] ids = count() for (contract, fn_name, *fn_inputs, block) in calls: fn = getattr(contract, fn_name) ...
def batch_call(calls): "\n Similar interface but block height as last param. Uses JSON-RPC batch.\n\n [[contract, 'func', arg, block_identifier]]\n " jsonrpc_batch = [] fn_list = [] ids = count() for (contract, fn_name, *fn_inputs, block) in calls: fn = getattr(contract, fn_name) ...
e4eb148d7a1bf5cfff52d2d1e622f9367ecf9adb7c1eadfaee43f2ea983272f9
def set_base_yaml(self): 'Set the base yaml for the alarm, specifics for alarms will be updated on their class' self.template = f''' {self.resource_unique_name}: Type: AWS::CloudWatch::Alarm Properties: AlarmDescription: Instance={self.instance_name} Metric={self.metric} AlertLev...
Set the base yaml for the alarm, specifics for alarms will be updated on their class
app/src/references/old/alarms_ec2.py
set_base_yaml
dwbelliston/cloudwedge
0
python
def set_base_yaml(self): self.template = f' {self.resource_unique_name}: Type: AWS::CloudWatch::Alarm Properties: AlarmDescription: Instance={self.instance_name} Metric={self.metric} AlertLevel={self.alert_level} Type=EC2 AlertOwner={self.alert_owner} Namespace: AWS/...
def set_base_yaml(self): self.template = f' {self.resource_unique_name}: Type: AWS::CloudWatch::Alarm Properties: AlarmDescription: Instance={self.instance_name} Metric={self.metric} AlertLevel={self.alert_level} Type=EC2 AlertOwner={self.alert_owner} Namespace: AWS/...
08f41045ab12cf17674fe956c24956856fa6195902bfcb556a138a870f9b2271
def test_to_bool(self): '\n Verify we can convert properly the boolean strings\n ' self.assertRaises(ValueError, SimpleConfigParser.to_bool, None) self.assertRaises(ValueError, SimpleConfigParser.to_bool, True) self.assertRaises(ValueError, SimpleConfigParser.to_bool, False) self.asser...
Verify we can convert properly the boolean strings
test/TestReadConfig.py
test_to_bool
lemaslab/redi
7
python
def test_to_bool(self): '\n \n ' self.assertRaises(ValueError, SimpleConfigParser.to_bool, None) self.assertRaises(ValueError, SimpleConfigParser.to_bool, True) self.assertRaises(ValueError, SimpleConfigParser.to_bool, False) self.assertTrue(SimpleConfigParser.to_bool('true')) self...
def test_to_bool(self): '\n \n ' self.assertRaises(ValueError, SimpleConfigParser.to_bool, None) self.assertRaises(ValueError, SimpleConfigParser.to_bool, True) self.assertRaises(ValueError, SimpleConfigParser.to_bool, False) self.assertTrue(SimpleConfigParser.to_bool('true')) self...
085f437315d7117ea5ea29534c52c8ea69c0446418b5120d7275a885e40e9c52
def __setup_bambou(): ' Avoid having bad behavior when using importlib.import_module method\n ' import pkg_resources from bambou import BambouConfig, NURESTModelController default_attrs = pkg_resources.resource_filename(__name__, '/resources/attrs_defaults.ini') BambouConfig.set_default_values_co...
Avoid having bad behavior when using importlib.import_module method
tests/base/sdk/python/tdldk/v1_0/__init__.py
__setup_bambou
edwinfeener/monolithe
18
python
def __setup_bambou(): ' \n ' import pkg_resources from bambou import BambouConfig, NURESTModelController default_attrs = pkg_resources.resource_filename(__name__, '/resources/attrs_defaults.ini') BambouConfig.set_default_values_config_file(default_attrs) NURESTModelController.register_model(G...
def __setup_bambou(): ' \n ' import pkg_resources from bambou import BambouConfig, NURESTModelController default_attrs = pkg_resources.resource_filename(__name__, '/resources/attrs_defaults.ini') BambouConfig.set_default_values_config_file(default_attrs) NURESTModelController.register_model(G...
d0325d0b54911211e8e13f3386c8bf8c5aadacce22985b48e07bbd69187a3945
def plot_string(self, ax=None, frame=None, plot_kwargs=None): "\n Plot the string at an input frame. Here, frame is a dump of a step in the run. If `fts_job´ is the name\n of the fts job, the number of dumps can be specified by the user while submitting the job, as:\n\n >>> fts_job.set_outp...
Plot the string at an input frame. Here, frame is a dump of a step in the run. If `fts_job´ is the name of the fts job, the number of dumps can be specified by the user while submitting the job, as: >>> fts_job.set_output_whitelist(**{'calc_static_centroids': {'energy_pot': 20}}) and run the job. Here, it dumps (...
pyiron_contrib/protocol/compound/finite_temperature_string.py
plot_string
pyiron/pyiron_contrib
5
python
def plot_string(self, ax=None, frame=None, plot_kwargs=None): "\n Plot the string at an input frame. Here, frame is a dump of a step in the run. If `fts_job´ is the name\n of the fts job, the number of dumps can be specified by the user while submitting the job, as:\n\n >>> fts_job.set_outp...
def plot_string(self, ax=None, frame=None, plot_kwargs=None): "\n Plot the string at an input frame. Here, frame is a dump of a step in the run. If `fts_job´ is the name\n of the fts job, the number of dumps can be specified by the user while submitting the job, as:\n\n >>> fts_job.set_outp...
94a8597023a2dc3dff565e27b0b73a9c0230a58563da1b1210a5fc6c2ebf2285
def get_forward_barrier(self, frame=None, use_minima=False): '\n Get the energy barrier from the 0th image to the highest energy (saddle state).\n\n Args:\n frame (int): A particular dump. (Default is None, the final dump.)\n use_minima (bool): Whether to use the minima of the en...
Get the energy barrier from the 0th image to the highest energy (saddle state). Args: frame (int): A particular dump. (Default is None, the final dump.) use_minima (bool): Whether to use the minima of the energies to compute tha barrier. (Default is False, use the 0th value.) Returns: (float): the...
pyiron_contrib/protocol/compound/finite_temperature_string.py
get_forward_barrier
pyiron/pyiron_contrib
5
python
def get_forward_barrier(self, frame=None, use_minima=False): '\n Get the energy barrier from the 0th image to the highest energy (saddle state).\n\n Args:\n frame (int): A particular dump. (Default is None, the final dump.)\n use_minima (bool): Whether to use the minima of the en...
def get_forward_barrier(self, frame=None, use_minima=False): '\n Get the energy barrier from the 0th image to the highest energy (saddle state).\n\n Args:\n frame (int): A particular dump. (Default is None, the final dump.)\n use_minima (bool): Whether to use the minima of the en...
243dfddbef4719b5c6a0ef5b7eec9e61c637d7806f134f2a827282a463e14f53
def get_reverse_barrier(self, frame=None, use_minima=False): '\n Get the energy barrier from the final image to the highest energy (saddle state).\n\n Args:\n frame (int): A particular dump. (Default is None, the final dump.)\n use_minima (bool): Whether to use the minima of the ...
Get the energy barrier from the final image to the highest energy (saddle state). Args: frame (int): A particular dump. (Default is None, the final dump.) use_minima (bool): Whether to use the minima of the energies to compute tha barrier. (Default is False, use the nth value.) Returns: (float): t...
pyiron_contrib/protocol/compound/finite_temperature_string.py
get_reverse_barrier
pyiron/pyiron_contrib
5
python
def get_reverse_barrier(self, frame=None, use_minima=False): '\n Get the energy barrier from the final image to the highest energy (saddle state).\n\n Args:\n frame (int): A particular dump. (Default is None, the final dump.)\n use_minima (bool): Whether to use the minima of the ...
def get_reverse_barrier(self, frame=None, use_minima=False): '\n Get the energy barrier from the final image to the highest energy (saddle state).\n\n Args:\n frame (int): A particular dump. (Default is None, the final dump.)\n use_minima (bool): Whether to use the minima of the ...
c52cb9b58345fab85dc3c2073c590a7caf483f239c3c5b028d1403f7818b4617
def __init__(self, nnef_graph, custom_operations=None, batch_normalization_momentum=0.1, tensor_hooks=None): '\n nnef_graph might be modified by this class if training and write_nnef is used\n ' super(NNEFModule, self).__init__() self._nnef_graph = nnef_graph for nnef_tensor in self._n...
nnef_graph might be modified by this class if training and write_nnef is used
nnef_tools/backend/pytorch/nnef_module.py
__init__
Alena19971993/NNEF-Tools
0
python
def __init__(self, nnef_graph, custom_operations=None, batch_normalization_momentum=0.1, tensor_hooks=None): '\n \n ' super(NNEFModule, self).__init__() self._nnef_graph = nnef_graph for nnef_tensor in self._nnef_graph.tensors: if nnef_tensor.is_constant: np_array =...
def __init__(self, nnef_graph, custom_operations=None, batch_normalization_momentum=0.1, tensor_hooks=None): '\n \n ' super(NNEFModule, self).__init__() self._nnef_graph = nnef_graph for nnef_tensor in self._nnef_graph.tensors: if nnef_tensor.is_constant: np_array =...
df50172c20f5bd0586557de096920832ba8f1b16bcd067b1a6765195e0a1ee62
def reset_parameters(self): '\n This method provides a very simple initialization that was enough for out experiments\n If you need something more nuanced, please do the initialization externally\n ' biases = set() for op in self._nnef_graph.operations: if (op.name in ('conv', '...
This method provides a very simple initialization that was enough for out experiments If you need something more nuanced, please do the initialization externally
nnef_tools/backend/pytorch/nnef_module.py
reset_parameters
Alena19971993/NNEF-Tools
0
python
def reset_parameters(self): '\n This method provides a very simple initialization that was enough for out experiments\n If you need something more nuanced, please do the initialization externally\n ' biases = set() for op in self._nnef_graph.operations: if (op.name in ('conv', '...
def reset_parameters(self): '\n This method provides a very simple initialization that was enough for out experiments\n If you need something more nuanced, please do the initialization externally\n ' biases = set() for op in self._nnef_graph.operations: if (op.name in ('conv', '...
c1f91cc500c4fe34d0bd8630ed8e106c2b21a5f07ae5432ba67339d8c31db48c
def list_of_array_equal(s, t): '\n Compare two lists of ndarrays\n\n s, t: lists of numpy.ndarrays\n\n ' eq_(len(s), len(t)) all((assert_array_equal(x, y) for (x, y) in zip(s, t)))
Compare two lists of ndarrays s, t: lists of numpy.ndarrays
quantecon/tests/test_graph_tools.py
list_of_array_equal
chenxulong/quanteco
9
python
def list_of_array_equal(s, t): '\n Compare two lists of ndarrays\n\n s, t: lists of numpy.ndarrays\n\n ' eq_(len(s), len(t)) all((assert_array_equal(x, y) for (x, y) in zip(s, t)))
def list_of_array_equal(s, t): '\n Compare two lists of ndarrays\n\n s, t: lists of numpy.ndarrays\n\n ' eq_(len(s), len(t)) all((assert_array_equal(x, y) for (x, y) in zip(s, t)))<|docstring|>Compare two lists of ndarrays s, t: lists of numpy.ndarrays<|endoftext|>
636dc9aba8cba6ec70a162b5fe7e4f0b5b008c179633c5192a9c24b1b5f27b07
@raises(ValueError) def test_raises_value_error_non_sym(): 'Test with non symmetric input' g = DiGraph(np.array([[0.4, 0.6]]))
Test with non symmetric input
quantecon/tests/test_graph_tools.py
test_raises_value_error_non_sym
chenxulong/quanteco
9
python
@raises(ValueError) def test_raises_value_error_non_sym(): g = DiGraph(np.array([[0.4, 0.6]]))
@raises(ValueError) def test_raises_value_error_non_sym(): g = DiGraph(np.array([[0.4, 0.6]]))<|docstring|>Test with non symmetric input<|endoftext|>
7818b73d33613d396f5cd9c18d43fa737a68f74716f718d9e963710f1991c553
def setUp(self): 'Setup Digraph instances' self.graphs = Graphs() for graph_dict in self.graphs.graph_dicts: try: weighted = graph_dict['weighted'] except: weighted = False graph_dict['g'] = DiGraph(graph_dict['A'], weighted=weighted)
Setup Digraph instances
quantecon/tests/test_graph_tools.py
setUp
chenxulong/quanteco
9
python
def setUp(self): self.graphs = Graphs() for graph_dict in self.graphs.graph_dicts: try: weighted = graph_dict['weighted'] except: weighted = False graph_dict['g'] = DiGraph(graph_dict['A'], weighted=weighted)
def setUp(self): self.graphs = Graphs() for graph_dict in self.graphs.graph_dicts: try: weighted = graph_dict['weighted'] except: weighted = False graph_dict['g'] = DiGraph(graph_dict['A'], weighted=weighted)<|docstring|>Setup Digraph instances<|endoftext|>
c10815b6396091204a457a9393d8a95a2ac0465d84dcef952a32810825d2f2f1
async def test_aspirate_implementation(decoy: Decoy, equipment: EquipmentHandler, movement: MovementHandler, pipetting: PipettingHandler, run_control: RunControlHandler) -> None: 'An Aspirate should have an execution implementation.' subject = AspirateImplementation(equipment=equipment, movement=movement, pipet...
An Aspirate should have an execution implementation.
api/tests/opentrons/protocol_engine/commands/test_aspirate.py
test_aspirate_implementation
y3rsh/opentrons
235
python
async def test_aspirate_implementation(decoy: Decoy, equipment: EquipmentHandler, movement: MovementHandler, pipetting: PipettingHandler, run_control: RunControlHandler) -> None: subject = AspirateImplementation(equipment=equipment, movement=movement, pipetting=pipetting, run_control=run_control) location ...
async def test_aspirate_implementation(decoy: Decoy, equipment: EquipmentHandler, movement: MovementHandler, pipetting: PipettingHandler, run_control: RunControlHandler) -> None: subject = AspirateImplementation(equipment=equipment, movement=movement, pipetting=pipetting, run_control=run_control) location ...
4eadd56a04f9e4473d180fb2a0b273900ba291051998338f0ac68c21ad9a5f9c
def gray2color(gray, color): ' \n transform a gray image (2d array) to a color image given the color (1x3 vector) \n untested\n ' return np.stack(((gray * c) for c in color), (- 1))
transform a gray image (2d array) to a color image given the color (1x3 vector) untested
voxelmorph/voxelmorph/tf/external/pytools-lib/pynd/imutils.py
gray2color
Noodles-321/Registration
107
python
def gray2color(gray, color): ' \n transform a gray image (2d array) to a color image given the color (1x3 vector) \n untested\n ' return np.stack(((gray * c) for c in color), (- 1))
def gray2color(gray, color): ' \n transform a gray image (2d array) to a color image given the color (1x3 vector) \n untested\n ' return np.stack(((gray * c) for c in color), (- 1))<|docstring|>transform a gray image (2d array) to a color image given the color (1x3 vector) untested<|endoftext|>
ede850614af4af880dd0dec16fd8c55cbc37358596c39a2c983be167c18d8ff1
def rgb2gray(rgb, mixing=[0.2989, 0.587, 0.114], keepdims=False): ' \n transform a rgb image (i.e. array with last dimension of 3) to grayscale\n (which reduces the last dimension)\n ' gray = np.dot(rgb[(..., :3)], mixing) if keepdims: gray = gray[(..., np.newaxis)] return gray
transform a rgb image (i.e. array with last dimension of 3) to grayscale (which reduces the last dimension)
voxelmorph/voxelmorph/tf/external/pytools-lib/pynd/imutils.py
rgb2gray
Noodles-321/Registration
107
python
def rgb2gray(rgb, mixing=[0.2989, 0.587, 0.114], keepdims=False): ' \n transform a rgb image (i.e. array with last dimension of 3) to grayscale\n (which reduces the last dimension)\n ' gray = np.dot(rgb[(..., :3)], mixing) if keepdims: gray = gray[(..., np.newaxis)] return gray
def rgb2gray(rgb, mixing=[0.2989, 0.587, 0.114], keepdims=False): ' \n transform a rgb image (i.e. array with last dimension of 3) to grayscale\n (which reduces the last dimension)\n ' gray = np.dot(rgb[(..., :3)], mixing) if keepdims: gray = gray[(..., np.newaxis)] return gray<|docstri...
4f75b57a4ae689d6c8d2b5fe8de2a1d592cf05bb6754becec7d9c4ee22441359
def main() -> None: 'Read the Real Python article feed.' args = [a for a in sys.argv[1:] if (not a.startswith('-'))] opts = [o for o in sys.argv[1:] if o.startswith('-')] if (('-h' in opts) or ('--help' in opts)): viewer.show(__doc__) raise SystemExit() show_links = (('-l' in opts) o...
Read the Real Python article feed.
reader/__main__.py
main
finage/realpython_reader
100
python
def main() -> None: args = [a for a in sys.argv[1:] if (not a.startswith('-'))] opts = [o for o in sys.argv[1:] if o.startswith('-')] if (('-h' in opts) or ('--help' in opts)): viewer.show(__doc__) raise SystemExit() show_links = (('-l' in opts) or ('--show-links' in opts)) url ...
def main() -> None: args = [a for a in sys.argv[1:] if (not a.startswith('-'))] opts = [o for o in sys.argv[1:] if o.startswith('-')] if (('-h' in opts) or ('--help' in opts)): viewer.show(__doc__) raise SystemExit() show_links = (('-l' in opts) or ('--show-links' in opts)) url ...
99805efc580e87d5cb9ad8a86fdd6f9d48746642d912028b507696acb7184124
def method_foo(self): '\n Method of Parent Class A\n ' print('AAA')
Method of Parent Class A
super/example_super.py
method_foo
firemanxbr/python-examples
2
python
def method_foo(self): '\n \n ' print('AAA')
def method_foo(self): '\n \n ' print('AAA')<|docstring|>Method of Parent Class A<|endoftext|>
27bc5c00eb766889ffb1349f5b8bb933622cb8b3a96738e4e301222eb8a7386a
def method_bar(self): '\n Method of Sub Class B\n ' super(SubB, self).method_foo() print('BBB')
Method of Sub Class B
super/example_super.py
method_bar
firemanxbr/python-examples
2
python
def method_bar(self): '\n \n ' super(SubB, self).method_foo() print('BBB')
def method_bar(self): '\n \n ' super(SubB, self).method_foo() print('BBB')<|docstring|>Method of Sub Class B<|endoftext|>
dfd0d74aab31c82a8e159ba0024ca48676a1d0b08e7bdd1f94ad0f8d07d1ff97
def method_foo(self): '\n Method of Sub Class X\n ' print('XXX')
Method of Sub Class X
super/example_super.py
method_foo
firemanxbr/python-examples
2
python
def method_foo(self): '\n \n ' print('XXX')
def method_foo(self): '\n \n ' print('XXX')<|docstring|>Method of Sub Class X<|endoftext|>
c6a3d20eddf59558b6bf84e7cfa7d9724611ab2b83da1cd1e6ddbd5684eb2e39
def _parse_args(): 'return a parser with arguments and values' parser = argparse.ArgumentParser() _init_general_parsers(parser) _init_subparsers(parser) if (len(sys.argv) == 1): parser.print_help() sys.exit(1) return parser.parse_args()
return a parser with arguments and values
wow_addon_manager/cli.py
_parse_args
qwezarty/wow-addon-manager
0
python
def _parse_args(): parser = argparse.ArgumentParser() _init_general_parsers(parser) _init_subparsers(parser) if (len(sys.argv) == 1): parser.print_help() sys.exit(1) return parser.parse_args()
def _parse_args(): parser = argparse.ArgumentParser() _init_general_parsers(parser) _init_subparsers(parser) if (len(sys.argv) == 1): parser.print_help() sys.exit(1) return parser.parse_args()<|docstring|>return a parser with arguments and values<|endoftext|>
d9b5933595569cb9cb8688b9d16353eabeb9c56bbaaeb0df4c419ef968c40a29
def _init_general_parsers(parser): 'initialize global cli arguments' parser.add_argument('-v', '--version', action='version', version='%(prog)s 0.0.1', help='show version and exit.')
initialize global cli arguments
wow_addon_manager/cli.py
_init_general_parsers
qwezarty/wow-addon-manager
0
python
def _init_general_parsers(parser): parser.add_argument('-v', '--version', action='version', version='%(prog)s 0.0.1', help='show version and exit.')
def _init_general_parsers(parser): parser.add_argument('-v', '--version', action='version', version='%(prog)s 0.0.1', help='show version and exit.')<|docstring|>initialize global cli arguments<|endoftext|>
199e9082c70e872b4e76ff9a7c08b1b579d496e54f7b891330dbd7fe75285440
def _init_subparsers(parent): 'initialize cli sub-positional arguments' subparsers = parent.add_subparsers() parser_install = subparsers.add_parser('install', help='install a specific addon.') parser_install.set_defaults(func=install) parser_install.add_argument('addon', help='the addon you want to ...
initialize cli sub-positional arguments
wow_addon_manager/cli.py
_init_subparsers
qwezarty/wow-addon-manager
0
python
def _init_subparsers(parent): subparsers = parent.add_subparsers() parser_install = subparsers.add_parser('install', help='install a specific addon.') parser_install.set_defaults(func=install) parser_install.add_argument('addon', help='the addon you want to install.') parser_search = subparsers...
def _init_subparsers(parent): subparsers = parent.add_subparsers() parser_install = subparsers.add_parser('install', help='install a specific addon.') parser_install.set_defaults(func=install) parser_install.add_argument('addon', help='the addon you want to install.') parser_search = subparsers...
97024d16483f12d79444c8a988d77658187681f8f797885cafdef16244738450
def create(self, validated_data): '\n Create / Update Configurations\n :param validated_data: Validated data\n :return: upserted configurations object\n ' workspace = validated_data['workspace'] (configuration, _) = Configuration.objects.update_or_create(workspace_id=workspace, d...
Create / Update Configurations :param validated_data: Validated data :return: upserted configurations object
apps/workspaces/serializers.py
create
fylein/fyle-netsuite-api
1
python
def create(self, validated_data): '\n Create / Update Configurations\n :param validated_data: Validated data\n :return: upserted configurations object\n ' workspace = validated_data['workspace'] (configuration, _) = Configuration.objects.update_or_create(workspace_id=workspace, d...
def create(self, validated_data): '\n Create / Update Configurations\n :param validated_data: Validated data\n :return: upserted configurations object\n ' workspace = validated_data['workspace'] (configuration, _) = Configuration.objects.update_or_create(workspace_id=workspace, d...
4f1e3de59b5b820e46e29441a5fdb25ef959322bcab671a448c9aec7cad6ecd4
def validate(self, attrs): '\n Validate auto create destination entity\n :param attrs: Non-validated data\n :return: upserted general settings object\n ' if self.partial: return attrs if ((not attrs['auto_map_employees']) and attrs['auto_create_destination_entity']): ...
Validate auto create destination entity :param attrs: Non-validated data :return: upserted general settings object
apps/workspaces/serializers.py
validate
fylein/fyle-netsuite-api
1
python
def validate(self, attrs): '\n Validate auto create destination entity\n :param attrs: Non-validated data\n :return: upserted general settings object\n ' if self.partial: return attrs if ((not attrs['auto_map_employees']) and attrs['auto_create_destination_entity']): ...
def validate(self, attrs): '\n Validate auto create destination entity\n :param attrs: Non-validated data\n :return: upserted general settings object\n ' if self.partial: return attrs if ((not attrs['auto_map_employees']) and attrs['auto_create_destination_entity']): ...
8401d1486f56c37247b72ebd7def50486aec5011080c1a401336169017f51cdc
def gaussian_log(x, x0, xsig): '\n\tfunction to calculate the gaussian probability (its normed to Pmax and given in log)\n\t\n\tINPUT:\n\t\n\t x = where is the data point or parameter value\n\t\n\t x0 = mu\n\t\n\t xsig = sigma\n\t' return (- np.divide(((x - x0) * (x - x0)), ((2 * xsig) * xsig)))
function to calculate the gaussian probability (its normed to Pmax and given in log) INPUT: x = where is the data point or parameter value x0 = mu xsig = sigma
Chempy/cem_function.py
gaussian_log
jan-rybizki/Chempy
25
python
def gaussian_log(x, x0, xsig): '\n\tfunction to calculate the gaussian probability (its normed to Pmax and given in log)\n\t\n\tINPUT:\n\t\n\t x = where is the data point or parameter value\n\t\n\t x0 = mu\n\t\n\t xsig = sigma\n\t' return (- np.divide(((x - x0) * (x - x0)), ((2 * xsig) * xsig)))
def gaussian_log(x, x0, xsig): '\n\tfunction to calculate the gaussian probability (its normed to Pmax and given in log)\n\t\n\tINPUT:\n\t\n\t x = where is the data point or parameter value\n\t\n\t x0 = mu\n\t\n\t xsig = sigma\n\t' return (- np.divide(((x - x0) * (x - x0)), ((2 * xsig) * xsig)))<|docstrin...
75404432c6b243d29a9225eecd5f9cd0ba1dde67d6c31bac69d13e3eba620c81
def lognorm_log(x, mu, factor): '\n\tthis function provides Prior probability distribution where the factor away from the mean behaves like the sigma deviation in normal_log \n\t\n\tfor example if mu = 1 and factor = 2 \n\t\n\tfor\t1 it returns 0\n\t\n\tfor 0,5 and 2 it returns -0.5\n\t\n\tfor 0.25 and 4 it returns...
this function provides Prior probability distribution where the factor away from the mean behaves like the sigma deviation in normal_log for example if mu = 1 and factor = 2 for 1 it returns 0 for 0,5 and 2 it returns -0.5 for 0.25 and 4 it returns -2.0 and so forth Can be used to specify the prior on the y...
Chempy/cem_function.py
lognorm_log
jan-rybizki/Chempy
25
python
def lognorm_log(x, mu, factor): '\n\tthis function provides Prior probability distribution where the factor away from the mean behaves like the sigma deviation in normal_log \n\t\n\tfor example if mu = 1 and factor = 2 \n\t\n\tfor\t1 it returns 0\n\t\n\tfor 0,5 and 2 it returns -0.5\n\t\n\tfor 0.25 and 4 it returns...
def lognorm_log(x, mu, factor): '\n\tthis function provides Prior probability distribution where the factor away from the mean behaves like the sigma deviation in normal_log \n\t\n\tfor example if mu = 1 and factor = 2 \n\t\n\tfor\t1 it returns 0\n\t\n\tfor 0,5 and 2 it returns -0.5\n\t\n\tfor 0.25 and 4 it returns...
575d3f0c5337ed3d7eb4c09109c902053a0ba450dfdaeb42eb4063acd8b0b7f2
def gaussian(x, x0, xsig): '\n\tfunction to calculate the gaussian probability (its normed to Pmax and given in log)\n\t\n\tINPUT:\n\t\n\t x = where is the data point or parameter value\n\t\n\t x0 = mu\n\t\n\t xsig = sigma\n\t' factor = (1.0 / np.sqrt((((xsig * xsig) * 2.0) * np.pi))) exponent = (- np...
function to calculate the gaussian probability (its normed to Pmax and given in log) INPUT: x = where is the data point or parameter value x0 = mu xsig = sigma
Chempy/cem_function.py
gaussian
jan-rybizki/Chempy
25
python
def gaussian(x, x0, xsig): '\n\tfunction to calculate the gaussian probability (its normed to Pmax and given in log)\n\t\n\tINPUT:\n\t\n\t x = where is the data point or parameter value\n\t\n\t x0 = mu\n\t\n\t xsig = sigma\n\t' factor = (1.0 / np.sqrt((((xsig * xsig) * 2.0) * np.pi))) exponent = (- np...
def gaussian(x, x0, xsig): '\n\tfunction to calculate the gaussian probability (its normed to Pmax and given in log)\n\t\n\tINPUT:\n\t\n\t x = where is the data point or parameter value\n\t\n\t x0 = mu\n\t\n\t xsig = sigma\n\t' factor = (1.0 / np.sqrt((((xsig * xsig) * 2.0) * np.pi))) exponent = (- np...
13fb197208bf2a75833d70d922e99c9b34637e1109925b72c1b27cb29d6c3119
def lognorm(x, mu, factor): '\n\tthis function provides Prior probability distribution where the factor away from the mean behaves like the sigma deviation in normal_log \n\tBEWARE: this function is not a properly normalized probability distribution. It only provides relative values.\n\t\n\tINPUT:\n\n\t x = where...
this function provides Prior probability distribution where the factor away from the mean behaves like the sigma deviation in normal_log BEWARE: this function is not a properly normalized probability distribution. It only provides relative values. INPUT: x = where to evaluate the function, can be an array mu ...
Chempy/cem_function.py
lognorm
jan-rybizki/Chempy
25
python
def lognorm(x, mu, factor): '\n\tthis function provides Prior probability distribution where the factor away from the mean behaves like the sigma deviation in normal_log \n\tBEWARE: this function is not a properly normalized probability distribution. It only provides relative values.\n\t\n\tINPUT:\n\n\t x = where...
def lognorm(x, mu, factor): '\n\tthis function provides Prior probability distribution where the factor away from the mean behaves like the sigma deviation in normal_log \n\tBEWARE: this function is not a properly normalized probability distribution. It only provides relative values.\n\t\n\tINPUT:\n\n\t x = where...
ac8eeb9732ad729bfafb18ac61fd03e43a79c07079f235efefad57ba6f360329
def shorten_sfr(a): '\n\tThis function crops the SFR to the length of the age of the star and ensures that enough stars are formed at the stellar birth epoch\n\n\tINPUT:\n\n\t a = Modelparameters\n\n\tOUTPUT:\n\t\n\t the function will update the modelparameters, such that the simulation will end when the star i...
This function crops the SFR to the length of the age of the star and ensures that enough stars are formed at the stellar birth epoch INPUT: a = Modelparameters OUTPUT: the function will update the modelparameters, such that the simulation will end when the star is born and it will also check whether there is ...
Chempy/cem_function.py
shorten_sfr
jan-rybizki/Chempy
25
python
def shorten_sfr(a): '\n\tThis function crops the SFR to the length of the age of the star and ensures that enough stars are formed at the stellar birth epoch\n\n\tINPUT:\n\n\t a = Modelparameters\n\n\tOUTPUT:\n\t\n\t the function will update the modelparameters, such that the simulation will end when the star i...
def shorten_sfr(a): '\n\tThis function crops the SFR to the length of the age of the star and ensures that enough stars are formed at the stellar birth epoch\n\n\tINPUT:\n\n\t a = Modelparameters\n\n\tOUTPUT:\n\t\n\t the function will update the modelparameters, such that the simulation will end when the star i...
b742578b6eac6cb8260b50132807d1228a560332a74726ac34a900539ec0533e
def cem(changing_parameter, a): "\n\tThis is the function calculating the chemical evolution for a specific parameter set (changing_parameter) and for a specific observational constraint specified in a (e.g. 'solar_norm' calculates the likelihood of solar abundances coming out of the model). It returns the posterio...
This is the function calculating the chemical evolution for a specific parameter set (changing_parameter) and for a specific observational constraint specified in a (e.g. 'solar_norm' calculates the likelihood of solar abundances coming out of the model). It returns the posterior and a list of blobs. It can be used by ...
Chempy/cem_function.py
cem
jan-rybizki/Chempy
25
python
def cem(changing_parameter, a): "\n\tThis is the function calculating the chemical evolution for a specific parameter set (changing_parameter) and for a specific observational constraint specified in a (e.g. 'solar_norm' calculates the likelihood of solar abundances coming out of the model). It returns the posterio...
def cem(changing_parameter, a): "\n\tThis is the function calculating the chemical evolution for a specific parameter set (changing_parameter) and for a specific observational constraint specified in a (e.g. 'solar_norm' calculates the likelihood of solar abundances coming out of the model). It returns the posterio...
bdb3d34f57b6f6a279ed92cea70cb41eefd67d3bc576a1e5a36af278ba334687
def cem_real(changing_parameter, a): '\n\treal chempy function. description can be found in cem\n\t' a = extract_parameters_and_priors(changing_parameter, a) basic_solar = solar_abundances() getattr(basic_solar, a.solar_abundance_name)() elements_to_trace = a.elements_to_trace directory = 'model...
real chempy function. description can be found in cem
Chempy/cem_function.py
cem_real
jan-rybizki/Chempy
25
python
def cem_real(changing_parameter, a): '\n\t\n\t' a = extract_parameters_and_priors(changing_parameter, a) basic_solar = solar_abundances() getattr(basic_solar, a.solar_abundance_name)() elements_to_trace = a.elements_to_trace directory = 'model_temp/' if a.calculate_model: (cube, abun...
def cem_real(changing_parameter, a): '\n\t\n\t' a = extract_parameters_and_priors(changing_parameter, a) basic_solar = solar_abundances() getattr(basic_solar, a.solar_abundance_name)() elements_to_trace = a.elements_to_trace directory = 'model_temp/' if a.calculate_model: (cube, abun...
48d677ca78dfc3678cd9ab1d9dee7ac13ade81ba6fa68659b65e5ea67935da71
def cem2(a): "\n\tThis is the function calculating the chemical evolution for a specific parameter set (changing_parameter) and for a specific observational constraint specified in a (e.g. 'solar_norm' calculates the likelihood of solar abundances coming out of the model). It returns the posterior and a list of blo...
This is the function calculating the chemical evolution for a specific parameter set (changing_parameter) and for a specific observational constraint specified in a (e.g. 'solar_norm' calculates the likelihood of solar abundances coming out of the model). It returns the posterior and a list of blobs. It can be used by ...
Chempy/cem_function.py
cem2
jan-rybizki/Chempy
25
python
def cem2(a): "\n\tThis is the function calculating the chemical evolution for a specific parameter set (changing_parameter) and for a specific observational constraint specified in a (e.g. 'solar_norm' calculates the likelihood of solar abundances coming out of the model). It returns the posterior and a list of blo...
def cem2(a): "\n\tThis is the function calculating the chemical evolution for a specific parameter set (changing_parameter) and for a specific observational constraint specified in a (e.g. 'solar_norm' calculates the likelihood of solar abundances coming out of the model). It returns the posterior and a list of blo...
4d2cfc9f5030c3e23a50a6a193613625ace455f08123f4ca12fffce20803928d
def cem_real2(a): '\n\treal chempy function. description can be found in cem2\n\t' a = shorten_sfr(a) basic_solar = solar_abundances() getattr(basic_solar, a.solar_abundance_name)() elements_to_trace = list(a.elements_to_trace) directory = 'model_temp/' if a.calculate_model: (cube, a...
real chempy function. description can be found in cem2
Chempy/cem_function.py
cem_real2
jan-rybizki/Chempy
25
python
def cem_real2(a): '\n\t\n\t' a = shorten_sfr(a) basic_solar = solar_abundances() getattr(basic_solar, a.solar_abundance_name)() elements_to_trace = list(a.elements_to_trace) directory = 'model_temp/' if a.calculate_model: (cube, abundances) = Chempy(a) cube1 = cube.cube ...
def cem_real2(a): '\n\t\n\t' a = shorten_sfr(a) basic_solar = solar_abundances() getattr(basic_solar, a.solar_abundance_name)() elements_to_trace = list(a.elements_to_trace) directory = 'model_temp/' if a.calculate_model: (cube, abundances) = Chempy(a) cube1 = cube.cube ...
2a90758227c8feac7ba15f958a3794336adfb4aefbd79759622cc6ec0af33fb8
def posterior_function(changing_parameter, a): "\n\tThe posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'.\n\tWildcards can be created according to the tutorial 6. A few wildcards are already store...
The posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'. Wildcards can be created according to the tutorial 6. A few wildcards are already stored in the input folder. Chempy will try the current folder f...
Chempy/cem_function.py
posterior_function
jan-rybizki/Chempy
25
python
def posterior_function(changing_parameter, a): "\n\tThe posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'.\n\tWildcards can be created according to the tutorial 6. A few wildcards are already store...
def posterior_function(changing_parameter, a): "\n\tThe posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'.\n\tWildcards can be created according to the tutorial 6. A few wildcards are already store...
9339705e0a47ae1f9ae901326fc46e1c3e4789ba2bc821662fc3f377e3421306
def posterior_function_real(changing_parameter, a): '\n\tThis is the actual posterior function. But the functionality is explained in posterior_function.\n\t' a = extract_parameters_and_priors(changing_parameter, a) prior = sum(np.log(a.prior)) backup = (a.end, a.time_steps, a.total_mass) if (a.stel...
This is the actual posterior function. But the functionality is explained in posterior_function.
Chempy/cem_function.py
posterior_function_real
jan-rybizki/Chempy
25
python
def posterior_function_real(changing_parameter, a): '\n\t\n\t' a = extract_parameters_and_priors(changing_parameter, a) prior = sum(np.log(a.prior)) backup = (a.end, a.time_steps, a.total_mass) if (a.stellar_identifier is 'prior'): likelihood = 0.0 abundance_list = 0 else: ...
def posterior_function_real(changing_parameter, a): '\n\t\n\t' a = extract_parameters_and_priors(changing_parameter, a) prior = sum(np.log(a.prior)) backup = (a.end, a.time_steps, a.total_mass) if (a.stellar_identifier is 'prior'): likelihood = 0.0 abundance_list = 0 else: ...
e5820d16e8380e1f17cc241629fa8c7b2efea17072696984225a5b6b88762a8b
def posterior_function_for_minimization(changing_parameter, a): '\n\tcalls the posterior function but just returns the negative log posterior instead of posterior and blobs\n\t' (posterior, blobs) = posterior_function(changing_parameter, a) return (- posterior)
calls the posterior function but just returns the negative log posterior instead of posterior and blobs
Chempy/cem_function.py
posterior_function_for_minimization
jan-rybizki/Chempy
25
python
def posterior_function_for_minimization(changing_parameter, a): '\n\t\n\t' (posterior, blobs) = posterior_function(changing_parameter, a) return (- posterior)
def posterior_function_for_minimization(changing_parameter, a): '\n\t\n\t' (posterior, blobs) = posterior_function(changing_parameter, a) return (- posterior)<|docstring|>calls the posterior function but just returns the negative log posterior instead of posterior and blobs<|endoftext|>
d5250f32c9ba76273e94899da0cd52429b1644d94c6aa267470d61ecc4de5a9b
def posterior_function_returning_predictions(args): '\n\tcalls the posterior function but just returns the negative log posterior instead of posterior and blobs\n\t' (changing_parameter, a) = args (posterior, abundance_list, element_list) = posterior_function_predictions(changing_parameter, a) return (a...
calls the posterior function but just returns the negative log posterior instead of posterior and blobs
Chempy/cem_function.py
posterior_function_returning_predictions
jan-rybizki/Chempy
25
python
def posterior_function_returning_predictions(args): '\n\t\n\t' (changing_parameter, a) = args (posterior, abundance_list, element_list) = posterior_function_predictions(changing_parameter, a) return (abundance_list, element_list)
def posterior_function_returning_predictions(args): '\n\t\n\t' (changing_parameter, a) = args (posterior, abundance_list, element_list) = posterior_function_predictions(changing_parameter, a) return (abundance_list, element_list)<|docstring|>calls the posterior function but just returns the negative log...
6bcf48ff551d53d8beaeea98fe6806dfe52b7bcfcab72c4fb0e3b6554f526931
def posterior_function_predictions(changing_parameter, a): '\n\tThis is like posterior_function_real. But returning the predicted elements as well.\n\t' start_time = time.time() a = extract_parameters_and_priors(changing_parameter, a) prior = sum(np.log(a.prior)) precalculation = time.time() bac...
This is like posterior_function_real. But returning the predicted elements as well.
Chempy/cem_function.py
posterior_function_predictions
jan-rybizki/Chempy
25
python
def posterior_function_predictions(changing_parameter, a): '\n\t\n\t' start_time = time.time() a = extract_parameters_and_priors(changing_parameter, a) prior = sum(np.log(a.prior)) precalculation = time.time() backup = (a.end, a.time_steps, a.total_mass) (abundance_list, elements_to_trace) =...
def posterior_function_predictions(changing_parameter, a): '\n\t\n\t' start_time = time.time() a = extract_parameters_and_priors(changing_parameter, a) prior = sum(np.log(a.prior)) precalculation = time.time() backup = (a.end, a.time_steps, a.total_mass) (abundance_list, elements_to_trace) =...
32c37175e2309416e6164f7924cd0b4f2c6d901541d56a958e62092ac967cccf
def get_prior(changing_parameter, a): '\n\tThis function calculates the prior probability\n\n\tINPUT:\n\n\t changing_parameter = the values of the parameter vector\n\n\t a = the model parameters including the names of the parameters (which is needed to identify them with the prescribed priors in parameters.py)\...
This function calculates the prior probability INPUT: changing_parameter = the values of the parameter vector a = the model parameters including the names of the parameters (which is needed to identify them with the prescribed priors in parameters.py) OUTPUT: the log prior is returned
Chempy/cem_function.py
get_prior
jan-rybizki/Chempy
25
python
def get_prior(changing_parameter, a): '\n\tThis function calculates the prior probability\n\n\tINPUT:\n\n\t changing_parameter = the values of the parameter vector\n\n\t a = the model parameters including the names of the parameters (which is needed to identify them with the prescribed priors in parameters.py)\...
def get_prior(changing_parameter, a): '\n\tThis function calculates the prior probability\n\n\tINPUT:\n\n\t changing_parameter = the values of the parameter vector\n\n\t a = the model parameters including the names of the parameters (which is needed to identify them with the prescribed priors in parameters.py)\...
f12e022a9a0d8413be5d851d29547c23cd1f662e796e3f123b8b5748ea318f0f
def global_optimization(changing_parameter, result): '\n\tThis function is a buffer function if global_optimization_real fails and it only returns the negative posterior\n\t' try: (posterior, error_list, elements) = global_optimization_real(changing_parameter, result) return posterior except...
This function is a buffer function if global_optimization_real fails and it only returns the negative posterior
Chempy/cem_function.py
global_optimization
jan-rybizki/Chempy
25
python
def global_optimization(changing_parameter, result): '\n\t\n\t' try: (posterior, error_list, elements) = global_optimization_real(changing_parameter, result) return posterior except Exception as ex: import traceback traceback.print_exc() return np.inf
def global_optimization(changing_parameter, result): '\n\t\n\t' try: (posterior, error_list, elements) = global_optimization_real(changing_parameter, result) return posterior except Exception as ex: import traceback traceback.print_exc() return np.inf<|docstring|>This fun...
d11dfc95053d00c8bc366b3363134fea346a1f39f4d12107572a52916a3cc1d3
def global_optimization_error_returned(changing_parameter, result): '\n\tthis is a buffer function preventing failures from global_optimization_real and returning all its output including the best model error\n\t' try: (posterior, error_list, elements) = global_optimization_real(changing_parameter, resu...
this is a buffer function preventing failures from global_optimization_real and returning all its output including the best model error
Chempy/cem_function.py
global_optimization_error_returned
jan-rybizki/Chempy
25
python
def global_optimization_error_returned(changing_parameter, result): '\n\t\n\t' try: (posterior, error_list, elements) = global_optimization_real(changing_parameter, result) return ((- posterior), error_list, elements) except Exception as ex: import traceback traceback.print_e...
def global_optimization_error_returned(changing_parameter, result): '\n\t\n\t' try: (posterior, error_list, elements) = global_optimization_real(changing_parameter, result) return ((- posterior), error_list, elements) except Exception as ex: import traceback traceback.print_e...
c0f42cb0fbfb6554e5b7af889f8ce507db2eaec75df4b7542a9ff5824b68c957
def global_optimization_real(changing_parameter, result): '\n\tThis function calculates the predictions from several Chempy zones in parallel. It also calculates the likelihood for common model errors\n\tBEWARE: Model parameters are called as saved in parameters.py!!!\n\n\tINPUT:\n\n\t changing_parameter = the gl...
This function calculates the predictions from several Chempy zones in parallel. It also calculates the likelihood for common model errors BEWARE: Model parameters are called as saved in parameters.py!!! INPUT: changing_parameter = the global SSP parameters (parameters that all stars share) result = the complet...
Chempy/cem_function.py
global_optimization_real
jan-rybizki/Chempy
25
python
def global_optimization_real(changing_parameter, result): '\n\tThis function calculates the predictions from several Chempy zones in parallel. It also calculates the likelihood for common model errors\n\tBEWARE: Model parameters are called as saved in parameters.py!!!\n\n\tINPUT:\n\n\t changing_parameter = the gl...
def global_optimization_real(changing_parameter, result): '\n\tThis function calculates the predictions from several Chempy zones in parallel. It also calculates the likelihood for common model errors\n\tBEWARE: Model parameters are called as saved in parameters.py!!!\n\n\tINPUT:\n\n\t changing_parameter = the gl...
be961f875722eff274fdf83c75d919a5a93ae9a2396081917c7726066cb34839
def extract_parameters_and_priors(changing_parameter, a): '\n\tThis function extracts the parameters from changing parameters and writes them into the ModelParamaters (a), so that Chempy can evaluate the changed parameter settings\n\t' for (i, item) in enumerate(a.to_optimize): setattr(a, item, changing...
This function extracts the parameters from changing parameters and writes them into the ModelParamaters (a), so that Chempy can evaluate the changed parameter settings
Chempy/cem_function.py
extract_parameters_and_priors
jan-rybizki/Chempy
25
python
def extract_parameters_and_priors(changing_parameter, a): '\n\t\n\t' for (i, item) in enumerate(a.to_optimize): setattr(a, item, changing_parameter[i]) val = getattr(a, item) prior_names = [] prior = [] for name in a.to_optimize: (mean, std, functional_form) = a.priors.get(na...
def extract_parameters_and_priors(changing_parameter, a): '\n\t\n\t' for (i, item) in enumerate(a.to_optimize): setattr(a, item, changing_parameter[i]) val = getattr(a, item) prior_names = [] prior = [] for name in a.to_optimize: (mean, std, functional_form) = a.priors.get(na...
73677c9e7b092eedbcc32e6d69dcf5781687aefab21dc53ef1915afe284408f9
def posterior_function_local_for_minimization(changing_parameter, stellar_identifier, global_parameters, errors, elements): '\n\tcalls the local posterior function but just returns the negative log posterior instead of posterior and blobs\n\t' (posterior, blobs) = posterior_function_local(changing_parameter, st...
calls the local posterior function but just returns the negative log posterior instead of posterior and blobs
Chempy/cem_function.py
posterior_function_local_for_minimization
jan-rybizki/Chempy
25
python
def posterior_function_local_for_minimization(changing_parameter, stellar_identifier, global_parameters, errors, elements): '\n\t\n\t' (posterior, blobs) = posterior_function_local(changing_parameter, stellar_identifier, global_parameters, errors, elements) return (- posterior)
def posterior_function_local_for_minimization(changing_parameter, stellar_identifier, global_parameters, errors, elements): '\n\t\n\t' (posterior, blobs) = posterior_function_local(changing_parameter, stellar_identifier, global_parameters, errors, elements) return (- posterior)<|docstring|>calls the local p...
8eb16e036de8c01c1cbbc3e069b0b14938432177f8900f4ad9dba2db665a187a
def posterior_function_local(changing_parameter, stellar_identifier, global_parameters, errors, elements): "\n\tThe posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'.\n\tWildcards can be created ac...
The posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'. Wildcards can be created according to the tutorial 6 from the github page. A few wildcards are already stored in the input folder. Chempy will try...
Chempy/cem_function.py
posterior_function_local
jan-rybizki/Chempy
25
python
def posterior_function_local(changing_parameter, stellar_identifier, global_parameters, errors, elements): "\n\tThe posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'.\n\tWildcards can be created ac...
def posterior_function_local(changing_parameter, stellar_identifier, global_parameters, errors, elements): "\n\tThe posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'.\n\tWildcards can be created ac...
9e1502600590bf6939496d6d027f170553244ffd09a9f60f18af46b1cc713a53
def posterior_function_local_real(changing_parameter, stellar_identifier, global_parameters, errors, elements): '\n\tThis is the actual posterior function. But the functionality is explained in posterior_function.\n\t' from .parameter import ModelParameters a = ModelParameters() a.stellar_identifier = s...
This is the actual posterior function. But the functionality is explained in posterior_function.
Chempy/cem_function.py
posterior_function_local_real
jan-rybizki/Chempy
25
python
def posterior_function_local_real(changing_parameter, stellar_identifier, global_parameters, errors, elements): '\n\t\n\t' from .parameter import ModelParameters a = ModelParameters() a.stellar_identifier = stellar_identifier start_time = time.time() changing_parameter = np.hstack((global_parame...
def posterior_function_local_real(changing_parameter, stellar_identifier, global_parameters, errors, elements): '\n\t\n\t' from .parameter import ModelParameters a = ModelParameters() a.stellar_identifier = stellar_identifier start_time = time.time() changing_parameter = np.hstack((global_parame...
cc49756192aaf179532427e5b43eae886ecb14d517fda50f68c238cba653f875
def posterior_function_many_stars(changing_parameter, error_list, elements): "\n\tThe posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'.\n\tWildcards can be created according to the tutorial 6. A f...
The posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'. Wildcards can be created according to the tutorial 6. A few wildcards are already stored in the input folder. Chempy will try the current folder f...
Chempy/cem_function.py
posterior_function_many_stars
jan-rybizki/Chempy
25
python
def posterior_function_many_stars(changing_parameter, error_list, elements): "\n\tThe posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'.\n\tWildcards can be created according to the tutorial 6. A f...
def posterior_function_many_stars(changing_parameter, error_list, elements): "\n\tThe posterior function is the interface between the optimizing function and Chempy. Usually the likelihood will be calculated with respect to a so called 'stellar wildcard'.\n\tWildcards can be created according to the tutorial 6. A f...
a1ad9b290f0daceacf4ce7da0709be6823abf98dc3b88dd189d74a538e24a120
def posterior_function_many_stars_real(changing_parameter, error_list, error_element_list): '\n\tThis is the actual posterior function for many stars. But the functionality is explained in posterior_function_many_stars.\n\t' import numpy.ma as ma from .cem_function import get_prior, posterior_function_retur...
This is the actual posterior function for many stars. But the functionality is explained in posterior_function_many_stars.
Chempy/cem_function.py
posterior_function_many_stars_real
jan-rybizki/Chempy
25
python
def posterior_function_many_stars_real(changing_parameter, error_list, error_element_list): '\n\t\n\t' import numpy.ma as ma from .cem_function import get_prior, posterior_function_returning_predictions from .data_to_test import likelihood_evaluation, read_out_wildcard from .parameter import ModelPa...
def posterior_function_many_stars_real(changing_parameter, error_list, error_element_list): '\n\t\n\t' import numpy.ma as ma from .cem_function import get_prior, posterior_function_returning_predictions from .data_to_test import likelihood_evaluation, read_out_wildcard from .parameter import ModelPa...