Skip to content

Commit

Permalink
Merge pull request #19 from rudymcintyre/7-random-walk-step-size
Browse files Browse the repository at this point in the history
Expose random walk step size as a parameter in source_model.py
  • Loading branch information
mattj89 authored Jan 10, 2025
2 parents 121d2cb + 6d3b50d commit ff7d1c9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
name: pytest_junitxml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
uses: SonarSource/sonarqube-scan-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
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.11"
version = "1.0.12"
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
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ sonar.python.coveragePlugin=cobertura
sonar.python.xunit.reportPath=pytest_junit.xml
sonar.tests=tests
sonar.sourceEncoding=UTF-8
sonar.coverage.exclusions=*/pyelq/data_access/*.*, */pyelq/plotting/*.*
sonar.coverage.exclusions=*/pyelq/data_access/*.*, */pyelq/plotting/*.*, */pyelq/support_functions/post_processing.py
5 changes: 4 additions & 1 deletion src/pyelq/component/source_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ class SourceModel(Component, SourceGrouping, SourceDistribution):
reversible_jump (bool): logical indicating whether the reversible jump algorithm for estimation of the number
of sources and their locations should be run. Defaults to False.
random_walk_step_size (np.ndarray): (3 x 1) array specifying the standard deviations of the distributions
from which the random walk sampler draws new source locations. Defaults to np.array([1.0, 1.0, 0.1]).
site_limits (np.ndarray): (3 x 2) array specifying the lower (column 0) and upper (column 1) limits of the
analysis site. Only relevant for cases where reversible_jump == True (where sources are free to move in
the solution).
Expand Down Expand Up @@ -462,6 +464,7 @@ class SourceModel(Component, SourceGrouping, SourceDistribution):
gas_species: GasSpecies = field(init=False, default=None)

reversible_jump: bool = False
random_walk_step_size: np.ndarray = field(default_factory=lambda: np.array([1.0, 1.0, 0.1], ndmin=2).T)
site_limits: np.ndarray = None
rate_num_sources: int = 5
n_sources_max: int = 20
Expand Down Expand Up @@ -788,7 +791,7 @@ def make_sampler_rjmcmc(self, model: Model, sampler_list: list) -> list:
RandomWalkLoop(
"z_src",
model,
step=np.array([1.0, 1.0, 0.1], ndmin=2).T,
step=self.random_walk_step_size,
max_variable_size=(3, self.n_sources_max),
domain_limits=self.site_limits,
state_update_function=self.move_function,
Expand Down

0 comments on commit ff7d1c9

Please sign in to comment.