adds chained request from layer to pld target

This commit is contained in:
2026-02-12 15:24:01 +01:00
parent 820337c06e
commit 3e85940eb6

View File

@@ -84,7 +84,15 @@ def chain_entrypoint_to_layers(sample_object):
layer_object_list.sort(key=lambda x: x.layer_number)
return layer_object_list
def chain_layer_to_target(layer_object):
'''
Takes a Layer-class object, looks at its .target_elabid attribute and returns a Material-class object containing data on the PLD target used in the deposition of said layer.
Dependency: call_material_from_elabid.
'''
target_elabid = layer_object.target_elabid
material_object = call_material_from_elabid(target_elabid)
return material_object
#sample_object = call_entrypoint_from_elabid(elabid)
#from_entrypoint_to_material(sample_object)
@@ -97,13 +105,17 @@ if __name__=="__main__":
elabid = input("Enter elabid of your starting sample [default= 1111]: ") or 1111
data = APIHandler(apikey).get_entry_from_elabid(elabid)
sample = Entrypoint(data)
layers = chain_entrypoint_to_layers(sample)
batch = chain_entrypoint_to_batch(sample) # Material-class object
layers = chain_entrypoint_to_layers(sample) # list of Layer-class objects
print(f"Sample name:\n{sample.name}\n")
print(f"Substrate data:\n{batch.get_compound_formula(apikey)}\n")
print(f"Layers data:")
for layer in layers:
ld = layer.__dict__
ld.pop("extra")
tgt = chain_layer_to_target(layer)
print(ld)
print(tgt.get_compound_formula(apikey) + f"\n")
# entryType = None
# while entryType not in ["items", "experiments"]: