Tier Meta-data
In the Notebook
WorkPackages
, Experiments
and Samples
can have meta-data associated with them.
These are just stored in a JSON file on disk:
>>> smpl = project['WP2.1a']
>>> smpl.meta_file
Path('.../WorkPackages/WP2/WP2.1/.smpls/WP2.1a.json')
The contents of this file can be access through the tier.meta
attribute:
>>> smpl.meta
<Meta conclusion='' started=datetime.datetime(2024, 10, 16, 16, 24, 52, 274990, tzinfo=TzInfo(UTC)) description='First Attempt\n\nMore details can be put after the first line. \n\nThis box is rendered as markdown, hence can contain $M\\alpha t \\hbar$.\n' "asd"=['One', 'Two', 'Three'] (6.3ms)>
You can see this is where the description and conclusion for your tier is stored, as well as its started time.
Additionally, here you can insert your own meta values.
You can do this from the preview panel in the tier browser, or in a notebook, you can create an editor widget using:
smpl.gui.meta_editor(name=['key'])
Once you've entered a value, and applied the change, click the save button at the top of the notebook to apply it.
Warning
Whilst setting of meta values directlly with smpl.meta['key'] = 'value'
is supported, it is generally not recommended because
this will take the UI of Cassini out of sync with the file, and may cause confusing errors/ popups. You can explicitly refresh the meta contents
in the UI through clicking the 🔄 button in the Tier Preview panel.
When values have been set, you can access them python-side with:
>>> smpl.meta['key']
'value'
Validation of meta-values is provided by Pydantic. More advanced serialisation and deserialisation can be achieved using MetaAttr
.
In the Cassini Browser
Meta can be seen and edited in the Preview Panel.
They can also be viewed in the tier table too.
To do so, simply click the edit columns
button , and select which meta you want to view in the table.
If you have recently set new meta values, and they are not appearing in the table, you can press the refresh tree button to reload all the meta of the children shown in the table.