From 73863c70b0883f662bdfc2ecb40a7f39199360d6 Mon Sep 17 00:00:00 2001 From: Christoph Knote <christoph.knote@med.uni-augsburg.de> Date: Mon, 14 Mar 2022 14:40:51 +0100 Subject: [PATCH] Fix circular dependency issue --- README.md | 30 ++++++++++++++-------------- pyproject.toml | 2 +- src/boxmox/__init__.py | 2 +- src/boxmox/experiment.py | 11 ++++------ tests/usage_examples/intermediate.py | 4 ++-- tests/usage_examples/run_tests.bash | 27 ------------------------- 6 files changed, 23 insertions(+), 53 deletions(-) delete mode 100644 tests/usage_examples/run_tests.bash diff --git a/README.md b/README.md index 0b16685..b7bce9c 100644 --- a/README.md +++ b/README.md @@ -3,27 +3,16 @@ ``boxmox`` is the Python wrapper for the chemical box model BOXMOX (a standalone C/Fortran executable). -## Contributing - -We are looking forward to receiving your [new issue report](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage/-/issues/new). - -If you'd like to contribute source code directly, please [create a fork](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage), -make your changes and then [submit a merge request](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage/-/merge_requests/new) to the original project. - ## Installation ### BOXMOX model needs to be installed -The BOXMOX chemical box model needs to be installed and usable, -and the KPP_HOME environment variable has to be set. - -You can download it from our website at https://mbees.med.uni-augsburg.de/boxmodeling. +The BOXMOX chemical box model needs to be installed and the ``KPP_HOME`` environment variable has to be set. Download and instructions are our website at https://mbees.med.uni-augsburg.de/boxmodeling. ### Environment variable needs to be set -Additionally, boxmox needs a path to write temporary model results -to. This directory needs to be accessible and writeable by the -user. Set it in your environment, e.g., through: +Additionally, ``boxmox`` needs a path to write temporary model results +to, given through the environment variable ``BOXMOX_WORK_PATH``. This directory needs to be accessible and writeable by the user. Set it in your environment, e.g., through: ``` export BOXMOX_WORK_PATH=/where/you/want/boxmox/to/write/stuff/to/ @@ -31,9 +20,20 @@ export BOXMOX_WORK_PATH=/where/you/want/boxmox/to/write/stuff/to/ Remember to close the shell and log in again for these changes to take effect. +## Contributing + +We are looking forward to receiving your [new issue report](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage/-/issues/new). + +If you'd like to contribute source code directly, please [create a fork](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage), +make your changes and then [submit a merge request](https://mbees.med.uni-augsburg.de/gitlab/mbees/boxmox_pypackage/-/merge_requests/new) to the original project. + # Changelog -## 1.2.0 (2022-03-08) +## 1.2.4 (2022-03-14) + +- Release on PyPI + +## 1.2.0 (2022-03-08) (not released) - Updates to be compatible with BOXMOX 1.8 diff --git a/pyproject.toml b/pyproject.toml index 836e917..fbbb29f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "boxmox" -version = "1.2.2" +version = "1.2.4" description = "BOXMOX python interface" license = "GPL-3.0-or-later" authors = ["Christoph Knote <christoph.knote@med.uni-augsburg.de>"] diff --git a/src/boxmox/__init__.py b/src/boxmox/__init__.py index 30e3076..274bfc6 100644 --- a/src/boxmox/__init__.py +++ b/src/boxmox/__init__.py @@ -28,7 +28,7 @@ if not os.path.isdir(work_path): else: from .experiment import Experiment, ExperimentFromExample, ExperimentFromExistingRun, Namelist, examples, compiledMechs -from .data import InputFile, InputFileOrig, InputFile17, Output, ConcentrationOutput, RatesOutput, AdjointOutput, JacobianOutput, HessianOutput +from .data import InputFile, Output, ConcentrationOutput, RatesOutput, AdjointOutput, JacobianOutput, HessianOutput from .fluxes import FluxParser try: diff --git a/src/boxmox/experiment.py b/src/boxmox/experiment.py index 6fec027..b06347d 100644 --- a/src/boxmox/experiment.py +++ b/src/boxmox/experiment.py @@ -3,18 +3,15 @@ import subprocess as s import threading import shutil import fnmatch -import numpy as np import datetime import f90nml -from . import _installation -from . import InputFile, Output, ConcentrationOutput, RatesOutput, AdjointOutput, JacobianOutput, HessianOutput +from .data import InputFile, Output, ConcentrationOutput, RatesOutput, AdjointOutput, JacobianOutput, HessianOutput try: - import matplotlib from .plotter import ExperimentPlotter except: pass -from . import FluxParser +from .fluxes import FluxParser workPath=os.environ['BOXMOX_WORK_PATH'] examplesPath=os.path.join(os.environ['KPP_HOME'], "case_studies") @@ -205,7 +202,7 @@ class Experiment: def _run(self, dumbOutput=False): try: - self.pid = s.Popen([ "./" + self.mechanism + ".exe" ], stdout=s.PIPE, bufsize=1, cwd=self.path) + self.pid = s.Popen([ "./" + self.mechanism + ".exe" ], stdout=s.PIPE, cwd=self.path) self.pid.wait() self._pp_run(dumbOutput=dumbOutput) except Exception as e: @@ -229,7 +226,7 @@ class Experiment: for type in self.input: with open( os.path.join(self.path, type + '.csv'), 'w') as f: - self.input[type].write(f, version=self.version) + self.input[type].write(f) pwd = os.getcwd() os.chdir(self.path) diff --git a/tests/usage_examples/intermediate.py b/tests/usage_examples/intermediate.py index b889e31..5d10a46 100644 --- a/tests/usage_examples/intermediate.py +++ b/tests/usage_examples/intermediate.py @@ -3,8 +3,8 @@ import boxmox import numpy as np # evaluate differences in run with different NO2 initial conditions -no2_ics = np.linspace(0.01, 0.3, 20) -c2h4_ics = np.linspace(0.1, 2.000, 20) +no2_ics = np.linspace(0.01, 0.3, 10) +c2h4_ics = np.linspace(0.1, 2.000, 10) X,Y = np.meshgrid(no2_ics, c2h4_ics) Z = np.zeros_like(X) diff --git a/tests/usage_examples/run_tests.bash b/tests/usage_examples/run_tests.bash deleted file mode 100644 index c540750..0000000 --- a/tests/usage_examples/run_tests.bash +++ /dev/null @@ -1,27 +0,0 @@ -export KPP_HOME=/Users/lechriso/git/boxmox/boxmox/ -export PATH="$KPP_HOME/bin:$KPP_HOME/boxmox/bin:$PATH" -export BOXMOX_WORK_PATH=/tmp/ - -echo " - - - - " -echo "PYTHON 2" -echo -echo "simple.py" -echo -python2 simple.py -echo -echo "intermediate.py" -echo -python2 intermediate.py -echo - -echo " - - - - " -echo "PYTHON 3" -echo -echo "simple.py" -echo -python3 simple.py -echo -echo "intermediate.py" -echo -python3 intermediate.py -echo -- GitLab