Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ogcore/output_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,11 @@ def model_fit_table(
omega_t = params.omega[t]
model_val = omega_t[idx_65:].sum() / omega_t.sum()
elif target_desc == r"Pop growth rate":
model_val = params.g_n[t]
# g_n[t] is now growth from period t to t+1; the boundary
# growth into period 0 lives in g_n_preTP. Report the growth
# into period t so this stays calendar-aligned with the
# omega[t]-based moments above.
model_val = params.g_n_preTP if t == 0 else params.g_n[t - 1]
else:
model_val = np.nan

Expand Down
14 changes: 12 additions & 2 deletions ogcore/parameter_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,13 @@ def plot_pop_growth(
year_vec = np.arange(start_year, start_year + num_years_to_plot)
start_index = start_year - p.start_year
fig, ax = plt.subplots()
plt.plot(year_vec, p.g_n[start_index : start_index + num_years_to_plot])
# g_n stores the pre-time-path boundary growth separately in
# g_n_preTP; prepend it to recover the year-aligned growth path.
g_n_full = np.append(p.g_n_preTP, p.g_n)
plt.plot(
year_vec,
g_n_full[start_index : start_index + num_years_to_plot],
)
plt.xlabel(r"Year $t$")
plt.ylabel(r"Population Growth Rate $g_{n, t}$")
ticks_loc = ax.get_yticks().tolist()
Expand Down Expand Up @@ -500,7 +506,11 @@ def plot_g_n(p_list, label_list=[""], include_title=False, path=None):
years = np.arange(p0.start_year, p0.start_year + p0.T)
fig, ax = plt.subplots()
for i, p in enumerate(p_list):
plt.plot(years, p.g_n[: p.T], label=label_list[i])
plt.plot(
years,
np.append(p.g_n_preTP, p.g_n[: p.T - 1]),
label=label_list[i],
)
plt.xlabel(r"Year $s$ (model periods)")
plt.ylabel(r"Population Growth Rate $g_{n,t}$")
if label_list[0] != "":
Expand Down
Loading