Created
July 27, 2023 01:07
-
-
Save josh-kaplan/d4e58e2bb450460021de6a660f509c0c to your computer and use it in GitHub Desktop.
Calculating percent margin in scaled agile planning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
# Globals | |
L_MIN = 1 | |
L_MAX = 4 | |
N_MIN = 4 | |
N_MAX = 6 | |
WIDTH_SIZE = 8 | |
HEIGHT_SIZE = 6 | |
SAVE_FIGURES = True | |
SHOW_FIGURES = False | |
# Initialize figures | |
fig1 = plt.figure(1, figsize=(WIDTH_SIZE,HEIGHT_SIZE)) | |
fig2 = plt.figure(2, figsize=(WIDTH_SIZE,HEIGHT_SIZE)) | |
plt.style.use("bmh") | |
for L in range(L_MIN, L_MAX + 1): | |
print(f"--- {L}-week sprints ---") | |
X = [] # Number of sprints | |
Y1 = [] # Margin hours | |
Y2 = [] # Margin % | |
for N in range(N_MIN, N_MAX + 1): | |
margin = .2 * (40 * L) * ( N - 1) + (40 * L - 40) | |
total = 40 * L * (N-1) | |
X.append(N) | |
Y1.append(margin) | |
Y2.append(margin / total) | |
print(f"Margin @ {N} {L}-week sprints: {margin} ({margin/total:.2%})") | |
plt.figure(1) | |
plt.plot(X, Y1, 'o-', label=f"{L}-week sprints (hours)") | |
plt.figure(2) | |
plt.plot(X, Y2, 'o-', label=f"{L}-week sprints (pct)") | |
# Format and plot figure 1 | |
plt.figure(1) | |
plt.title('Margin vs. Number of Sprints in PI') | |
plt.xlabel('Number of Sprints in PI') | |
plt.ylabel('Margin (hrs)') | |
plt.legend() | |
plt.grid( axis='both', linestyle='-', linewidth=.5) | |
if SAVE_FIGURES: | |
plt.savefig('margin_vs_sprints_hours.png') | |
# Format and plot figure 2 | |
plt.figure(2) | |
plt.title('Margin vs. Number of Sprints in PI') | |
plt.xlabel('Number of Sprints in PI') | |
plt.ylabel('Margin (%)') | |
plt.legend() | |
plt.grid( axis='both', linestyle='-', linewidth=.5) | |
if SAVE_FIGURES: | |
plt.savefig('margin_vs_sprints_pct.png') | |
# Show figures | |
if SHOW_FIGURES: | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment