From a1a779d40002c851c359524d0ca6582bcab7192e Mon Sep 17 00:00:00 2001 From: TannazHajiMohammadloo Date: Wed, 22 May 2024 20:35:36 +0000 Subject: [PATCH 1/9] modify MCMC input parameter to have n_thin as an input to enable thinning the results. --- src/pyelq/model.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pyelq/model.py b/src/pyelq/model.py index c6cf5c9..0a9b4d8 100644 --- a/src/pyelq/model.py +++ b/src/pyelq/model.py @@ -42,6 +42,7 @@ class ELQModel: mcmc (MCMC): MCMC object containing model and sampler specification for the problem. Constructed from the other components in self.to_mcmc(). n_iter (int): number of MCMC iterations to be run. + n_thin (int): number of iterations to thin by. fitted_values (np.ndarray): samples of fitted values (i.e. model predictions for the data) generated during the MCMC sampler. Attached in self.from_mcmc(). @@ -52,6 +53,7 @@ class ELQModel: model: Model = field(init=False) mcmc: MCMC = field(init=False) n_iter: int = 1000 + n_thin: int = 1 fitted_values: np.ndarray = field(init=False) def __init__( @@ -151,7 +153,7 @@ def to_mcmc(self): for component in self.components.values(): sampler_list = component.make_sampler(self.model, sampler_list) - self.mcmc = MCMC(initial_state, sampler_list, self.model, n_burn=0, n_iter=self.n_iter) + self.mcmc = MCMC(initial_state, sampler_list, self.model, n_burn=0, n_iter=self.n_iter, n_thin= self.n_thin) def run_mcmc(self): """Run the mcmc function.""" From 044ad2bed9b199c047d156d31b8cec3113ffef87 Mon Sep 17 00:00:00 2001 From: "david.randell" Date: Tue, 18 Jun 2024 10:08:53 +0200 Subject: [PATCH 2/9] test push works --- README.md | 2 +- src/pyelq/meteorology.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 68a271a..c26f4f5 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Or you could clone the repository and install it from the source code. After activating the environment you want to install pyELQ in, open a terminal, move to the main pyELQ folder where pyproject.toml is located and run `pip install .`, optionally you can pass the `-e` flag is for editable mode. All the main options, info and settings for the package are found in the pyproject.toml file which sits in this repo -as well. +as well. *** diff --git a/src/pyelq/meteorology.py b/src/pyelq/meteorology.py index f1cf976..3553d12 100644 --- a/src/pyelq/meteorology.py +++ b/src/pyelq/meteorology.py @@ -5,7 +5,7 @@ # -*- coding: utf-8 -*- """Meteorology module. -The superclass for the meteorology classes +The superclass for the meteorology class """ import warnings From dc4a2a6e920d9f8ab2adb1f80be67ffae5b3871f Mon Sep 17 00:00:00 2001 From: "Matthew.Jones" Date: Tue, 18 Jun 2024 11:29:33 +0200 Subject: [PATCH 3/9] Minor updates to readme and docstring. --- .vscode/settings.json | 7 +++++++ README.md | 2 +- src/pyelq/meteorology.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ad7af29 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} \ No newline at end of file diff --git a/README.md b/README.md index 8300d1b..7efa6d1 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Or you could clone the repository and install it from the source code. After activating the environment you want to install pyELQ in, open a terminal, move to the main pyELQ folder where pyproject.toml is located and run `pip install .`, optionally you can pass the `-e` flag is for editable mode. All the main options, info and settings for the package are found in the pyproject.toml file which sits in this repo -as well. +as well. *** diff --git a/src/pyelq/meteorology.py b/src/pyelq/meteorology.py index 6a746d4..87cc358 100644 --- a/src/pyelq/meteorology.py +++ b/src/pyelq/meteorology.py @@ -5,7 +5,7 @@ # -*- coding: utf-8 -*- """Meteorology module. -The superclass for the meteorology class +The superclass for the meteorology classes """ import warnings From 31f657047ef47618d2d239b16e840ebde4725c66 Mon Sep 17 00:00:00 2001 From: "Matthew.Jones" Date: Tue, 18 Jun 2024 11:35:35 +0200 Subject: [PATCH 4/9] Updated gitignore. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 4193586..cdbb5a2 100644 --- a/.gitignore +++ b/.gitignore @@ -109,6 +109,9 @@ target/ profile_default/ ipython_config.py +# vscode local settings +.vscode + # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: From fe8daf544b7552f761009f24e8e0735de54a2613 Mon Sep 17 00:00:00 2001 From: TannazHajiMohammadloo Date: Wed, 22 May 2024 20:35:36 +0000 Subject: [PATCH 5/9] modify MCMC input parameter to have n_thin as an input to enable thinning the results. Signed-off-by: t.hajimohammadloo --- src/pyelq/model.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pyelq/model.py b/src/pyelq/model.py index c6cf5c9..0a9b4d8 100644 --- a/src/pyelq/model.py +++ b/src/pyelq/model.py @@ -42,6 +42,7 @@ class ELQModel: mcmc (MCMC): MCMC object containing model and sampler specification for the problem. Constructed from the other components in self.to_mcmc(). n_iter (int): number of MCMC iterations to be run. + n_thin (int): number of iterations to thin by. fitted_values (np.ndarray): samples of fitted values (i.e. model predictions for the data) generated during the MCMC sampler. Attached in self.from_mcmc(). @@ -52,6 +53,7 @@ class ELQModel: model: Model = field(init=False) mcmc: MCMC = field(init=False) n_iter: int = 1000 + n_thin: int = 1 fitted_values: np.ndarray = field(init=False) def __init__( @@ -151,7 +153,7 @@ def to_mcmc(self): for component in self.components.values(): sampler_list = component.make_sampler(self.model, sampler_list) - self.mcmc = MCMC(initial_state, sampler_list, self.model, n_burn=0, n_iter=self.n_iter) + self.mcmc = MCMC(initial_state, sampler_list, self.model, n_burn=0, n_iter=self.n_iter, n_thin= self.n_thin) def run_mcmc(self): """Run the mcmc function.""" From 7bc0b7bf1d126e596590d5d60a220058b9fd0c0a Mon Sep 17 00:00:00 2001 From: code_reformat <> Date: Tue, 18 Jun 2024 15:11:20 +0000 Subject: [PATCH 6/9] Automatic reformat of code Signed-off-by: code_reformat <> --- src/pyelq/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyelq/model.py b/src/pyelq/model.py index 0a9b4d8..8b8bf3a 100644 --- a/src/pyelq/model.py +++ b/src/pyelq/model.py @@ -153,7 +153,7 @@ def to_mcmc(self): for component in self.components.values(): sampler_list = component.make_sampler(self.model, sampler_list) - self.mcmc = MCMC(initial_state, sampler_list, self.model, n_burn=0, n_iter=self.n_iter, n_thin= self.n_thin) + self.mcmc = MCMC(initial_state, sampler_list, self.model, n_burn=0, n_iter=self.n_iter, n_thin=self.n_thin) def run_mcmc(self): """Run the mcmc function.""" From 0d64a3d741882dbb682e6b51606529a992b34f28 Mon Sep 17 00:00:00 2001 From: "Matthew.Jones" Date: Mon, 1 Jul 2024 18:53:53 +0200 Subject: [PATCH 7/9] Minor docstring update. --- src/pyelq/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pyelq/model.py b/src/pyelq/model.py index 8b8bf3a..f6553b3 100644 --- a/src/pyelq/model.py +++ b/src/pyelq/model.py @@ -5,8 +5,8 @@ # -*- coding: utf-8 -*- """ELQModel module. -This module provides a class definition main functionalities of the codebase, providing the interface with the openMCMC -repo and defining some plotting wrappers. +This module provides a class definition for the main functionalities of the codebase, providing the interface with the +openMCMC repo and defining some plotting wrappers. """ import warnings From d8e4002bf63ae62b012be57903637c09e50b9c78 Mon Sep 17 00:00:00 2001 From: "Matthew.Jones" Date: Tue, 2 Jul 2024 08:59:50 +0200 Subject: [PATCH 8/9] Updated np.infty to np.inf in preprocessing.py, to resolve issue with github actions unit tests. --- src/pyelq/preprocessing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pyelq/preprocessing.py b/src/pyelq/preprocessing.py index 895cf2f..74a9114 100644 --- a/src/pyelq/preprocessing.py +++ b/src/pyelq/preprocessing.py @@ -156,9 +156,9 @@ def filter_on_met(self, filter_variable: list, lower_limit: list = None, upper_l """ if lower_limit is None: - lower_limit = [-np.infty] * len(filter_variable) + lower_limit = [-np.inf] * len(filter_variable) if upper_limit is None: - upper_limit = [np.infty] * len(filter_variable) + upper_limit = [np.inf] * len(filter_variable) for vrb, low, high in zip(filter_variable, lower_limit, upper_limit): for sns_key, met_key in zip(self.sensor_object, self.met_object): From 743f2c24bb0f12e7a510e4d021d136358c200b29 Mon Sep 17 00:00:00 2001 From: mattj89 <58080201+mattj89@users.noreply.github.com> Date: Tue, 2 Jul 2024 09:04:57 +0200 Subject: [PATCH 9/9] Update version number in pyproject.toml. Signed-off-by: mattj89 <58080201+mattj89@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 32ec6f2..466be3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "pyelq-sdk" -version = "1.0.6" +version = "1.0.7" description = "Package for detection, localization and quantification code." authors = ["Bas van de Kerkhof", "Matthew Jones", "David Randell"] homepage = "https://sede-open.github.io/pyELQ/"