Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
c1591c9ce9
|
|||
10358287d9
|
|||
d4f6e2f99e
|
|||
d64939f346
|
|||
0c6490dad7
|
@@ -1,13 +1,14 @@
|
|||||||
import logging
|
import logging
|
||||||
from deepdog.meta import __version__
|
from deepdog.meta import __version__
|
||||||
from deepdog.bayes_run import BayesRun
|
from deepdog.bayes_run import BayesRun
|
||||||
|
from deepdog.diagnostic import Diagnostic
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
return __version__
|
return __version__
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["get_version", "BayesRun"]
|
__all__ = ["get_version", "BayesRun", "Diagnostic"]
|
||||||
|
|
||||||
|
|
||||||
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
||||||
|
@@ -41,7 +41,7 @@ class BayesRun():
|
|||||||
run_count: int
|
run_count: int
|
||||||
The number of runs to do.
|
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.dot_inputs = dot_inputs
|
||||||
self.discretisations = [disc for (_, disc) in discretisations_with_names]
|
self.discretisations = [disc for (_, disc) in discretisations_with_names]
|
||||||
self.model_names = [name for (name, _) 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")
|
timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
|
||||||
self.filename = f"{timestamp}-{filename_slug}.csv"
|
self.filename = f"{timestamp}-{filename_slug}.csv"
|
||||||
|
self.max_frequency = max_frequency
|
||||||
|
|
||||||
def go(self) -> None:
|
def go(self) -> None:
|
||||||
with open(self.filename, "a", newline="") as outfile:
|
with open(self.filename, "a", newline="") as outfile:
|
||||||
@@ -65,7 +66,11 @@ class BayesRun():
|
|||||||
writer.writeheader()
|
writer.writeheader()
|
||||||
|
|
||||||
for run in range(1, self.run_count + 1):
|
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)
|
dots = dipoles.get_dot_measurements(self.dot_inputs)
|
||||||
_logger.info(f"Going to work on dipole at {dipoles.dipoles}")
|
_logger.info(f"Going to work on dipole at {dipoles.dipoles}")
|
||||||
|
@@ -69,7 +69,7 @@ class Diagnostic():
|
|||||||
row = {
|
row = {
|
||||||
"model": name,
|
"model": name,
|
||||||
"index": idx,
|
"index": idx,
|
||||||
"bounds_px": bounds,
|
"bounds": bounds,
|
||||||
"actual_dipole_moment": self.dipoles.dipoles[0].p,
|
"actual_dipole_moment": self.dipoles.dipoles[0].p,
|
||||||
"actual_dipole_position": self.dipoles.dipoles[0].s,
|
"actual_dipole_position": self.dipoles.dipoles[0].s,
|
||||||
"actual_dipole_freq": self.dipoles.dipoles[0].w,
|
"actual_dipole_freq": self.dipoles.dipoles[0].w,
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "deepdog"
|
name = "deepdog"
|
||||||
version = "0.1.3"
|
version = "0.1.5"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Deepak Mallubhotla <dmallubhotla+github@gmail.com>"]
|
authors = ["Deepak Mallubhotla <dmallubhotla+github@gmail.com>"]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user