main now turns content of realtime window analysis into nx dataset

the data is not parsed or analysed, it's written as text (well, tsv
technically) - this is only for testing and first attempts
This commit is contained in:
2026-03-11 15:01:04 +01:00
parent aa3bf531f9
commit fc150be724

View File

@@ -1,4 +1,5 @@
import os, json, requests, h5py import os, json, requests, h5py
import numpy as np
from getpass import getpass from getpass import getpass
from APIHandler import APIHandler from APIHandler import APIHandler
from classes import * from classes import *
@@ -301,7 +302,7 @@ def make_nexus_schema_dictionary(substrate_object, layers):
} }
return pld_fabrication return pld_fabrication
def build_nexus_file(pld_fabrication, output_path): def build_nexus_file(pld_fabrication, output_path, rheed_osc=None):
# NOTE: look at the mail attachment from Emiliano... # NOTE: look at the mail attachment from Emiliano...
with h5py.File(output_path, "w") as f: with h5py.File(output_path, "w") as f:
nx_pld_entry = f.create_group("pld_fabrication") nx_pld_entry = f.create_group("pld_fabrication")
@@ -439,6 +440,9 @@ def build_nexus_file(pld_fabrication, output_path):
nx_instruments.create_dataset("rheed_system", data = instruments_dict["rheed_system"]) nx_instruments.create_dataset("rheed_system", data = instruments_dict["rheed_system"])
except TypeError as te: except TypeError as te:
raise TypeError(te) raise TypeError(te)
nx_rheed = nx_pld_entry.create_group("rheed_data")
nx_rheed.attrs["NX_class"] = "NXdata"
nx_rheed.create_dataset("intensity", data=rheed_osc)
return return
if __name__=="__main__": if __name__=="__main__":
@@ -455,4 +459,6 @@ if __name__=="__main__":
# print(make_nexus_schema_dictionary(substrate_object, layers)) # debug # print(make_nexus_schema_dictionary(substrate_object, layers)) # debug
with open (f"output/sample-{sample_name}.json", "w") as f: with open (f"output/sample-{sample_name}.json", "w") as f:
json.dump(result, f, indent=3) json.dump(result, f, indent=3)
build_nexus_file(result, output_path=f"output/sample-{sample_name}-nexus.h5") with open(f"tests/Realtime_Window_Analysis.txt", "r") as o:
osc = np.loadtxt(o)
build_nexus_file(result, output_path=f"output/sample-{sample_name}-nexus.h5", rheed_osc=osc)