Skip to content

Commit

Permalink
Merge pull request #10 from sede-open/apply_thinning
Browse files Browse the repository at this point in the history
Apply thinning
  • Loading branch information
mattj89 authored Jul 2, 2024
2 parents 318a268 + 743f2c2 commit 573342b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
8 changes: 5 additions & 3 deletions src/pyelq/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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().
Expand All @@ -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__(
Expand Down Expand Up @@ -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."""
Expand Down
4 changes: 2 additions & 2 deletions src/pyelq/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 573342b

Please sign in to comment.