src.model package

Submodules

src.model.model module

Read workout data and calculate 1RM and training volume.

src.model.model.calc_volume(df: DataFrame) DataFrame[source]

Sets times reps times load.

Parameters:

df (pd.DataFrame) – DataFrame containing weight, reps, and set_number data

Returns:

DataFrame with volume per date

Return type:

pd.DataFrame

src.model.model.get_data(df, y_col='1RM') tuple[list[float], list[float]][source]

Get workout-timestamps and 1RM estimates.

Parameters:
  • df (pd.DataFrame) – Pandas dataframe with workout-timestamps and either 1RM estimates or volume

  • y_col (str) – String signifying whether to use 1RM estimates or volume

Returns:

workout-timestamps and either 1RM estimates or volume

Return type:

tuple[list[float], list[float]]

src.model.model.get_df(table, splits: list[str] = ['chest', 'push', 'chest_and_back'], exercise: str = 'barbell_bench_press') DataFrame[source]

Return one consolidated Pandas dataframe, containing workout date and training data, for specified split(s) and exercise.

Parameters:
  • table (tinydb.table.Table) – TinyDB table

  • splits (list, optional) – List of workout splits to include, defaults to [“chest”, “push”, “chest_and_back”]

  • exercise (str, optional) – Exercise to include, defaults to “barbell_bench_press”

Returns:

Consolidated Pandas dataframe

Return type:

pd.DataFrame

src.model.model.get_weight(df: DataFrame) Series[source]

Extracts weight from the ‘weight’ column.

Parameters:

df (pd.DataFrame) – Pandas dataframe with ‘weight’ column

Returns:

Weight in kg

Return type:

pd.Series

src.model.model.main() None[source]

Prepare dfs, calc 1RM and do linear regression.

src.model.model.one_rep_max_estimator(df: DataFrame, formula: str = 'acsm') DataFrame[source]

Estimates 1RM using ACSM, Epley, or Brzycki formulas.

Parameters:
  • df (pd.DataFrame) – DataFrame containing weight and reps data

  • formula (str, optional) – Formula to use (‘acsm’, ‘epley’, or ‘brzycki’), defaults to “acsm”

Returns:

DataFrame with estimated 1RM per date

Return type:

pd.DataFrame

src.model.plot_model module

Plot weight-training data with fit.

src.model.plot_model.create_1rm_plots(datatype: str, x: list, y: list, exercise: str) None[source]

Plot training data 1RM with fit.

Parameters:
  • datatype (str) – Data type: real or simulated

  • x (list) – x-axis data

  • y (list) – y-axis data

  • exercise (str) – Exercise name

src.model.plot_model.create_volume_plots(datatype: str, x: list, y: list, exercise: str) None[source]

Create volume plots.

Parameters:
  • datatype (str) – Data type: real or simulated

  • x (list) – x-axis data

  • y (list) – y-axis data

  • exercise (str) – Exercise name

src.model.plot_model.get_split(pgm: str) list[tuple[list, str]][source]

Get split and key exercises.

Parameters:

pgm (str) – Program type: 1rm or gvt

Returns:

Split and key exercises

Return type:

list[tuple[list, str]]

src.model.plot_model.main() None[source]

Get data and create figure.

src.model.plot_model.make_plots(pgm: str, split_selection: list[tuple[list, str]], table, datatype: str) None[source]

Make plots.

Parameters:
  • pgm (str) – Program type

  • split_selection (list[tuple[list, str]]) – Split and key exercises

  • table (TinyDB.table) – TinyDB table

  • datatype (str) – Data type: real or simulated

Raises:

ValueError – If program type is not 1rm or gvt

Module contents