Skip to content

Commit 1aae80c

Browse files
committed
Updates related to changes in NeXus definitions, made during the NFDI-MatWerk project meeting in Frankfurt
1 parent c6d0057 commit 1aae80c

File tree

7 files changed

+34
-30
lines changed

7 files changed

+34
-30
lines changed

compositionspace/autophase.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ def automated_phase_assignment(self):
8787
trg = f"/entry{self.config['entry_id']}/autophase/result"
8888
grp = h5w.create_group(trg)
8989
grp.attrs["NX_class"] = "NXdata"
90-
grp.attrs["axes"] = "axis_feature_identifier"
91-
grp.attrs["axis_feature_identifier_indices"] = np.uint64(0)
90+
grp.attrs["axes"] = "axis_feature_indices"
91+
grp.attrs["axis_feature_indices_indices"] = np.uint64(0)
9292
grp.attrs["signal"] = "axis_feature_importance"
9393
# further attributes, to render it a proper NeXus NXdata object
9494
dst = h5w.create_dataset(
95-
f"{trg}/axis_feature_identifier",
95+
f"{trg}/axis_feature_indices",
9696
compression="gzip",
9797
compression_opts=1,
9898
data=np.asarray(sorted_indices, APT_UINT),

compositionspace/clustering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def run(self):
6161
dst = h5w.create_dataset(f"{trg}/sequence_index", data=np.uint64(sequence_idx))
6262
trg = f"/entry{self.config['entry_id']}/clustering/ic_opt"
6363
grp = h5w.create_group(trg)
64-
grp.attrs["NX_class"] = "NXobject"
64+
grp.attrs["NX_class"] = "NXprocess"
6565
h5w.close()
6666

6767
# n_ic_runs = sum(1 for grpnm in ic_results_group_names if grpnm.startswith("cluster_analysis"))

compositionspace/meshing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def meshes_normals(config_file_path, input_file_path, output_file_path):
5151
# and other parameter from yaml config file like shown in other *.py files
5252
Node_list_plot = []
5353
no_elements = config["voxelization/edge_length"]
54-
dist_cut = config["meshing/dist_cut"]
54+
dist_cut = config["meshing/distance_cut"]
5555
normal_end_length = config["meshing/normal_end_length"]
5656
nodes_edit_lst = []
5757
simp_plot_edit_lst = []

compositionspace/preparation.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ def write_init_results(self):
9191
)
9292
trg = f"/entry{self.config['entry_id']}/config"
9393
grp = h5w.create_group(trg)
94-
grp.attrs["NX_class"] = "NXserialized"
94+
grp.attrs["NX_class"] = "NXnote"
9595
dst = h5w.create_dataset(f"{trg}/type", data="file")
96-
dst = h5w.create_dataset(f"{trg}/path", data=self.config["config_file_path"])
96+
dst = h5w.create_dataset(f"{trg}/file_name", data=self.config["config_file_path"])
9797
dst = h5w.create_dataset(f"{trg}/checksum", data=get_sha256(self.config["config_file_path"]))
9898
dst = h5w.create_dataset(f"{trg}/algorithm", data="sha256")
9999

@@ -237,12 +237,12 @@ def write_voxelization_grid_info(self):
237237
)
238238
dst.attrs["units"] = "nm"
239239
dst = h5w.create_dataset(f"{trg}/extent", data=self.extent)
240-
identifier_offset = 0 # we count cells starting from this value
240+
index_offset = 0 # we count cells starting from this value
241241
dst = h5w.create_dataset(
242-
f"{trg}/identifier_offset", data=np.uint64(identifier_offset)
242+
f"{trg}/index_offset", data=np.uint64(index_offset)
243243
)
244244

245-
voxel_id = identifier_offset
245+
voxel_id = index_offset
246246
position = np.zeros([c, 3], np.float64)
247247
for k in np.arange(0, self.extent[2]):
248248
z = self.aabb3d[2, 0] + (0.5 + k) * dedge
@@ -258,7 +258,7 @@ def write_voxelization_grid_info(self):
258258
dst.attrs["units"] = "nm"
259259
del position
260260

261-
voxel_id = identifier_offset
261+
voxel_id = index_offset
262262
coordinate = np.zeros([c, 3], np.uint64)
263263
for k in np.arange(0, self.extent[2]):
264264
for j in np.arange(0, self.extent[1]):
@@ -295,7 +295,7 @@ def write_voxelization_results(self):
295295
h5w = h5py.File(self.config["results_file_path"], "a")
296296
trg = f"/entry{self.config['entry_id']}/voxelization/cg_grid"
297297
dst = h5w.create_dataset(
298-
f"{trg}/voxel_identifier",
298+
f"{trg}/indices_voxel",
299299
compression="gzip",
300300
compression_opts=1,
301301
data=self.voxel_identifier,
@@ -345,14 +345,15 @@ def write_voxelization_results(self):
345345
)
346346

347347
# specimen group
348-
trg = f"/entry{self.config['entry_id']}/specimen"
349-
grp = h5w.create_group(f"{trg}")
350-
grp.attrs["NX_class"] = "NXsample"
351-
if str(self.config["specimen/type"]) in ["experiment", "simulation"]:
352-
dst = h5w.create_dataset(f"{trg}/type", data=str(self.config["specimen/type"]))
353-
else:
354-
dst = h5w.create_dataset(f"{trg}/type", data="unknown")
355-
dst = h5w.create_dataset(f"{trg}/atom_types", data=str(", ".join(list(atom_types))))
348+
if "specimen/is_simulation" in self.config:
349+
trg = f"/entry{self.config['entry_id']}/specimen"
350+
grp = h5w.create_group(f"{trg}")
351+
grp.attrs["NX_class"] = "NXsample"
352+
if self.config["specimen/is_simulation"] is True:
353+
dst = h5w.create_dataset(f"{trg}/is_simulation", data=True)
354+
else:
355+
dst = h5w.create_dataset(f"{trg}/is_simulation", data=False)
356+
dst = h5w.create_dataset(f"{trg}/atom_types", data=str(", ".join(list(atom_types))))
356357
h5w.close()
357358

358359
def run(self, recon_file_path: str, range_file_path: str):

compositionspace/segmentation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ def perform_bics_minimization_and_write_results(self):
110110
aics = []
111111
bics = []
112112
n_clusters_queue = list(
113-
range(1, self.config["segmentation/n_max_ic_cluster"] + 1)
113+
range(1, self.config["segmentation/ic_opt/n_max_ic_cluster"] + 1)
114114
)
115115
for n_bics_cluster in n_clusters_queue:
116116
X_train = None
117117
C_mod = None
118118
if self.config["autophase/use"]:
119119
print("Using results with automated phase assignment")
120120
with h5py.File(self.config["results_file_path"], "r") as h5r:
121-
trg = f"/entry{self.config['entry_id']}/autophase/result/axis_feature_identifier"
121+
trg = f"/entry{self.config['entry_id']}/autophase/result/axis_feature_indices"
122122
if trg in h5r:
123123
descending_indices = h5r[trg][:]
124124
# print(descending_indices)
@@ -193,8 +193,8 @@ def perform_bics_minimization_and_write_results(self):
193193
axis_dim = np.asarray(
194194
np.linspace(
195195
1,
196-
self.config["segmentation/n_max_ic_cluster"],
197-
num=self.config["segmentation/n_max_ic_cluster"],
196+
self.config["segmentation/ic_opt/n_max_ic_cluster"],
197+
num=self.config["segmentation/ic_opt/n_max_ic_cluster"],
198198
endpoint=True,
199199
),
200200
APT_UINT,

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ authors = [
1111
description = "APT analysis tools"
1212
readme = "README.md"
1313
license = { file = "LICENSE" }
14-
requires-python = ">=3.7"
14+
requires-python = ">=3.8"
1515
classifiers = [
16-
"Programming Language :: Python :: 3.7",
1716
"Programming Language :: Python :: 3.8",
1817
"Programming Language :: Python :: 3.9",
1918
"Programming Language :: Python :: 3.10",
@@ -26,7 +25,7 @@ dependencies = [
2625
"h5py",
2726
"scikit-learn",
2827
"trimesh",
29-
"ifes_apt_tc_data_modeling>=0.2.1",
28+
"ifes_apt_tc_data_modeling>=0.2.2",
3029
"pyyaml",
3130
"flatdict",
3231
"lxml",

tests/experiment_params.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
identifier_analysis:
2+
reconstruction:
3+
ranging:
14
specimen:
2-
type: experiment
5+
is_simulation: false
36
voxelization:
47
edge_length: 1
58
autophase:
@@ -8,8 +11,9 @@ autophase:
811
trunc_species: 2
912
random_forest_classifier:
1013
segmentation:
11-
n_max_ic_cluster: 5
12-
gaussian_mixture:
14+
ic_opt:
15+
n_max_ic_cluster: 5
16+
gaussian_mixture:
1317
clustering:
1418
dbscan:
1519
eps: 3

0 commit comments

Comments
 (0)