Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
093a3fb5c4
|
|||
dc1d2d45a3
|
|||
f0e2fa3da9
|
@@ -2,6 +2,14 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [1.2.0](https://gitea.deepak.science:2222/physics/deepdog/compare/1.1.0...1.2.0) (2024-05-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* adds additional matching regexes ([dc1d2d4](https://gitea.deepak.science:2222/physics/deepdog/commit/dc1d2d45a3e631c5efccce80f8a24fa87c6089e0))
|
||||
* adds magnitude enabled parsing option ([f0e2fa3](https://gitea.deepak.science:2222/physics/deepdog/commit/f0e2fa3da9f5a5136908d691137a904fda4e3a9a))
|
||||
|
||||
## [1.1.0](https://gitea.deepak.science:2222/physics/deepdog/compare/1.0.1...1.1.0) (2024-05-03)
|
||||
|
||||
|
||||
|
@@ -11,12 +11,15 @@ _logger = logging.getLogger(__name__)
|
||||
FILENAME_REGEX = r"(?P<timestamp>\d{8}-\d{6})-(?P<filename_slug>.*)\.realdata\.fast_filter\.bayesrun\.csv"
|
||||
|
||||
MODEL_REGEXES = [
|
||||
r"geom_(?P<xmin>-?\d+)_(?P<xmax>-?\d+)_(?P<ymin>-?\d+)_(?P<ymax>-?\d+)_(?P<zmin>-?\d+)_(?P<zmax>-?\d+)-orientation_(?P<orientation>free|fixedxy|fixedz)-dipole_count_(?P<avg_filled>\d+)_(?P<field_name>\w*)"
|
||||
r"geom_(?P<xmin>-?\d+)_(?P<xmax>-?\d+)_(?P<ymin>-?\d+)_(?P<ymax>-?\d+)_(?P<zmin>-?\d+)_(?P<zmax>-?\d+)-orientation_(?P<orientation>free|fixedxy|fixedz)-dipole_count_(?P<avg_filled>\d+)_(?P<field_name>\w*)",
|
||||
r"geom_(?P<xmin>-?\d+)_(?P<xmax>-?\d+)_(?P<ymin>-?\d+)_(?P<ymax>-?\d+)_(?P<zmin>-?\d+)_(?P<zmax>-?\d+)-magnitude_(?P<log_magnitude>\d*\.?\d+)-orientation_(?P<orientation>free|fixedxy|fixedz)-dipole_count_(?P<avg_filled>\d+)_(?P<field_name>\w*)",
|
||||
r"geom_(?P<xmin>-?\d*\.?\d+)_(?P<xmax>-?\d*\.?\d+)_(?P<ymin>-?\d*\.?\d+)_(?P<ymax>-?\d*\.?\d+)_(?P<zmin>-?\d*\.?\d+)_(?P<zmax>-?\d*\.?\d+)-magnitude_(?P<log_magnitude>\d*\.?\d+)-orientation_(?P<orientation>free|fixedxy|fixedz)-dipole_count_(?P<avg_filled>\d+)_(?P<field_name>\w*)"
|
||||
]
|
||||
|
||||
FILE_SLUG_REGEXES = [
|
||||
r"mock_tarucha-(?P<job_index>\d+)",
|
||||
r"(?:(?P<mock>mock)_)?tarucha(?:_(?P<tarucha_run_id>\d+))?-(?P<job_index>\d+)",
|
||||
r"(?P<tag>\w+)-(?P<job_index>\d+)",
|
||||
]
|
||||
|
||||
|
||||
@@ -27,7 +30,6 @@ class BayesrunOutputFilename:
|
||||
path: pathlib.Path
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class BayesrunColumnParsed:
|
||||
"""
|
||||
class for parsing a bayesrun while pulling certain special fields out
|
||||
@@ -38,10 +40,21 @@ class BayesrunColumnParsed:
|
||||
self.model_field_dict = {
|
||||
k: v for k, v in groupdict.items() if k != "field_name"
|
||||
}
|
||||
self._groupdict_str = repr(groupdict)
|
||||
|
||||
def __str__(self):
|
||||
return f"BayesrunColumnParsed[{self.column_field}: {self.model_field_dict}]"
|
||||
|
||||
def __repr__(self):
|
||||
return f"BayesrunColumnParsed({self._groupdict_str})"
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, BayesrunColumnParsed):
|
||||
return (self.column_field == other.column_field) and (
|
||||
self.model_field_dict == other.model_field_dict
|
||||
)
|
||||
return NotImplemented
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class BayesrunModelResult:
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "deepdog"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
description = ""
|
||||
authors = ["Deepak Mallubhotla <dmallubhotla+github@gmail.com>"]
|
||||
|
||||
|
@@ -7,6 +7,7 @@ def test_parse_groupdict():
|
||||
)
|
||||
|
||||
parsed = deepdog.results._parse_bayesrun_column(example_column_name)
|
||||
assert parsed is not None
|
||||
expected = deepdog.results.BayesrunColumnParsed(
|
||||
{
|
||||
"xmin": "-20",
|
||||
@@ -23,6 +24,30 @@ def test_parse_groupdict():
|
||||
assert parsed == expected
|
||||
|
||||
|
||||
def test_parse_groupdict_with_magnitude():
|
||||
example_column_name = (
|
||||
"geom_-20_20_-10_10_0_5-magnitude_3.5-orientation_free-dipole_count_100_success"
|
||||
)
|
||||
|
||||
parsed = deepdog.results._parse_bayesrun_column(example_column_name)
|
||||
assert parsed is not None
|
||||
expected = deepdog.results.BayesrunColumnParsed(
|
||||
{
|
||||
"xmin": "-20",
|
||||
"xmax": "20",
|
||||
"ymin": "-10",
|
||||
"ymax": "10",
|
||||
"zmin": "0",
|
||||
"zmax": "5",
|
||||
"orientation": "free",
|
||||
"avg_filled": "100",
|
||||
"log_magnitude": "3.5",
|
||||
"field_name": "success",
|
||||
}
|
||||
)
|
||||
assert parsed == expected
|
||||
|
||||
|
||||
# def test_parse_no_match_column_name():
|
||||
# parsed = deepdog.results.parse_bayesrun_column("There's nothing here")
|
||||
# assert parsed is None
|
||||
|
Reference in New Issue
Block a user