code cleanup: deletes debug lines from main.py

This commit is contained in:
2026-02-13 00:05:05 +01:00
parent a12506b8be
commit 38d281543e

View File

@@ -138,67 +138,12 @@ def make_nexus_schema_dictionary(substrate_object, layers):
return json.dumps(pld_fabrication, indent=2)
if __name__=="__main__":
print(f"=======================\n===== DEBUG MODE! =====\n=======================\n")
# TO-DO: place the API base URL somewhere else.
ELABFTW_API_URL = "https://elabftw.fisica.unina.it/api/v2"
apikey = getpass("Paste API key here: ")
elabid = input("Enter elabid of your starting sample [default= 1111]: ") or 1111
data = APIHandler(apikey).get_entry_from_elabid(elabid)
sample = Entrypoint(data)
substrate_object = chain_entrypoint_to_batch(sample) # Substrate-class object
# bd = substrate_object.__dict__ # debug
# bd.pop("extra") # debug
layers = chain_entrypoint_to_layers(sample) # list of Layer-class objects
# print(f"Sample name:\n{sample.name}\n") # debug
# print(f"Substrate data:\n{bd}\n") # debug
# print(f"Layers data:") # debug
print(make_nexus_schema_dictionary(substrate_object, layers)) # debug
for layer in layers:
# ld = layer.__dict__ # debug
# ld.pop("extra") # debug
tgt = chain_layer_to_target(layer) # Target-class object
# td = tgt.__dict__ # debug
# td.pop("extra") # debug
# print(ld) # debug
# # print(td) # debug
# print() # debug
# entryType = None
# while entryType not in ["items", "experiments"]:
# eT = input("Enter a valid entry type [items, experiments]: ")
# # This allows for a shortcut: instead of prompting the type before and the elabid after I can just prompt both at the same time - e.g. e51 is exp. 51, i1108 is item 1108...
# if eT[0] in ["e", "i"] and eT[-1].isnumeric():
# try:
# elabid = int(eT[1:])
# eT = eT[0]
# except Exception:
# print("Usage: i|item|items|i[ELABID] for items, e|experiment|experiments|e[ELABID] for experiments.")
# continue
# match eT:
# case "items" | "i" | "item":
# entryType = "items"
# case "experiments" | "e" | "exp" | "experiment":
# entryType = "experiments"
# case _:
# continue
# # This will probably be reworked in production
# try:
# elabid = elabid
# except NameError:
# elabid = input("Input elabid here [default = 1111]: ") or 1111
# data = APIHandler(apikey).get_entry_from_elabid(elabid, entryType)
# if entryType == "experiments":
# layer = Layer(data)
# result = layer.__dict__
# result.pop("extra")
# print(result)
# elif entryType == "items":
# if data.get("category_title") == "Sample":
# item = Entrypoint(data)
# elif data.get("category_title") in ["PLD Target", "Substrate"]:
# item = Material(data)
# print(item.get_compound_formula(apikey))
# else:
# raise Exception("The selected item or experiment is not in one of the following categories: [Sample, PLD Target, Substrate, PLD Deposition].")
# result = item.__dict__
# result.pop("extra")
# print(result)