bucky package

Submodules

bucky.arg_parser_model module

arg parser for bucky.model

This module handles all the CLI argument parsing for bucky.model and autodetects CuPy

bucky.make_input_graph module

bucky.make_input_graph.compute_population_density(age_df, shape_df)

Computes normalized population density.

Parameters
  • age_df (Pandas DataFrame) – age-stratified population data

  • shape_df (Geopandas GeoDataFrame) – GeoDataFrame with shape information indexed by FIPS

Returns

popdens – DataFrame with population density by FIPS

Return type

Pandas DataFrame

bucky.make_input_graph.get_case_history(historical_data, end_date, num_days=45)

Gets case and death history for the requested number of days for each FIPS.

If data is missing for a date, it is replaced with the data from the last valid date.

Parameters
  • historical_data (Pandas DataFrame) – Dataframe with case, death data indexed by date, FIPS

  • end_date (date string) – Last date to get data for

  • num_days (int) – Number of days of history requested

Returns

hist – Dictionary of case data, keyed by FIPS

Return type

dict

bucky.make_input_graph.get_lex(last_date, window_size=7)

Reads county-level location exposure indices from PlaceIQ location data and applies a window.

Parameters
  • last_date (last_date) – Fetches data for requested date

  • window_size (int (default: 7)) – Size of window, in days, to apply to data

Returns

frac_df – TODO

Return type

Pandas DataFrame

bucky.make_input_graph.get_mobility_data(popdens, end_date, age_data, add_territories=True)

Fetches mobility data.

Parameters
  • popdens (Pandas DataFrame) – Population density indexed by FIPS

  • end_date (string) – Last date of historical data

  • age_data (Pandas DataFrame) – County-level age-stratified population data

  • add_territories (boolean) – Adds territory data if True

Returns

  • mean_edge_weights (Pandas DataFrame) – TODO

  • move_dict (dict) – TODO

bucky.make_input_graph.get_safegraph(last_date, window_size=7)

Reads SafeGraph mobility data and applies a window.

Parameters
  • last_date (last_date) – Fetches data for requested date

  • window_size (int (default: 7)) – Size of window, in days, to apply to data

Returns

frac_df – TODO

Return type

Pandas DataFrame

bucky.make_input_graph.read_descartes_data(end_date)

Reads Descartes mobility data. [WS20]

Parameters

end_date (string) – Last date to get Descartes data

Returns

  • nat_frac_move (Pandas DataFrame) – TODO

  • dl_state (Pandas DataFrame) – TODO

  • dl_county (Pandas DataFrame) – TODO

Notes

Data provided by Descartes Labs (https://descarteslabs.com/mobility/) 1

1

Warren, Michael S. & Skillman, Samuel W. “Mobility Changes in Response to COVID-19”. arXiv:2003.14228 [cs.SI], Mar. 2020. arxiv.org/abs/2003.14228

bucky.make_input_graph.read_lex_data(date)

Reads county-level location exposure indices for a given date from PlaceIQ location data.

In order to improve performance, preprocessed data is saved. If the user requests data for a date that has already been preprocessed, it will read the data from disk instead of repeating the processing.

Parameters

date (string) – Fetches data for requested date

Returns

df_long – Preprocessed LEX data

Return type

Pandas DataFrame

bucky.make_state_csv module

bucky.model module

class bucky.model.SEIR_covid(seed=None, randomize_params_on_reset=True)

Bases: object

dGdt_vec(t, y, Nij, Cij, Aij, par)
estimate_doubling_time(days_back=7, doubling_time_window=7, mean_time_window=None, min_doubling_t=1.0)
estimate_reporting(cfr, days_back=14, case_lag=None, min_deaths=100.0)
get_state_indices()
reset(seed=None, params=None)
reset_A(var)
run_once(seed=None, outdir='raw_output/', output=True, output_queue=None)
exception bucky.model.SimulationException

Bases: Exception

bucky.model.get_runid(pid=0)

bucky.parameters module

bucky.parameters.CI_to_std(CI)
bucky.parameters.calc_Reff(m, n, Tg, Te, r)
bucky.parameters.calc_Te(Tg, Ts, n, f)
bucky.parameters.calc_Ti(Te, Tg, n)
bucky.parameters.calc_beta(Te)
bucky.parameters.calc_gamma(Ti)
class bucky.parameters.seir_params(par_file=None, gpu=False)

Bases: object

static age_interp(x_bins_new, x_bins, y)
static calc_derived_params(params)
generate_params(var=0.2)
static read_yml(par_file)
reroll_params(base_params, var)
static rescale_doubling_rate(D, params, xp, A=None)

bucky.postprocess module

bucky.postprocess.divide_by_pop(dataframe, cols)

Given a dataframe and list of columns, divides the columns by the population column (‘N’).

Parameters
  • dataframe (Pandas DataFrame) – Simulation data

  • cols (list of strings) – Column names to scale by population

Returns

dataframe – Original dataframe with the requested columns scaled

Return type

Pandas DataFrame

Module contents