Hi.
I’d like to unterstand the difference between extending a subsection vs. adding a new subsection. From the documentation, about the results section:
The sub-sections in results can be re-used and extended by users and plugins, but new subsections can only be added by Nomad.
Furthermore, if extends_base_section=True:
all definitions in this section will be added to the properties of the base class section. This allows the extension of existing sections with additional properties.
I don’t understand this, so I would like to clarify with 3 questions:
Let’s say we are in results.properties.optoelectronic, and I want to extend this subsection. Would I be able to add solar_cell ? If not, can you give me an example of what I could add?
Still in results.properties.optoelectronic. Would I be able to add the quantity efficiency (from subsection solar_cell)?
Still in results.properties.optoelectronic. Would I be able to add the completly new quantity test?
Thanks for the comment. The terminology can be quite confusing and maybe the documentation does not convey the idea very well. But in short:
When you are writing e.g. a Python schema or YAML schema, you cannot (or should not) modify the layout of results: this means you cannot add completely new sections or quantities but only populate the existing ones shown e.g. here. The reason is because this is the part of the data that is supposed to be interoperable between different types of entries, and we cannot allow different schemas to modify it at will.
When the documentation says:
The sub-sections in results can be re-used and extended by users and plugins,
what is meant that you can take the Python class that represents e.g. a band structure (found in nomad.datamodel.results.BandStructure) and re-use it or use it as a base class in your own schema. The wording is a bit poor in the documentation, I will modify it.
extends_base_section=True I think this is a legacy option that was introduced before the plugin system and should not be typically used by custom schemas. It is a boolean that determines the inheritance. If this is False, normal Python inheritance implies and this section will inherit all properties (sub-sections, quantities) from all base classes. If this is True, all definitions in this section
will be added to the properties of the base class section.
So the answer to all of your three questions is: No, you can’t add new quantities or properties to results. In your schema you can add any kind of sections or quantities but they will always end up in the data section.
But I do have to say that we are open towards introducing new standardized properties within results if we see that they would add value to the NOMAD ecosystem. You can make suggestions, preferably backed up also by some source of data that produces these properties.