Skip to content

Commit 940cdcf

Browse files
authored
Update randomizeop.py
1 parent 4b89d67 commit 940cdcf

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
@@ -82,7 +82,7 @@ def run(self, source: Dataset) -> Dataset: # noqa: D102
8282
"tracking_id",
8383
source.attrs.get(
8484
"uuid",
85-
f"{uuid.uuid3(uuid.NAMESPACE_URL, self._args.source_file.stem)}",
85+
f"{uuid.uuid3(uuid.NAMESPACE_URL, self._args.source_file.resolve().as_uri())}",
8686
),
8787
)
8888
target: Dataset = Dataset(
@@ -97,12 +97,9 @@ def run(self, source: Dataset) -> Dataset: # noqa: D102
9797
if v not in config or self._args.selector == 0:
9898
continue
9999
get_logger().info(f"starting graph for variable: {v}")
100+
s: list[int] = self.entropy(v, source_id)
100101
a: dict[str:Any] = config[v]
101-
f = Randomize(
102-
m=x.ndim,
103-
dist=a["distribution"],
104-
entropy=self.entropy(v, source_id),
105-
)
102+
f = Randomize(m=x.ndim, dist=a["distribution"], entropy=s)
106103
if "uncertainty" in a:
107104
u = (
108105
target[a["uncertainty"]]
@@ -144,10 +141,9 @@ def run(self, source: Dataset) -> Dataset: # noqa: D102
144141
dtype=z.dtype,
145142
)
146143
target[v].attrs["dtype"] = x.dtype
147-
target[v].attrs["entropy"] = np.array(
148-
self.entropy(v, source_id), dtype=np.int64
149-
)
144+
target[v].attrs["entropy"] = np.array(s, dtype=np.int64)
150145
if get_logger().is_enabled(Logging.DEBUG):
146+
get_logger().debug(f"entropy: {s}")
151147
get_logger().debug(f"min: {da.nanmin(z).compute() :.3f}")
152148
get_logger().debug(f"max: {da.nanmax(z).compute() :.3f}")
153149
get_logger().debug(f"mean: {da.nanmean(z).compute() :.3f}")

0 commit comments

Comments
 (0)