I'll provide some more context (pun intended) next week but the parse function can already generate a file. It's more related to how we generate new archive raw files (ELNs) in the parsers and normalize functions.
It would be great with some sort of preview of the plot generated from calling the CLI parse command. Currently we have to either inspect the json manually or run nomad locally to test this during plugin development.
It seems like float, str, and int are all displayed properly on the overview page but not booleans. The data is still visible from the data tab.
Tested on staging with nomad verion 1.2.2.dev483+gd2702d60.
test.archive.yaml
to reproduce images:
definitions:
sections:
MySection:
quantities:
my_float:
type: float
my_int:
type: int
my_str:
type: str
my_bool:
type: bool
data:
m_def: MySection
my_float: 3.14
my_int: 1
my_str: "Hello World!"
my_bool: true
We should extend the Client and Server context to provide a create_archive function which works on the server, in the CLI, and during tests.
I had a similar problem with an oasis. Changed it to liters
and then I believe it worked. I was also under the impression the h
worked for hours before but now I had to change it to hours
. In general the SI units seem to work which is I guess what we should have in the unit but the display unit then needs to work!
I would suggest to adopt the DIN 461 standard for plots. Specifically placing the units as e.g. "Temperature / °C" I'm also fine with the nature style guide which uses "Temperature (°C)". But I don't like the square brackets as that should be reserved for unit analysis, i.e. [Temperature]=°C (see DIN 1313 section 4.3)
Indeed the problem was caused by lazy loading the schemas. Disabled it now.
Now the schema loads in as it should, thanks!
Hampus Naesstroem (a255c9e8) at 05 Feb 15:29
Trigger pipeline by commit
Hampus Naesstroem (ba9b7e99) at 05 Feb 15:23
Hampus Naesstroem (ba9b7e99) at 05 Feb 15:22
Hampus Naesstroem (ba9b7e99) at 05 Feb 15:15
@mscheidg, @afekete, and @g-sarthakkapoor this is the issue I mentioned during the FAIRmat Cafe talk today.
@himanel1 this was the error we discussed some time ago but never wrote an issue for.
This is the bug I mentioned @aalbino
There is an error when trying to assign a nomad quantity value with a pint Quantity
in the section constructor.
Adding a class A
to, for example, nomad.datamodel.metainfo.basesections
(same error in other locations and in plugins):
class A(ArchiveSection):
a = Quantity(
type=float,
unit='meter',
)
and trying to construct an instance in a normalizer or even in a python console gives the following error
(.pyenv) [hampusnasstrom@fedora nomad]$ python
Python 3.9.18 (main, Aug 28 2023, 00:00:00)
[GCC 12.3.1 20230508 (Red Hat 12.3.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from nomad.datamodel.metainfo.basesections import A, ureg
>>> A(a=ureg.Quantity(3.14, 'meter'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hampusnasstrom/repositories/nomad/nomad/metainfo/metainfo.py", line 1248, in __init__
self.m_update(**other_kwargs)
File "/home/hampusnasstrom/repositories/nomad/nomad/metainfo/metainfo.py", line 2075, in m_update
self.m_set(prop, value)
File "/home/hampusnasstrom/repositories/nomad/nomad/metainfo/metainfo.py", line 1588, in m_set
value = self.__set_normalize(quantity_def, value)
File "/home/hampusnasstrom/repositories/nomad/nomad/metainfo/metainfo.py", line 1508, in __set_normalize
return MTypes.primitive[target_type](value) # type: ignore
File "/home/hampusnasstrom/repositories/nomad/nomad/metainfo/util.py", line 201, in <lambda>
float: lambda v: None if v is None else float(v),
File "/home/hampusnasstrom/repositories/nomad/.pyenv/lib64/python3.9/site-packages/pint/quantity.py", line 833, in __float__
raise DimensionalityError(self._units, "dimensionless")
pint.errors.DimensionalityError: Cannot convert from 'meter' to 'dimensionless'
If the quantity is instead set with the setter it works like expected:
>>> a = A()
>>> a.a = ureg.Quantity(3.14, 'meter')
>>> print(a.a)
3.14 meter
Hampus Naesstroem (1aa7340c) at 23 Jan 14:44
Added docs for creating experimental ELN entry
Hampus Naesstroem (7e6b9d68) at 23 Jan 13:36
Fixed paths
Hampus Naesstroem (e2bbf53a) at 23 Jan 13:24
Added basis structure for experimental example