Skip to content

Commit

Permalink
Update to V0.5.6 (#85)
Browse files Browse the repository at this point in the history
* poetry dev dependencies update

* Replace unnecessary memmap by arrays (#84)

* Replace unnecessary memmap by arrays

* black

* Fix order not known

* quick fix for tests

* better record handling

Should be improve even further but it lays the basis to select which variables
to record, and how (just as arrays or as memmaps)

---------

Co-authored-by: sjuhel <pro@sjuhel.org>

* Bump actions/upload-pages-artifact from 1 to 3 (#83)

Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 1 to 3.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](actions/upload-pages-artifact@v1...v3)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/deploy-pages from 1 to 4 (#82)

Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 1 to 4.
- [Release notes](https://github.com/actions/deploy-pages/releases)
- [Commits](actions/deploy-pages@v1...v4)

---
updated-dependencies:
- dependency-name: actions/deploy-pages
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/upload-artifact from 1 to 4 (#81)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 1 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v1...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Samuel Juhel <10011382+spjuhel@users.noreply.github.com>

* Bump actions/configure-pages from 3 to 4 (#80)

Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 3 to 4.
- [Release notes](https://github.com/actions/configure-pages/releases)
- [Commits](actions/configure-pages@v3...v4)

---
updated-dependencies:
- dependency-name: actions/configure-pages
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/checkout from 2 to 4 (#79)

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v2...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: sjuhel <pro@sjuhel.org>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 14, 2024
1 parent 73fe777 commit 9e2c88c
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 194 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# This should be the path to the paper within your repo.
paper-path: paper.md
- name: Upload
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: paper
# This is the output path where Pandoc will write the compiled
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gitlabsync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
name: Git Repo Sync
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wangchucheng/git-repo-sync@v0.1.0
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/static_html_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'docs/build/html'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
64 changes: 46 additions & 18 deletions boario/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def __init__(
self.records_storage: pathlib.Path = self.results_storage / "records"
"""pathlib.Path: Place where records are stored if stored"""

self._vars_to_record = []
self._files_to_record = []

if save_records != []:
Expand Down Expand Up @@ -481,34 +482,53 @@ def next_step(
# and updates the internal model production_cap decrease and rebuild_demand
self._check_happening_events()

if "_inputs_evolution" in self._files_to_record:
if ("_inputs_evolution" in self._files_to_record) or (
"_inputs_evolution" in self._vars_to_record
):
self._write_stocks()

# 0)
if self.current_temporal_unit > 1:
self.model.calc_overproduction()

if "_overproduction_evolution" in self._files_to_record:
if ("_overproduction_evolution" in self._files_to_record) or (
"_overproduction_evolution" in self._files_to_record
):
self._write_overproduction()
if "_rebuild_demand_evolution" in self._files_to_record:
if ("_rebuild_demand_evolution" in self._files_to_record) or (
"_rebuild_demand_evolution" in self._vars_to_record
):
self._write_rebuild_demand()
if "_final_demand_evolution" in self._files_to_record:
if ("_final_demand_evolution" in self._files_to_record) or (
"_final_demand_evolution" in self._vars_to_record
):
self._write_final_demand()
if "_io_demand_evolution" in self._files_to_record:
if ("_io_demand_evolution" in self._files_to_record) or (
"_io_demand_evolution" in self._vars_to_record
):
self._write_io_demand()

# 1)
constraints = self.model.calc_production(self.current_temporal_unit)

if "_limiting_inputs_evolution" in self._files_to_record:
if ("_limiting_inputs_evolution" in self._files_to_record) or (
"_limiting_inputs_evolution" in self._vars_to_record
):
self._write_limiting_stocks(constraints)
if "_production_evolution" in self._files_to_record:
if ("_production_evolution" in self._files_to_record) or (
"_production_evolution" in self._vars_to_record
):
self._write_production()
if "_production_cap_evolution" in self._files_to_record:
if ("_production_cap_evolution" in self._files_to_record) or (
"_production_cap_evolution" in self._vars_to_record
):
self._write_production_max()
if (
"_regional_sectoral_productive_capital_destroyed_evolution"
in self._files_to_record
) or (
"_regional_sectoral_productive_capital_destroyed_evolution"
in self._vars_to_record
):
self._write_productive_capital_lost()

Expand All @@ -522,9 +542,13 @@ def next_step(
events_to_remove = self.model.distribute_production(
rebuildable_events, self.scheme
)
if "_final_demand_unmet_evolution" in self._files_to_record:
if ("_final_demand_unmet_evolution" in self._files_to_record) or (
"_final_demand_unmet_evolution" in self._vars_to_record
):
self._write_final_demand_unmet()
if "_rebuild_production_evolution" in self._files_to_record:
if ("_rebuild_production_evolution" in self._files_to_record) or (
"_rebuild_production_evolution" in self._vars_to_record
):
self._write_rebuild_prod()
except RuntimeError:
logger.exception("An exception happened:")
Expand Down Expand Up @@ -796,15 +820,19 @@ def _init_records(self, save_records):
)
else:
raise RuntimeError(f"shapev {shapev} unrecognised")
memmap_array = TempMemmap(
filename=(self.records_storage / filename),
dtype=dtype,
mode="w+",
shape=shape,
save=save,
)
if save:
memmap_array = TempMemmap(
filename=(self.records_storage / filename),
dtype=dtype,
mode="w+",
shape=shape,
save=save,
)
self._files_to_record.append(attr_name)
else:
memmap_array = np.ndarray(shape=shape, dtype=dtype, order="C")
self._vars_to_record.append(attr_name)
memmap_array.fill(fillv)
self._files_to_record.append(attr_name)
setattr(self, attr_name, memmap_array)

def _reset_records(
Expand Down
Loading

0 comments on commit 9e2c88c

Please sign in to comment.