errors in the gui whenquantitities are of type=np.float64 and no unit given
This is a repost of my original message in the former "develop" channel: https://discord.com/channels/1201445470485106719/1207666216689205298/1213067517258366977
Hi, I get errors in the gui that are related to quantitities that are of type=np.float64
when no unit
is specified. That is the error:
42 | } else if (unit instanceof UnitMathJS) {
43 | unit = unit.clone()
44 | } else {
> 45 | throw Error('Please provide the unit as a string or as an instance of Unit.')
| ^ 46 | }
47 | this.mathjsUnit = unit
48 | // this._labelabbreviate = undefined
and that is the code snippet that causes the error:
class UVVisNirTransmissionResult(MeasurementResult, ArchiveSection):
"""
Class autogenerated from yaml schema.
"""
m_def = Section()
type = Quantity(
type=MEnum(["Transmission", "Absorbance"]),
description="type of measurement",
a_eln={"component": "RadioEnumEditQuantity"},
)
transmission = Quantity(
type=np.float64,
description="transmittance",
a_eln={"component": "NumberEditQuantity"},
shape=["*"],
)
wavelength = Quantity(
type=np.float64,
description="wavelength",
a_eln={"component": "NumberEditQuantity", "defaultDisplayUnit": "nm"},
shape=["*"],
unit="nm",
)
The whole Python plugin can be found here: https://github.com/FAIRmat-NFDI/AreaA-data_modeling_and_schemas/tree/127-add-transmission-plugin/transmission/transmission_plugin/uv_vis_nir_transmission_plugin
Please see also the comments to this post in discord: https://discord.com/channels/1201445470485106719/1213103185020059718 @mscheidg