From c2d8a7a35c4bdf4a04830ea6f7ea4ab1464b57d4 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:03:57 +0100 Subject: [PATCH 1/2] Fix subsampling bug (#297) * Fix Subsample doesn't work with behavioural response simulations #296 * Versioning * Add safety check --- changelog_entry.yaml | 4 ++++ policyengine_core/simulations/simulation.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..1fa7f744 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + fixed: + - Bug causing subsample to not work in some situations. diff --git a/policyengine_core/simulations/simulation.py b/policyengine_core/simulations/simulation.py index 482c90e4..a18312c2 100644 --- a/policyengine_core/simulations/simulation.py +++ b/policyengine_core/simulations/simulation.py @@ -1549,6 +1549,14 @@ def subsample( # Update the dataset and rebuild the simulation self.dataset = Dataset.from_dataframe(df, self.dataset.time_period) self.build_from_dataset() + + # Ensure the baseline branch has the new data. + if "baseline" in self.branches: + baseline_tax_benefit_system = self.branches[ + "baseline" + ].tax_benefit_system + self.branches["baseline"] = self.clone() + self.branches["tax_benefit_system"] = baseline_tax_benefit_system return self From 0efe621a7a829e6fcfaf096e9fcb6c2235115b76 Mon Sep 17 00:00:00 2001 From: "Github Actions[bot]" Date: Thu, 24 Oct 2024 11:04:16 +0000 Subject: [PATCH 2/2] Update PolicyEngine Core --- CHANGELOG.md | 7 +++++++ changelog.yaml | 5 +++++ changelog_entry.yaml | 4 ---- setup.py | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 582e1f7f..dda5a5fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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). +## [3.11.0] - 2024-10-24 11:04:12 + +### Fixed + +- Bug causing subsample to not work in some situations. + ## [3.10.0] - 2024-10-17 15:59:10 ### Added @@ -882,6 +888,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +[3.11.0]: https://github.com/PolicyEngine/policyengine-core/compare/3.10.0...3.11.0 [3.10.0]: https://github.com/PolicyEngine/policyengine-core/compare/3.9.0...3.10.0 [3.9.0]: https://github.com/PolicyEngine/policyengine-core/compare/3.8.2...3.9.0 [3.8.2]: https://github.com/PolicyEngine/policyengine-core/compare/3.8.1...3.8.2 diff --git a/changelog.yaml b/changelog.yaml index 2307c4e6..93956630 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -711,3 +711,8 @@ - Shallow copy GroupEntities and PopulationEntity when cloning TaxBenefitSystem object date: 2024-10-17 15:59:10 +- bump: minor + changes: + fixed: + - Bug causing subsample to not work in some situations. + date: 2024-10-24 11:04:12 diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 1fa7f744..e69de29b 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +0,0 @@ -- bump: minor - changes: - fixed: - - Bug causing subsample to not work in some situations. diff --git a/setup.py b/setup.py index ed780641..dc58e7c2 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ setup( name="policyengine-core", - version="3.10.0", + version="3.11.0", author="PolicyEngine", author_email="hello@policyengine.org", classifiers=[