komanawa.gw_age_tools.lightweight#

created matt_dumont on: 16/05/24

Functions#

lightweight_predict_future(source, out_years, ages, ...)

a lightweight version of predict_future_conc_bepm that does not check inputs and does not interpolate the source concentration and does not check the parmeters... use at your own warning

lightweight_predict_future_int_np(source, out_years, ...)

a lightweight version of predict_future_conc_bepm that does not check inputs and does not interpolate the source concentration and does not check the parmeters... use at your own warning, but 0.05x the runtime of lightweight_predict_future

Module Contents#

lightweight_predict_future(source, out_years, ages, age_fractions, precision)[source]#

a lightweight version of predict_future_conc_bepm that does not check inputs and does not interpolate the source concentration and does not check the parmeters… use at your own warning

Parameters:
  • source

  • out_years

  • ages

  • age_fractions

  • precision

Returns:

lightweight_predict_future_int_np(source, out_years, ages, age_fractions, adder)[source]#

a lightweight version of predict_future_conc_bepm that does not check inputs and does not interpolate the source concentration and does not check the parmeters… use at your own warning, but 0.05x the runtime of lightweight_predict_future

The inputs for this are different to the other functions, STRONGLY suggest testing with lightweight_predict_future first

The inputs relative to lightweight_predict_future are:

precision = 2
age_step, ages, age_fractions = make_age_dist(....)
source1 = pd.Series(index=np.arange(-ages.max(), 500, 10 ** -precision).round(precision), data=np.nan, dtype=float)
outages = np.linspace(1, 400, 1000)
lightweight_predict_future(source1, outages, ages, age_fractions, precision)

source4.index = (np.round(source4.index * int(10 ** precision))).astype(int)
outages4 = (np.round(deepcopy(outages) * int(10 ** precision))).astype(int)
insource = deepcopy(source4).values
adder = source4.index.min()*-1
ages4 = (np.round(deepcopy(ages) * int(10 ** precision))).astype(int)
lightweight_predict_future_int_np(insource, outages4, ages4, age_fractions, adder)
Parameters:
  • source – np.ndarray, sorted by age

  • out_years – np.ndarray of years to predict (integer (np.round(deepcopy(outages) * int(10 ** precision))).astype(int))

  • ages – np.ndarray of ages (integer (np.round(deepcopy(ages) * int(10 ** precision))).astype(int)

  • adder – integer, the minimum age in the source data (source4.index.min()*-1)

Returns: