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
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12"]
python-version: ["3.12", "3.13"]

steps:
- name: Checkout
Expand Down
23 changes: 6 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.2.0] - 2026-08-31 9:00:00

### Changed

- Rewrote the installation instructions. The README now documents two
install paths — the OG family universal installer
(`bash install.sh --repo og-bra`, from OG-Core's `scripts/`) and a
manual uv install — with complete, copy-pasteable per-platform blocks
for macOS, Linux, and Windows, and a "what happens" note for the
example run (runtime, output locations, and the UN Data Portal token
prompt fallback). Removed the PyPI install section and badges: the
`ogbra` package has never been published to PyPI, so `pip install
ogbra` fails for everyone who tries it.
- Updated the contributor guide to the uv workflow: `uv sync --extra
dev` and `uv run` replace the conda environment steps, which have
been broken since `environment.yml` was removed in 0.1.0. Fixed the
test command to this repo's real marker set (`pytest -m "not
local"`; the old text cited OG-USA's `needs_puf`/`regression`
markers and 24-hour suite) and replaced stale `master`-branch
references with `main`.
- Calibration now works with OG-Core > 0.18.0, which has demographic parameters varying by income goup.
- Rewrote the installation instructions. The README now documents two install paths — the OG family universal installer (`bash install.sh --repo og-bra`, from OG-Core's `scripts/`) and a manual uv install — with complete, copy-pasteable per-platform blocks for macOS, Linux, and Windows, and a "what happens" note for the example run (runtime, output locations, and the UN Data Portal token prompt fallback). Removed the PyPI install section and badges: the `ogbra` package has never been published to PyPI, so `pip install ogbra` fails for everyone who tries it.
- Updated the contributor guide to the uv workflow: `uv sync --extra dev` and `uv run` replace the conda environment steps, which have been broken since `environment.yml` was removed in 0.1.0. Fixed the test command to this repo's real marker set (`pytest -m "not local"`; the old text cited OG-USA's `needs_puf`/`regression` markers and 24-hour suite) and replaced stale `master`-branch references with `main`.

## [0.1.0] - 2026-06-25 12:00:00

Expand All @@ -45,3 +32,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- This version is a pre-release alpha. The example run script OG-BRA/examples/run_og_bra.py runs, but the model is not currently calibrated to represent the Brazilan economy and population.


[0.2.0]: https://github.com/PSLmodels/OG-BRA/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/PSLmodels/OG-BRA/compare/v0.0.0...v0.1.0
2 changes: 1 addition & 1 deletion ogbra/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
from ogbra.macro_params import * # noqa: F403
from ogbra.utils import * # noqa: F403

__version__ = "0.1.0"
__version__ = "0.2.0"
2 changes: 2 additions & 0 deletions ogbra/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def __init__(
country_id=UN_COUNTRY_CODE,
initial_data_year=p.start_year - 1,
final_data_year=p.start_year + 1,
income_percentiles=p.lambdas.flatten(),
GraphDiag=False,
download_path=demographic_data_path,
)
Expand All @@ -104,6 +105,7 @@ def __init__(
country_id=UN_COUNTRY_CODE,
initial_data_year=p.start_year - 1,
final_data_year=p.start_year + 1,
income_percentiles=p.lambdas.flatten(),
GraphDiag=False,
)

Expand Down
18 changes: 4 additions & 14 deletions ogbra/income.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,7 @@ def f(
)
a = x.root
e_new = usa_params.e[0, :, :] * np.exp(a * usa_params.e[0, :, :])
emat_new_scaled = (
e_new
/ (
e_new
* usa_params.omega_SS.reshape(usa_params.S, 1)
* usa_params.lambdas.reshape(1, usa_params.J)
).sum()
)
emat_new_scaled = e_new / (e_new * usa_params.omega_SS).sum()
# Now interpolate for the cases where S and/or J not the same in the
# country parameterization as in the default USA parameterization
if (
Expand All @@ -146,8 +139,8 @@ def f(
emat_j_midp = np.zeros(M)
pct_lb = 0.0
for m in range(M):
emat_j_midp[m] = pct_lb + 0.5 * usa_params.lambdas[m]
pct_lb += usa_params.lambdas[m]
emat_j_midp[m] = pct_lb + 0.5 * float(usa_params.lambdas[m])
pct_lb += float(usa_params.lambdas[m])

# Make sure that values in abil_midp are within interpolating
# bounds
Expand Down Expand Up @@ -181,10 +174,7 @@ def f(
(new_s_mesh, new_j_mesh),
method="linear",
)
emat_new_scaled = (
emat_new
/ (emat_new * age_wgts.reshape(S, 1) * lambdas.reshape(1, J)).sum()
)
emat_new_scaled = emat_new / (emat_new * age_wgts).sum()

if plot:
kwargs = {"filesuffix": "_intrp_scaled"}
Expand Down
Loading