Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
93d8e48
ignore invalid value warnings in pyest
jdebacker Sep 28, 2025
eda7693
extract item to avoid numpy deprecation warning
jdebacker Sep 28, 2025
408f894
proper handle array to scalar conversion
jdebacker Sep 28, 2025
f46333c
change how tighten image
jdebacker Sep 29, 2025
773de05
avoid divide by zero
jdebacker Sep 29, 2025
0c428ee
update from deprecated cm map
jdebacker Sep 29, 2025
af78abb
avoid power warnings
jdebacker Sep 29, 2025
2f1569c
fix negation
jdebacker Sep 29, 2025
b493779
Merge remote-tracking branch 'upstream/master' into fix_test_warnings
jdebacker Oct 3, 2025
6876b4a
Improve dask scheduler configuration and timeout handling
jdebacker Oct 3, 2025
91c5f4e
Fix dask timeout implementation using wait() instead of gather(timeout=)
jdebacker Oct 3, 2025
73f3725
use consistent superscript
jdebacker Oct 6, 2025
8eff47b
remove duplicate code from SS.run_SS
jdebacker Oct 22, 2025
5ac2f71
format
jdebacker Oct 22, 2025
7c68081
remove more redundant lines in run_SS
jdebacker Oct 22, 2025
b53c322
make function for initial guesses
jdebacker Oct 22, 2025
411af2e
move dev factors to constants
jdebacker Oct 23, 2025
19baba7
add docstring
jdebacker Oct 23, 2025
030cd57
change starting value for r
jdebacker Oct 23, 2025
95152bb
add line at end
jdebacker Oct 23, 2025
5bb3479
add test of new function
jdebacker Oct 23, 2025
66b6fd7
add test of solve_for_j function
jdebacker Oct 23, 2025
4d3b8b0
remove print commands used to debug
jdebacker Oct 24, 2025
60fc3ef
update paths
jdebacker Oct 27, 2025
b8ed1d0
Merge remote-tracking branch 'upstream/master' into fix_test_warnings
jdebacker Nov 8, 2025
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
4 changes: 2 additions & 2 deletions ogcore/SS.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def inner_loop(outer_loop_vars, p, client):
C_vec = np.zeros(p.I)
K_demand_open_vec = np.zeros(p.M)
for i_ind in range(p.I):
C_vec[i_ind] = aggr.get_C(c_i[i_ind, :, :], p, "SS")
C_vec[i_ind] = aggr.get_C(c_i[i_ind, :, :], p, "SS").item()
Y_vec = np.dot(p.io_matrix.T, C_vec)
for m_ind in range(p.M - 1):
KYrat_m = firm.get_KY_ratio(r, p_m, p, "SS", m_ind)
Expand Down Expand Up @@ -994,7 +994,7 @@ def SS_solver(
c_i_ss_mat[i_ind, :, :],
p,
"SS",
)
).item()

(
total_tax_revenue,
Expand Down
8 changes: 3 additions & 5 deletions ogcore/parameter_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@ def plot_imm_rates(
"Source: " + source,
fontsize=9,
)
plt.tight_layout(rect=(0, 0.035, 1, 1))
if include_title:
plt.title("Immigration Rates")
# Save or return figure
if path:
output_path = os.path.join(path, "imm_rates")
plt.savefig(output_path, dpi=300)
plt.savefig(output_path, bbox_inches="tight", dpi=300)
plt.close()
else:
fig.show()
Expand Down Expand Up @@ -407,11 +406,10 @@ def plot_fert_rates(
"Source: " + source,
fontsize=9,
)
plt.tight_layout(rect=(0, 0.035, 1, 1))
# Save or return figure
if path:
output_path = os.path.join(path, "fert_rates")
plt.savefig(output_path, dpi=300)
plt.savefig(output_path, bbox_inches="tight", dpi=300)
plt.close()
else:
fig.show()
Expand Down Expand Up @@ -816,7 +814,7 @@ def txfunc_graph(
None

"""
cmap1 = matplotlib.cm.get_cmap("summer")
cmap1 = matplotlib.colormaps.get_cmap("summer")

# Make comparison plot with full income domains
fig = plt.figure()
Expand Down
2 changes: 1 addition & 1 deletion ogcore/parameter_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def param_table(p, table_format="tex", path=None):
table["Symbol"].append(v[1])
table["Description"].append(v[0])
value = getattr(p, k)
if hasattr(value, "__len__") & ~isinstance(value, str):
if hasattr(value, "__len__") and not isinstance(value, str):
if value.ndim > 1:
report = (
"Too large to report here, see default parameters JSON"
Expand Down
4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# pytest.ini
[pytest]
filterwarnings =
ignore::RuntimeWarning:.*invalid value encountered.*
ignore::RuntimeWarning:.*divide by zero encountered in divide.*
ignore::RuntimeWarning:.*invalid value encountered in power.*
minversion = 6.0
testpaths =
./tests
Expand Down
5 changes: 4 additions & 1 deletion tests/test_aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
for i in range(p.S):
for k in range(p.J):
L_loop[t, i, k] *= (
p.omega[t, i] * p.lambdas[k] * n[t, i, k] * p.e[t, i, k]
p.omega[t, i].item()
* p.lambdas[k].item()
* n[t, i, k].item()
* p.e[t, i, k].item()
)
expected1 = L_loop[-1, :, :].sum()
expected2 = L_loop.sum(1).sum(1)
Expand Down
Loading