API: Functions

Functions documented here.

Functions modeling reps/intensity mapping

reps_to_intensity

streprogen.reps_to_intensity(reps, slope=-3.5, constant=97.5, quadratic=True)

A mapping from repetitions in range [1, 12] to intensities in range [0, 100].

Parameters:
  • reps – The number of repetitions to map to the intensity range.
  • slope – Slope for the linear function.
  • constant – Constant for the linear function.
  • quadratic – If ‘True’, add a slight quadratic offset.
Returns:

An intensity value in the range from 0 to 100.

Return type:

intensity

Examples

>>> reps_to_intensity(5, slope=-5, constant=100, quadratic=False)
80
>>> reps_to_intensity(8, slope=-5, constant=100, quadratic=True)
67.45
>>> reps_to_intensity(8, slope=-5, constant=100, quadratic=False)
65

Functions modeling progression

progression_linear

streprogen.progression_diffeq(week, start_weight, final_weight, start_week, final_week, k=0)

A linear/exponential progression function going through the points (‘start_week’, ‘start_weight’) and (‘end_week’, ‘final_weight’), evaluated in ‘week’.

Parameters:
  • week – The week to evaluate the linear function at.
  • start_weight – The weight at ‘start_week’.
  • final_weight – The weight at ‘final_week’.
  • start_week – The number of the first week, typically 1.
  • final_week – The number of the final week, e.g. 8.
  • k – How much the function “bends”. k=0 is linear, k>0 bends it.
Returns:

The weight at ‘week’.

Return type:

weight

Examples

>>> progression_diffeq(week = 2, start_weight = 100, final_weight = 120,
...                    start_week = 1, final_week = 3)
110.0
>>> progression_diffeq(3, 100, 140, 1, 5)
120.0

progression_sinusoidal

streprogen.progression_sinusoidal(week, start_weight, final_weight, start_week, final_week, period=4, scale=0.025, offset=0, k=0, correct_boundaries=False)

A sinusoidal progression function going through the points (‘start_week’, ‘start_weight’) and (‘final_week’, ‘final_weight’), evaluated in ‘week’. This function calls a linear progression function and multiplies it by a sinusoid.

Parameters:
  • week – The week to evaluate the linear function at.
  • start_weight – The weight at ‘start_week’.
  • final_weight – The weight at ‘final_week’.
  • start_week – The number of the first week, typically 1.
  • final_week – The number of the final week, e.g. 8.
  • period – The length of a period (cycle) in weeks.
  • scale – The scale (amplitude) of the sinusoidal term.
  • offset – The offset (shift) of the sinusoid.
  • k – Exponential growth. Higher results in more exponential growth.
  • correct_boundaries – If True, the function is adjusted to pass through the endpoints exactly.
Returns:

The weight at ‘week’.

Return type:

weight

Examples

>>> progression_sinusoidal(1, 123, 123, 1, 8, period=4)
123.0
>>> progression_sinusoidal(7, 123, 123, 1, 8, period=4)
123.0