diff --git a/src/caosadvancedtools/parameter_tools/parameter_tools.py b/src/caosadvancedtools/parameter_tools/parameter_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..68f1ce549c12325b31baaa0c4010d38d09605544 --- /dev/null +++ b/src/caosadvancedtools/parameter_tools/parameter_tools.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# Tools for storing parameters in python scripts into CaosDB +# A. Schlemmer, 02/2022 + +import caosdb as db +from caosdb.apiutils import (convert_to_entity, convert_to_python_object) + +def register_parameterset(name): + """ + Download the RecordType for a parameter set. This can be e.g. the RecordType for a + Simulation or a DataAnalysis. + + Create a new CaosDB record and return its object structure for use in python programs. + + This function makes use of the pythonic object structure for CaosDB Records as defined + in pylib apiutils. + """ + + res = db.execute_query("FIND RecordType {}".format(name), unique=True) + res.resolve_references(deep=True) + return convert_to_python_object(res) +