From fc150be724a0d32856d08f61af5d4ca259245ca9f6d4d2e077ea214f33c0dcab Mon Sep 17 00:00:00 2001 From: PioApocalypse Date: Wed, 11 Mar 2026 15:01:04 +0100 Subject: [PATCH] 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 --- src/main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index 329e0db..b90fab4 100644 --- a/src/main.py +++ b/src/main.py @@ -1,4 +1,5 @@ import os, json, requests, h5py +import numpy as np from getpass import getpass from APIHandler import APIHandler from classes import * @@ -301,7 +302,7 @@ def make_nexus_schema_dictionary(substrate_object, layers): } 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... with h5py.File(output_path, "w") as f: 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"]) except TypeError as 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 if __name__=="__main__": @@ -455,4 +459,6 @@ if __name__=="__main__": # print(make_nexus_schema_dictionary(substrate_object, layers)) # debug with open (f"output/sample-{sample_name}.json", "w") as f: 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)