body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def grangercausalitytests(x, maxlag, addconst=True, verbose=True): "four tests for granger non causality of 2 timeseries\n\n all four tests give similar results\n `params_ftest` and `ssr_ftest` are equivalent based on F test which is\n identical to lmtest:grangertest in R\n\n Parameters\n ----------\...
2,497,703,576,321,163,000
four tests for granger non causality of 2 timeseries all four tests give similar results `params_ftest` and `ssr_ftest` are equivalent based on F test which is identical to lmtest:grangertest in R Parameters ---------- x : array, 2d data for test whether the time series in the second column Granger causes the...
statsmodels/tsa/stattools.py
grangercausalitytests
josef-pkt/statsmodels
python
def grangercausalitytests(x, maxlag, addconst=True, verbose=True): "four tests for granger non causality of 2 timeseries\n\n all four tests give similar results\n `params_ftest` and `ssr_ftest` are equivalent based on F test which is\n identical to lmtest:grangertest in R\n\n Parameters\n ----------\...
def coint(y0, y1, trend='c', method='aeg', maxlag=None, autolag='aic', return_results=None): 'Test for no-cointegration of a univariate equation\n\n The null hypothesis is no cointegration. Variables in y0 and y1 are\n assumed to be integrated of order 1, I(1).\n\n This uses the augmented Engle-Granger two...
3,271,704,490,787,290,600
Test for no-cointegration of a univariate equation The null hypothesis is no cointegration. Variables in y0 and y1 are assumed to be integrated of order 1, I(1). This uses the augmented Engle-Granger two-step cointegration test. Constant or trend is included in 1st stage regression, i.e. in cointegrating equation. *...
statsmodels/tsa/stattools.py
coint
josef-pkt/statsmodels
python
def coint(y0, y1, trend='c', method='aeg', maxlag=None, autolag='aic', return_results=None): 'Test for no-cointegration of a univariate equation\n\n The null hypothesis is no cointegration. Variables in y0 and y1 are\n assumed to be integrated of order 1, I(1).\n\n This uses the augmented Engle-Granger two...
def arma_order_select_ic(y, max_ar=4, max_ma=2, ic='bic', trend='c', model_kw={}, fit_kw={}): "\n Returns information criteria for many ARMA models\n\n Parameters\n ----------\n y : array-like\n Time-series data\n max_ar : int\n Maximum number of AR lags to use. Default 4.\n max_ma :...
-3,637,179,301,659,311,600
Returns information criteria for many ARMA models Parameters ---------- y : array-like Time-series data max_ar : int Maximum number of AR lags to use. Default 4. max_ma : int Maximum number of MA lags to use. Default 2. ic : str, list Information criteria to report. Either a single string or a list ...
statsmodels/tsa/stattools.py
arma_order_select_ic
josef-pkt/statsmodels
python
def arma_order_select_ic(y, max_ar=4, max_ma=2, ic='bic', trend='c', model_kw={}, fit_kw={}): "\n Returns information criteria for many ARMA models\n\n Parameters\n ----------\n y : array-like\n Time-series data\n max_ar : int\n Maximum number of AR lags to use. Default 4.\n max_ma :...
def has_missing(data): "\n Returns True if 'data' contains missing entries, otherwise False\n " return np.isnan(np.sum(data))
-7,950,675,208,535,767,000
Returns True if 'data' contains missing entries, otherwise False
statsmodels/tsa/stattools.py
has_missing
josef-pkt/statsmodels
python
def has_missing(data): "\n \n " return np.isnan(np.sum(data))
def kpss(x, regression='c', lags=None, store=False): "\n Kwiatkowski-Phillips-Schmidt-Shin test for stationarity.\n\n Computes the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test for the null\n hypothesis that x is level or trend stationary.\n\n Parameters\n ----------\n x : array_like, 1d\n ...
-7,045,372,392,550,583,000
Kwiatkowski-Phillips-Schmidt-Shin test for stationarity. Computes the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test for the null hypothesis that x is level or trend stationary. Parameters ---------- x : array_like, 1d Data series regression : str{'c', 'ct'} Indicates the null hypothesis for the KPSS test ...
statsmodels/tsa/stattools.py
kpss
josef-pkt/statsmodels
python
def kpss(x, regression='c', lags=None, store=False): "\n Kwiatkowski-Phillips-Schmidt-Shin test for stationarity.\n\n Computes the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test for the null\n hypothesis that x is level or trend stationary.\n\n Parameters\n ----------\n x : array_like, 1d\n ...
def _sigma_est_kpss(resids, nobs, lags): '\n Computes equation 10, p. 164 of Kwiatkowski et al. (1992). This is the\n consistent estimator for the variance.\n ' s_hat = sum((resids ** 2)) for i in range(1, (lags + 1)): resids_prod = np.dot(resids[i:], resids[:(nobs - i)]) s_hat += (...
-4,347,780,852,716,475,400
Computes equation 10, p. 164 of Kwiatkowski et al. (1992). This is the consistent estimator for the variance.
statsmodels/tsa/stattools.py
_sigma_est_kpss
josef-pkt/statsmodels
python
def _sigma_est_kpss(resids, nobs, lags): '\n Computes equation 10, p. 164 of Kwiatkowski et al. (1992). This is the\n consistent estimator for the variance.\n ' s_hat = sum((resids ** 2)) for i in range(1, (lags + 1)): resids_prod = np.dot(resids[i:], resids[:(nobs - i)]) s_hat += (...
async def trigger_update(opp): 'Trigger a polling update by moving time forward.' new_time = (dt.utcnow() + timedelta(seconds=(SCAN_INTERVAL + 1))) async_fire_time_changed(opp, new_time) (await opp.async_block_till_done())
-1,536,932,550,561,218,800
Trigger a polling update by moving time forward.
tests/components/smarttub/__init__.py
trigger_update
OpenPeerPower/core
python
async def trigger_update(opp): new_time = (dt.utcnow() + timedelta(seconds=(SCAN_INTERVAL + 1))) async_fire_time_changed(opp, new_time) (await opp.async_block_till_done())
def __init__(self, dataclass_types: Union[(DataClassType, Iterable[DataClassType])], **kwargs): '\n Args:\n dataclass_types:\n Dataclass type, or list of dataclass types for which we will "fill" instances with the parsed args.\n kwargs:\n (Optional) Passed ...
5,540,399,526,315,942,000
Args: dataclass_types: Dataclass type, or list of dataclass types for which we will "fill" instances with the parsed args. kwargs: (Optional) Passed to `argparse.ArgumentParser()` in the regular way.
toolbox/KGArgsParser.py
__init__
LinXueyuanStdio/KGE-toolbox
python
def __init__(self, dataclass_types: Union[(DataClassType, Iterable[DataClassType])], **kwargs): '\n Args:\n dataclass_types:\n Dataclass type, or list of dataclass types for which we will "fill" instances with the parsed args.\n kwargs:\n (Optional) Passed ...
def parse_args_into_dataclasses(self, args=None, return_remaining_strings=False, look_for_args_file=True, args_filename=None) -> Tuple[(DataClass, ...)]: '\n Parse command-line args into instances of the specified dataclass types.\n\n This relies on argparse\'s `ArgumentParser.parse_known_args`. See t...
7,657,435,898,646,354,000
Parse command-line args into instances of the specified dataclass types. This relies on argparse's `ArgumentParser.parse_known_args`. See the doc at: docs.python.org/3.7/library/argparse.html#argparse.ArgumentParser.parse_args Args: args: List of strings to parse. The default is taken from sys.argv. (same...
toolbox/KGArgsParser.py
parse_args_into_dataclasses
LinXueyuanStdio/KGE-toolbox
python
def parse_args_into_dataclasses(self, args=None, return_remaining_strings=False, look_for_args_file=True, args_filename=None) -> Tuple[(DataClass, ...)]: '\n Parse command-line args into instances of the specified dataclass types.\n\n This relies on argparse\'s `ArgumentParser.parse_known_args`. See t...
def parse_json_file(self, json_file: str) -> Tuple[(DataClass, ...)]: '\n Alternative helper method that does not use `argparse` at all, instead loading a json file and populating the\n dataclass types.\n ' data = json.loads(Path(json_file).read_text()) outputs = [] for dtype in sel...
-4,033,736,629,704,605,700
Alternative helper method that does not use `argparse` at all, instead loading a json file and populating the dataclass types.
toolbox/KGArgsParser.py
parse_json_file
LinXueyuanStdio/KGE-toolbox
python
def parse_json_file(self, json_file: str) -> Tuple[(DataClass, ...)]: '\n Alternative helper method that does not use `argparse` at all, instead loading a json file and populating the\n dataclass types.\n ' data = json.loads(Path(json_file).read_text()) outputs = [] for dtype in sel...
def parse_dict(self, args: dict) -> Tuple[(DataClass, ...)]: '\n Alternative helper method that does not use `argparse` at all, instead uses a dict and populating the dataclass\n types.\n ' outputs = [] for dtype in self.dataclass_types: keys = {f.name for f in dataclasses.field...
3,798,765,331,785,445,000
Alternative helper method that does not use `argparse` at all, instead uses a dict and populating the dataclass types.
toolbox/KGArgsParser.py
parse_dict
LinXueyuanStdio/KGE-toolbox
python
def parse_dict(self, args: dict) -> Tuple[(DataClass, ...)]: '\n Alternative helper method that does not use `argparse` at all, instead uses a dict and populating the dataclass\n types.\n ' outputs = [] for dtype in self.dataclass_types: keys = {f.name for f in dataclasses.field...
def __init__(self, pkg_dict: Dict[(str, Any)]): '\n Class containing data that describes a package API\n\n :param pkg_dict: A dictionary representation of a\n software package, complying with the output format of\n doppel-describe.\n\n ' self._validate_pkg(pkg_dict) ...
-6,044,739,435,903,076,000
Class containing data that describes a package API :param pkg_dict: A dictionary representation of a software package, complying with the output format of doppel-describe.
doppel/PackageAPI.py
__init__
franklinen/doppel-cli
python
def __init__(self, pkg_dict: Dict[(str, Any)]): '\n Class containing data that describes a package API\n\n :param pkg_dict: A dictionary representation of a\n software package, complying with the output format of\n doppel-describe.\n\n ' self._validate_pkg(pkg_dict) ...
@classmethod def from_json(cls, filename: str) -> 'PackageAPI': "\n Instantiate a Package object from a file.\n\n :param filename: Name of the JSON file\n that contains the description of the\n target package's API.\n\n " _log_info(f'Creating package from {filename}') ...
-6,133,293,852,267,853,000
Instantiate a Package object from a file. :param filename: Name of the JSON file that contains the description of the target package's API.
doppel/PackageAPI.py
from_json
franklinen/doppel-cli
python
@classmethod def from_json(cls, filename: str) -> 'PackageAPI': "\n Instantiate a Package object from a file.\n\n :param filename: Name of the JSON file\n that contains the description of the\n target package's API.\n\n " _log_info(f'Creating package from {filename}') ...
def name(self) -> str: '\n Get the name of the package.\n ' return self.pkg_dict['name']
-4,031,569,820,273,227,000
Get the name of the package.
doppel/PackageAPI.py
name
franklinen/doppel-cli
python
def name(self) -> str: '\n \n ' return self.pkg_dict['name']
def num_functions(self) -> int: '\n Get the number of exported functions in the package.\n ' return len(self.function_names())
358,728,798,804,206,400
Get the number of exported functions in the package.
doppel/PackageAPI.py
num_functions
franklinen/doppel-cli
python
def num_functions(self) -> int: '\n \n ' return len(self.function_names())
def function_names(self) -> List[str]: '\n Get a list with the names of all exported functions\n in the package.\n ' return sorted(list(self.pkg_dict['functions'].keys()))
3,015,912,207,251,559,000
Get a list with the names of all exported functions in the package.
doppel/PackageAPI.py
function_names
franklinen/doppel-cli
python
def function_names(self) -> List[str]: '\n Get a list with the names of all exported functions\n in the package.\n ' return sorted(list(self.pkg_dict['functions'].keys()))
def functions_with_args(self) -> Dict[(str, Dict[(str, Any)])]: '\n Get a dictionary with all exported functions in the package\n and some details describing them.\n ' return self.pkg_dict['functions']
-5,598,182,101,801,267,000
Get a dictionary with all exported functions in the package and some details describing them.
doppel/PackageAPI.py
functions_with_args
franklinen/doppel-cli
python
def functions_with_args(self) -> Dict[(str, Dict[(str, Any)])]: '\n Get a dictionary with all exported functions in the package\n and some details describing them.\n ' return self.pkg_dict['functions']
def num_classes(self) -> int: '\n Get the number of exported classes in the package.\n ' return len(self.class_names())
-5,579,227,444,031,814,000
Get the number of exported classes in the package.
doppel/PackageAPI.py
num_classes
franklinen/doppel-cli
python
def num_classes(self) -> int: '\n \n ' return len(self.class_names())
def class_names(self) -> List[str]: '\n Get a list with the names of all exported classes\n in the package.\n ' return sorted(list(self.pkg_dict['classes'].keys()))
-6,672,906,188,787,706,000
Get a list with the names of all exported classes in the package.
doppel/PackageAPI.py
class_names
franklinen/doppel-cli
python
def class_names(self) -> List[str]: '\n Get a list with the names of all exported classes\n in the package.\n ' return sorted(list(self.pkg_dict['classes'].keys()))
def public_methods(self, class_name: str) -> List[str]: '\n Get a list with the names of all public methods for a class.\n\n :param class_name: Name of a class in the package\n ' return sorted(list(self.pkg_dict['classes'][class_name]['public_methods'].keys()))
1,912,717,380,565,422,000
Get a list with the names of all public methods for a class. :param class_name: Name of a class in the package
doppel/PackageAPI.py
public_methods
franklinen/doppel-cli
python
def public_methods(self, class_name: str) -> List[str]: '\n Get a list with the names of all public methods for a class.\n\n :param class_name: Name of a class in the package\n ' return sorted(list(self.pkg_dict['classes'][class_name]['public_methods'].keys()))
def public_method_args(self, class_name: str, method_name: str) -> List[str]: '\n Get a list of arguments for a public method from a class.\n\n :param class_name: Name of a class in the package\n :param method-name: Name of the method to get arguments for\n ' return list(self.pkg_dic...
8,502,998,262,803,455,000
Get a list of arguments for a public method from a class. :param class_name: Name of a class in the package :param method-name: Name of the method to get arguments for
doppel/PackageAPI.py
public_method_args
franklinen/doppel-cli
python
def public_method_args(self, class_name: str, method_name: str) -> List[str]: '\n Get a list of arguments for a public method from a class.\n\n :param class_name: Name of a class in the package\n :param method-name: Name of the method to get arguments for\n ' return list(self.pkg_dic...
@staticmethod def get_placeholder(page, slot=None): '\n Returns the named placeholder or, if no «slot» provided, the first\n editable, non-static placeholder or None.\n ' placeholders = page.get_placeholders() if slot: placeholders = placeholders.filter(slot=slot) for ph in ...
1,405,203,255,283,725,800
Returns the named placeholder or, if no «slot» provided, the first editable, non-static placeholder or None.
cms/forms/wizards.py
get_placeholder
rspeed/django-cms-contrib
python
@staticmethod def get_placeholder(page, slot=None): '\n Returns the named placeholder or, if no «slot» provided, the first\n editable, non-static placeholder or None.\n ' placeholders = page.get_placeholders() if slot: placeholders = placeholders.filter(slot=slot) for ph in ...
def clean(self): '\n Validates that either the slug is provided, or that slugification from\n `title` produces a valid slug.\n :return:\n ' cleaned_data = super(CreateCMSPageForm, self).clean() slug = cleaned_data.get('slug') sub_page = cleaned_data.get('sub_page') title ...
13,318,186,756,332,642
Validates that either the slug is provided, or that slugification from `title` produces a valid slug. :return:
cms/forms/wizards.py
clean
rspeed/django-cms-contrib
python
def clean(self): '\n Validates that either the slug is provided, or that slugification from\n `title` produces a valid slug.\n :return:\n ' cleaned_data = super(CreateCMSPageForm, self).clean() slug = cleaned_data.get('slug') sub_page = cleaned_data.get('sub_page') title ...
def __init__(self, application, hostname, key): "\n\t\t:param application: The application to associate this popup dialog with.\n\t\t:type application: :py:class:`.KingPhisherClientApplication`\n\t\t:param str hostname: The hostname associated with the key.\n\t\t:param key: The host's SSH key.\n\t\t:type key: :py:c...
-28,344,514,441,261,160
:param application: The application to associate this popup dialog with. :type application: :py:class:`.KingPhisherClientApplication` :param str hostname: The hostname associated with the key. :param key: The host's SSH key. :type key: :py:class:`paramiko.pkey.PKey`
king_phisher/client/dialogs/ssh_host_key.py
__init__
tanc7/king-phisher
python
def __init__(self, application, hostname, key): "\n\t\t:param application: The application to associate this popup dialog with.\n\t\t:type application: :py:class:`.KingPhisherClientApplication`\n\t\t:param str hostname: The hostname associated with the key.\n\t\t:param key: The host's SSH key.\n\t\t:type key: :py:c...
def __init__(self, application): '\n\t\t:param application: The application which is using this policy.\n\t\t:type application: :py:class:`.KingPhisherClientApplication`\n\t\t' self.application = application self.logger = logging.getLogger(('KingPhisher.Client.' + self.__class__.__name__)) super(Missing...
-4,761,189,396,857,635,000
:param application: The application which is using this policy. :type application: :py:class:`.KingPhisherClientApplication`
king_phisher/client/dialogs/ssh_host_key.py
__init__
tanc7/king-phisher
python
def __init__(self, application): '\n\t\t:param application: The application which is using this policy.\n\t\t:type application: :py:class:`.KingPhisherClientApplication`\n\t\t' self.application = application self.logger = logging.getLogger(('KingPhisher.Client.' + self.__class__.__name__)) super(Missing...
def generate_bubblesort(prefix, num_examples, debug=False, maximum=10000000000, debug_every=1000): "\n Generates addition data with the given string prefix (i.e. 'train', 'test') and the specified\n number of examples.\n\n :param prefix: String prefix for saving the file ('train', 'test')\n :param num_e...
-4,308,264,678,087,419,000
Generates addition data with the given string prefix (i.e. 'train', 'test') and the specified number of examples. :param prefix: String prefix for saving the file ('train', 'test') :param num_examples: Number of examples to generate.
tasks/bubblesort/env/generate_data.py
generate_bubblesort
ford-core-ai/neural-programming-architectures
python
def generate_bubblesort(prefix, num_examples, debug=False, maximum=10000000000, debug_every=1000): "\n Generates addition data with the given string prefix (i.e. 'train', 'test') and the specified\n number of examples.\n\n :param prefix: String prefix for saving the file ('train', 'test')\n :param num_e...
def check(): ' check that all paths are properly defined' checked = True print(f' - history tar files will be mounted on: {dirmounted_root}') print(f' - ratarmount executable is in : {ratarmount}')
7,019,680,802,621,906,000
check that all paths are properly defined
paragridded/giga_tools.py
check
Mesharou/paragridded
python
def check(): ' ' checked = True print(f' - history tar files will be mounted on: {dirmounted_root}') print(f' - ratarmount executable is in : {ratarmount}')
def get_subdmap(directory): 'Reconstruct how netCDF files are stored in fused directory\n\n directory == dirgrid | dirhis ' _subdmap = {} for subd in subdomains: fs = glob.glob((directory.format(subd=subd) + '/*.nc')) tiles = [int(f.split('.')[(- 2)]) for f in fs] for t in tiles: ...
5,205,752,084,815,372,000
Reconstruct how netCDF files are stored in fused directory directory == dirgrid | dirhis
paragridded/giga_tools.py
get_subdmap
Mesharou/paragridded
python
def get_subdmap(directory): 'Reconstruct how netCDF files are stored in fused directory\n\n directory == dirgrid | dirhis ' _subdmap = {} for subd in subdomains: fs = glob.glob((directory.format(subd=subd) + '/*.nc')) tiles = [int(f.split('.')[(- 2)]) for f in fs] for t in tiles: ...
def mount_tar(source, tarfile, destdir): '\n source: str, directory of the tar files\n template: str, template name for the tar file containing "{subd"\n subd: int, index of the subdomain (0<=subd<=13)\n destdir: str, directory where to archivemount\n\n ' srcfile = f'{source}/{tarfile}' asser...
4,785,231,440,578,954,000
source: str, directory of the tar files template: str, template name for the tar file containing "{subd" subd: int, index of the subdomain (0<=subd<=13) destdir: str, directory where to archivemount
paragridded/giga_tools.py
mount_tar
Mesharou/paragridded
python
def mount_tar(source, tarfile, destdir): '\n source: str, directory of the tar files\n template: str, template name for the tar file containing "{subd"\n subd: int, index of the subdomain (0<=subd<=13)\n destdir: str, directory where to archivemount\n\n ' srcfile = f'{source}/{tarfile}' asser...
def mount(subd, grid=False, overwrite=True): 'Mount tar file `subd`' if grid: destdir = dirgrid.format(subd=subd) srcdir = dirgridtar.format(subd=subd) tarfile = targridtemplate.format(subd=subd) else: destdir = dirhis.format(subd=subd) srcdir = dirgigaref.format(subd...
-7,433,501,504,231,536,000
Mount tar file `subd`
paragridded/giga_tools.py
mount
Mesharou/paragridded
python
def mount(subd, grid=False, overwrite=True): if grid: destdir = dirgrid.format(subd=subd) srcdir = dirgridtar.format(subd=subd) tarfile = targridtemplate.format(subd=subd) else: destdir = dirhis.format(subd=subd) srcdir = dirgigaref.format(subd=subd) tarfile ...
def mount_stats(grid=False): ' Print statistics on mounted tar files' print(('-' * 40)) print(BB('statistics on mounted tar files')) print(f'mounting point: {dirmounted}') for subd in subdomains: if grid: destdir = dirgrid.format(subd=subd) else: destdir = dir...
8,784,130,287,067,626,000
Print statistics on mounted tar files
paragridded/giga_tools.py
mount_stats
Mesharou/paragridded
python
def mount_stats(grid=False): ' ' print(('-' * 40)) print(BB('statistics on mounted tar files')) print(f'mounting point: {dirmounted}') for subd in subdomains: if grid: destdir = dirgrid.format(subd=subd) else: destdir = dirhis.format(subd=subd) if os.p...
def umount(subd, grid=False): ' Unmount `subd` tar archive folder\n\n The command to unmount a fuse folder is fusermount -u' if grid: destdir = dirgrid.format(subd=subd) else: destdir = dirhis.format(subd=subd) if (os.path.isdir(destdir) and (len(os.listdir(f'{destdir}')) != 0)): ...
-2,445,494,873,886,492,700
Unmount `subd` tar archive folder The command to unmount a fuse folder is fusermount -u
paragridded/giga_tools.py
umount
Mesharou/paragridded
python
def umount(subd, grid=False): ' Unmount `subd` tar archive folder\n\n The command to unmount a fuse folder is fusermount -u' if grid: destdir = dirgrid.format(subd=subd) else: destdir = dirhis.format(subd=subd) if (os.path.isdir(destdir) and (len(os.listdir(f'{destdir}')) != 0)): ...
def LLTP2domain(lowerleft, topright): 'Convert the two pairs of (lower, left), (top, right) in (lat, lon)\n into the four pairs of (lat, lon) of the corners ' (xa, ya) = lowerleft (xb, yb) = topright domain = [(xa, ya), (xa, yb), (xb, yb), (xb, ya)] return domain
-7,237,054,415,005,802,000
Convert the two pairs of (lower, left), (top, right) in (lat, lon) into the four pairs of (lat, lon) of the corners
paragridded/giga_tools.py
LLTP2domain
Mesharou/paragridded
python
def LLTP2domain(lowerleft, topright): 'Convert the two pairs of (lower, left), (top, right) in (lat, lon)\n into the four pairs of (lat, lon) of the corners ' (xa, ya) = lowerleft (xb, yb) = topright domain = [(xa, ya), (xa, yb), (xb, yb), (xb, ya)] return domain
def find_tiles_inside(domain, corners): 'Determine which tiles are inside `domain`\n\n The function uses `corners` the list of corners for each tile\n ' p = Polygon(domain) tileslist = [] for (tile, c) in corners.items(): q = Polygon(c) if (p.overlaps(q) or p.contains(q)): ...
-2,155,202,173,137,227,300
Determine which tiles are inside `domain` The function uses `corners` the list of corners for each tile
paragridded/giga_tools.py
find_tiles_inside
Mesharou/paragridded
python
def find_tiles_inside(domain, corners): 'Determine which tiles are inside `domain`\n\n The function uses `corners` the list of corners for each tile\n ' p = Polygon(domain) tileslist = [] for (tile, c) in corners.items(): q = Polygon(c) if (p.overlaps(q) or p.contains(q)): ...
def get_dates(): '\n Scan dirgiga for *tar files\n ' subd = 1 pattern = f'{dirgigaref}/*.{subd:02}.tar'.format(subd=subd) files = glob.glob(pattern) _dates_tar = [f.split('/')[(- 1)].split('.')[(- 3)] for f in files] return sorted(_dates_tar)
2,012,071,602,746,254,300
Scan dirgiga for *tar files
paragridded/giga_tools.py
get_dates
Mesharou/paragridded
python
def get_dates(): '\n \n ' subd = 1 pattern = f'{dirgigaref}/*.{subd:02}.tar'.format(subd=subd) files = glob.glob(pattern) _dates_tar = [f.split('/')[(- 1)].split('.')[(- 3)] for f in files] return sorted(_dates_tar)
def set_default_time_zone(time_zone: dt.tzinfo) -> None: 'Set a default time zone to be used when none is specified.\n\n Async friendly.\n ' global DEFAULT_TIME_ZONE assert isinstance(time_zone, dt.tzinfo) DEFAULT_TIME_ZONE = time_zone
8,305,351,147,355,129,000
Set a default time zone to be used when none is specified. Async friendly.
homeassistant/util/dt.py
set_default_time_zone
854562/home-assistant
python
def set_default_time_zone(time_zone: dt.tzinfo) -> None: 'Set a default time zone to be used when none is specified.\n\n Async friendly.\n ' global DEFAULT_TIME_ZONE assert isinstance(time_zone, dt.tzinfo) DEFAULT_TIME_ZONE = time_zone
def get_time_zone(time_zone_str: str) -> Optional[dt.tzinfo]: 'Get time zone from string. Return None if unable to determine.\n\n Async friendly.\n ' try: return pytz.timezone(time_zone_str) except pytzexceptions.UnknownTimeZoneError: return None
808,354,402,533,898,000
Get time zone from string. Return None if unable to determine. Async friendly.
homeassistant/util/dt.py
get_time_zone
854562/home-assistant
python
def get_time_zone(time_zone_str: str) -> Optional[dt.tzinfo]: 'Get time zone from string. Return None if unable to determine.\n\n Async friendly.\n ' try: return pytz.timezone(time_zone_str) except pytzexceptions.UnknownTimeZoneError: return None
def utcnow() -> dt.datetime: 'Get now in UTC time.' return dt.datetime.now(UTC)
-7,757,326,031,541,859,000
Get now in UTC time.
homeassistant/util/dt.py
utcnow
854562/home-assistant
python
def utcnow() -> dt.datetime: return dt.datetime.now(UTC)
def now(time_zone: Optional[dt.tzinfo]=None) -> dt.datetime: 'Get now in specified time zone.' return dt.datetime.now((time_zone or DEFAULT_TIME_ZONE))
-7,334,469,809,376,690,000
Get now in specified time zone.
homeassistant/util/dt.py
now
854562/home-assistant
python
def now(time_zone: Optional[dt.tzinfo]=None) -> dt.datetime: return dt.datetime.now((time_zone or DEFAULT_TIME_ZONE))
def as_utc(dattim: dt.datetime) -> dt.datetime: 'Return a datetime as UTC time.\n\n Assumes datetime without tzinfo to be in the DEFAULT_TIME_ZONE.\n ' if (dattim.tzinfo == UTC): return dattim if (dattim.tzinfo is None): dattim = DEFAULT_TIME_ZONE.localize(dattim) return dattim.ast...
-256,635,588,040,750,370
Return a datetime as UTC time. Assumes datetime without tzinfo to be in the DEFAULT_TIME_ZONE.
homeassistant/util/dt.py
as_utc
854562/home-assistant
python
def as_utc(dattim: dt.datetime) -> dt.datetime: 'Return a datetime as UTC time.\n\n Assumes datetime without tzinfo to be in the DEFAULT_TIME_ZONE.\n ' if (dattim.tzinfo == UTC): return dattim if (dattim.tzinfo is None): dattim = DEFAULT_TIME_ZONE.localize(dattim) return dattim.ast...
def as_timestamp(dt_value: dt.datetime) -> float: 'Convert a date/time into a unix time (seconds since 1970).' if hasattr(dt_value, 'timestamp'): parsed_dt: Optional[dt.datetime] = dt_value else: parsed_dt = parse_datetime(str(dt_value)) if (parsed_dt is None): raise ValueError('...
7,903,070,737,980,607,000
Convert a date/time into a unix time (seconds since 1970).
homeassistant/util/dt.py
as_timestamp
854562/home-assistant
python
def as_timestamp(dt_value: dt.datetime) -> float: if hasattr(dt_value, 'timestamp'): parsed_dt: Optional[dt.datetime] = dt_value else: parsed_dt = parse_datetime(str(dt_value)) if (parsed_dt is None): raise ValueError('not a valid date/time.') return parsed_dt.timestamp()
def as_local(dattim: dt.datetime) -> dt.datetime: 'Convert a UTC datetime object to local time zone.' if (dattim.tzinfo == DEFAULT_TIME_ZONE): return dattim if (dattim.tzinfo is None): dattim = UTC.localize(dattim) return dattim.astimezone(DEFAULT_TIME_ZONE)
2,996,560,705,096,557,600
Convert a UTC datetime object to local time zone.
homeassistant/util/dt.py
as_local
854562/home-assistant
python
def as_local(dattim: dt.datetime) -> dt.datetime: if (dattim.tzinfo == DEFAULT_TIME_ZONE): return dattim if (dattim.tzinfo is None): dattim = UTC.localize(dattim) return dattim.astimezone(DEFAULT_TIME_ZONE)
def utc_from_timestamp(timestamp: float) -> dt.datetime: 'Return a UTC time from a timestamp.' return UTC.localize(dt.datetime.utcfromtimestamp(timestamp))
-6,724,019,066,667,065,000
Return a UTC time from a timestamp.
homeassistant/util/dt.py
utc_from_timestamp
854562/home-assistant
python
def utc_from_timestamp(timestamp: float) -> dt.datetime: return UTC.localize(dt.datetime.utcfromtimestamp(timestamp))
def start_of_local_day(dt_or_d: Union[(dt.date, dt.datetime, None)]=None) -> dt.datetime: 'Return local datetime object of start of day from date or datetime.' if (dt_or_d is None): date: dt.date = now().date() elif isinstance(dt_or_d, dt.datetime): date = dt_or_d.date() return DEFAULT_T...
-5,787,161,904,655,488,000
Return local datetime object of start of day from date or datetime.
homeassistant/util/dt.py
start_of_local_day
854562/home-assistant
python
def start_of_local_day(dt_or_d: Union[(dt.date, dt.datetime, None)]=None) -> dt.datetime: if (dt_or_d is None): date: dt.date = now().date() elif isinstance(dt_or_d, dt.datetime): date = dt_or_d.date() return DEFAULT_TIME_ZONE.localize(dt.datetime.combine(date, dt.time()))
def parse_datetime(dt_str: str) -> Optional[dt.datetime]: "Parse a string and return a datetime.datetime.\n\n This function supports time zone offsets. When the input contains one,\n the output uses a timezone with a fixed offset from UTC.\n Raises ValueError if the input is well formatted but not a valid ...
-1,937,966,146,818,874,600
Parse a string and return a datetime.datetime. This function supports time zone offsets. When the input contains one, the output uses a timezone with a fixed offset from UTC. Raises ValueError if the input is well formatted but not a valid datetime. Returns None if the input isn't well formatted.
homeassistant/util/dt.py
parse_datetime
854562/home-assistant
python
def parse_datetime(dt_str: str) -> Optional[dt.datetime]: "Parse a string and return a datetime.datetime.\n\n This function supports time zone offsets. When the input contains one,\n the output uses a timezone with a fixed offset from UTC.\n Raises ValueError if the input is well formatted but not a valid ...
def parse_date(dt_str: str) -> Optional[dt.date]: 'Convert a date string to a date object.' try: return dt.datetime.strptime(dt_str, DATE_STR_FORMAT).date() except ValueError: return None
-1,140,153,710,754,188,500
Convert a date string to a date object.
homeassistant/util/dt.py
parse_date
854562/home-assistant
python
def parse_date(dt_str: str) -> Optional[dt.date]: try: return dt.datetime.strptime(dt_str, DATE_STR_FORMAT).date() except ValueError: return None
def parse_time(time_str: str) -> Optional[dt.time]: 'Parse a time string (00:20:00) into Time object.\n\n Return None if invalid.\n ' parts = str(time_str).split(':') if (len(parts) < 2): return None try: hour = int(parts[0]) minute = int(parts[1]) second = (int(par...
4,760,396,034,145,555,000
Parse a time string (00:20:00) into Time object. Return None if invalid.
homeassistant/util/dt.py
parse_time
854562/home-assistant
python
def parse_time(time_str: str) -> Optional[dt.time]: 'Parse a time string (00:20:00) into Time object.\n\n Return None if invalid.\n ' parts = str(time_str).split(':') if (len(parts) < 2): return None try: hour = int(parts[0]) minute = int(parts[1]) second = (int(par...
def get_age(date: dt.datetime) -> str: '\n Take a datetime and return its "age" as a string.\n\n The age can be in second, minute, hour, day, month or year. Only the\n biggest unit is considered, e.g. if it\'s 2 days and 3 hours, "2 days" will\n be returned.\n Make sure date is not in the future, or ...
-8,345,418,009,683,860,000
Take a datetime and return its "age" as a string. The age can be in second, minute, hour, day, month or year. Only the biggest unit is considered, e.g. if it's 2 days and 3 hours, "2 days" will be returned. Make sure date is not in the future, or else it won't work.
homeassistant/util/dt.py
get_age
854562/home-assistant
python
def get_age(date: dt.datetime) -> str: '\n Take a datetime and return its "age" as a string.\n\n The age can be in second, minute, hour, day, month or year. Only the\n biggest unit is considered, e.g. if it\'s 2 days and 3 hours, "2 days" will\n be returned.\n Make sure date is not in the future, or ...
def parse_time_expression(parameter: Any, min_value: int, max_value: int) -> List[int]: 'Parse the time expression part and return a list of times to match.' if ((parameter is None) or (parameter == MATCH_ALL)): res = list(range(min_value, (max_value + 1))) elif (isinstance(parameter, str) and param...
8,850,174,465,410,132,000
Parse the time expression part and return a list of times to match.
homeassistant/util/dt.py
parse_time_expression
854562/home-assistant
python
def parse_time_expression(parameter: Any, min_value: int, max_value: int) -> List[int]: if ((parameter is None) or (parameter == MATCH_ALL)): res = list(range(min_value, (max_value + 1))) elif (isinstance(parameter, str) and parameter.startswith('/')): parameter = int(parameter[1:]) ...
def find_next_time_expression_time(now: dt.datetime, seconds: List[int], minutes: List[int], hours: List[int]) -> dt.datetime: 'Find the next datetime from now for which the time expression matches.\n\n The algorithm looks at each time unit separately and tries to find the\n next one that matches for each. If...
-6,388,431,229,437,913,000
Find the next datetime from now for which the time expression matches. The algorithm looks at each time unit separately and tries to find the next one that matches for each. If any of them would roll over, all time units below that are reset to the first matching value. Timezones are also handled (the tzinfo of the n...
homeassistant/util/dt.py
find_next_time_expression_time
854562/home-assistant
python
def find_next_time_expression_time(now: dt.datetime, seconds: List[int], minutes: List[int], hours: List[int]) -> dt.datetime: 'Find the next datetime from now for which the time expression matches.\n\n The algorithm looks at each time unit separately and tries to find the\n next one that matches for each. If...
def formatn(number: int, unit: str) -> str: 'Add "unit" if it\'s plural.' if (number == 1): return f'1 {unit}' return f'{number:d} {unit}s'
6,630,770,749,241,600,000
Add "unit" if it's plural.
homeassistant/util/dt.py
formatn
854562/home-assistant
python
def formatn(number: int, unit: str) -> str: 'Add "unit" if it\'s plural.' if (number == 1): return f'1 {unit}' return f'{number:d} {unit}s'
def q_n_r(first: int, second: int) -> Tuple[(int, int)]: 'Return quotient and remaining.' return ((first // second), (first % second))
-3,372,020,599,350,087,700
Return quotient and remaining.
homeassistant/util/dt.py
q_n_r
854562/home-assistant
python
def q_n_r(first: int, second: int) -> Tuple[(int, int)]: return ((first // second), (first % second))
def _lower_bound(arr: List[int], cmp: int) -> Optional[int]: 'Return the first value in arr greater or equal to cmp.\n\n Return None if no such value exists.\n ' left = 0 right = len(arr) while (left < right): mid = ((left + right) // 2) if (arr[mid] < cmp): lef...
-4,479,979,004,816,162,300
Return the first value in arr greater or equal to cmp. Return None if no such value exists.
homeassistant/util/dt.py
_lower_bound
854562/home-assistant
python
def _lower_bound(arr: List[int], cmp: int) -> Optional[int]: 'Return the first value in arr greater or equal to cmp.\n\n Return None if no such value exists.\n ' left = 0 right = len(arr) while (left < right): mid = ((left + right) // 2) if (arr[mid] < cmp): lef...
def __init__(self, location: str=dataset_dir('MSLR10K'), split: str='train', fold: int=1, normalize: bool=True, filter_queries: Optional[bool]=None, download: bool=True, validate_checksums: bool=True): '\n Args:\n location: Directory where the dataset is located.\n split: The data split...
7,654,225,927,789,626,000
Args: location: Directory where the dataset is located. split: The data split to load ("train", "test" or "vali") fold: Which data fold to load (1...5) normalize: Whether to perform query-level feature normalization. filter_queries: Whether to filter out queries that have no relevant...
pytorchltr/datasets/svmrank/mslr10k.py
__init__
SuperXiang/pytorchltr
python
def __init__(self, location: str=dataset_dir('MSLR10K'), split: str='train', fold: int=1, normalize: bool=True, filter_queries: Optional[bool]=None, download: bool=True, validate_checksums: bool=True): '\n Args:\n location: Directory where the dataset is located.\n split: The data split...
def tokenizeInput(self, token): "\n Cleans and tokenizes the user's input.\n\n empty characters and spaces are trimmed to prevent\n matching all paths in the index.\n " return list(filter(None, re.split(self.options.input_tokenizer, self.clean(token))))
5,647,962,165,047,563,000
Cleans and tokenizes the user's input. empty characters and spaces are trimmed to prevent matching all paths in the index.
gooey/gui/components/filtering/prefix_filter.py
tokenizeInput
QuantumSpatialInc/Gooey
python
def tokenizeInput(self, token): "\n Cleans and tokenizes the user's input.\n\n empty characters and spaces are trimmed to prevent\n matching all paths in the index.\n " return list(filter(None, re.split(self.options.input_tokenizer, self.clean(token))))
def tokenizeChoice(self, choice): "\n Splits the `choice` into a series of tokens based on\n the user's criteria.\n\n If suffix indexing is enabled, the individual tokens\n are further broken down and indexed by their suffix offsets. e.g.\n\n 'Banana', 'anana', 'nana', 'ana'\n...
7,454,731,504,844,039,000
Splits the `choice` into a series of tokens based on the user's criteria. If suffix indexing is enabled, the individual tokens are further broken down and indexed by their suffix offsets. e.g. 'Banana', 'anana', 'nana', 'ana'
gooey/gui/components/filtering/prefix_filter.py
tokenizeChoice
QuantumSpatialInc/Gooey
python
def tokenizeChoice(self, choice): "\n Splits the `choice` into a series of tokens based on\n the user's criteria.\n\n If suffix indexing is enabled, the individual tokens\n are further broken down and indexed by their suffix offsets. e.g.\n\n 'Banana', 'anana', 'nana', 'ana'\n...
def decov(h, reduce='half_squared_sum'): "Computes the DeCov loss of ``h``\n\n The output is a variable whose value depends on the value of\n the option ``reduce``. If it is ``'no'``, it holds a matrix\n whose size is same as the number of columns of ``y``.\n If it is ``'half_squared_sum'``, it holds th...
6,244,738,837,472,731,000
Computes the DeCov loss of ``h`` The output is a variable whose value depends on the value of the option ``reduce``. If it is ``'no'``, it holds a matrix whose size is same as the number of columns of ``y``. If it is ``'half_squared_sum'``, it holds the half of the squared Frobenius norm (i.e. squared of the L2 norm o...
chainer/functions/loss/decov.py
decov
Anyz01/chainer
python
def decov(h, reduce='half_squared_sum'): "Computes the DeCov loss of ``h``\n\n The output is a variable whose value depends on the value of\n the option ``reduce``. If it is ``'no'``, it holds a matrix\n whose size is same as the number of columns of ``y``.\n If it is ``'half_squared_sum'``, it holds th...
def _findFirstTraceInsideTensorFlowPyLibrary(self, op): 'Find the first trace of an op that belongs to the TF Python library.' for trace in op.traceback: if source_utils.guess_is_tensorflow_py_library(trace.filename): return trace
-7,241,050,063,364,547,000
Find the first trace of an op that belongs to the TF Python library.
tensorflow/python/debug/lib/source_remote_test.py
_findFirstTraceInsideTensorFlowPyLibrary
05259/tensorflow
python
def _findFirstTraceInsideTensorFlowPyLibrary(self, op): for trace in op.traceback: if source_utils.guess_is_tensorflow_py_library(trace.filename): return trace
def testGRPCServerMessageSizeLimit(self): 'Assert gRPC debug server is started with unlimited message size.' with test.mock.patch.object(grpc, 'server', wraps=grpc.server) as mock_grpc_server: (_, _, _, server_thread, server) = grpc_debug_test_server.start_server_on_separate_thread(poll_server=True) ...
-3,176,832,388,540,558,000
Assert gRPC debug server is started with unlimited message size.
tensorflow/python/debug/lib/source_remote_test.py
testGRPCServerMessageSizeLimit
05259/tensorflow
python
def testGRPCServerMessageSizeLimit(self): with test.mock.patch.object(grpc, 'server', wraps=grpc.server) as mock_grpc_server: (_, _, _, server_thread, server) = grpc_debug_test_server.start_server_on_separate_thread(poll_server=True) mock_grpc_server.assert_called_with(test.mock.ANY, options=[(...
def list_combinations_generator(modalities: list): 'Generates combinations for items in the given list.\n\n Args:\n modalities: List of modalities available in the dataset.\n\n Returns:\n Combinations of items in the given list.\n ' modality_combinations = list() for l...
4,698,962,698,077,386,000
Generates combinations for items in the given list. Args: modalities: List of modalities available in the dataset. Returns: Combinations of items in the given list.
codes/model_training_testing.py
list_combinations_generator
preetham-ganesh/multi-sensor-human-activity-recognition
python
def list_combinations_generator(modalities: list): 'Generates combinations for items in the given list.\n\n Args:\n modalities: List of modalities available in the dataset.\n\n Returns:\n Combinations of items in the given list.\n ' modality_combinations = list() for l...
def data_combiner(n_actions: int, subject_ids: list, n_takes: int, modalities: list, skeleton_pose_model: str): 'Combines skeleton point information for all actions, all takes, given list of subject ids and given list of\n modalities.\n\n Args:\n n_actions: Total number of actions in the origin...
-6,621,214,251,104,755,000
Combines skeleton point information for all actions, all takes, given list of subject ids and given list of modalities. Args: n_actions: Total number of actions in the original dataset. subject_ids: List of subjects in the current set. n_takes: Total number of takes in the original dataset....
codes/model_training_testing.py
data_combiner
preetham-ganesh/multi-sensor-human-activity-recognition
python
def data_combiner(n_actions: int, subject_ids: list, n_takes: int, modalities: list, skeleton_pose_model: str): 'Combines skeleton point information for all actions, all takes, given list of subject ids and given list of\n modalities.\n\n Args:\n n_actions: Total number of actions in the origin...
def calculate_metrics(actual_values: np.ndarray, predicted_values: np.ndarray): 'Using actual_values, predicted_values calculates metrics such as accuracy, balanced accuracy, precision, recall,\n and f1 scores.\n\n Args:\n actual_values: Actual action labels in the dataset\n predicte...
-4,365,684,577,823,481,300
Using actual_values, predicted_values calculates metrics such as accuracy, balanced accuracy, precision, recall, and f1 scores. Args: actual_values: Actual action labels in the dataset predicted_values: Action labels predicted by the currently trained model Returns: Dictionary contains...
codes/model_training_testing.py
calculate_metrics
preetham-ganesh/multi-sensor-human-activity-recognition
python
def calculate_metrics(actual_values: np.ndarray, predicted_values: np.ndarray): 'Using actual_values, predicted_values calculates metrics such as accuracy, balanced accuracy, precision, recall,\n and f1 scores.\n\n Args:\n actual_values: Actual action labels in the dataset\n predicte...
def retrieve_hyperparameters(current_model_name: str): 'Based on the current_model_name returns a list of hyperparameters used for optimizing the model (if necessary).\n\n Args:\n current_model_name: Name of the model currently expected to be trained\n\n Returns:\n A dictionary c...
2,844,473,804,344,919,600
Based on the current_model_name returns a list of hyperparameters used for optimizing the model (if necessary). Args: current_model_name: Name of the model currently expected to be trained Returns: A dictionary containing the hyperparameter name and the values that will be used to optimize the model
codes/model_training_testing.py
retrieve_hyperparameters
preetham-ganesh/multi-sensor-human-activity-recognition
python
def retrieve_hyperparameters(current_model_name: str): 'Based on the current_model_name returns a list of hyperparameters used for optimizing the model (if necessary).\n\n Args:\n current_model_name: Name of the model currently expected to be trained\n\n Returns:\n A dictionary c...
def split_data_input_target(skeleton_data: pd.DataFrame): 'Splits skeleton_data into input and target datasets by filtering / selecting certain columns.\n\n Args:\n skeleton_data: Train / Validation / Test dataset used to split / filter certain columns.\n\n Returns:\n A tuple con...
-172,952,320,064,424,670
Splits skeleton_data into input and target datasets by filtering / selecting certain columns. Args: skeleton_data: Train / Validation / Test dataset used to split / filter certain columns. Returns: A tuple containing 2 numpy ndarrays for the input and target datasets.
codes/model_training_testing.py
split_data_input_target
preetham-ganesh/multi-sensor-human-activity-recognition
python
def split_data_input_target(skeleton_data: pd.DataFrame): 'Splits skeleton_data into input and target datasets by filtering / selecting certain columns.\n\n Args:\n skeleton_data: Train / Validation / Test dataset used to split / filter certain columns.\n\n Returns:\n A tuple con...
def video_based_model_testing(test_skeleton_information: pd.DataFrame, current_model: sklearn): 'Tests performance of the currently trained model on the validation or testing sets, where the performance is\n evaluated per video / file, instead of evaluating per frame.\n\n Args:\n test_skeleton_...
3,758,275,840,654,412,000
Tests performance of the currently trained model on the validation or testing sets, where the performance is evaluated per video / file, instead of evaluating per frame. Args: test_skeleton_information: Pandas dataframe which contains skeleton point information for all actions, ...
codes/model_training_testing.py
video_based_model_testing
preetham-ganesh/multi-sensor-human-activity-recognition
python
def video_based_model_testing(test_skeleton_information: pd.DataFrame, current_model: sklearn): 'Tests performance of the currently trained model on the validation or testing sets, where the performance is\n evaluated per video / file, instead of evaluating per frame.\n\n Args:\n test_skeleton_...
def model_training_testing(train_skeleton_information: pd.DataFrame, validation_skeleton_information: pd.DataFrame, test_skeleton_information: pd.DataFrame, current_model_name: str, parameters: dict): 'Trains and validates model for the current model name and hyperparameters on the train_skeleton_informaiton and\n ...
8,992,935,888,324,668,000
Trains and validates model for the current model name and hyperparameters on the train_skeleton_informaiton and validation_skeleton_information. Args: train_skeleton_information: Pandas dataframe which contains skeleton point information for all actions, subject_ids, and...
codes/model_training_testing.py
model_training_testing
preetham-ganesh/multi-sensor-human-activity-recognition
python
def model_training_testing(train_skeleton_information: pd.DataFrame, validation_skeleton_information: pd.DataFrame, test_skeleton_information: pd.DataFrame, current_model_name: str, parameters: dict): 'Trains and validates model for the current model name and hyperparameters on the train_skeleton_informaiton and\n ...
def per_combination_results_export(combination_name: str, data_split: str, metrics_dataframe: pd.DataFrame): 'Exports the metrics_dataframe into a CSV format to the mentioned data_split folder. If the folder does not exist,\n then the folder is created.\n\n Args:\n combination_name: Name of the...
-7,363,266,707,070,975,000
Exports the metrics_dataframe into a CSV format to the mentioned data_split folder. If the folder does not exist, then the folder is created. Args: combination_name: Name of the current combination of modalities and skeleton pose model. data_split: Name of the split the subset of the dataset belong...
codes/model_training_testing.py
per_combination_results_export
preetham-ganesh/multi-sensor-human-activity-recognition
python
def per_combination_results_export(combination_name: str, data_split: str, metrics_dataframe: pd.DataFrame): 'Exports the metrics_dataframe into a CSV format to the mentioned data_split folder. If the folder does not exist,\n then the folder is created.\n\n Args:\n combination_name: Name of the...
def appends_parameter_metrics_combination(current_model_name: str, current_combination_name: str, current_split_metrics: dict, split_metrics_dataframe: pd.DataFrame): 'Appends the metrics for the current model and current parameter combination to the main dataframe.\n\n Args:\n current_model_name:...
8,218,222,589,331,363,000
Appends the metrics for the current model and current parameter combination to the main dataframe. Args: current_model_name: Name of the model currently being trained. current_combination_name: Current combination of parameters used for training the model. current_split_metrics: Metrics for the current par...
codes/model_training_testing.py
appends_parameter_metrics_combination
preetham-ganesh/multi-sensor-human-activity-recognition
python
def appends_parameter_metrics_combination(current_model_name: str, current_combination_name: str, current_split_metrics: dict, split_metrics_dataframe: pd.DataFrame): 'Appends the metrics for the current model and current parameter combination to the main dataframe.\n\n Args:\n current_model_name:...
def per_combination_model_training_testing(train_subject_ids: list, validation_subject_ids: list, test_subject_ids: list, n_actions: int, n_takes: int, current_combination_modalities: list, skeleton_pose_model: str, model_names: list): 'Combines skeleton point information based on modality combination, and subject ...
-7,157,611,953,615,802,000
Combines skeleton point information based on modality combination, and subject id group. Trains, validates, and tests the list of classifier models. Calculates metrics for each data split, model and parameter combination. Args: train_subject_ids: List of subject ids in the training set. validation_...
codes/model_training_testing.py
per_combination_model_training_testing
preetham-ganesh/multi-sensor-human-activity-recognition
python
def per_combination_model_training_testing(train_subject_ids: list, validation_subject_ids: list, test_subject_ids: list, n_actions: int, n_takes: int, current_combination_modalities: list, skeleton_pose_model: str, model_names: list): 'Combines skeleton point information based on modality combination, and subject ...
def __init__(self, multi_scale=False, multi_image_sizes=(320, 352, 384, 416, 448, 480, 512, 544, 576, 608), misc_effect=None, visual_effect=None, batch_size=1, group_method='ratio', shuffle_groups=True, input_size=512, max_objects=100): "\n Initialize Generator object.\n\n Args:\n batch_siz...
1,858,173,405,841,341,700
Initialize Generator object. Args: batch_size: The size of the batches to generate. group_method: Determines how images are grouped together (defaults to 'ratio', one of ('none', 'random', 'ratio')). shuffle_groups: If True, shuffles the groups each epoch. input_size: max_objects:
generators/common.py
__init__
lbcsept/keras-CenterNet
python
def __init__(self, multi_scale=False, multi_image_sizes=(320, 352, 384, 416, 448, 480, 512, 544, 576, 608), misc_effect=None, visual_effect=None, batch_size=1, group_method='ratio', shuffle_groups=True, input_size=512, max_objects=100): "\n Initialize Generator object.\n\n Args:\n batch_siz...
def size(self): '\n Size of the dataset.\n ' raise NotImplementedError('size method not implemented')
2,519,970,720,400,613,400
Size of the dataset.
generators/common.py
size
lbcsept/keras-CenterNet
python
def size(self): '\n \n ' raise NotImplementedError('size method not implemented')
def num_classes(self): '\n Number of classes in the dataset.\n ' raise NotImplementedError('num_classes method not implemented')
2,245,586,942,049,278,500
Number of classes in the dataset.
generators/common.py
num_classes
lbcsept/keras-CenterNet
python
def num_classes(self): '\n \n ' raise NotImplementedError('num_classes method not implemented')
def has_label(self, label): '\n Returns True if label is a known label.\n ' raise NotImplementedError('has_label method not implemented')
8,231,604,603,183,398,000
Returns True if label is a known label.
generators/common.py
has_label
lbcsept/keras-CenterNet
python
def has_label(self, label): '\n \n ' raise NotImplementedError('has_label method not implemented')
def has_name(self, name): '\n Returns True if name is a known class.\n ' raise NotImplementedError('has_name method not implemented')
5,509,816,958,451,983,000
Returns True if name is a known class.
generators/common.py
has_name
lbcsept/keras-CenterNet
python
def has_name(self, name): '\n \n ' raise NotImplementedError('has_name method not implemented')
def name_to_label(self, name): '\n Map name to label.\n ' raise NotImplementedError('name_to_label method not implemented')
-3,816,862,996,482,635,300
Map name to label.
generators/common.py
name_to_label
lbcsept/keras-CenterNet
python
def name_to_label(self, name): '\n \n ' raise NotImplementedError('name_to_label method not implemented')
def label_to_name(self, label): '\n Map label to name.\n ' raise NotImplementedError('label_to_name method not implemented')
5,471,730,362,505,122,000
Map label to name.
generators/common.py
label_to_name
lbcsept/keras-CenterNet
python
def label_to_name(self, label): '\n \n ' raise NotImplementedError('label_to_name method not implemented')
def image_aspect_ratio(self, image_index): '\n Compute the aspect ratio for an image with image_index.\n ' raise NotImplementedError('image_aspect_ratio method not implemented')
5,160,404,832,456,020,000
Compute the aspect ratio for an image with image_index.
generators/common.py
image_aspect_ratio
lbcsept/keras-CenterNet
python
def image_aspect_ratio(self, image_index): '\n \n ' raise NotImplementedError('image_aspect_ratio method not implemented')
def load_image(self, image_index): '\n Load an image at the image_index.\n ' raise NotImplementedError('load_image method not implemented')
-7,955,758,498,265,859,000
Load an image at the image_index.
generators/common.py
load_image
lbcsept/keras-CenterNet
python
def load_image(self, image_index): '\n \n ' raise NotImplementedError('load_image method not implemented')
def load_annotations(self, image_index): '\n Load annotations for an image_index.\n ' raise NotImplementedError('load_annotations method not implemented')
-7,710,779,890,866,678,000
Load annotations for an image_index.
generators/common.py
load_annotations
lbcsept/keras-CenterNet
python
def load_annotations(self, image_index): '\n \n ' raise NotImplementedError('load_annotations method not implemented')
def load_annotations_group(self, group): '\n Load annotations for all images in group.\n ' annotations_group = [self.load_annotations(image_index) for image_index in group] for annotations in annotations_group: assert isinstance(annotations, dict), "'load_annotations' should return a l...
1,904,131,570,393,643,300
Load annotations for all images in group.
generators/common.py
load_annotations_group
lbcsept/keras-CenterNet
python
def load_annotations_group(self, group): '\n \n ' annotations_group = [self.load_annotations(image_index) for image_index in group] for annotations in annotations_group: assert isinstance(annotations, dict), "'load_annotations' should return a list of dictionaries, received: {}".format...
def filter_annotations(self, image_group, annotations_group, group): '\n Filter annotations by removing those that are outside of the image bounds or whose width/height < 0.\n ' for (index, (image, annotations)) in enumerate(zip(image_group, annotations_group)): invalid_indices = np.where(...
-5,141,735,004,164,665,000
Filter annotations by removing those that are outside of the image bounds or whose width/height < 0.
generators/common.py
filter_annotations
lbcsept/keras-CenterNet
python
def filter_annotations(self, image_group, annotations_group, group): '\n \n ' for (index, (image, annotations)) in enumerate(zip(image_group, annotations_group)): invalid_indices = np.where(((((((((annotations['bboxes'][:, 2] <= annotations['bboxes'][:, 0]) | (annotations['bboxes'][:, 3] <...
def clip_transformed_annotations(self, image_group, annotations_group, group): '\n Filter annotations by removing those that are outside of the image bounds or whose width/height < 0.\n ' filtered_image_group = [] filtered_annotations_group = [] for (index, (image, annotations)) in enumera...
4,534,439,093,873,950,700
Filter annotations by removing those that are outside of the image bounds or whose width/height < 0.
generators/common.py
clip_transformed_annotations
lbcsept/keras-CenterNet
python
def clip_transformed_annotations(self, image_group, annotations_group, group): '\n \n ' filtered_image_group = [] filtered_annotations_group = [] for (index, (image, annotations)) in enumerate(zip(image_group, annotations_group)): image_height = image.shape[0] image_width =...
def load_image_group(self, group): '\n Load images for all images in a group.\n ' return [self.load_image(image_index) for image_index in group]
-208,212,597,319,730,600
Load images for all images in a group.
generators/common.py
load_image_group
lbcsept/keras-CenterNet
python
def load_image_group(self, group): '\n \n ' return [self.load_image(image_index) for image_index in group]
def random_visual_effect_group_entry(self, image, annotations): '\n Randomly transforms image and annotation.\n ' image = self.visual_effect(image) return (image, annotations)
-7,949,354,188,122,564,000
Randomly transforms image and annotation.
generators/common.py
random_visual_effect_group_entry
lbcsept/keras-CenterNet
python
def random_visual_effect_group_entry(self, image, annotations): '\n \n ' image = self.visual_effect(image) return (image, annotations)
def random_visual_effect_group(self, image_group, annotations_group): '\n Randomly apply visual effect on each image.\n ' assert (len(image_group) == len(annotations_group)) if (self.visual_effect is None): return (image_group, annotations_group) for index in range(len(image_group)...
6,606,122,371,543,051,000
Randomly apply visual effect on each image.
generators/common.py
random_visual_effect_group
lbcsept/keras-CenterNet
python
def random_visual_effect_group(self, image_group, annotations_group): '\n \n ' assert (len(image_group) == len(annotations_group)) if (self.visual_effect is None): return (image_group, annotations_group) for index in range(len(image_group)): (image_group[index], annotations...
def random_transform_group_entry(self, image, annotations, transform=None): '\n Randomly transforms image and annotation.\n ' if ((transform is not None) or self.transform_generator): if (transform is None): transform = adjust_transform_for_image(next(self.transform_generator),...
3,619,452,415,224,716,000
Randomly transforms image and annotation.
generators/common.py
random_transform_group_entry
lbcsept/keras-CenterNet
python
def random_transform_group_entry(self, image, annotations, transform=None): '\n \n ' if ((transform is not None) or self.transform_generator): if (transform is None): transform = adjust_transform_for_image(next(self.transform_generator), image, self.transform_parameters.relativ...
def random_transform_group(self, image_group, annotations_group): '\n Randomly transforms each image and its annotations.\n ' assert (len(image_group) == len(annotations_group)) for index in range(len(image_group)): (image_group[index], annotations_group[index]) = self.random_transform...
-6,856,956,971,389,891,000
Randomly transforms each image and its annotations.
generators/common.py
random_transform_group
lbcsept/keras-CenterNet
python
def random_transform_group(self, image_group, annotations_group): '\n \n ' assert (len(image_group) == len(annotations_group)) for index in range(len(image_group)): (image_group[index], annotations_group[index]) = self.random_transform_group_entry(image_group[index], annotations_group[...
def random_misc_group_entry(self, image, annotations): '\n Randomly transforms image and annotation.\n ' assert (annotations['bboxes'].shape[0] != 0) (image, boxes) = self.misc_effect(image, annotations['bboxes']) annotations['bboxes'] = boxes return (image, annotations)
-9,044,219,135,588,454,000
Randomly transforms image and annotation.
generators/common.py
random_misc_group_entry
lbcsept/keras-CenterNet
python
def random_misc_group_entry(self, image, annotations): '\n \n ' assert (annotations['bboxes'].shape[0] != 0) (image, boxes) = self.misc_effect(image, annotations['bboxes']) annotations['bboxes'] = boxes return (image, annotations)
def random_misc_group(self, image_group, annotations_group): '\n Randomly transforms each image and its annotations.\n ' assert (len(image_group) == len(annotations_group)) if (self.misc_effect is None): return (image_group, annotations_group) for index in range(len(image_group)): ...
3,756,365,868,291,788,000
Randomly transforms each image and its annotations.
generators/common.py
random_misc_group
lbcsept/keras-CenterNet
python
def random_misc_group(self, image_group, annotations_group): '\n \n ' assert (len(image_group) == len(annotations_group)) if (self.misc_effect is None): return (image_group, annotations_group) for index in range(len(image_group)): (image_group[index], annotations_group[inde...
def preprocess_group_entry(self, image, annotations): '\n Preprocess image and its annotations.\n ' (image, scale, offset_h, offset_w) = self.preprocess_image(image) annotations['bboxes'] *= scale annotations['bboxes'][:, [0, 2]] += offset_w annotations['bboxes'][:, [1, 3]] += offset_h...
-2,648,293,636,791,352,300
Preprocess image and its annotations.
generators/common.py
preprocess_group_entry
lbcsept/keras-CenterNet
python
def preprocess_group_entry(self, image, annotations): '\n \n ' (image, scale, offset_h, offset_w) = self.preprocess_image(image) annotations['bboxes'] *= scale annotations['bboxes'][:, [0, 2]] += offset_w annotations['bboxes'][:, [1, 3]] += offset_h return (image, annotations)
def preprocess_group(self, image_group, annotations_group): '\n Preprocess each image and its annotations in its group.\n ' assert (len(image_group) == len(annotations_group)) for index in range(len(image_group)): (image_group[index], annotations_group[index]) = self.preprocess_group_e...
-3,169,902,642,537,334,300
Preprocess each image and its annotations in its group.
generators/common.py
preprocess_group
lbcsept/keras-CenterNet
python
def preprocess_group(self, image_group, annotations_group): '\n \n ' assert (len(image_group) == len(annotations_group)) for index in range(len(image_group)): (image_group[index], annotations_group[index]) = self.preprocess_group_entry(image_group[index], annotations_group[index]) ...
def group_images(self): '\n Order the images according to self.order and makes groups of self.batch_size.\n ' order = list(range(self.size())) if (self.group_method == 'random'): random.shuffle(order) elif (self.group_method == 'ratio'): order.sort(key=(lambda x: self.image...
-2,192,540,384,019,374,800
Order the images according to self.order and makes groups of self.batch_size.
generators/common.py
group_images
lbcsept/keras-CenterNet
python
def group_images(self): '\n \n ' order = list(range(self.size())) if (self.group_method == 'random'): random.shuffle(order) elif (self.group_method == 'ratio'): order.sort(key=(lambda x: self.image_aspect_ratio(x))) self.groups = [[order[(x % len(order))] for x in range...
def compute_inputs(self, image_group, annotations_group): '\n Compute inputs for the network using an image_group.\n ' batch_images = np.zeros((len(image_group), self.input_size, self.input_size, 3), dtype=np.float32) batch_hms = np.zeros((len(image_group), self.output_size, self.output_size, ...
-7,551,723,626,296,321,000
Compute inputs for the network using an image_group.
generators/common.py
compute_inputs
lbcsept/keras-CenterNet
python
def compute_inputs(self, image_group, annotations_group): '\n \n ' batch_images = np.zeros((len(image_group), self.input_size, self.input_size, 3), dtype=np.float32) batch_hms = np.zeros((len(image_group), self.output_size, self.output_size, self.num_classes()), dtype=np.float32) batch_hms...
def compute_targets(self, image_group, annotations_group): '\n Compute target outputs for the network using images and their annotations.\n ' return np.zeros((len(image_group),))
-4,948,169,037,549,393,000
Compute target outputs for the network using images and their annotations.
generators/common.py
compute_targets
lbcsept/keras-CenterNet
python
def compute_targets(self, image_group, annotations_group): '\n \n ' return np.zeros((len(image_group),))
def compute_inputs_targets(self, group): '\n Compute inputs and target outputs for the network.\n ' image_group = self.load_image_group(group) annotations_group = self.load_annotations_group(group) (image_group, annotations_group) = self.filter_annotations(image_group, annotations_group, g...
3,504,434,119,494,047,000
Compute inputs and target outputs for the network.
generators/common.py
compute_inputs_targets
lbcsept/keras-CenterNet
python
def compute_inputs_targets(self, group): '\n \n ' image_group = self.load_image_group(group) annotations_group = self.load_annotations_group(group) (image_group, annotations_group) = self.filter_annotations(image_group, annotations_group, group) (image_group, annotations_group) = self....
def __len__(self): '\n Number of batches for generator.\n ' return len(self.groups)
4,036,216,262,415,912,000
Number of batches for generator.
generators/common.py
__len__
lbcsept/keras-CenterNet
python
def __len__(self): '\n \n ' return len(self.groups)
def __getitem__(self, index): '\n Keras sequence method for generating batches.\n ' group = self.groups[self.current_index] if self.multi_scale: if ((self.current_index % 10) == 0): random_size_index = np.random.randint(0, len(self.multi_image_sizes)) self.image...
2,202,590,093,009,340,400
Keras sequence method for generating batches.
generators/common.py
__getitem__
lbcsept/keras-CenterNet
python
def __getitem__(self, index): '\n \n ' group = self.groups[self.current_index] if self.multi_scale: if ((self.current_index % 10) == 0): random_size_index = np.random.randint(0, len(self.multi_image_sizes)) self.image_size = self.multi_image_sizes[random_size_in...
def test_fas(): '\n Testing based upon the work provided in\n https://github.com/arkottke/notebooks/blob/master/effective_amp_spectrum.ipynb\n ' ddir = os.path.join('data', 'testdata') datadir = pkg_resources.resource_filename('gmprocess', ddir) fas_file = os.path.join(datadir, 'fas_greater_of_...
5,979,378,271,937,405,000
Testing based upon the work provided in https://github.com/arkottke/notebooks/blob/master/effective_amp_spectrum.ipynb
tests/gmprocess/metrics/imt/fas_greater_of_two_test.py
test_fas
jrekoske-usgs/groundmotion-processing
python
def test_fas(): '\n Testing based upon the work provided in\n https://github.com/arkottke/notebooks/blob/master/effective_amp_spectrum.ipynb\n ' ddir = os.path.join('data', 'testdata') datadir = pkg_resources.resource_filename('gmprocess', ddir) fas_file = os.path.join(datadir, 'fas_greater_of_...
def transcribe_audio(project_slug, creds, overwrite=False): '\n project_slug: ./projects/audiostreams/filename.wav\n ' watson_jobs = [] audio_fn = (project_slug + '.wav') print(('audio_filename:' + audio_fn)) time_slug = make_slug_from_path(audio_fn) transcript_fn = (join(transcripts_dir(p...
1,367,059,603,446,845,000
project_slug: ./projects/audiostreams/filename.wav
watsoncloud/foo/high.py
transcribe_audio
audip/youtubeseek
python
def transcribe_audio(project_slug, creds, overwrite=False): '\n \n ' watson_jobs = [] audio_fn = (project_slug + '.wav') print(('audio_filename:' + audio_fn)) time_slug = make_slug_from_path(audio_fn) transcript_fn = (join(transcripts_dir(project_slug), time_slug) + '.json') print(('tr...
@abstractmethod def _plot_init(self): 'Setup MPL figure display with empty data.' pass
-3,701,202,470,411,182,000
Setup MPL figure display with empty data.
src/pymor/discretizers/builtin/gui/matplotlib.py
_plot_init
TreeerT/pymor
python
@abstractmethod def _plot_init(self): pass