bucky.util.util
¶
Generic utility functions/classes used in the model.
Module Contents¶
Classes¶
Logging handler that is friendly with tqdm. |
|
dot.notation access to dictionary attributes. |
Functions¶
|
A banner for the CLI. |
|
Group ages in the Census csv to match the bins used by Prem et al. |
|
Find the indices of a list of dates internally used by time indexed arrays in the model. |
|
Estimate the best fit IFR for a given age. |
Gets a UUID based of the current datatime and caches it. |
|
|
Function similar to pandas map but for np arrays. |
|
Remove all non digit characters from a string, but cleanly passthrough non strs. |
- class bucky.util.util.TqdmLoggingHandler(level=logging.NOTSET)[source]¶
Bases:
logging.Handler
Logging handler that is friendly with tqdm.
- class bucky.util.util.dotdict[source]¶
Bases:
dict
dot.notation access to dictionary attributes.
- __delattr__¶
- __getattr__¶
- __setattr__¶
- bucky.util.util.bin_age_csv(filename, out_filename)[source]¶
Group ages in the Census csv to match the bins used by Prem et al.
- bucky.util.util.date_to_t_int(dates, start_date)[source]¶
Find the indices of a list of dates internally used by time indexed arrays in the model.
- bucky.util.util.estimate_IFR(age)[source]¶
Estimate the best fit IFR for a given age.
See https://www.medrxiv.org/content/10.1101/2020.07.23.20160895v4.full.pdf for the fit
- Parameters
age (
numpy.ndarray
orcupy.ndarray
if using CuPy) – Array of ages to calculate IFR for- Returns
ifr – The calculated best fit IFR
- Return type
numpy.ndarray
orcupy.ndarray
if using CuPy
- bucky.util.util.map_array(a, d)[source]¶
Function similar to pandas map but for np arrays.
Deprecated since version 0.8.0.
- bucky.util.util.remove_chars(seq)[source]¶
Remove all non digit characters from a string, but cleanly passthrough non strs.
- Parameters
seq (
Any
) – Strings will be modified, any other type is directly returned- Returns
The original sequence, minus non-digit characters if input was a string
- Return type
Any