* Adding a test for all PINN solvers to assert that the metrics are correctly log

* Adding test for Metric Tracker
* Modify Metric Tracker to correctly log metrics
This commit is contained in:
dario-coscia
2024-08-06 11:12:19 +02:00
committed by Nicola Demo
parent d00fb95d6e
commit 0fa4e1e58a
10 changed files with 308 additions and 9 deletions

View File

@@ -195,15 +195,20 @@ class AbstractProblem(metaclass=ABCMeta):
)
# check consistency location
locations_to_sample = [
condition for condition in self.conditions
if hasattr(self.conditions[condition], 'location')
]
if locations == "all":
locations = [condition for condition in self.conditions]
# only locations that can be sampled
locations = locations_to_sample
else:
check_consistency(locations, str)
if sorted(locations) != sorted(self.conditions):
if sorted(locations) != sorted(locations_to_sample):
TypeError(
f"Wrong locations for sampling. Location ",
f"should be in {self.conditions}.",
f"should be in {locations_to_sample}.",
)
# sampling