Skip to content

Commit 1cc02b9

Browse files
committed
Fix: wrong tracking identifier
1 parent 4053835 commit 1cc02b9

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

kaleidoscope/operators/randomizeop.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,19 @@ def run(self, source: Dataset) -> Dataset: # noqa: D102
9292
:param source: The source dataset.
9393
:return: The result dataset.
9494
"""
95-
source_id = source.attrs.get(
96-
"tracking_id", source.attrs.get("uuid", f"{self.uuid}")
97-
)
9895
target: Dataset = Dataset(
9996
data_vars=source.data_vars,
10097
coords=source.coords,
10198
attrs=source.attrs,
10299
)
103-
target.attrs["tracking_id"] = (
104-
f"{source_id}:{self._args.selector :04d}"
105-
)
106100
config: dict[str : dict[str:Any]] = self.config.get(
107101
self._args.source_type, {}
108102
)
109103
for v, x in target.data_vars.items():
110104
if v not in config or self._args.selector == 0:
111105
continue
112106
get_logger().info(f"starting graph for variable: {v}")
113-
s: list[int] = self.entropy(v, source_id)
107+
s: list[int] = self.entropy(v, self.uuid)
114108
a: dict[str:Any] = config[v]
115109
f = Randomize(m=x.ndim, dist=a["distribution"], entropy=s)
116110
if "uncertainty" in a:
@@ -197,8 +191,10 @@ def entropy(self, name: str, uuid: str, n: int = 4) -> list[int]:
197191
return [g.next() for _ in range(n)]
198192

199193
@property
200-
def uuid(self) -> uuid.UUID:
194+
def uuid(self) -> str:
201195
"""
202196
Returns a UUID constructed from the basename of the source file.
203197
"""
204-
return uuid.uuid5(uuid.NAMESPACE_URL, self._args.source_file.stem)
198+
return f"{uuid.uuid5(
199+
uuid.NAMESPACE_URL, self._args.source_file.stem
200+
)}"

0 commit comments

Comments
 (0)