Compare commits

...

5 Commits
0.1.3 ... 0.1.5

Author SHA1 Message Date
c1591c9ce9 Created version 0.1.5
All checks were successful
gitea-physics/deepdog/pipeline/tag This commit looks good
gitea-physics/deepdog/pipeline/head This commit looks good
2022-01-30 20:53:48 -06:00
10358287d9 Makes frequency cappable
Some checks reported errors
gitea-physics/deepdog/pipeline/head Something is wrong with the build of this commit
2022-01-30 20:52:32 -06:00
d4f6e2f99e Created version 0.1.4
All checks were successful
gitea-physics/deepdog/pipeline/head This commit looks good
gitea-physics/deepdog/pipeline/tag This commit looks good
2022-01-24 11:13:29 -06:00
d64939f346 Don't break the build
All checks were successful
gitea-physics/deepdog/pipeline/head This commit looks good
2022-01-24 11:13:24 -06:00
0c6490dad7 Small fix t ocsv headers and also adds init for better imports
Some checks reported errors
gitea-physics/deepdog/pipeline/head Something is wrong with the build of this commit
2022-01-24 11:12:54 -06:00
4 changed files with 11 additions and 5 deletions

View File

@@ -1,13 +1,14 @@
import logging
from deepdog.meta import __version__
from deepdog.bayes_run import BayesRun
from deepdog.diagnostic import Diagnostic
def get_version():
return __version__
__all__ = ["get_version", "BayesRun"]
__all__ = ["get_version", "BayesRun", "Diagnostic"]
logging.getLogger(__name__).addHandler(logging.NullHandler())

View File

@@ -41,7 +41,7 @@ class BayesRun():
run_count: int
The number of runs to do.
'''
def __init__(self, dot_inputs: Sequence[DotInput], discretisations_with_names: Sequence[Tuple[str, pdme.model.Discretisation]], actual_model: pdme.model.Model, filename_slug: str, run_count: int) -> None:
def __init__(self, dot_inputs: Sequence[DotInput], discretisations_with_names: Sequence[Tuple[str, pdme.model.Discretisation]], actual_model: pdme.model.Model, filename_slug: str, run_count: int, max_frequency: float = None) -> None:
self.dot_inputs = dot_inputs
self.discretisations = [disc for (_, disc) in discretisations_with_names]
self.model_names = [name for (name, _) in discretisations_with_names]
@@ -58,6 +58,7 @@ class BayesRun():
timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
self.filename = f"{timestamp}-{filename_slug}.csv"
self.max_frequency = max_frequency
def go(self) -> None:
with open(self.filename, "a", newline="") as outfile:
@@ -65,7 +66,11 @@ class BayesRun():
writer.writeheader()
for run in range(1, self.run_count + 1):
dipoles = self.actual_model.get_dipoles(run)
frequency: float = run
if self.max_frequency is not None and self.max_frequency > 1:
rng = numpy.random.default_rng()
frequency = rng.uniform(1, self.max_frequency)
dipoles = self.actual_model.get_dipoles(frequency)
dots = dipoles.get_dot_measurements(self.dot_inputs)
_logger.info(f"Going to work on dipole at {dipoles.dipoles}")

View File

@@ -69,7 +69,7 @@ class Diagnostic():
row = {
"model": name,
"index": idx,
"bounds_px": bounds,
"bounds": bounds,
"actual_dipole_moment": self.dipoles.dipoles[0].p,
"actual_dipole_position": self.dipoles.dipoles[0].s,
"actual_dipole_freq": self.dipoles.dipoles[0].w,

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "deepdog"
version = "0.1.3"
version = "0.1.5"
description = ""
authors = ["Deepak Mallubhotla <dmallubhotla+github@gmail.com>"]