partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
save_load_result
Saves and/or loads func output (must be picklable).
nestcheck/io_utils.py
def save_load_result(func): """Saves and/or loads func output (must be picklable).""" @functools.wraps(func) def wrapper(*args, **kwargs): """ Default behavior is no saving and loading. Specify save_name to save and load. Parameters ---------- save_name: str,...
def save_load_result(func): """Saves and/or loads func output (must be picklable).""" @functools.wraps(func) def wrapper(*args, **kwargs): """ Default behavior is no saving and loading. Specify save_name to save and load. Parameters ---------- save_name: str,...
[ "Saves", "and", "/", "or", "loads", "func", "output", "(", "must", "be", "picklable", ")", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/io_utils.py#L39-L97
[ "def", "save_load_result", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"\n Default behavior is no saving and loading. Specify save_name to save\n an...
29151c314deb89746fd674f27f6ce54b77603189
train
pickle_save
Saves object with pickle. Parameters ---------- data: anything picklable Object to save. name: str Path to save to (includes dir, excludes extension). extension: str, optional File extension. overwrite existing: bool, optional When the save path already contains ...
nestcheck/io_utils.py
def pickle_save(data, name, **kwargs): """Saves object with pickle. Parameters ---------- data: anything picklable Object to save. name: str Path to save to (includes dir, excludes extension). extension: str, optional File extension. overwrite existing: bool, optiona...
def pickle_save(data, name, **kwargs): """Saves object with pickle. Parameters ---------- data: anything picklable Object to save. name: str Path to save to (includes dir, excludes extension). extension: str, optional File extension. overwrite existing: bool, optiona...
[ "Saves", "object", "with", "pickle", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/io_utils.py#L101-L142
[ "def", "pickle_save", "(", "data", ",", "name", ",", "*", "*", "kwargs", ")", ":", "extension", "=", "kwargs", ".", "pop", "(", "'extension'", ",", "'.pkl'", ")", "overwrite_existing", "=", "kwargs", ".", "pop", "(", "'overwrite_existing'", ",", "True", ...
29151c314deb89746fd674f27f6ce54b77603189
train
pickle_load
Load data with pickle. Parameters ---------- name: str Path to save to (includes dir, excludes extension). extension: str, optional File extension. Returns ------- Contents of file path.
nestcheck/io_utils.py
def pickle_load(name, extension='.pkl'): """Load data with pickle. Parameters ---------- name: str Path to save to (includes dir, excludes extension). extension: str, optional File extension. Returns ------- Contents of file path. """ filename = name + extension...
def pickle_load(name, extension='.pkl'): """Load data with pickle. Parameters ---------- name: str Path to save to (includes dir, excludes extension). extension: str, optional File extension. Returns ------- Contents of file path. """ filename = name + extension...
[ "Load", "data", "with", "pickle", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/io_utils.py#L146-L164
[ "def", "pickle_load", "(", "name", ",", "extension", "=", "'.pkl'", ")", ":", "filename", "=", "name", "+", "extension", "infile", "=", "open", "(", "filename", ",", "'rb'", ")", "data", "=", "pickle", ".", "load", "(", "infile", ")", "infile", ".", ...
29151c314deb89746fd674f27f6ce54b77603189
train
bootstrap_resample_run
Bootstrap resamples threads of nested sampling run, returning a new (resampled) nested sampling run. Get the individual threads for a nested sampling run. Parameters ---------- ns_run: dict Nested sampling run dictionary. threads: None or list of numpy arrays, optional ninit_sep: b...
nestcheck/error_analysis.py
def bootstrap_resample_run(ns_run, threads=None, ninit_sep=False, random_seed=False): """Bootstrap resamples threads of nested sampling run, returning a new (resampled) nested sampling run. Get the individual threads for a nested sampling run. Parameters ---------- n...
def bootstrap_resample_run(ns_run, threads=None, ninit_sep=False, random_seed=False): """Bootstrap resamples threads of nested sampling run, returning a new (resampled) nested sampling run. Get the individual threads for a nested sampling run. Parameters ---------- n...
[ "Bootstrap", "resamples", "threads", "of", "nested", "sampling", "run", "returning", "a", "new", "(", "resampled", ")", "nested", "sampling", "run", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/error_analysis.py#L17-L80
[ "def", "bootstrap_resample_run", "(", "ns_run", ",", "threads", "=", "None", ",", "ninit_sep", "=", "False", ",", "random_seed", "=", "False", ")", ":", "if", "random_seed", "is", "not", "False", ":", "# save the random state so we don't affect other bits of the code"...
29151c314deb89746fd674f27f6ce54b77603189
train
run_std_bootstrap
Uses bootstrap resampling to calculate an estimate of the standard deviation of the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. For more details about bootstrap resampling for estimating sampling errors see 'Sampling errors in nested sampling p...
nestcheck/error_analysis.py
def run_std_bootstrap(ns_run, estimator_list, **kwargs): """ Uses bootstrap resampling to calculate an estimate of the standard deviation of the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. For more details about bootstrap resampling for est...
def run_std_bootstrap(ns_run, estimator_list, **kwargs): """ Uses bootstrap resampling to calculate an estimate of the standard deviation of the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. For more details about bootstrap resampling for est...
[ "Uses", "bootstrap", "resampling", "to", "calculate", "an", "estimate", "of", "the", "standard", "deviation", "of", "the", "distribution", "of", "sampling", "errors", "(", "the", "uncertainty", "on", "the", "calculation", ")", "for", "a", "single", "nested", "...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/error_analysis.py#L83-L114
[ "def", "run_std_bootstrap", "(", "ns_run", ",", "estimator_list", ",", "*", "*", "kwargs", ")", ":", "bs_values", "=", "run_bootstrap_values", "(", "ns_run", ",", "estimator_list", ",", "*", "*", "kwargs", ")", "stds", "=", "np", ".", "zeros", "(", "bs_val...
29151c314deb89746fd674f27f6ce54b77603189
train
run_bootstrap_values
Uses bootstrap resampling to calculate an estimate of the standard deviation of the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. For more details about bootstrap resampling for estimating sampling errors see 'Sampling errors in nested sampling p...
nestcheck/error_analysis.py
def run_bootstrap_values(ns_run, estimator_list, **kwargs): """Uses bootstrap resampling to calculate an estimate of the standard deviation of the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. For more details about bootstrap resampling for estim...
def run_bootstrap_values(ns_run, estimator_list, **kwargs): """Uses bootstrap resampling to calculate an estimate of the standard deviation of the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. For more details about bootstrap resampling for estim...
[ "Uses", "bootstrap", "resampling", "to", "calculate", "an", "estimate", "of", "the", "standard", "deviation", "of", "the", "distribution", "of", "sampling", "errors", "(", "the", "uncertainty", "on", "the", "calculation", ")", "for", "a", "single", "nested", "...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/error_analysis.py#L117-L178
[ "def", "run_bootstrap_values", "(", "ns_run", ",", "estimator_list", ",", "*", "*", "kwargs", ")", ":", "ninit_sep", "=", "kwargs", ".", "pop", "(", "'ninit_sep'", ",", "False", ")", "flip_skew", "=", "kwargs", ".", "pop", "(", "'flip_skew'", ",", "True", ...
29151c314deb89746fd674f27f6ce54b77603189
train
run_ci_bootstrap
Uses bootstrap resampling to calculate credible intervals on the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. For more details about bootstrap resampling for estimating sampling errors see 'Sampling errors in nested sampling parameter estimation...
nestcheck/error_analysis.py
def run_ci_bootstrap(ns_run, estimator_list, **kwargs): """Uses bootstrap resampling to calculate credible intervals on the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. For more details about bootstrap resampling for estimating sampling erro...
def run_ci_bootstrap(ns_run, estimator_list, **kwargs): """Uses bootstrap resampling to calculate credible intervals on the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. For more details about bootstrap resampling for estimating sampling erro...
[ "Uses", "bootstrap", "resampling", "to", "calculate", "credible", "intervals", "on", "the", "distribution", "of", "sampling", "errors", "(", "the", "uncertainty", "on", "the", "calculation", ")", "for", "a", "single", "nested", "sampling", "run", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/error_analysis.py#L181-L221
[ "def", "run_ci_bootstrap", "(", "ns_run", ",", "estimator_list", ",", "*", "*", "kwargs", ")", ":", "cred_int", "=", "kwargs", ".", "pop", "(", "'cred_int'", ")", "# No default, must specify", "bs_values", "=", "run_bootstrap_values", "(", "ns_run", ",", "estima...
29151c314deb89746fd674f27f6ce54b77603189
train
run_std_simulate
Uses the 'simulated weights' method to calculate an estimate of the standard deviation of the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. Note that the simulated weights method is not accurate for parameter estimation calculations. For mor...
nestcheck/error_analysis.py
def run_std_simulate(ns_run, estimator_list, n_simulate=None): """Uses the 'simulated weights' method to calculate an estimate of the standard deviation of the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. Note that the simulated weights method i...
def run_std_simulate(ns_run, estimator_list, n_simulate=None): """Uses the 'simulated weights' method to calculate an estimate of the standard deviation of the distribution of sampling errors (the uncertainty on the calculation) for a single nested sampling run. Note that the simulated weights method i...
[ "Uses", "the", "simulated", "weights", "method", "to", "calculate", "an", "estimate", "of", "the", "standard", "deviation", "of", "the", "distribution", "of", "sampling", "errors", "(", "the", "uncertainty", "on", "the", "calculation", ")", "for", "a", "single...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/error_analysis.py#L224-L260
[ "def", "run_std_simulate", "(", "ns_run", ",", "estimator_list", ",", "n_simulate", "=", "None", ")", ":", "assert", "n_simulate", "is", "not", "None", ",", "'run_std_simulate: must specify n_simulate'", "all_values", "=", "np", ".", "zeros", "(", "(", "len", "(...
29151c314deb89746fd674f27f6ce54b77603189
train
implementation_std
r"""Estimates varaition of results due to implementation-specific effects. See 'nestcheck: diagnostic tests for nested sampling calculations' (Higson et al. 2019) for more details. Uncertainties on the output are calculated numerically using the fact that (from central limit theorem) our uncertainties ...
nestcheck/error_analysis.py
def implementation_std(vals_std, vals_std_u, bs_std, bs_std_u, **kwargs): r"""Estimates varaition of results due to implementation-specific effects. See 'nestcheck: diagnostic tests for nested sampling calculations' (Higson et al. 2019) for more details. Uncertainties on the output are calculated numer...
def implementation_std(vals_std, vals_std_u, bs_std, bs_std_u, **kwargs): r"""Estimates varaition of results due to implementation-specific effects. See 'nestcheck: diagnostic tests for nested sampling calculations' (Higson et al. 2019) for more details. Uncertainties on the output are calculated numer...
[ "r", "Estimates", "varaition", "of", "results", "due", "to", "implementation", "-", "specific", "effects", ".", "See", "nestcheck", ":", "diagnostic", "tests", "for", "nested", "sampling", "calculations", "(", "Higson", "et", "al", ".", "2019", ")", "for", "...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/error_analysis.py#L267-L332
[ "def", "implementation_std", "(", "vals_std", ",", "vals_std_u", ",", "bs_std", ",", "bs_std_u", ",", "*", "*", "kwargs", ")", ":", "nsim", "=", "kwargs", ".", "pop", "(", "'nsim'", ",", "1000000", ")", "random_seed", "=", "kwargs", ".", "pop", "(", "'...
29151c314deb89746fd674f27f6ce54b77603189
train
run_thread_values
Helper function for parallelising thread_values_df. Parameters ---------- ns_run: dict Nested sampling run dictionary. estimator_list: list of functions Returns ------- vals_array: numpy array Array of estimator values for each thread. Has shape (len(estimator_list)...
nestcheck/error_analysis.py
def run_thread_values(run, estimator_list): """Helper function for parallelising thread_values_df. Parameters ---------- ns_run: dict Nested sampling run dictionary. estimator_list: list of functions Returns ------- vals_array: numpy array Array of estimator values for ...
def run_thread_values(run, estimator_list): """Helper function for parallelising thread_values_df. Parameters ---------- ns_run: dict Nested sampling run dictionary. estimator_list: list of functions Returns ------- vals_array: numpy array Array of estimator values for ...
[ "Helper", "function", "for", "parallelising", "thread_values_df", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/error_analysis.py#L335-L355
[ "def", "run_thread_values", "(", "run", ",", "estimator_list", ")", ":", "threads", "=", "nestcheck", ".", "ns_run_utils", ".", "get_run_threads", "(", "run", ")", "vals_list", "=", "[", "nestcheck", ".", "ns_run_utils", ".", "run_estimators", "(", "th", ",", ...
29151c314deb89746fd674f27f6ce54b77603189
train
pairwise_distances
Applies statistical_distances to each unique pair of distribution samples in dist_list. Parameters ---------- dist_list: list of 1d arrays earth_mover_dist: bool, optional Passed to statistical_distances. energy_dist: bool, optional Passed to statistical_distances. Returns ...
nestcheck/error_analysis.py
def pairwise_distances(dist_list, earth_mover_dist=True, energy_dist=True): """Applies statistical_distances to each unique pair of distribution samples in dist_list. Parameters ---------- dist_list: list of 1d arrays earth_mover_dist: bool, optional Passed to statistical_distances. ...
def pairwise_distances(dist_list, earth_mover_dist=True, energy_dist=True): """Applies statistical_distances to each unique pair of distribution samples in dist_list. Parameters ---------- dist_list: list of 1d arrays earth_mover_dist: bool, optional Passed to statistical_distances. ...
[ "Applies", "statistical_distances", "to", "each", "unique", "pair", "of", "distribution", "samples", "in", "dist_list", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/error_analysis.py#L358-L394
[ "def", "pairwise_distances", "(", "dist_list", ",", "earth_mover_dist", "=", "True", ",", "energy_dist", "=", "True", ")", ":", "out", "=", "[", "]", "index", "=", "[", "]", "for", "i", ",", "samp_i", "in", "enumerate", "(", "dist_list", ")", ":", "for...
29151c314deb89746fd674f27f6ce54b77603189
train
statistical_distances
Compute measures of the statistical distance between samples. Parameters ---------- samples1: 1d array samples2: 1d array earth_mover_dist: bool, optional Whether or not to compute the Earth mover's distance between the samples. energy_dist: bool, optional Whether or not...
nestcheck/error_analysis.py
def statistical_distances(samples1, samples2, earth_mover_dist=True, energy_dist=True): """Compute measures of the statistical distance between samples. Parameters ---------- samples1: 1d array samples2: 1d array earth_mover_dist: bool, optional Whether or not ...
def statistical_distances(samples1, samples2, earth_mover_dist=True, energy_dist=True): """Compute measures of the statistical distance between samples. Parameters ---------- samples1: 1d array samples2: 1d array earth_mover_dist: bool, optional Whether or not ...
[ "Compute", "measures", "of", "the", "statistical", "distance", "between", "samples", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/error_analysis.py#L397-L423
[ "def", "statistical_distances", "(", "samples1", ",", "samples2", ",", "earth_mover_dist", "=", "True", ",", "energy_dist", "=", "True", ")", ":", "out", "=", "[", "]", "temp", "=", "scipy", ".", "stats", ".", "ks_2samp", "(", "samples1", ",", "samples2", ...
29151c314deb89746fd674f27f6ce54b77603189
train
get_dummy_thread
Generate dummy data for a single nested sampling thread. Log-likelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each generated from a uniform distribution in (0, 1...
nestcheck/dummy_data.py
def get_dummy_thread(nsamples, **kwargs): """Generate dummy data for a single nested sampling thread. Log-likelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each g...
def get_dummy_thread(nsamples, **kwargs): """Generate dummy data for a single nested sampling thread. Log-likelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each g...
[ "Generate", "dummy", "data", "for", "a", "single", "nested", "sampling", "thread", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/dummy_data.py#L11-L47
[ "def", "get_dummy_thread", "(", "nsamples", ",", "*", "*", "kwargs", ")", ":", "seed", "=", "kwargs", ".", "pop", "(", "'seed'", ",", "False", ")", "ndim", "=", "kwargs", ".", "pop", "(", "'ndim'", ",", "2", ")", "logl_start", "=", "kwargs", ".", "...
29151c314deb89746fd674f27f6ce54b77603189
train
get_dummy_run
Generate dummy data for a nested sampling run. Log-likelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each generated from a uniform distribution in (0, 1). Pa...
nestcheck/dummy_data.py
def get_dummy_run(nthread, nsamples, **kwargs): """Generate dummy data for a nested sampling run. Log-likelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each gener...
def get_dummy_run(nthread, nsamples, **kwargs): """Generate dummy data for a nested sampling run. Log-likelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each gener...
[ "Generate", "dummy", "data", "for", "a", "nested", "sampling", "run", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/dummy_data.py#L50-L96
[ "def", "get_dummy_run", "(", "nthread", ",", "nsamples", ",", "*", "*", "kwargs", ")", ":", "seed", "=", "kwargs", ".", "pop", "(", "'seed'", ",", "False", ")", "ndim", "=", "kwargs", ".", "pop", "(", "'ndim'", ",", "2", ")", "logl_start", "=", "kw...
29151c314deb89746fd674f27f6ce54b77603189
train
get_dummy_dynamic_run
Generate dummy data for a dynamic nested sampling run. Loglikelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each generated from a uniform distribution in (0, 1). ...
nestcheck/dummy_data.py
def get_dummy_dynamic_run(nsamples, **kwargs): """Generate dummy data for a dynamic nested sampling run. Loglikelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each...
def get_dummy_dynamic_run(nsamples, **kwargs): """Generate dummy data for a dynamic nested sampling run. Loglikelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each...
[ "Generate", "dummy", "data", "for", "a", "dynamic", "nested", "sampling", "run", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/dummy_data.py#L99-L148
[ "def", "get_dummy_dynamic_run", "(", "nsamples", ",", "*", "*", "kwargs", ")", ":", "seed", "=", "kwargs", ".", "pop", "(", "'seed'", ",", "False", ")", "ndim", "=", "kwargs", ".", "pop", "(", "'ndim'", ",", "2", ")", "nthread_init", "=", "kwargs", "...
29151c314deb89746fd674f27f6ce54b77603189
train
get_long_description
Get PyPI long description from the .rst file.
setup.py
def get_long_description(): """Get PyPI long description from the .rst file.""" pkg_dir = get_package_dir() with open(os.path.join(pkg_dir, '.pypi_long_desc.rst')) as readme_file: long_description = readme_file.read() return long_description
def get_long_description(): """Get PyPI long description from the .rst file.""" pkg_dir = get_package_dir() with open(os.path.join(pkg_dir, '.pypi_long_desc.rst')) as readme_file: long_description = readme_file.read() return long_description
[ "Get", "PyPI", "long", "description", "from", "the", ".", "rst", "file", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/setup.py#L16-L21
[ "def", "get_long_description", "(", ")", ":", "pkg_dir", "=", "get_package_dir", "(", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "pkg_dir", ",", "'.pypi_long_desc.rst'", ")", ")", "as", "readme_file", ":", "long_description", "=", "readme...
29151c314deb89746fd674f27f6ce54b77603189
train
get_version
Get single-source __version__.
setup.py
def get_version(): """Get single-source __version__.""" pkg_dir = get_package_dir() with open(os.path.join(pkg_dir, 'nestcheck/_version.py')) as ver_file: string = ver_file.read() return string.strip().replace('__version__ = ', '').replace('\'', '')
def get_version(): """Get single-source __version__.""" pkg_dir = get_package_dir() with open(os.path.join(pkg_dir, 'nestcheck/_version.py')) as ver_file: string = ver_file.read() return string.strip().replace('__version__ = ', '').replace('\'', '')
[ "Get", "single", "-", "source", "__version__", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/setup.py#L24-L29
[ "def", "get_version", "(", ")", ":", "pkg_dir", "=", "get_package_dir", "(", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "pkg_dir", ",", "'nestcheck/_version.py'", ")", ")", "as", "ver_file", ":", "string", "=", "ver_file", ".", "read"...
29151c314deb89746fd674f27f6ce54b77603189
train
plot_run_nlive
Plot the allocations of live points as a function of logX for the input sets of nested sampling runs of the type used in the dynamic nested sampling paper (Higson et al. 2019). Plots also include analytically calculated distributions of relative posterior mass and relative posterior mass remaining. ...
nestcheck/plots.py
def plot_run_nlive(method_names, run_dict, **kwargs): """Plot the allocations of live points as a function of logX for the input sets of nested sampling runs of the type used in the dynamic nested sampling paper (Higson et al. 2019). Plots also include analytically calculated distributions of relative ...
def plot_run_nlive(method_names, run_dict, **kwargs): """Plot the allocations of live points as a function of logX for the input sets of nested sampling runs of the type used in the dynamic nested sampling paper (Higson et al. 2019). Plots also include analytically calculated distributions of relative ...
[ "Plot", "the", "allocations", "of", "live", "points", "as", "a", "function", "of", "logX", "for", "the", "input", "sets", "of", "nested", "sampling", "runs", "of", "the", "type", "used", "in", "the", "dynamic", "nested", "sampling", "paper", "(", "Higson",...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/plots.py#L21-L154
[ "def", "plot_run_nlive", "(", "method_names", ",", "run_dict", ",", "*", "*", "kwargs", ")", ":", "logx_given_logl", "=", "kwargs", ".", "pop", "(", "'logx_given_logl'", ",", "None", ")", "logl_given_logx", "=", "kwargs", ".", "pop", "(", "'logl_given_logx'", ...
29151c314deb89746fd674f27f6ce54b77603189
train
kde_plot_df
Plots kde estimates of distributions of samples in each cell of the input pandas DataFrame. There is one subplot for each dataframe column, and on each subplot there is one kde line. Parameters ---------- df: pandas data frame Each cell must contain a 1d numpy array of samples. xli...
nestcheck/plots.py
def kde_plot_df(df, xlims=None, **kwargs): """Plots kde estimates of distributions of samples in each cell of the input pandas DataFrame. There is one subplot for each dataframe column, and on each subplot there is one kde line. Parameters ---------- df: pandas data frame Each cell...
def kde_plot_df(df, xlims=None, **kwargs): """Plots kde estimates of distributions of samples in each cell of the input pandas DataFrame. There is one subplot for each dataframe column, and on each subplot there is one kde line. Parameters ---------- df: pandas data frame Each cell...
[ "Plots", "kde", "estimates", "of", "distributions", "of", "samples", "in", "each", "cell", "of", "the", "input", "pandas", "DataFrame", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/plots.py#L157-L232
[ "def", "kde_plot_df", "(", "df", ",", "xlims", "=", "None", ",", "*", "*", "kwargs", ")", ":", "assert", "xlims", "is", "None", "or", "isinstance", "(", "xlims", ",", "dict", ")", "figsize", "=", "kwargs", ".", "pop", "(", "'figsize'", ",", "(", "6...
29151c314deb89746fd674f27f6ce54b77603189
train
bs_param_dists
Creates posterior distributions and their bootstrap error functions for input runs and estimators. For a more detailed description and some example use cases, see 'nestcheck: diagnostic tests for nested sampling calculations' (Higson et al. 2019). Parameters ---------- run_list: dict or list o...
nestcheck/plots.py
def bs_param_dists(run_list, **kwargs): """Creates posterior distributions and their bootstrap error functions for input runs and estimators. For a more detailed description and some example use cases, see 'nestcheck: diagnostic tests for nested sampling calculations' (Higson et al. 2019). Paramet...
def bs_param_dists(run_list, **kwargs): """Creates posterior distributions and their bootstrap error functions for input runs and estimators. For a more detailed description and some example use cases, see 'nestcheck: diagnostic tests for nested sampling calculations' (Higson et al. 2019). Paramet...
[ "Creates", "posterior", "distributions", "and", "their", "bootstrap", "error", "functions", "for", "input", "runs", "and", "estimators", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/plots.py#L235-L346
[ "def", "bs_param_dists", "(", "run_list", ",", "*", "*", "kwargs", ")", ":", "fthetas", "=", "kwargs", ".", "pop", "(", "'fthetas'", ",", "[", "lambda", "theta", ":", "theta", "[", ":", ",", "0", "]", ",", "lambda", "theta", ":", "theta", "[", ":",...
29151c314deb89746fd674f27f6ce54b77603189
train
param_logx_diagram
Creates diagrams of a nested sampling run's evolution as it iterates towards higher likelihoods, expressed as a function of log X, where X(L) is the fraction of the prior volume with likelihood greater than some value L. For a more detailed description and some example use cases, see 'nestcheck: diagno...
nestcheck/plots.py
def param_logx_diagram(run_list, **kwargs): """Creates diagrams of a nested sampling run's evolution as it iterates towards higher likelihoods, expressed as a function of log X, where X(L) is the fraction of the prior volume with likelihood greater than some value L. For a more detailed description and...
def param_logx_diagram(run_list, **kwargs): """Creates diagrams of a nested sampling run's evolution as it iterates towards higher likelihoods, expressed as a function of log X, where X(L) is the fraction of the prior volume with likelihood greater than some value L. For a more detailed description and...
[ "Creates", "diagrams", "of", "a", "nested", "sampling", "run", "s", "evolution", "as", "it", "iterates", "towards", "higher", "likelihoods", "expressed", "as", "a", "function", "of", "log", "X", "where", "X", "(", "L", ")", "is", "the", "fraction", "of", ...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/plots.py#L349-L571
[ "def", "param_logx_diagram", "(", "run_list", ",", "*", "*", "kwargs", ")", ":", "fthetas", "=", "kwargs", ".", "pop", "(", "'fthetas'", ",", "[", "lambda", "theta", ":", "theta", "[", ":", ",", "0", "]", ",", "lambda", "theta", ":", "theta", "[", ...
29151c314deb89746fd674f27f6ce54b77603189
train
plot_bs_dists
Helper function for plotting uncertainties on posterior distributions using bootstrap resamples and the fgivenx module. Used by bs_param_dists and param_logx_diagram. Parameters ---------- run: dict Nested sampling run to plot. fthetas: list of functions Quantities to plot. Each...
nestcheck/plots.py
def plot_bs_dists(run, fthetas, axes, **kwargs): """Helper function for plotting uncertainties on posterior distributions using bootstrap resamples and the fgivenx module. Used by bs_param_dists and param_logx_diagram. Parameters ---------- run: dict Nested sampling run to plot. fth...
def plot_bs_dists(run, fthetas, axes, **kwargs): """Helper function for plotting uncertainties on posterior distributions using bootstrap resamples and the fgivenx module. Used by bs_param_dists and param_logx_diagram. Parameters ---------- run: dict Nested sampling run to plot. fth...
[ "Helper", "function", "for", "plotting", "uncertainties", "on", "posterior", "distributions", "using", "bootstrap", "resamples", "and", "the", "fgivenx", "module", ".", "Used", "by", "bs_param_dists", "and", "param_logx_diagram", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/plots.py#L578-L693
[ "def", "plot_bs_dists", "(", "run", ",", "fthetas", ",", "axes", ",", "*", "*", "kwargs", ")", ":", "ftheta_lims", "=", "kwargs", ".", "pop", "(", "'ftheta_lims'", ",", "[", "[", "-", "1", ",", "1", "]", "]", "*", "len", "(", "fthetas", ")", ")",...
29151c314deb89746fd674f27f6ce54b77603189
train
alternate_helper
Helper function for making fgivenx plots of functions with 2 array arguments of variable lengths.
nestcheck/plots.py
def alternate_helper(x, alt_samps, func=None): """Helper function for making fgivenx plots of functions with 2 array arguments of variable lengths.""" alt_samps = alt_samps[~np.isnan(alt_samps)] arg1 = alt_samps[::2] arg2 = alt_samps[1::2] return func(x, arg1, arg2)
def alternate_helper(x, alt_samps, func=None): """Helper function for making fgivenx plots of functions with 2 array arguments of variable lengths.""" alt_samps = alt_samps[~np.isnan(alt_samps)] arg1 = alt_samps[::2] arg2 = alt_samps[1::2] return func(x, arg1, arg2)
[ "Helper", "function", "for", "making", "fgivenx", "plots", "of", "functions", "with", "2", "array", "arguments", "of", "variable", "lengths", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/plots.py#L696-L702
[ "def", "alternate_helper", "(", "x", ",", "alt_samps", ",", "func", "=", "None", ")", ":", "alt_samps", "=", "alt_samps", "[", "~", "np", ".", "isnan", "(", "alt_samps", ")", "]", "arg1", "=", "alt_samps", "[", ":", ":", "2", "]", "arg2", "=", "alt...
29151c314deb89746fd674f27f6ce54b77603189
train
weighted_1d_gaussian_kde
Gaussian kde with weighted samples (1d only). Uses Scott bandwidth factor. When all the sample weights are equal, this is equivalent to kde = scipy.stats.gaussian_kde(theta) return kde(x) When the weights are not all equal, we compute the effective number of samples as the information content...
nestcheck/plots.py
def weighted_1d_gaussian_kde(x, samples, weights): """Gaussian kde with weighted samples (1d only). Uses Scott bandwidth factor. When all the sample weights are equal, this is equivalent to kde = scipy.stats.gaussian_kde(theta) return kde(x) When the weights are not all equal, we compute the ...
def weighted_1d_gaussian_kde(x, samples, weights): """Gaussian kde with weighted samples (1d only). Uses Scott bandwidth factor. When all the sample weights are equal, this is equivalent to kde = scipy.stats.gaussian_kde(theta) return kde(x) When the weights are not all equal, we compute the ...
[ "Gaussian", "kde", "with", "weighted", "samples", "(", "1d", "only", ")", ".", "Uses", "Scott", "bandwidth", "factor", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/plots.py#L705-L761
[ "def", "weighted_1d_gaussian_kde", "(", "x", ",", "samples", ",", "weights", ")", ":", "assert", "x", ".", "ndim", "==", "1", "assert", "samples", ".", "ndim", "==", "1", "assert", "samples", ".", "shape", "==", "weights", ".", "shape", "# normalise weight...
29151c314deb89746fd674f27f6ce54b77603189
train
rel_posterior_mass
Calculate the relative posterior mass for some array of logx values given the likelihood, prior and number of dimensions. The posterior mass at each logX value is proportional to L(X)X, where L(X) is the likelihood. The weight is returned normalized so that the integral of the weight with respect to...
nestcheck/plots.py
def rel_posterior_mass(logx, logl): """Calculate the relative posterior mass for some array of logx values given the likelihood, prior and number of dimensions. The posterior mass at each logX value is proportional to L(X)X, where L(X) is the likelihood. The weight is returned normalized so that the...
def rel_posterior_mass(logx, logl): """Calculate the relative posterior mass for some array of logx values given the likelihood, prior and number of dimensions. The posterior mass at each logX value is proportional to L(X)X, where L(X) is the likelihood. The weight is returned normalized so that the...
[ "Calculate", "the", "relative", "posterior", "mass", "for", "some", "array", "of", "logx", "values", "given", "the", "likelihood", "prior", "and", "number", "of", "dimensions", ".", "The", "posterior", "mass", "at", "each", "logX", "value", "is", "proportional...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/plots.py#L764-L787
[ "def", "rel_posterior_mass", "(", "logx", ",", "logl", ")", ":", "logw", "=", "logx", "+", "logl", "w_rel", "=", "np", ".", "exp", "(", "logw", "-", "logw", ".", "max", "(", ")", ")", "w_rel", "/=", "np", ".", "abs", "(", "np", ".", "trapz", "(...
29151c314deb89746fd674f27f6ce54b77603189
train
average_by_key
Helper function for plot_run_nlive. Try returning the average of dict_in[key] and, if this does not work or if key is None, return average of whole dict. Parameters ---------- dict_in: dict Values should be arrays. key: str Returns ------- average: float
nestcheck/plots.py
def average_by_key(dict_in, key): """Helper function for plot_run_nlive. Try returning the average of dict_in[key] and, if this does not work or if key is None, return average of whole dict. Parameters ---------- dict_in: dict Values should be arrays. key: str Returns ----...
def average_by_key(dict_in, key): """Helper function for plot_run_nlive. Try returning the average of dict_in[key] and, if this does not work or if key is None, return average of whole dict. Parameters ---------- dict_in: dict Values should be arrays. key: str Returns ----...
[ "Helper", "function", "for", "plot_run_nlive", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/plots.py#L790-L815
[ "def", "average_by_key", "(", "dict_in", ",", "key", ")", ":", "if", "key", "is", "None", ":", "return", "np", ".", "mean", "(", "np", ".", "concatenate", "(", "list", "(", "dict_in", ".", "values", "(", ")", ")", ")", ")", "else", ":", "try", ":...
29151c314deb89746fd674f27f6ce54b77603189
train
batch_process_data
Process output from many nested sampling runs in parallel with optional error handling and caching. The result can be cached using the 'save_name', 'save' and 'load' kwargs (by default this is not done). See save_load_result docstring for more details. Remaining kwargs passed to parallel_utils.par...
nestcheck/data_processing.py
def batch_process_data(file_roots, **kwargs): """Process output from many nested sampling runs in parallel with optional error handling and caching. The result can be cached using the 'save_name', 'save' and 'load' kwargs (by default this is not done). See save_load_result docstring for more detail...
def batch_process_data(file_roots, **kwargs): """Process output from many nested sampling runs in parallel with optional error handling and caching. The result can be cached using the 'save_name', 'save' and 'load' kwargs (by default this is not done). See save_load_result docstring for more detail...
[ "Process", "output", "from", "many", "nested", "sampling", "runs", "in", "parallel", "with", "optional", "error", "handling", "and", "caching", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/data_processing.py#L103-L169
[ "def", "batch_process_data", "(", "file_roots", ",", "*", "*", "kwargs", ")", ":", "base_dir", "=", "kwargs", ".", "pop", "(", "'base_dir'", ",", "'chains'", ")", "process_func", "=", "kwargs", ".", "pop", "(", "'process_func'", ",", "process_polychord_run", ...
29151c314deb89746fd674f27f6ce54b77603189
train
process_error_helper
Wrapper which applies process_func and handles some common errors so one bad run does not spoil the whole batch. Useful errors to handle include: OSError: if you are not sure if all the files exist AssertionError: if some of the many assertions fail for known reasons; for example is there are occa...
nestcheck/data_processing.py
def process_error_helper(root, base_dir, process_func, errors_to_handle=(), **func_kwargs): """Wrapper which applies process_func and handles some common errors so one bad run does not spoil the whole batch. Useful errors to handle include: OSError: if you are not sure if all ...
def process_error_helper(root, base_dir, process_func, errors_to_handle=(), **func_kwargs): """Wrapper which applies process_func and handles some common errors so one bad run does not spoil the whole batch. Useful errors to handle include: OSError: if you are not sure if all ...
[ "Wrapper", "which", "applies", "process_func", "and", "handles", "some", "common", "errors", "so", "one", "bad", "run", "does", "not", "spoil", "the", "whole", "batch", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/data_processing.py#L172-L209
[ "def", "process_error_helper", "(", "root", ",", "base_dir", ",", "process_func", ",", "errors_to_handle", "=", "(", ")", ",", "*", "*", "func_kwargs", ")", ":", "try", ":", "return", "process_func", "(", "root", ",", "base_dir", ",", "*", "*", "func_kwarg...
29151c314deb89746fd674f27f6ce54b77603189
train
process_polychord_run
Loads data from a PolyChord run into the nestcheck dictionary format for analysis. N.B. producing required output file containing information about the iso-likelihood contours within which points were sampled (where they were "born") requies PolyChord version v1.13 or later and the setting write_de...
nestcheck/data_processing.py
def process_polychord_run(file_root, base_dir, process_stats_file=True, **kwargs): """Loads data from a PolyChord run into the nestcheck dictionary format for analysis. N.B. producing required output file containing information about the iso-likelihood contours within which po...
def process_polychord_run(file_root, base_dir, process_stats_file=True, **kwargs): """Loads data from a PolyChord run into the nestcheck dictionary format for analysis. N.B. producing required output file containing information about the iso-likelihood contours within which po...
[ "Loads", "data", "from", "a", "PolyChord", "run", "into", "the", "nestcheck", "dictionary", "format", "for", "analysis", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/data_processing.py#L212-L254
[ "def", "process_polychord_run", "(", "file_root", ",", "base_dir", ",", "process_stats_file", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# N.B. PolyChord dead points files also contains remaining live points at", "# termination", "samples", "=", "np", ".", "loadtxt"...
29151c314deb89746fd674f27f6ce54b77603189
train
process_multinest_run
Loads data from a MultiNest run into the nestcheck dictionary format for analysis. N.B. producing required output file containing information about the iso-likelihood contours within which points were sampled (where they were "born") requies MultiNest version 3.11 or later. Parameters --------...
nestcheck/data_processing.py
def process_multinest_run(file_root, base_dir, **kwargs): """Loads data from a MultiNest run into the nestcheck dictionary format for analysis. N.B. producing required output file containing information about the iso-likelihood contours within which points were sampled (where they were "born") requ...
def process_multinest_run(file_root, base_dir, **kwargs): """Loads data from a MultiNest run into the nestcheck dictionary format for analysis. N.B. producing required output file containing information about the iso-likelihood contours within which points were sampled (where they were "born") requ...
[ "Loads", "data", "from", "a", "MultiNest", "run", "into", "the", "nestcheck", "dictionary", "format", "for", "analysis", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/data_processing.py#L257-L299
[ "def", "process_multinest_run", "(", "file_root", ",", "base_dir", ",", "*", "*", "kwargs", ")", ":", "# Load dead and live points", "dead", "=", "np", ".", "loadtxt", "(", "os", ".", "path", ".", "join", "(", "base_dir", ",", "file_root", ")", "+", "'-dea...
29151c314deb89746fd674f27f6ce54b77603189
train
process_dynesty_run
Transforms results from a dynesty run into the nestcheck dictionary format for analysis. This function has been tested with dynesty v9.2.0. Note that the nestcheck point weights and evidence will not be exactly the same as the dynesty ones as nestcheck calculates logX volumes more precisely (using the ...
nestcheck/data_processing.py
def process_dynesty_run(results): """Transforms results from a dynesty run into the nestcheck dictionary format for analysis. This function has been tested with dynesty v9.2.0. Note that the nestcheck point weights and evidence will not be exactly the same as the dynesty ones as nestcheck calculates lo...
def process_dynesty_run(results): """Transforms results from a dynesty run into the nestcheck dictionary format for analysis. This function has been tested with dynesty v9.2.0. Note that the nestcheck point weights and evidence will not be exactly the same as the dynesty ones as nestcheck calculates lo...
[ "Transforms", "results", "from", "a", "dynesty", "run", "into", "the", "nestcheck", "dictionary", "format", "for", "analysis", ".", "This", "function", "has", "been", "tested", "with", "dynesty", "v9", ".", "2", ".", "0", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/data_processing.py#L302-L357
[ "def", "process_dynesty_run", "(", "results", ")", ":", "samples", "=", "np", ".", "zeros", "(", "(", "results", ".", "samples", ".", "shape", "[", "0", "]", ",", "results", ".", "samples", ".", "shape", "[", "1", "]", "+", "3", ")", ")", "samples"...
29151c314deb89746fd674f27f6ce54b77603189
train
process_polychord_stats
Reads a PolyChord <root>.stats output file and returns the information contained in a dictionary. Parameters ---------- file_root: str Root for run output file names (PolyChord file_root setting). base_dir: str Directory containing data (PolyChord base_dir setting). Returns ...
nestcheck/data_processing.py
def process_polychord_stats(file_root, base_dir): """Reads a PolyChord <root>.stats output file and returns the information contained in a dictionary. Parameters ---------- file_root: str Root for run output file names (PolyChord file_root setting). base_dir: str Directory conta...
def process_polychord_stats(file_root, base_dir): """Reads a PolyChord <root>.stats output file and returns the information contained in a dictionary. Parameters ---------- file_root: str Root for run output file names (PolyChord file_root setting). base_dir: str Directory conta...
[ "Reads", "a", "PolyChord", "<root", ">", ".", "stats", "output", "file", "and", "returns", "the", "information", "contained", "in", "a", "dictionary", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/data_processing.py#L360-L415
[ "def", "process_polychord_stats", "(", "file_root", ",", "base_dir", ")", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "base_dir", ",", "file_root", ")", "+", "'.stats'", "output", "=", "{", "'base_dir'", ":", "base_dir", ",", "'file_root'", ...
29151c314deb89746fd674f27f6ce54b77603189
train
process_samples_array
Convert an array of nested sampling dead and live points of the type produced by PolyChord and MultiNest into a nestcheck nested sampling run dictionary. Parameters ---------- samples: 2d numpy array Array of dead points and any remaining live points at termination. Has #parameters ...
nestcheck/data_processing.py
def process_samples_array(samples, **kwargs): """Convert an array of nested sampling dead and live points of the type produced by PolyChord and MultiNest into a nestcheck nested sampling run dictionary. Parameters ---------- samples: 2d numpy array Array of dead points and any remaining...
def process_samples_array(samples, **kwargs): """Convert an array of nested sampling dead and live points of the type produced by PolyChord and MultiNest into a nestcheck nested sampling run dictionary. Parameters ---------- samples: 2d numpy array Array of dead points and any remaining...
[ "Convert", "an", "array", "of", "nested", "sampling", "dead", "and", "live", "points", "of", "the", "type", "produced", "by", "PolyChord", "and", "MultiNest", "into", "a", "nestcheck", "nested", "sampling", "run", "dictionary", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/data_processing.py#L418-L478
[ "def", "process_samples_array", "(", "samples", ",", "*", "*", "kwargs", ")", ":", "samples", "=", "samples", "[", "np", ".", "argsort", "(", "samples", "[", ":", ",", "-", "2", "]", ")", "]", "ns_run", "=", "{", "}", "ns_run", "[", "'logl'", "]", ...
29151c314deb89746fd674f27f6ce54b77603189
train
birth_inds_given_contours
Maps the iso-likelihood contours on which points were born to the index of the dead point on this contour. MultiNest and PolyChord use different values to identify the inital live points which were sampled from the whole prior (PolyChord uses -1e+30 and MultiNest -0.179769313486231571E+309). However in...
nestcheck/data_processing.py
def birth_inds_given_contours(birth_logl_arr, logl_arr, **kwargs): """Maps the iso-likelihood contours on which points were born to the index of the dead point on this contour. MultiNest and PolyChord use different values to identify the inital live points which were sampled from the whole prior (PolyC...
def birth_inds_given_contours(birth_logl_arr, logl_arr, **kwargs): """Maps the iso-likelihood contours on which points were born to the index of the dead point on this contour. MultiNest and PolyChord use different values to identify the inital live points which were sampled from the whole prior (PolyC...
[ "Maps", "the", "iso", "-", "likelihood", "contours", "on", "which", "points", "were", "born", "to", "the", "index", "of", "the", "dead", "point", "on", "this", "contour", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/data_processing.py#L481-L591
[ "def", "birth_inds_given_contours", "(", "birth_logl_arr", ",", "logl_arr", ",", "*", "*", "kwargs", ")", ":", "dup_assert", "=", "kwargs", ".", "pop", "(", "'dup_assert'", ",", "False", ")", "dup_warn", "=", "kwargs", ".", "pop", "(", "'dup_warn'", ",", "...
29151c314deb89746fd674f27f6ce54b77603189
train
sample_less_than_condition
Creates a random sample from choices without replacement, subject to the condition that each element of the output is greater than the corresponding element of the condition array. condition should be in ascending order.
nestcheck/data_processing.py
def sample_less_than_condition(choices_in, condition): """Creates a random sample from choices without replacement, subject to the condition that each element of the output is greater than the corresponding element of the condition array. condition should be in ascending order. """ output = np....
def sample_less_than_condition(choices_in, condition): """Creates a random sample from choices without replacement, subject to the condition that each element of the output is greater than the corresponding element of the condition array. condition should be in ascending order. """ output = np....
[ "Creates", "a", "random", "sample", "from", "choices", "without", "replacement", "subject", "to", "the", "condition", "that", "each", "element", "of", "the", "output", "is", "greater", "than", "the", "corresponding", "element", "of", "the", "condition", "array",...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/data_processing.py#L594-L610
[ "def", "sample_less_than_condition", "(", "choices_in", ",", "condition", ")", ":", "output", "=", "np", ".", "zeros", "(", "min", "(", "condition", ".", "shape", "[", "0", "]", ",", "choices_in", ".", "shape", "[", "0", "]", ")", ")", "choices", "=", ...
29151c314deb89746fd674f27f6ce54b77603189
train
threads_given_birth_inds
Divides a nested sampling run into threads, using info on the indexes at which points were sampled. See "Sampling errors in nested sampling parameter estimation" (Higson et al. 2018) for more information. Parameters ---------- birth_inds: 1d numpy array Indexes of the iso-likelihood contour...
nestcheck/data_processing.py
def threads_given_birth_inds(birth_inds): """Divides a nested sampling run into threads, using info on the indexes at which points were sampled. See "Sampling errors in nested sampling parameter estimation" (Higson et al. 2018) for more information. Parameters ---------- birth_inds: 1d numpy ar...
def threads_given_birth_inds(birth_inds): """Divides a nested sampling run into threads, using info on the indexes at which points were sampled. See "Sampling errors in nested sampling parameter estimation" (Higson et al. 2018) for more information. Parameters ---------- birth_inds: 1d numpy ar...
[ "Divides", "a", "nested", "sampling", "run", "into", "threads", "using", "info", "on", "the", "indexes", "at", "which", "points", "were", "sampled", ".", "See", "Sampling", "errors", "in", "nested", "sampling", "parameter", "estimation", "(", "Higson", "et", ...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/data_processing.py#L613-L697
[ "def", "threads_given_birth_inds", "(", "birth_inds", ")", ":", "unique", ",", "counts", "=", "np", ".", "unique", "(", "birth_inds", ",", "return_counts", "=", "True", ")", "# First get a list of all the indexes on which threads start and their", "# counts. This is every p...
29151c314deb89746fd674f27f6ce54b77603189
train
parallel_map
Apply function to iterable with parallel map, and hence returns results in order. functools.partial is used to freeze func_pre_args and func_kwargs, meaning that the iterable argument must be the last positional argument. Roughly equivalent to >>> [func(*func_pre_args, x, **func_kwargs) for x in a...
nestcheck/parallel_utils.py
def parallel_map(func, *arg_iterable, **kwargs): """Apply function to iterable with parallel map, and hence returns results in order. functools.partial is used to freeze func_pre_args and func_kwargs, meaning that the iterable argument must be the last positional argument. Roughly equivalent to ...
def parallel_map(func, *arg_iterable, **kwargs): """Apply function to iterable with parallel map, and hence returns results in order. functools.partial is used to freeze func_pre_args and func_kwargs, meaning that the iterable argument must be the last positional argument. Roughly equivalent to ...
[ "Apply", "function", "to", "iterable", "with", "parallel", "map", "and", "hence", "returns", "results", "in", "order", ".", "functools", ".", "partial", "is", "used", "to", "freeze", "func_pre_args", "and", "func_kwargs", "meaning", "that", "the", "iterable", ...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/parallel_utils.py#L12-L67
[ "def", "parallel_map", "(", "func", ",", "*", "arg_iterable", ",", "*", "*", "kwargs", ")", ":", "chunksize", "=", "kwargs", ".", "pop", "(", "'chunksize'", ",", "1", ")", "func_pre_args", "=", "kwargs", ".", "pop", "(", "'func_pre_args'", ",", "(", ")...
29151c314deb89746fd674f27f6ce54b77603189
train
parallel_apply
Apply function to iterable with parallelisation and a tqdm progress bar. Roughly equivalent to >>> [func(*func_pre_args, x, *func_args, **func_kwargs) for x in arg_iterable] but will **not** necessarily return results in input order. Parameters ---------- func: function Func...
nestcheck/parallel_utils.py
def parallel_apply(func, arg_iterable, **kwargs): """Apply function to iterable with parallelisation and a tqdm progress bar. Roughly equivalent to >>> [func(*func_pre_args, x, *func_args, **func_kwargs) for x in arg_iterable] but will **not** necessarily return results in input order. ...
def parallel_apply(func, arg_iterable, **kwargs): """Apply function to iterable with parallelisation and a tqdm progress bar. Roughly equivalent to >>> [func(*func_pre_args, x, *func_args, **func_kwargs) for x in arg_iterable] but will **not** necessarily return results in input order. ...
[ "Apply", "function", "to", "iterable", "with", "parallelisation", "and", "a", "tqdm", "progress", "bar", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/parallel_utils.py#L70-L142
[ "def", "parallel_apply", "(", "func", ",", "arg_iterable", ",", "*", "*", "kwargs", ")", ":", "max_workers", "=", "kwargs", ".", "pop", "(", "'max_workers'", ",", "None", ")", "parallel", "=", "kwargs", ".", "pop", "(", "'parallel'", ",", "True", ")", ...
29151c314deb89746fd674f27f6ce54b77603189
train
select_tqdm
If running in a jupyter notebook, then returns tqdm_notebook. Otherwise returns a regular tqdm progress bar. Returns ------- progress: function
nestcheck/parallel_utils.py
def select_tqdm(): """If running in a jupyter notebook, then returns tqdm_notebook. Otherwise returns a regular tqdm progress bar. Returns ------- progress: function """ try: progress = tqdm.tqdm_notebook assert get_ipython().has_trait('kernel') except (NameError, Assert...
def select_tqdm(): """If running in a jupyter notebook, then returns tqdm_notebook. Otherwise returns a regular tqdm progress bar. Returns ------- progress: function """ try: progress = tqdm.tqdm_notebook assert get_ipython().has_trait('kernel') except (NameError, Assert...
[ "If", "running", "in", "a", "jupyter", "notebook", "then", "returns", "tqdm_notebook", ".", "Otherwise", "returns", "a", "regular", "tqdm", "progress", "bar", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/parallel_utils.py#L145-L158
[ "def", "select_tqdm", "(", ")", ":", "try", ":", "progress", "=", "tqdm", ".", "tqdm_notebook", "assert", "get_ipython", "(", ")", ".", "has_trait", "(", "'kernel'", ")", "except", "(", "NameError", ",", "AssertionError", ")", ":", "progress", "=", "tqdm",...
29151c314deb89746fd674f27f6ce54b77603189
train
summary_df_from_array
Make a panda data frame of the mean and std devs of an array of results, including the uncertainties on the values. This function converts the array to a DataFrame and calls summary_df on it. Parameters ---------- results_array: 2d numpy array names: list of str Names for the output df...
nestcheck/pandas_functions.py
def summary_df_from_array(results_array, names, axis=0, **kwargs): """Make a panda data frame of the mean and std devs of an array of results, including the uncertainties on the values. This function converts the array to a DataFrame and calls summary_df on it. Parameters ---------- results_ar...
def summary_df_from_array(results_array, names, axis=0, **kwargs): """Make a panda data frame of the mean and std devs of an array of results, including the uncertainties on the values. This function converts the array to a DataFrame and calls summary_df on it. Parameters ---------- results_ar...
[ "Make", "a", "panda", "data", "frame", "of", "the", "mean", "and", "std", "devs", "of", "an", "array", "of", "results", "including", "the", "uncertainties", "on", "the", "values", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/pandas_functions.py#L12-L36
[ "def", "summary_df_from_array", "(", "results_array", ",", "names", ",", "axis", "=", "0", ",", "*", "*", "kwargs", ")", ":", "assert", "axis", "==", "0", "or", "axis", "==", "1", "df", "=", "pd", ".", "DataFrame", "(", "results_array", ")", "if", "a...
29151c314deb89746fd674f27f6ce54b77603189
train
summary_df_from_list
Make a panda data frame of the mean and std devs of each element of a list of 1d arrays, including the uncertainties on the values. This just converts the array to a DataFrame and calls summary_df on it. Parameters ---------- results_list: list of 1d numpy arrays Must have same length as n...
nestcheck/pandas_functions.py
def summary_df_from_list(results_list, names, **kwargs): """Make a panda data frame of the mean and std devs of each element of a list of 1d arrays, including the uncertainties on the values. This just converts the array to a DataFrame and calls summary_df on it. Parameters ---------- results_...
def summary_df_from_list(results_list, names, **kwargs): """Make a panda data frame of the mean and std devs of each element of a list of 1d arrays, including the uncertainties on the values. This just converts the array to a DataFrame and calls summary_df on it. Parameters ---------- results_...
[ "Make", "a", "panda", "data", "frame", "of", "the", "mean", "and", "std", "devs", "of", "each", "element", "of", "a", "list", "of", "1d", "arrays", "including", "the", "uncertainties", "on", "the", "values", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/pandas_functions.py#L39-L63
[ "def", "summary_df_from_list", "(", "results_list", ",", "names", ",", "*", "*", "kwargs", ")", ":", "for", "arr", "in", "results_list", ":", "assert", "arr", ".", "shape", "==", "(", "len", "(", "names", ")", ",", ")", "df", "=", "pd", ".", "DataFra...
29151c314deb89746fd674f27f6ce54b77603189
train
summary_df_from_multi
Apply summary_df to a multiindex while preserving some levels. Parameters ---------- multi_in: multiindex pandas DataFrame inds_to_keep: None or list of strs, optional Index levels to preserve. kwargs: dict, optional Keyword arguments to pass to summary_df. Returns ------- ...
nestcheck/pandas_functions.py
def summary_df_from_multi(multi_in, inds_to_keep=None, **kwargs): """Apply summary_df to a multiindex while preserving some levels. Parameters ---------- multi_in: multiindex pandas DataFrame inds_to_keep: None or list of strs, optional Index levels to preserve. kwargs: dict, optional ...
def summary_df_from_multi(multi_in, inds_to_keep=None, **kwargs): """Apply summary_df to a multiindex while preserving some levels. Parameters ---------- multi_in: multiindex pandas DataFrame inds_to_keep: None or list of strs, optional Index levels to preserve. kwargs: dict, optional ...
[ "Apply", "summary_df", "to", "a", "multiindex", "while", "preserving", "some", "levels", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/pandas_functions.py#L66-L120
[ "def", "summary_df_from_multi", "(", "multi_in", ",", "inds_to_keep", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Need to pop include true values and add separately at the end as", "# otherwise we get multiple true values added", "include_true_values", "=", "kwargs", "."...
29151c314deb89746fd674f27f6ce54b77603189
train
summary_df
Make a panda data frame of the mean and std devs of an array of results, including the uncertainties on the values. This is similar to pandas.DataFrame.describe but also includes estimates of the numerical uncertainties. The output DataFrame has multiindex levels: 'calculation type': mean and st...
nestcheck/pandas_functions.py
def summary_df(df_in, **kwargs): """Make a panda data frame of the mean and std devs of an array of results, including the uncertainties on the values. This is similar to pandas.DataFrame.describe but also includes estimates of the numerical uncertainties. The output DataFrame has multiindex level...
def summary_df(df_in, **kwargs): """Make a panda data frame of the mean and std devs of an array of results, including the uncertainties on the values. This is similar to pandas.DataFrame.describe but also includes estimates of the numerical uncertainties. The output DataFrame has multiindex level...
[ "Make", "a", "panda", "data", "frame", "of", "the", "mean", "and", "std", "devs", "of", "an", "array", "of", "results", "including", "the", "uncertainties", "on", "the", "values", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/pandas_functions.py#L123-L202
[ "def", "summary_df", "(", "df_in", ",", "*", "*", "kwargs", ")", ":", "true_values", "=", "kwargs", ".", "pop", "(", "'true_values'", ",", "None", ")", "include_true_values", "=", "kwargs", ".", "pop", "(", "'include_true_values'", ",", "False", ")", "incl...
29151c314deb89746fd674f27f6ce54b77603189
train
efficiency_gain_df
r"""Calculated data frame showing .. math:: \mathrm{efficiency\,gain} = \frac{\mathrm{Var[base\,method]}}{\mathrm{Var[new\,method]}} See the dynamic nested sampling paper (Higson et al. 2019) for more details. The standard method on which to base the gain is assumed to be the...
nestcheck/pandas_functions.py
def efficiency_gain_df(method_names, method_values, est_names, **kwargs): r"""Calculated data frame showing .. math:: \mathrm{efficiency\,gain} = \frac{\mathrm{Var[base\,method]}}{\mathrm{Var[new\,method]}} See the dynamic nested sampling paper (Higson et al. 2019) for more de...
def efficiency_gain_df(method_names, method_values, est_names, **kwargs): r"""Calculated data frame showing .. math:: \mathrm{efficiency\,gain} = \frac{\mathrm{Var[base\,method]}}{\mathrm{Var[new\,method]}} See the dynamic nested sampling paper (Higson et al. 2019) for more de...
[ "r", "Calculated", "data", "frame", "showing" ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/pandas_functions.py#L205-L306
[ "def", "efficiency_gain_df", "(", "method_names", ",", "method_values", ",", "est_names", ",", "*", "*", "kwargs", ")", ":", "true_values", "=", "kwargs", ".", "pop", "(", "'true_values'", ",", "None", ")", "include_true_values", "=", "kwargs", ".", "pop", "...
29151c314deb89746fd674f27f6ce54b77603189
train
paper_format_efficiency_gain_df
Transform efficiency gain data frames output by nestcheck into the format shown in the dynamic nested sampling paper (Higson et al. 2019). Parameters ---------- eff_gain_df: pandas DataFrame DataFrame of the from produced by efficiency_gain_df. Returns ------- paper_df: pandas Data...
nestcheck/pandas_functions.py
def paper_format_efficiency_gain_df(eff_gain_df): """Transform efficiency gain data frames output by nestcheck into the format shown in the dynamic nested sampling paper (Higson et al. 2019). Parameters ---------- eff_gain_df: pandas DataFrame DataFrame of the from produced by efficiency_ga...
def paper_format_efficiency_gain_df(eff_gain_df): """Transform efficiency gain data frames output by nestcheck into the format shown in the dynamic nested sampling paper (Higson et al. 2019). Parameters ---------- eff_gain_df: pandas DataFrame DataFrame of the from produced by efficiency_ga...
[ "Transform", "efficiency", "gain", "data", "frames", "output", "by", "nestcheck", "into", "the", "format", "shown", "in", "the", "dynamic", "nested", "sampling", "paper", "(", "Higson", "et", "al", ".", "2019", ")", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/pandas_functions.py#L309-L345
[ "def", "paper_format_efficiency_gain_df", "(", "eff_gain_df", ")", ":", "idxs", "=", "pd", ".", "IndexSlice", "[", "[", "'std'", ",", "'std efficiency gain'", "]", ",", ":", ",", ":", "]", "paper_df", "=", "copy", ".", "deepcopy", "(", "eff_gain_df", ".", ...
29151c314deb89746fd674f27f6ce54b77603189
train
get_eff_gain
r"""Calculates efficiency gain for a new method compared to a base method. Given the variation in repeated calculations' results using the two methods, the efficiency gain is: .. math:: \mathrm{efficiency\,gain} = \frac{\mathrm{Var[base\,method]}}{\mathrm{Var[new\,method]}} Th...
nestcheck/pandas_functions.py
def get_eff_gain(base_std, base_std_unc, meth_std, meth_std_unc, adjust=1): r"""Calculates efficiency gain for a new method compared to a base method. Given the variation in repeated calculations' results using the two methods, the efficiency gain is: .. math:: \mathrm{efficiency\,gain} ...
def get_eff_gain(base_std, base_std_unc, meth_std, meth_std_unc, adjust=1): r"""Calculates efficiency gain for a new method compared to a base method. Given the variation in repeated calculations' results using the two methods, the efficiency gain is: .. math:: \mathrm{efficiency\,gain} ...
[ "r", "Calculates", "efficiency", "gain", "for", "a", "new", "method", "compared", "to", "a", "base", "method", ".", "Given", "the", "variation", "in", "repeated", "calculations", "results", "using", "the", "two", "methods", "the", "efficiency", "gain", "is", ...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/pandas_functions.py#L352-L390
[ "def", "get_eff_gain", "(", "base_std", ",", "base_std_unc", ",", "meth_std", ",", "meth_std_unc", ",", "adjust", "=", "1", ")", ":", "ratio", "=", "base_std", "/", "meth_std", "ratio_unc", "=", "array_ratio_std", "(", "base_std", ",", "base_std_unc", ",", "...
29151c314deb89746fd674f27f6ce54b77603189
train
rmse_and_unc
r"""Calculate the root meet squared error and its numerical uncertainty. With a reasonably large number of values in values_list the uncertainty on sq_errors should be approximately normal (from the central limit theorem). Uncertainties are calculated via error propagation: if :math:`\sigma` is the...
nestcheck/pandas_functions.py
def rmse_and_unc(values_array, true_values): r"""Calculate the root meet squared error and its numerical uncertainty. With a reasonably large number of values in values_list the uncertainty on sq_errors should be approximately normal (from the central limit theorem). Uncertainties are calculated vi...
def rmse_and_unc(values_array, true_values): r"""Calculate the root meet squared error and its numerical uncertainty. With a reasonably large number of values in values_list the uncertainty on sq_errors should be approximately normal (from the central limit theorem). Uncertainties are calculated vi...
[ "r", "Calculate", "the", "root", "meet", "squared", "error", "and", "its", "numerical", "uncertainty", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/pandas_functions.py#L393-L426
[ "def", "rmse_and_unc", "(", "values_array", ",", "true_values", ")", ":", "assert", "true_values", ".", "shape", "==", "(", "values_array", ".", "shape", "[", "1", "]", ",", ")", "errors", "=", "values_array", "-", "true_values", "[", "np", ".", "newaxis",...
29151c314deb89746fd674f27f6ce54b77603189
train
array_ratio_std
r"""Gives error on the ratio of 2 floats or 2 1-dimensional arrays given their values and uncertainties. This assumes the covariance = 0, and that the input uncertainties are small compared to the corresponding input values. _n and _d denote the numerator and denominator respectively. Parameters --...
nestcheck/pandas_functions.py
def array_ratio_std(values_n, sigmas_n, values_d, sigmas_d): r"""Gives error on the ratio of 2 floats or 2 1-dimensional arrays given their values and uncertainties. This assumes the covariance = 0, and that the input uncertainties are small compared to the corresponding input values. _n and _d denote t...
def array_ratio_std(values_n, sigmas_n, values_d, sigmas_d): r"""Gives error on the ratio of 2 floats or 2 1-dimensional arrays given their values and uncertainties. This assumes the covariance = 0, and that the input uncertainties are small compared to the corresponding input values. _n and _d denote t...
[ "r", "Gives", "error", "on", "the", "ratio", "of", "2", "floats", "or", "2", "1", "-", "dimensional", "arrays", "given", "their", "values", "and", "uncertainties", ".", "This", "assumes", "the", "covariance", "=", "0", "and", "that", "the", "input", "unc...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/pandas_functions.py#L429-L453
[ "def", "array_ratio_std", "(", "values_n", ",", "sigmas_n", ",", "values_d", ",", "sigmas_d", ")", ":", "std", "=", "np", ".", "sqrt", "(", "(", "sigmas_n", "/", "values_n", ")", "**", "2", "+", "(", "sigmas_d", "/", "values_d", ")", "**", "2", ")", ...
29151c314deb89746fd674f27f6ce54b77603189
train
run_estimators
Calculates values of list of quantities (such as the Bayesian evidence or mean of parameters) for a single nested sampling run. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing module docstring for more details). estimator_list: list of functions for ...
nestcheck/ns_run_utils.py
def run_estimators(ns_run, estimator_list, simulate=False): """Calculates values of list of quantities (such as the Bayesian evidence or mean of parameters) for a single nested sampling run. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing module docstring fo...
def run_estimators(ns_run, estimator_list, simulate=False): """Calculates values of list of quantities (such as the Bayesian evidence or mean of parameters) for a single nested sampling run. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing module docstring fo...
[ "Calculates", "values", "of", "list", "of", "quantities", "(", "such", "as", "the", "Bayesian", "evidence", "or", "mean", "of", "parameters", ")", "for", "a", "single", "nested", "sampling", "run", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L15-L39
[ "def", "run_estimators", "(", "ns_run", ",", "estimator_list", ",", "simulate", "=", "False", ")", ":", "logw", "=", "get_logw", "(", "ns_run", ",", "simulate", "=", "simulate", ")", "output", "=", "np", ".", "zeros", "(", "len", "(", "estimator_list", "...
29151c314deb89746fd674f27f6ce54b77603189
train
array_given_run
Converts information on samples in a nested sampling run dictionary into a numpy array representation. This allows fast addition of more samples and recalculation of nlive. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing module docstring for more det...
nestcheck/ns_run_utils.py
def array_given_run(ns_run): """Converts information on samples in a nested sampling run dictionary into a numpy array representation. This allows fast addition of more samples and recalculation of nlive. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing m...
def array_given_run(ns_run): """Converts information on samples in a nested sampling run dictionary into a numpy array representation. This allows fast addition of more samples and recalculation of nlive. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing m...
[ "Converts", "information", "on", "samples", "in", "a", "nested", "sampling", "run", "dictionary", "into", "a", "numpy", "array", "representation", ".", "This", "allows", "fast", "addition", "of", "more", "samples", "and", "recalculation", "of", "nlive", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L42-L67
[ "def", "array_given_run", "(", "ns_run", ")", ":", "samples", "=", "np", ".", "zeros", "(", "(", "ns_run", "[", "'logl'", "]", ".", "shape", "[", "0", "]", ",", "3", "+", "ns_run", "[", "'theta'", "]", ".", "shape", "[", "1", "]", ")", ")", "sa...
29151c314deb89746fd674f27f6ce54b77603189
train
dict_given_run_array
Converts an array of information about samples back into a nested sampling run dictionary (see data_processing module docstring for more details). N.B. the output dict only contains the following keys: 'logl', 'thread_label', 'nlive_array', 'theta'. Any other keys giving additional information about th...
nestcheck/ns_run_utils.py
def dict_given_run_array(samples, thread_min_max): """ Converts an array of information about samples back into a nested sampling run dictionary (see data_processing module docstring for more details). N.B. the output dict only contains the following keys: 'logl', 'thread_label', 'nlive_array', 'th...
def dict_given_run_array(samples, thread_min_max): """ Converts an array of information about samples back into a nested sampling run dictionary (see data_processing module docstring for more details). N.B. the output dict only contains the following keys: 'logl', 'thread_label', 'nlive_array', 'th...
[ "Converts", "an", "array", "of", "information", "about", "samples", "back", "into", "a", "nested", "sampling", "run", "dictionary", "(", "see", "data_processing", "module", "docstring", "for", "more", "details", ")", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L70-L132
[ "def", "dict_given_run_array", "(", "samples", ",", "thread_min_max", ")", ":", "ns_run", "=", "{", "'logl'", ":", "samples", "[", ":", ",", "0", "]", ",", "'thread_labels'", ":", "samples", "[", ":", ",", "1", "]", ",", "'thread_min_max'", ":", "thread_...
29151c314deb89746fd674f27f6ce54b77603189
train
get_run_threads
Get the individual threads from a nested sampling run. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing module docstring for more details). Returns ------- threads: list of numpy array Each thread (list element) is a samples array contain...
nestcheck/ns_run_utils.py
def get_run_threads(ns_run): """ Get the individual threads from a nested sampling run. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing module docstring for more details). Returns ------- threads: list of numpy array Each thread ...
def get_run_threads(ns_run): """ Get the individual threads from a nested sampling run. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing module docstring for more details). Returns ------- threads: list of numpy array Each thread ...
[ "Get", "the", "individual", "threads", "from", "a", "nested", "sampling", "run", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L135-L167
[ "def", "get_run_threads", "(", "ns_run", ")", ":", "samples", "=", "array_given_run", "(", "ns_run", ")", "unique_threads", "=", "np", ".", "unique", "(", "ns_run", "[", "'thread_labels'", "]", ")", "assert", "ns_run", "[", "'thread_min_max'", "]", ".", "sha...
29151c314deb89746fd674f27f6ce54b77603189
train
combine_ns_runs
Combine a list of complete nested sampling run dictionaries into a single ns run. Input runs must contain any repeated threads. Parameters ---------- run_list_in: list of dicts List of nested sampling runs in dict format (see data_processing module docstring for more details). ...
nestcheck/ns_run_utils.py
def combine_ns_runs(run_list_in, **kwargs): """ Combine a list of complete nested sampling run dictionaries into a single ns run. Input runs must contain any repeated threads. Parameters ---------- run_list_in: list of dicts List of nested sampling runs in dict format (see data_pro...
def combine_ns_runs(run_list_in, **kwargs): """ Combine a list of complete nested sampling run dictionaries into a single ns run. Input runs must contain any repeated threads. Parameters ---------- run_list_in: list of dicts List of nested sampling runs in dict format (see data_pro...
[ "Combine", "a", "list", "of", "complete", "nested", "sampling", "run", "dictionaries", "into", "a", "single", "ns", "run", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L170-L215
[ "def", "combine_ns_runs", "(", "run_list_in", ",", "*", "*", "kwargs", ")", ":", "run_list", "=", "copy", ".", "deepcopy", "(", "run_list_in", ")", "if", "len", "(", "run_list", ")", "==", "1", ":", "run", "=", "run_list", "[", "0", "]", "else", ":",...
29151c314deb89746fd674f27f6ce54b77603189
train
combine_threads
Combine list of threads into a single ns run. This is different to combining runs as repeated threads are allowed, and as some threads can start from log-likelihood contours on which no dead point in the run is present. Note that if all the thread labels are not unique and in ascending order, the o...
nestcheck/ns_run_utils.py
def combine_threads(threads, assert_birth_point=False): """ Combine list of threads into a single ns run. This is different to combining runs as repeated threads are allowed, and as some threads can start from log-likelihood contours on which no dead point in the run is present. Note that if al...
def combine_threads(threads, assert_birth_point=False): """ Combine list of threads into a single ns run. This is different to combining runs as repeated threads are allowed, and as some threads can start from log-likelihood contours on which no dead point in the run is present. Note that if al...
[ "Combine", "list", "of", "threads", "into", "a", "single", "ns", "run", ".", "This", "is", "different", "to", "combining", "runs", "as", "repeated", "threads", "are", "allowed", "and", "as", "some", "threads", "can", "start", "from", "log", "-", "likelihoo...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L218-L286
[ "def", "combine_threads", "(", "threads", ",", "assert_birth_point", "=", "False", ")", ":", "thread_min_max", "=", "np", ".", "vstack", "(", "[", "td", "[", "'thread_min_max'", "]", "for", "td", "in", "threads", "]", ")", "assert", "len", "(", "threads", ...
29151c314deb89746fd674f27f6ce54b77603189
train
get_logw
r"""Calculates the log posterior weights of the samples (using logarithms to avoid overflow errors with very large or small values). Uses the trapezium rule such that the weight of point i is .. math:: w_i = \mathcal{L}_i (X_{i-1} - X_{i+1}) / 2 Parameters ---------- ns_run: dict Nest...
nestcheck/ns_run_utils.py
def get_logw(ns_run, simulate=False): r"""Calculates the log posterior weights of the samples (using logarithms to avoid overflow errors with very large or small values). Uses the trapezium rule such that the weight of point i is .. math:: w_i = \mathcal{L}_i (X_{i-1} - X_{i+1}) / 2 Parameters ...
def get_logw(ns_run, simulate=False): r"""Calculates the log posterior weights of the samples (using logarithms to avoid overflow errors with very large or small values). Uses the trapezium rule such that the weight of point i is .. math:: w_i = \mathcal{L}_i (X_{i-1} - X_{i+1}) / 2 Parameters ...
[ "r", "Calculates", "the", "log", "posterior", "weights", "of", "the", "samples", "(", "using", "logarithms", "to", "avoid", "overflow", "errors", "with", "very", "large", "or", "small", "values", ")", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L289-L334
[ "def", "get_logw", "(", "ns_run", ",", "simulate", "=", "False", ")", ":", "try", ":", "# find logX value for each point", "logx", "=", "get_logx", "(", "ns_run", "[", "'nlive_array'", "]", ",", "simulate", "=", "simulate", ")", "logw", "=", "np", ".", "ze...
29151c314deb89746fd674f27f6ce54b77603189
train
get_w_rel
Get the relative posterior weights of the samples, normalised so the maximum sample weight is 1. This is calculated from get_logw with protection against numerical overflows. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing module docstring for more d...
nestcheck/ns_run_utils.py
def get_w_rel(ns_run, simulate=False): """Get the relative posterior weights of the samples, normalised so the maximum sample weight is 1. This is calculated from get_logw with protection against numerical overflows. Parameters ---------- ns_run: dict Nested sampling run dict (see data_...
def get_w_rel(ns_run, simulate=False): """Get the relative posterior weights of the samples, normalised so the maximum sample weight is 1. This is calculated from get_logw with protection against numerical overflows. Parameters ---------- ns_run: dict Nested sampling run dict (see data_...
[ "Get", "the", "relative", "posterior", "weights", "of", "the", "samples", "normalised", "so", "the", "maximum", "sample", "weight", "is", "1", ".", "This", "is", "calculated", "from", "get_logw", "with", "protection", "against", "numerical", "overflows", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L337-L356
[ "def", "get_w_rel", "(", "ns_run", ",", "simulate", "=", "False", ")", ":", "logw", "=", "get_logw", "(", "ns_run", ",", "simulate", "=", "simulate", ")", "return", "np", ".", "exp", "(", "logw", "-", "logw", ".", "max", "(", ")", ")" ]
29151c314deb89746fd674f27f6ce54b77603189
train
get_logx
r"""Returns a logx vector showing the expected or simulated logx positions of points. The shrinkage factor between two points .. math:: t_i = X_{i-1} / X_{i} is distributed as the largest of :math:`n_i` uniform random variables between 1 and 0, where :math:`n_i` is the local number of live points...
nestcheck/ns_run_utils.py
def get_logx(nlive, simulate=False): r"""Returns a logx vector showing the expected or simulated logx positions of points. The shrinkage factor between two points .. math:: t_i = X_{i-1} / X_{i} is distributed as the largest of :math:`n_i` uniform random variables between 1 and 0, where :math...
def get_logx(nlive, simulate=False): r"""Returns a logx vector showing the expected or simulated logx positions of points. The shrinkage factor between two points .. math:: t_i = X_{i-1} / X_{i} is distributed as the largest of :math:`n_i` uniform random variables between 1 and 0, where :math...
[ "r", "Returns", "a", "logx", "vector", "showing", "the", "expected", "or", "simulated", "logx", "positions", "of", "points", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L359-L396
[ "def", "get_logx", "(", "nlive", ",", "simulate", "=", "False", ")", ":", "assert", "nlive", ".", "min", "(", ")", ">", "0", ",", "(", "'nlive contains zeros or negative values! nlive = '", "+", "str", "(", "nlive", ")", ")", "if", "simulate", ":", "logx_s...
29151c314deb89746fd674f27f6ce54b77603189
train
log_subtract
r"""Numerically stable method for avoiding overflow errors when calculating :math:`\log (a-b)`, given :math:`\log (a)`, :math:`\log (a)` and that :math:`a > b`. See https://hips.seas.harvard.edu/blog/2013/01/09/computing-log-sum-exp/ for more details. Parameters ---------- loga: float ...
nestcheck/ns_run_utils.py
def log_subtract(loga, logb): r"""Numerically stable method for avoiding overflow errors when calculating :math:`\log (a-b)`, given :math:`\log (a)`, :math:`\log (a)` and that :math:`a > b`. See https://hips.seas.harvard.edu/blog/2013/01/09/computing-log-sum-exp/ for more details. Parameters ...
def log_subtract(loga, logb): r"""Numerically stable method for avoiding overflow errors when calculating :math:`\log (a-b)`, given :math:`\log (a)`, :math:`\log (a)` and that :math:`a > b`. See https://hips.seas.harvard.edu/blog/2013/01/09/computing-log-sum-exp/ for more details. Parameters ...
[ "r", "Numerically", "stable", "method", "for", "avoiding", "overflow", "errors", "when", "calculating", ":", "math", ":", "\\", "log", "(", "a", "-", "b", ")", "given", ":", "math", ":", "\\", "log", "(", "a", ")", ":", "math", ":", "\\", "log", "(...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L399-L417
[ "def", "log_subtract", "(", "loga", ",", "logb", ")", ":", "return", "loga", "+", "np", ".", "log", "(", "1", "-", "np", ".", "exp", "(", "logb", "-", "loga", ")", ")" ]
29151c314deb89746fd674f27f6ce54b77603189
train
check_ns_run
Checks a nestcheck format nested sampling run dictionary has the expected properties (see the data_processing module docstring for more details). Parameters ---------- run: dict nested sampling run to check. dup_assert: bool, optional See check_ns_run_logls docstring. dup_wa...
nestcheck/ns_run_utils.py
def check_ns_run(run, dup_assert=False, dup_warn=False): """Checks a nestcheck format nested sampling run dictionary has the expected properties (see the data_processing module docstring for more details). Parameters ---------- run: dict nested sampling run to check. dup_assert: boo...
def check_ns_run(run, dup_assert=False, dup_warn=False): """Checks a nestcheck format nested sampling run dictionary has the expected properties (see the data_processing module docstring for more details). Parameters ---------- run: dict nested sampling run to check. dup_assert: boo...
[ "Checks", "a", "nestcheck", "format", "nested", "sampling", "run", "dictionary", "has", "the", "expected", "properties", "(", "see", "the", "data_processing", "module", "docstring", "for", "more", "details", ")", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L424-L447
[ "def", "check_ns_run", "(", "run", ",", "dup_assert", "=", "False", ",", "dup_warn", "=", "False", ")", ":", "assert", "isinstance", "(", "run", ",", "dict", ")", "check_ns_run_members", "(", "run", ")", "check_ns_run_logls", "(", "run", ",", "dup_assert", ...
29151c314deb89746fd674f27f6ce54b77603189
train
check_ns_run_members
Check nested sampling run member keys and values. Parameters ---------- run: dict nested sampling run to check. Raises ------ AssertionError if run does not have expected properties.
nestcheck/ns_run_utils.py
def check_ns_run_members(run): """Check nested sampling run member keys and values. Parameters ---------- run: dict nested sampling run to check. Raises ------ AssertionError if run does not have expected properties. """ run_keys = list(run.keys()) # Mandatory k...
def check_ns_run_members(run): """Check nested sampling run member keys and values. Parameters ---------- run: dict nested sampling run to check. Raises ------ AssertionError if run does not have expected properties. """ run_keys = list(run.keys()) # Mandatory k...
[ "Check", "nested", "sampling", "run", "member", "keys", "and", "values", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L450-L487
[ "def", "check_ns_run_members", "(", "run", ")", ":", "run_keys", "=", "list", "(", "run", ".", "keys", "(", ")", ")", "# Mandatory keys", "for", "key", "in", "[", "'logl'", ",", "'nlive_array'", ",", "'theta'", ",", "'thread_labels'", ",", "'thread_min_max'"...
29151c314deb89746fd674f27f6ce54b77603189
train
check_ns_run_logls
Check run logls are unique and in the correct order. Parameters ---------- run: dict nested sampling run to check. dup_assert: bool, optional Whether to raise and AssertionError if there are duplicate logl values. dup_warn: bool, optional Whether to give a UserWarning if the...
nestcheck/ns_run_utils.py
def check_ns_run_logls(run, dup_assert=False, dup_warn=False): """Check run logls are unique and in the correct order. Parameters ---------- run: dict nested sampling run to check. dup_assert: bool, optional Whether to raise and AssertionError if there are duplicate logl values. ...
def check_ns_run_logls(run, dup_assert=False, dup_warn=False): """Check run logls are unique and in the correct order. Parameters ---------- run: dict nested sampling run to check. dup_assert: bool, optional Whether to raise and AssertionError if there are duplicate logl values. ...
[ "Check", "run", "logls", "are", "unique", "and", "in", "the", "correct", "order", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L490-L523
[ "def", "check_ns_run_logls", "(", "run", ",", "dup_assert", "=", "False", ",", "dup_warn", "=", "False", ")", ":", "assert", "np", ".", "array_equal", "(", "run", "[", "'logl'", "]", ",", "run", "[", "'logl'", "]", "[", "np", ".", "argsort", "(", "ru...
29151c314deb89746fd674f27f6ce54b77603189
train
check_ns_run_threads
Check thread labels and thread_min_max have expected properties. Parameters ---------- run: dict Nested sampling run to check. Raises ------ AssertionError If run does not have expected properties.
nestcheck/ns_run_utils.py
def check_ns_run_threads(run): """Check thread labels and thread_min_max have expected properties. Parameters ---------- run: dict Nested sampling run to check. Raises ------ AssertionError If run does not have expected properties. """ assert run['thread_labels'].dt...
def check_ns_run_threads(run): """Check thread labels and thread_min_max have expected properties. Parameters ---------- run: dict Nested sampling run to check. Raises ------ AssertionError If run does not have expected properties. """ assert run['thread_labels'].dt...
[ "Check", "thread", "labels", "and", "thread_min_max", "have", "expected", "properties", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L526-L557
[ "def", "check_ns_run_threads", "(", "run", ")", ":", "assert", "run", "[", "'thread_labels'", "]", ".", "dtype", "==", "int", "uniq_th", "=", "np", ".", "unique", "(", "run", "[", "'thread_labels'", "]", ")", "assert", "np", ".", "array_equal", "(", "np"...
29151c314deb89746fd674f27f6ce54b77603189
train
count_samples
r"""Number of samples in run. Unlike most estimators this does not require log weights, but for convenience will not throw an error if they are specified. Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). R...
nestcheck/estimators.py
def count_samples(ns_run, **kwargs): r"""Number of samples in run. Unlike most estimators this does not require log weights, but for convenience will not throw an error if they are specified. Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module ...
def count_samples(ns_run, **kwargs): r"""Number of samples in run. Unlike most estimators this does not require log weights, but for convenience will not throw an error if they are specified. Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module ...
[ "r", "Number", "of", "samples", "in", "run", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/estimators.py#L32-L52
[ "def", "count_samples", "(", "ns_run", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "pop", "(", "'logw'", ",", "None", ")", "kwargs", ".", "pop", "(", "'simulate'", ",", "None", ")", "if", "kwargs", ":", "raise", "TypeError", "(", "'Unexpected **k...
29151c314deb89746fd674f27f6ce54b77603189
train
logz
r"""Natural log of Bayesian evidence :math:`\log \mathcal{Z}`. Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log weights of samples. simulate: bool, optional ...
nestcheck/estimators.py
def logz(ns_run, logw=None, simulate=False): r"""Natural log of Bayesian evidence :math:`\log \mathcal{Z}`. Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log wei...
def logz(ns_run, logw=None, simulate=False): r"""Natural log of Bayesian evidence :math:`\log \mathcal{Z}`. Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log wei...
[ "r", "Natural", "log", "of", "Bayesian", "evidence", ":", "math", ":", "\\", "log", "\\", "mathcal", "{", "Z", "}", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/estimators.py#L55-L75
[ "def", "logz", "(", "ns_run", ",", "logw", "=", "None", ",", "simulate", "=", "False", ")", ":", "if", "logw", "is", "None", ":", "logw", "=", "nestcheck", ".", "ns_run_utils", ".", "get_logw", "(", "ns_run", ",", "simulate", "=", "simulate", ")", "r...
29151c314deb89746fd674f27f6ce54b77603189
train
evidence
r"""Bayesian evidence :math:`\log \mathcal{Z}`. Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log weights of samples. simulate: bool, optional Passed to ...
nestcheck/estimators.py
def evidence(ns_run, logw=None, simulate=False): r"""Bayesian evidence :math:`\log \mathcal{Z}`. Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log weights of sam...
def evidence(ns_run, logw=None, simulate=False): r"""Bayesian evidence :math:`\log \mathcal{Z}`. Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log weights of sam...
[ "r", "Bayesian", "evidence", ":", "math", ":", "\\", "log", "\\", "mathcal", "{", "Z", "}", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/estimators.py#L78-L98
[ "def", "evidence", "(", "ns_run", ",", "logw", "=", "None", ",", "simulate", "=", "False", ")", ":", "if", "logw", "is", "None", ":", "logw", "=", "nestcheck", ".", "ns_run_utils", ".", "get_logw", "(", "ns_run", ",", "simulate", "=", "simulate", ")", ...
29151c314deb89746fd674f27f6ce54b77603189
train
param_mean
Mean of a single parameter (single component of theta). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log weights of samples. simulate: bool, optional Pa...
nestcheck/estimators.py
def param_mean(ns_run, logw=None, simulate=False, param_ind=0, handle_indexerror=False): """Mean of a single parameter (single component of theta). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). ...
def param_mean(ns_run, logw=None, simulate=False, param_ind=0, handle_indexerror=False): """Mean of a single parameter (single component of theta). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). ...
[ "Mean", "of", "a", "single", "parameter", "(", "single", "component", "of", "theta", ")", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/estimators.py#L101-L138
[ "def", "param_mean", "(", "ns_run", ",", "logw", "=", "None", ",", "simulate", "=", "False", ",", "param_ind", "=", "0", ",", "handle_indexerror", "=", "False", ")", ":", "if", "logw", "is", "None", ":", "logw", "=", "nestcheck", ".", "ns_run_utils", "...
29151c314deb89746fd674f27f6ce54b77603189
train
param_cred
One-tailed credible interval on the value of a single parameter (component of theta). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log weights of samples. s...
nestcheck/estimators.py
def param_cred(ns_run, logw=None, simulate=False, probability=0.5, param_ind=0): """One-tailed credible interval on the value of a single parameter (component of theta). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstr...
def param_cred(ns_run, logw=None, simulate=False, probability=0.5, param_ind=0): """One-tailed credible interval on the value of a single parameter (component of theta). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstr...
[ "One", "-", "tailed", "credible", "interval", "on", "the", "value", "of", "a", "single", "parameter", "(", "component", "of", "theta", ")", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/estimators.py#L141-L173
[ "def", "param_cred", "(", "ns_run", ",", "logw", "=", "None", ",", "simulate", "=", "False", ",", "probability", "=", "0.5", ",", "param_ind", "=", "0", ")", ":", "if", "logw", "is", "None", ":", "logw", "=", "nestcheck", ".", "ns_run_utils", ".", "g...
29151c314deb89746fd674f27f6ce54b77603189
train
param_squared_mean
Mean of the square of single parameter (second moment of its posterior distribution). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log weights of samples. s...
nestcheck/estimators.py
def param_squared_mean(ns_run, logw=None, simulate=False, param_ind=0): """Mean of the square of single parameter (second moment of its posterior distribution). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). ...
def param_squared_mean(ns_run, logw=None, simulate=False, param_ind=0): """Mean of the square of single parameter (second moment of its posterior distribution). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). ...
[ "Mean", "of", "the", "square", "of", "single", "parameter", "(", "second", "moment", "of", "its", "posterior", "distribution", ")", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/estimators.py#L176-L203
[ "def", "param_squared_mean", "(", "ns_run", ",", "logw", "=", "None", ",", "simulate", "=", "False", ",", "param_ind", "=", "0", ")", ":", "if", "logw", "is", "None", ":", "logw", "=", "nestcheck", ".", "ns_run_utils", ".", "get_logw", "(", "ns_run", "...
29151c314deb89746fd674f27f6ce54b77603189
train
r_mean
Mean of the radial coordinate (magnitude of theta vector). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log weights of samples. simulate: bool, optional ...
nestcheck/estimators.py
def r_mean(ns_run, logw=None, simulate=False): """Mean of the radial coordinate (magnitude of theta vector). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log we...
def r_mean(ns_run, logw=None, simulate=False): """Mean of the radial coordinate (magnitude of theta vector). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log we...
[ "Mean", "of", "the", "radial", "coordinate", "(", "magnitude", "of", "theta", "vector", ")", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/estimators.py#L206-L228
[ "def", "r_mean", "(", "ns_run", ",", "logw", "=", "None", ",", "simulate", "=", "False", ")", ":", "if", "logw", "is", "None", ":", "logw", "=", "nestcheck", ".", "ns_run_utils", ".", "get_logw", "(", "ns_run", ",", "simulate", "=", "simulate", ")", ...
29151c314deb89746fd674f27f6ce54b77603189
train
r_cred
One-tailed credible interval on the value of the radial coordinate (magnitude of theta vector). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details). logw: None or 1d numpy array, optional Log weights of samp...
nestcheck/estimators.py
def r_cred(ns_run, logw=None, simulate=False, probability=0.5): """One-tailed credible interval on the value of the radial coordinate (magnitude of theta vector). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details)....
def r_cred(ns_run, logw=None, simulate=False, probability=0.5): """One-tailed credible interval on the value of the radial coordinate (magnitude of theta vector). Parameters ---------- ns_run: dict Nested sampling run dict (see the data_processing module docstring for more details)....
[ "One", "-", "tailed", "credible", "interval", "on", "the", "value", "of", "the", "radial", "coordinate", "(", "magnitude", "of", "theta", "vector", ")", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/estimators.py#L231-L258
[ "def", "r_cred", "(", "ns_run", ",", "logw", "=", "None", ",", "simulate", "=", "False", ",", "probability", "=", "0.5", ")", ":", "if", "logw", "is", "None", ":", "logw", "=", "nestcheck", ".", "ns_run_utils", ".", "get_logw", "(", "ns_run", ",", "s...
29151c314deb89746fd674f27f6ce54b77603189
train
get_latex_name
Produce a latex formatted name for each function for use in labelling results. Parameters ---------- func_in: function kwargs: dict, optional Kwargs for function. Returns ------- latex_name: str Latex formatted name for the function.
nestcheck/estimators.py
def get_latex_name(func_in, **kwargs): """ Produce a latex formatted name for each function for use in labelling results. Parameters ---------- func_in: function kwargs: dict, optional Kwargs for function. Returns ------- latex_name: str Latex formatted name for...
def get_latex_name(func_in, **kwargs): """ Produce a latex formatted name for each function for use in labelling results. Parameters ---------- func_in: function kwargs: dict, optional Kwargs for function. Returns ------- latex_name: str Latex formatted name for...
[ "Produce", "a", "latex", "formatted", "name", "for", "each", "function", "for", "use", "in", "labelling", "results", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/estimators.py#L265-L316
[ "def", "get_latex_name", "(", "func_in", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "func_in", ",", "functools", ".", "partial", ")", ":", "func", "=", "func_in", ".", "func", "assert", "not", "set", "(", "func_in", ".", "keywords", ")...
29151c314deb89746fd674f27f6ce54b77603189
train
weighted_quantile
Get quantile estimate for input probability given weighted samples using linear interpolation. Parameters ---------- probability: float Quantile to estimate - must be in open interval (0, 1). For example, use 0.5 for the median and 0.84 for the upper 84% quantile. values: 1d...
nestcheck/estimators.py
def weighted_quantile(probability, values, weights): """ Get quantile estimate for input probability given weighted samples using linear interpolation. Parameters ---------- probability: float Quantile to estimate - must be in open interval (0, 1). For example, use 0.5 for the m...
def weighted_quantile(probability, values, weights): """ Get quantile estimate for input probability given weighted samples using linear interpolation. Parameters ---------- probability: float Quantile to estimate - must be in open interval (0, 1). For example, use 0.5 for the m...
[ "Get", "quantile", "estimate", "for", "input", "probability", "given", "weighted", "samples", "using", "linear", "interpolation", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/estimators.py#L319-L347
[ "def", "weighted_quantile", "(", "probability", ",", "values", ",", "weights", ")", ":", "assert", "1", ">", "probability", ">", "0", ",", "(", "'credible interval prob= '", "+", "str", "(", "probability", ")", "+", "' not in (0, 1)'", ")", "assert", "values",...
29151c314deb89746fd674f27f6ce54b77603189
train
write_run_output
Writes PolyChord output files corresponding to the input nested sampling run. The file root is .. code-block:: python root = os.path.join(run['output']['base_dir'], run['output']['file_root']) Output files which can be made with this function (see the PolyChord doc...
nestcheck/write_polychord_output.py
def write_run_output(run, **kwargs): """Writes PolyChord output files corresponding to the input nested sampling run. The file root is .. code-block:: python root = os.path.join(run['output']['base_dir'], run['output']['file_root']) Output files which can be made w...
def write_run_output(run, **kwargs): """Writes PolyChord output files corresponding to the input nested sampling run. The file root is .. code-block:: python root = os.path.join(run['output']['base_dir'], run['output']['file_root']) Output files which can be made w...
[ "Writes", "PolyChord", "output", "files", "corresponding", "to", "the", "input", "nested", "sampling", "run", ".", "The", "file", "root", "is" ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/write_polychord_output.py#L16-L115
[ "def", "write_run_output", "(", "run", ",", "*", "*", "kwargs", ")", ":", "write_dead", "=", "kwargs", ".", "pop", "(", "'write_dead'", ",", "True", ")", "write_stats", "=", "kwargs", ".", "pop", "(", "'write_stats'", ",", "True", ")", "posteriors", "=",...
29151c314deb89746fd674f27f6ce54b77603189
train
run_dead_birth_array
Converts input run into an array of the format of a PolyChord <root>_dead-birth.txt file. Note that this in fact includes live points remaining at termination as well as dead points. Parameters ---------- ns_run: dict Nested sampling run dict (see data_processing module docstring for more ...
nestcheck/write_polychord_output.py
def run_dead_birth_array(run, **kwargs): """Converts input run into an array of the format of a PolyChord <root>_dead-birth.txt file. Note that this in fact includes live points remaining at termination as well as dead points. Parameters ---------- ns_run: dict Nested sampling run dict ...
def run_dead_birth_array(run, **kwargs): """Converts input run into an array of the format of a PolyChord <root>_dead-birth.txt file. Note that this in fact includes live points remaining at termination as well as dead points. Parameters ---------- ns_run: dict Nested sampling run dict ...
[ "Converts", "input", "run", "into", "an", "array", "of", "the", "format", "of", "a", "PolyChord", "<root", ">", "_dead", "-", "birth", ".", "txt", "file", ".", "Note", "that", "this", "in", "fact", "includes", "live", "points", "remaining", "at", "termin...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/write_polychord_output.py#L118-L154
[ "def", "run_dead_birth_array", "(", "run", ",", "*", "*", "kwargs", ")", ":", "nestcheck", ".", "ns_run_utils", ".", "check_ns_run", "(", "run", ",", "*", "*", "kwargs", ")", "threads", "=", "nestcheck", ".", "ns_run_utils", ".", "get_run_threads", "(", "r...
29151c314deb89746fd674f27f6ce54b77603189
train
write_stats_file
Writes a dummy PolyChord format .stats file for tests functions for processing stats files. This is written to: base_dir/file_root.stats Also returns the data in the file as a dict for comparison. Parameters ---------- run_output_dict: dict Output information to write to .stats file. ...
nestcheck/write_polychord_output.py
def write_stats_file(run_output_dict): """Writes a dummy PolyChord format .stats file for tests functions for processing stats files. This is written to: base_dir/file_root.stats Also returns the data in the file as a dict for comparison. Parameters ---------- run_output_dict: dict ...
def write_stats_file(run_output_dict): """Writes a dummy PolyChord format .stats file for tests functions for processing stats files. This is written to: base_dir/file_root.stats Also returns the data in the file as a dict for comparison. Parameters ---------- run_output_dict: dict ...
[ "Writes", "a", "dummy", "PolyChord", "format", ".", "stats", "file", "for", "tests", "functions", "for", "processing", "stats", "files", ".", "This", "is", "written", "to", ":" ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/write_polychord_output.py#L157-L248
[ "def", "write_stats_file", "(", "run_output_dict", ")", ":", "mandatory_keys", "=", "[", "'file_root'", ",", "'base_dir'", "]", "for", "key", "in", "mandatory_keys", ":", "assert", "key", "in", "run_output_dict", ",", "key", "+", "' not in run_output_dict'", "defa...
29151c314deb89746fd674f27f6ce54b77603189
train
run_list_error_values
Gets a data frame with calculation values and error diagnostics for each run in the input run list. NB when parallelised the results will not be produced in order (so results from some run number will not nessesarily correspond to that number run in run_list). Parameters ---------- run_lis...
nestcheck/diagnostics_tables.py
def run_list_error_values(run_list, estimator_list, estimator_names, n_simulate=100, **kwargs): """Gets a data frame with calculation values and error diagnostics for each run in the input run list. NB when parallelised the results will not be produced in order (so results fro...
def run_list_error_values(run_list, estimator_list, estimator_names, n_simulate=100, **kwargs): """Gets a data frame with calculation values and error diagnostics for each run in the input run list. NB when parallelised the results will not be produced in order (so results fro...
[ "Gets", "a", "data", "frame", "with", "calculation", "values", "and", "error", "diagnostics", "for", "each", "run", "in", "the", "input", "run", "list", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/diagnostics_tables.py#L17-L119
[ "def", "run_list_error_values", "(", "run_list", ",", "estimator_list", ",", "estimator_names", ",", "n_simulate", "=", "100", ",", "*", "*", "kwargs", ")", ":", "thread_pvalue", "=", "kwargs", ".", "pop", "(", "'thread_pvalue'", ",", "False", ")", "bs_stat_di...
29151c314deb89746fd674f27f6ce54b77603189
train
estimator_values_df
Get a dataframe of estimator values. NB when parallelised the results will not be produced in order (so results from some run number will not nessesarily correspond to that number run in run_list). Parameters ---------- run_list: list of dicts List of nested sampling run dicts. est...
nestcheck/diagnostics_tables.py
def estimator_values_df(run_list, estimator_list, **kwargs): """Get a dataframe of estimator values. NB when parallelised the results will not be produced in order (so results from some run number will not nessesarily correspond to that number run in run_list). Parameters ---------- run_li...
def estimator_values_df(run_list, estimator_list, **kwargs): """Get a dataframe of estimator values. NB when parallelised the results will not be produced in order (so results from some run number will not nessesarily correspond to that number run in run_list). Parameters ---------- run_li...
[ "Get", "a", "dataframe", "of", "estimator", "values", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/diagnostics_tables.py#L123-L169
[ "def", "estimator_values_df", "(", "run_list", ",", "estimator_list", ",", "*", "*", "kwargs", ")", ":", "estimator_names", "=", "kwargs", ".", "pop", "(", "'estimator_names'", ",", "[", "'est_'", "+", "str", "(", "i", ")", "for", "i", "in", "range", "("...
29151c314deb89746fd674f27f6ce54b77603189
train
error_values_summary
Get summary statistics about calculation errors, including estimated implementation errors. Parameters ---------- error_values: pandas DataFrame Of format output by run_list_error_values (look at it for more details). summary_df_kwargs: dict, optional See pandas_functions.su...
nestcheck/diagnostics_tables.py
def error_values_summary(error_values, **summary_df_kwargs): """Get summary statistics about calculation errors, including estimated implementation errors. Parameters ---------- error_values: pandas DataFrame Of format output by run_list_error_values (look at it for more details). ...
def error_values_summary(error_values, **summary_df_kwargs): """Get summary statistics about calculation errors, including estimated implementation errors. Parameters ---------- error_values: pandas DataFrame Of format output by run_list_error_values (look at it for more details). ...
[ "Get", "summary", "statistics", "about", "calculation", "errors", "including", "estimated", "implementation", "errors", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/diagnostics_tables.py#L172-L228
[ "def", "error_values_summary", "(", "error_values", ",", "*", "*", "summary_df_kwargs", ")", ":", "df", "=", "pf", ".", "summary_df_from_multi", "(", "error_values", ",", "*", "*", "summary_df_kwargs", ")", "# get implementation stds", "imp_std", ",", "imp_std_unc",...
29151c314deb89746fd674f27f6ce54b77603189
train
run_list_error_summary
Wrapper which runs run_list_error_values then applies error_values summary to the resulting dataframe. See the docstrings for those two funcions for more details and for descriptions of parameters and output.
nestcheck/diagnostics_tables.py
def run_list_error_summary(run_list, estimator_list, estimator_names, n_simulate, **kwargs): """Wrapper which runs run_list_error_values then applies error_values summary to the resulting dataframe. See the docstrings for those two funcions for more details and for descriptions of...
def run_list_error_summary(run_list, estimator_list, estimator_names, n_simulate, **kwargs): """Wrapper which runs run_list_error_values then applies error_values summary to the resulting dataframe. See the docstrings for those two funcions for more details and for descriptions of...
[ "Wrapper", "which", "runs", "run_list_error_values", "then", "applies", "error_values", "summary", "to", "the", "resulting", "dataframe", ".", "See", "the", "docstrings", "for", "those", "two", "funcions", "for", "more", "details", "and", "for", "descriptions", "o...
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/diagnostics_tables.py#L231-L244
[ "def", "run_list_error_summary", "(", "run_list", ",", "estimator_list", ",", "estimator_names", ",", "n_simulate", ",", "*", "*", "kwargs", ")", ":", "true_values", "=", "kwargs", ".", "pop", "(", "'true_values'", ",", "None", ")", "include_true_values", "=", ...
29151c314deb89746fd674f27f6ce54b77603189
train
bs_values_df
Computes a data frame of bootstrap resampled values. Parameters ---------- run_list: list of dicts List of nested sampling run dicts. estimator_list: list of functions Estimators to apply to runs. estimator_names: list of strs Name of each func in estimator_list. n_simul...
nestcheck/diagnostics_tables.py
def bs_values_df(run_list, estimator_list, estimator_names, n_simulate, **kwargs): """Computes a data frame of bootstrap resampled values. Parameters ---------- run_list: list of dicts List of nested sampling run dicts. estimator_list: list of functions Estimators t...
def bs_values_df(run_list, estimator_list, estimator_names, n_simulate, **kwargs): """Computes a data frame of bootstrap resampled values. Parameters ---------- run_list: list of dicts List of nested sampling run dicts. estimator_list: list of functions Estimators t...
[ "Computes", "a", "data", "frame", "of", "bootstrap", "resampled", "values", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/diagnostics_tables.py#L247-L288
[ "def", "bs_values_df", "(", "run_list", ",", "estimator_list", ",", "estimator_names", ",", "n_simulate", ",", "*", "*", "kwargs", ")", ":", "tqdm_kwargs", "=", "kwargs", ".", "pop", "(", "'tqdm_kwargs'", ",", "{", "'desc'", ":", "'bs values'", "}", ")", "...
29151c314deb89746fd674f27f6ce54b77603189
train
thread_values_df
Calculates estimator values for the constituent threads of the input runs. Parameters ---------- run_list: list of dicts List of nested sampling run dicts. estimator_list: list of functions Estimators to apply to runs. estimator_names: list of strs Name of each func in e...
nestcheck/diagnostics_tables.py
def thread_values_df(run_list, estimator_list, estimator_names, **kwargs): """Calculates estimator values for the constituent threads of the input runs. Parameters ---------- run_list: list of dicts List of nested sampling run dicts. estimator_list: list of functions Estimators ...
def thread_values_df(run_list, estimator_list, estimator_names, **kwargs): """Calculates estimator values for the constituent threads of the input runs. Parameters ---------- run_list: list of dicts List of nested sampling run dicts. estimator_list: list of functions Estimators ...
[ "Calculates", "estimator", "values", "for", "the", "constituent", "threads", "of", "the", "input", "runs", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/diagnostics_tables.py#L291-L331
[ "def", "thread_values_df", "(", "run_list", ",", "estimator_list", ",", "estimator_names", ",", "*", "*", "kwargs", ")", ":", "tqdm_kwargs", "=", "kwargs", ".", "pop", "(", "'tqdm_kwargs'", ",", "{", "'desc'", ":", "'thread values'", "}", ")", "assert", "len...
29151c314deb89746fd674f27f6ce54b77603189
train
pairwise_dists_on_cols
Computes pairwise statistical distance measures. parameters ---------- df_in: pandas data frame Columns represent estimators and rows represent runs. Each data frane element is an array of values which are used as samples in the distance measures. earth_mover_dist: bool, optiona...
nestcheck/diagnostics_tables.py
def pairwise_dists_on_cols(df_in, earth_mover_dist=True, energy_dist=True): """Computes pairwise statistical distance measures. parameters ---------- df_in: pandas data frame Columns represent estimators and rows represent runs. Each data frane element is an array of values which are us...
def pairwise_dists_on_cols(df_in, earth_mover_dist=True, energy_dist=True): """Computes pairwise statistical distance measures. parameters ---------- df_in: pandas data frame Columns represent estimators and rows represent runs. Each data frane element is an array of values which are us...
[ "Computes", "pairwise", "statistical", "distance", "measures", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/diagnostics_tables.py#L334-L357
[ "def", "pairwise_dists_on_cols", "(", "df_in", ",", "earth_mover_dist", "=", "True", ",", "energy_dist", "=", "True", ")", ":", "df", "=", "pd", ".", "DataFrame", "(", ")", "for", "col", "in", "df_in", ".", "columns", ":", "df", "[", "col", "]", "=", ...
29151c314deb89746fd674f27f6ce54b77603189
train
DictMySQL._backtick_columns
Quote the column names
dictmysql.py
def _backtick_columns(cols): """ Quote the column names """ def bt(s): b = '' if s == '*' or not s else '`' return [_ for _ in [b + (s or '') + b] if _] formatted = [] for c in cols: if c[0] == '#': formatted.append(c[1...
def _backtick_columns(cols): """ Quote the column names """ def bt(s): b = '' if s == '*' or not s else '`' return [_ for _ in [b + (s or '') + b] if _] formatted = [] for c in cols: if c[0] == '#': formatted.append(c[1...
[ "Quote", "the", "column", "names" ]
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L49-L68
[ "def", "_backtick_columns", "(", "cols", ")", ":", "def", "bt", "(", "s", ")", ":", "b", "=", "''", "if", "s", "==", "'*'", "or", "not", "s", "else", "'`'", "return", "[", "_", "for", "_", "in", "[", "b", "+", "(", "s", "or", "''", ")", "+"...
f40d649193ccf58d1c7933189be1042b37afbe31
train
DictMySQL._value_parser
Input: {'c1': 'v', 'c2': None, '#c3': 'uuid()'} Output: ('%s, %s, uuid()', [None, 'v']) # insert; columnname=False ('`c2` = %s, `c1` = %s, `c3` = uuid()', [None, 'v']) # update; columnname=True No need to transform NULL value since it's supported in exe...
dictmysql.py
def _value_parser(self, value, columnname=False, placeholder='%s'): """ Input: {'c1': 'v', 'c2': None, '#c3': 'uuid()'} Output: ('%s, %s, uuid()', [None, 'v']) # insert; columnname=False ('`c2` = %s, `c1` = %s, `c3` = uuid()', [None, 'v']) # upd...
def _value_parser(self, value, columnname=False, placeholder='%s'): """ Input: {'c1': 'v', 'c2': None, '#c3': 'uuid()'} Output: ('%s, %s, uuid()', [None, 'v']) # insert; columnname=False ('`c2` = %s, `c1` = %s, `c3` = uuid()', [None, 'v']) # upd...
[ "Input", ":", "{", "c1", ":", "v", "c2", ":", "None", "#c3", ":", "uuid", "()", "}", "Output", ":", "(", "%s", "%s", "uuid", "()", "[", "None", "v", "]", ")", "#", "insert", ";", "columnname", "=", "False", "(", "c2", "=", "%s", "c1", "=", ...
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L99-L117
[ "def", "_value_parser", "(", "self", ",", "value", ",", "columnname", "=", "False", ",", "placeholder", "=", "'%s'", ")", ":", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "raise", "TypeError", "(", "'Input value should be a dictionary'", ...
f40d649193ccf58d1c7933189be1042b37afbe31
train
DictMySQL._by_columns
Allow select.group and select.order accepting string and list
dictmysql.py
def _by_columns(self, columns): """ Allow select.group and select.order accepting string and list """ return columns if self.isstr(columns) else self._backtick_columns(columns)
def _by_columns(self, columns): """ Allow select.group and select.order accepting string and list """ return columns if self.isstr(columns) else self._backtick_columns(columns)
[ "Allow", "select", ".", "group", "and", "select", ".", "order", "accepting", "string", "and", "list" ]
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L299-L303
[ "def", "_by_columns", "(", "self", ",", "columns", ")", ":", "return", "columns", "if", "self", ".", "isstr", "(", "columns", ")", "else", "self", ".", "_backtick_columns", "(", "columns", ")" ]
f40d649193ccf58d1c7933189be1042b37afbe31
train
DictMySQL.select
:type table: string :type columns: list :type join: dict :param join: {'[>]table1(t1)': {'user.id': 't1.user_id'}} -> "LEFT JOIN table AS t1 ON user.id = t1.user_id" :type where: dict :type group: string|list :type having: string :type order: string|list :...
dictmysql.py
def select(self, table, columns=None, join=None, where=None, group=None, having=None, order=None, limit=None, iterator=False, fetch=True): """ :type table: string :type columns: list :type join: dict :param join: {'[>]table1(t1)': {'user.id': 't1.user_id'}} -> "LEF...
def select(self, table, columns=None, join=None, where=None, group=None, having=None, order=None, limit=None, iterator=False, fetch=True): """ :type table: string :type columns: list :type join: dict :param join: {'[>]table1(t1)': {'user.id': 't1.user_id'}} -> "LEF...
[ ":", "type", "table", ":", "string", ":", "type", "columns", ":", "list", ":", "type", "join", ":", "dict", ":", "param", "join", ":", "{", "[", ">", "]", "table1", "(", "t1", ")", ":", "{", "user", ".", "id", ":", "t1", ".", "user_id", "}}", ...
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L305-L353
[ "def", "select", "(", "self", ",", "table", ",", "columns", "=", "None", ",", "join", "=", "None", ",", "where", "=", "None", ",", "group", "=", "None", ",", "having", "=", "None", ",", "order", "=", "None", ",", "limit", "=", "None", ",", "itera...
f40d649193ccf58d1c7933189be1042b37afbe31
train
DictMySQL.select_page
:type limit: int :param limit: The max row number for each page :type offset: int :param offset: The starting position of the page :return:
dictmysql.py
def select_page(self, limit, offset=0, **kwargs): """ :type limit: int :param limit: The max row number for each page :type offset: int :param offset: The starting position of the page :return: """ start = offset while True: result = se...
def select_page(self, limit, offset=0, **kwargs): """ :type limit: int :param limit: The max row number for each page :type offset: int :param offset: The starting position of the page :return: """ start = offset while True: result = se...
[ ":", "type", "limit", ":", "int", ":", "param", "limit", ":", "The", "max", "row", "number", "for", "each", "page", ":", "type", "offset", ":", "int", ":", "param", "offset", ":", "The", "starting", "position", "of", "the", "page", ":", "return", ":"...
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L355-L372
[ "def", "select_page", "(", "self", ",", "limit", ",", "offset", "=", "0", ",", "*", "*", "kwargs", ")", ":", "start", "=", "offset", "while", "True", ":", "result", "=", "self", ".", "select", "(", "limit", "=", "[", "start", ",", "limit", "]", "...
f40d649193ccf58d1c7933189be1042b37afbe31
train
DictMySQL.get
A simplified method of select, for getting the first result in one column only. A common case of using this method is getting id. :type table: string :type column: str :type join: dict :type where: dict :type insert: bool :param insert: If insert==True, insert the...
dictmysql.py
def get(self, table, column, join=None, where=None, insert=False, ifnone=None): """ A simplified method of select, for getting the first result in one column only. A common case of using this method is getting id. :type table: string :type column: str :type join: dict ...
def get(self, table, column, join=None, where=None, insert=False, ifnone=None): """ A simplified method of select, for getting the first result in one column only. A common case of using this method is getting id. :type table: string :type column: str :type join: dict ...
[ "A", "simplified", "method", "of", "select", "for", "getting", "the", "first", "result", "in", "one", "column", "only", ".", "A", "common", "case", "of", "using", "this", "method", "is", "getting", "id", ".", ":", "type", "table", ":", "string", ":", "...
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L374-L406
[ "def", "get", "(", "self", ",", "table", ",", "column", ",", "join", "=", "None", ",", "where", "=", "None", ",", "insert", "=", "False", ",", "ifnone", "=", "None", ")", ":", "select_result", "=", "self", ".", "select", "(", "table", "=", "table",...
f40d649193ccf58d1c7933189be1042b37afbe31
train
DictMySQL.insert
Insert a dict into db. :type table: string :type value: dict :type ignore: bool :type commit: bool :return: int. The row id of the insert.
dictmysql.py
def insert(self, table, value, ignore=False, commit=True): """ Insert a dict into db. :type table: string :type value: dict :type ignore: bool :type commit: bool :return: int. The row id of the insert. """ value_q, _args = self._value_parser(value,...
def insert(self, table, value, ignore=False, commit=True): """ Insert a dict into db. :type table: string :type value: dict :type ignore: bool :type commit: bool :return: int. The row id of the insert. """ value_q, _args = self._value_parser(value,...
[ "Insert", "a", "dict", "into", "db", ".", ":", "type", "table", ":", "string", ":", "type", "value", ":", "dict", ":", "type", "ignore", ":", "bool", ":", "type", "commit", ":", "bool", ":", "return", ":", "int", ".", "The", "row", "id", "of", "t...
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L408-L427
[ "def", "insert", "(", "self", ",", "table", ",", "value", ",", "ignore", "=", "False", ",", "commit", "=", "True", ")", ":", "value_q", ",", "_args", "=", "self", ".", "_value_parser", "(", "value", ",", "columnname", "=", "False", ")", "_sql", "=", ...
f40d649193ccf58d1c7933189be1042b37afbe31
train
DictMySQL.upsert
:type table: string :type value: dict :type update_columns: list :param update_columns: specify the columns which will be updated if record exists :type commit: bool
dictmysql.py
def upsert(self, table, value, update_columns=None, commit=True): """ :type table: string :type value: dict :type update_columns: list :param update_columns: specify the columns which will be updated if record exists :type commit: bool """ if not isinstanc...
def upsert(self, table, value, update_columns=None, commit=True): """ :type table: string :type value: dict :type update_columns: list :param update_columns: specify the columns which will be updated if record exists :type commit: bool """ if not isinstanc...
[ ":", "type", "table", ":", "string", ":", "type", "value", ":", "dict", ":", "type", "update_columns", ":", "list", ":", "param", "update_columns", ":", "specify", "the", "columns", "which", "will", "be", "updated", "if", "record", "exists", ":", "type", ...
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L429-L456
[ "def", "upsert", "(", "self", ",", "table", ",", "value", ",", "update_columns", "=", "None", ",", "commit", "=", "True", ")", ":", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "raise", "TypeError", "(", "'Input value should be a diction...
f40d649193ccf58d1c7933189be1042b37afbe31
train
DictMySQL.insertmany
Insert multiple records within one query. :type table: string :type columns: list :type value: list|tuple :param value: Doesn't support MySQL functions :param value: Example: [(value1_column1, value1_column2,), ] :type ignore: bool :type commit: bool :retu...
dictmysql.py
def insertmany(self, table, columns, value, ignore=False, commit=True): """ Insert multiple records within one query. :type table: string :type columns: list :type value: list|tuple :param value: Doesn't support MySQL functions :param value: Example: [(value1_colu...
def insertmany(self, table, columns, value, ignore=False, commit=True): """ Insert multiple records within one query. :type table: string :type columns: list :type value: list|tuple :param value: Doesn't support MySQL functions :param value: Example: [(value1_colu...
[ "Insert", "multiple", "records", "within", "one", "query", ".", ":", "type", "table", ":", "string", ":", "type", "columns", ":", "list", ":", "type", "value", ":", "list|tuple", ":", "param", "value", ":", "Doesn", "t", "support", "MySQL", "functions", ...
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L458-L492
[ "def", "insertmany", "(", "self", ",", "table", ",", "columns", ",", "value", ",", "ignore", "=", "False", ",", "commit", "=", "True", ")", ":", "if", "not", "isinstance", "(", "value", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "TypeE...
f40d649193ccf58d1c7933189be1042b37afbe31
train
DictMySQL.update
:type table: string :type value: dict :type where: dict :type join: dict :type commit: bool
dictmysql.py
def update(self, table, value, where, join=None, commit=True): """ :type table: string :type value: dict :type where: dict :type join: dict :type commit: bool """ value_q, _value_args = self._value_parser(value, columnname=True) where_q, _where_a...
def update(self, table, value, where, join=None, commit=True): """ :type table: string :type value: dict :type where: dict :type join: dict :type commit: bool """ value_q, _value_args = self._value_parser(value, columnname=True) where_q, _where_a...
[ ":", "type", "table", ":", "string", ":", "type", "value", ":", "dict", ":", "type", "where", ":", "dict", ":", "type", "join", ":", "dict", ":", "type", "commit", ":", "bool" ]
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L494-L518
[ "def", "update", "(", "self", ",", "table", ",", "value", ",", "where", ",", "join", "=", "None", ",", "commit", "=", "True", ")", ":", "value_q", ",", "_value_args", "=", "self", ".", "_value_parser", "(", "value", ",", "columnname", "=", "True", ")...
f40d649193ccf58d1c7933189be1042b37afbe31
train
DictMySQL.delete
:type table: string :type where: dict :type commit: bool
dictmysql.py
def delete(self, table, where=None, commit=True): """ :type table: string :type where: dict :type commit: bool """ where_q, _args = self._where_parser(where) alias = self._tablename_parser(table)['alias'] _sql = ''.join(['DELETE ', ...
def delete(self, table, where=None, commit=True): """ :type table: string :type where: dict :type commit: bool """ where_q, _args = self._where_parser(where) alias = self._tablename_parser(table)['alias'] _sql = ''.join(['DELETE ', ...
[ ":", "type", "table", ":", "string", ":", "type", "where", ":", "dict", ":", "type", "commit", ":", "bool" ]
ligyxy/DictMySQL
python
https://github.com/ligyxy/DictMySQL/blob/f40d649193ccf58d1c7933189be1042b37afbe31/dictmysql.py#L520-L540
[ "def", "delete", "(", "self", ",", "table", ",", "where", "=", "None", ",", "commit", "=", "True", ")", ":", "where_q", ",", "_args", "=", "self", ".", "_where_parser", "(", "where", ")", "alias", "=", "self", ".", "_tablename_parser", "(", "table", ...
f40d649193ccf58d1c7933189be1042b37afbe31
train
get_whitespace
Returns a list containing the whitespace to the left and right of a string as its two elements
mwtemplates/templateeditor2.py
def get_whitespace(txt): """ Returns a list containing the whitespace to the left and right of a string as its two elements """ # if the entire parameter is whitespace rall = re.search(r'^([\s])+$', txt) if rall: tmp = txt.split('\n', 1) if len(tmp) == 2: return ...
def get_whitespace(txt): """ Returns a list containing the whitespace to the left and right of a string as its two elements """ # if the entire parameter is whitespace rall = re.search(r'^([\s])+$', txt) if rall: tmp = txt.split('\n', 1) if len(tmp) == 2: return ...
[ "Returns", "a", "list", "containing", "the", "whitespace", "to", "the", "left", "and", "right", "of", "a", "string", "as", "its", "two", "elements" ]
danmichaelo/mwtemplates
python
https://github.com/danmichaelo/mwtemplates/blob/4a57831ee32152eb6dea9d099cec478962782276/mwtemplates/templateeditor2.py#L89-L113
[ "def", "get_whitespace", "(", "txt", ")", ":", "# if the entire parameter is whitespace", "rall", "=", "re", ".", "search", "(", "r'^([\\s])+$'", ",", "txt", ")", "if", "rall", ":", "tmp", "=", "txt", ".", "split", "(", "'\\n'", ",", "1", ")", "if", "len...
4a57831ee32152eb6dea9d099cec478962782276
train
Parameters.find_whitespace_pattern
Try to find a whitespace pattern in the existing parameters to be applied to a newly added parameter
mwtemplates/templateeditor2.py
def find_whitespace_pattern(self): """ Try to find a whitespace pattern in the existing parameters to be applied to a newly added parameter """ name_ws = [] value_ws = [] for entry in self._entries: name_ws.append(get_whitespace(entry.name)) ...
def find_whitespace_pattern(self): """ Try to find a whitespace pattern in the existing parameters to be applied to a newly added parameter """ name_ws = [] value_ws = [] for entry in self._entries: name_ws.append(get_whitespace(entry.name)) ...
[ "Try", "to", "find", "a", "whitespace", "pattern", "in", "the", "existing", "parameters", "to", "be", "applied", "to", "a", "newly", "added", "parameter" ]
danmichaelo/mwtemplates
python
https://github.com/danmichaelo/mwtemplates/blob/4a57831ee32152eb6dea9d099cec478962782276/mwtemplates/templateeditor2.py#L323-L342
[ "def", "find_whitespace_pattern", "(", "self", ")", ":", "name_ws", "=", "[", "]", "value_ws", "=", "[", "]", "for", "entry", "in", "self", ".", "_entries", ":", "name_ws", ".", "append", "(", "get_whitespace", "(", "entry", ".", "name", ")", ")", "if"...
4a57831ee32152eb6dea9d099cec478962782276
train
DiskDataCache._path_for_file
Generate the path on disk for a specified project and date. :param project_name: the PyPI project name for the data :type project: str :param date: the date for the data :type date: datetime.datetime :return: path for where to store this data on disk :rtype: str
pypi_download_stats/diskdatacache.py
def _path_for_file(self, project_name, date): """ Generate the path on disk for a specified project and date. :param project_name: the PyPI project name for the data :type project: str :param date: the date for the data :type date: datetime.datetime :return: path...
def _path_for_file(self, project_name, date): """ Generate the path on disk for a specified project and date. :param project_name: the PyPI project name for the data :type project: str :param date: the date for the data :type date: datetime.datetime :return: path...
[ "Generate", "the", "path", "on", "disk", "for", "a", "specified", "project", "and", "date", "." ]
jantman/pypi-download-stats
python
https://github.com/jantman/pypi-download-stats/blob/44a7a6bbcd61a9e7f02bd02c52584a98183f80c5/pypi_download_stats/diskdatacache.py#L66-L80
[ "def", "_path_for_file", "(", "self", ",", "project_name", ",", "date", ")", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "cache_path", ",", "'%s_%s.json'", "%", "(", "project_name", ",", "date", ".", "strftime", "(", "'%Y%m%d'", ")",...
44a7a6bbcd61a9e7f02bd02c52584a98183f80c5
train
DiskDataCache.get
Get the cache data for a specified project for the specified date. Returns None if the data cannot be found in the cache. :param project: PyPi project name to get data for :type project: str :param date: date to get data for :type date: datetime.datetime :return: dict of...
pypi_download_stats/diskdatacache.py
def get(self, project, date): """ Get the cache data for a specified project for the specified date. Returns None if the data cannot be found in the cache. :param project: PyPi project name to get data for :type project: str :param date: date to get data for :typ...
def get(self, project, date): """ Get the cache data for a specified project for the specified date. Returns None if the data cannot be found in the cache. :param project: PyPi project name to get data for :type project: str :param date: date to get data for :typ...
[ "Get", "the", "cache", "data", "for", "a", "specified", "project", "for", "the", "specified", "date", ".", "Returns", "None", "if", "the", "data", "cannot", "be", "found", "in", "the", "cache", "." ]
jantman/pypi-download-stats
python
https://github.com/jantman/pypi-download-stats/blob/44a7a6bbcd61a9e7f02bd02c52584a98183f80c5/pypi_download_stats/diskdatacache.py#L82-L111
[ "def", "get", "(", "self", ",", "project", ",", "date", ")", ":", "fpath", "=", "self", ".", "_path_for_file", "(", "project", ",", "date", ")", "logger", ".", "debug", "(", "'Cache GET project=%s date=%s - path=%s'", ",", "project", ",", "date", ".", "str...
44a7a6bbcd61a9e7f02bd02c52584a98183f80c5
train
DiskDataCache.set
Set the cache data for a specified project for the specified date. :param project: project name to set data for :type project: str :param date: date to set data for :type date: datetime.datetime :param data: data to cache :type data: dict :param data_ts: maximum ...
pypi_download_stats/diskdatacache.py
def set(self, project, date, data, data_ts): """ Set the cache data for a specified project for the specified date. :param project: project name to set data for :type project: str :param date: date to set data for :type date: datetime.datetime :param data: data t...
def set(self, project, date, data, data_ts): """ Set the cache data for a specified project for the specified date. :param project: project name to set data for :type project: str :param date: date to set data for :type date: datetime.datetime :param data: data t...
[ "Set", "the", "cache", "data", "for", "a", "specified", "project", "for", "the", "specified", "date", "." ]
jantman/pypi-download-stats
python
https://github.com/jantman/pypi-download-stats/blob/44a7a6bbcd61a9e7f02bd02c52584a98183f80c5/pypi_download_stats/diskdatacache.py#L113-L137
[ "def", "set", "(", "self", ",", "project", ",", "date", ",", "data", ",", "data_ts", ")", ":", "data", "[", "'cache_metadata'", "]", "=", "{", "'project'", ":", "project", ",", "'date'", ":", "date", ".", "strftime", "(", "'%Y%m%d'", ")", ",", "'upda...
44a7a6bbcd61a9e7f02bd02c52584a98183f80c5
train
DiskDataCache.get_dates_for_project
Return a list of the dates we have in cache for the specified project, sorted in ascending date order. :param project: project name :type project: str :return: list of datetime.datetime objects :rtype: datetime.datetime
pypi_download_stats/diskdatacache.py
def get_dates_for_project(self, project): """ Return a list of the dates we have in cache for the specified project, sorted in ascending date order. :param project: project name :type project: str :return: list of datetime.datetime objects :rtype: datetime.dateti...
def get_dates_for_project(self, project): """ Return a list of the dates we have in cache for the specified project, sorted in ascending date order. :param project: project name :type project: str :return: list of datetime.datetime objects :rtype: datetime.dateti...
[ "Return", "a", "list", "of", "the", "dates", "we", "have", "in", "cache", "for", "the", "specified", "project", "sorted", "in", "ascending", "date", "order", "." ]
jantman/pypi-download-stats
python
https://github.com/jantman/pypi-download-stats/blob/44a7a6bbcd61a9e7f02bd02c52584a98183f80c5/pypi_download_stats/diskdatacache.py#L139-L158
[ "def", "get_dates_for_project", "(", "self", ",", "project", ")", ":", "file_re", "=", "re", ".", "compile", "(", "r'^%s_([0-9]{8})\\.json$'", "%", "project", ")", "all_dates", "=", "[", "]", "for", "f", "in", "os", ".", "listdir", "(", "self", ".", "cac...
44a7a6bbcd61a9e7f02bd02c52584a98183f80c5
train
parse_args
Use Argparse to parse command-line arguments. :param argv: list of arguments to parse (``sys.argv[1:]``) :type argv: ``list`` :return: parsed arguments :rtype: :py:class:`argparse.Namespace`
pypi_download_stats/runner.py
def parse_args(argv): """ Use Argparse to parse command-line arguments. :param argv: list of arguments to parse (``sys.argv[1:]``) :type argv: ``list`` :return: parsed arguments :rtype: :py:class:`argparse.Namespace` """ p = argparse.ArgumentParser( description='pypi-download-st...
def parse_args(argv): """ Use Argparse to parse command-line arguments. :param argv: list of arguments to parse (``sys.argv[1:]``) :type argv: ``list`` :return: parsed arguments :rtype: :py:class:`argparse.Namespace` """ p = argparse.ArgumentParser( description='pypi-download-st...
[ "Use", "Argparse", "to", "parse", "command", "-", "line", "arguments", "." ]
jantman/pypi-download-stats
python
https://github.com/jantman/pypi-download-stats/blob/44a7a6bbcd61a9e7f02bd02c52584a98183f80c5/pypi_download_stats/runner.py#L69-L121
[ "def", "parse_args", "(", "argv", ")", ":", "p", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'pypi-download-stats - Calculate detailed download stats '", "'and generate HTML and badges for PyPI packages - '", "'<%s>'", "%", "PROJECT_URL", ",", "prog", ...
44a7a6bbcd61a9e7f02bd02c52584a98183f80c5