PainterQubits / paramview

GUI for viewing and editing the contents of a ParamDB database.
https://pypi.org/project/paramview
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Validate Astropy units #67

Open alexhad6 opened 1 year ago

alexhad6 commented 1 year ago

Right now, the frontend accepts any string as a valid unit, whereas Astropy only allows particular units with scientific meaning. This is pretty complex, and the best way might be to make an API call to the backend and actually have Astropy attempt to parse the unit.

See https://docs.astropy.org/en/stable/units/index.html#module-astropy.units.si for valid units, but keep in mind that units can be combined with multiplication or division, raised to exponents, etc.

alexhad6 commented 1 year ago

The other issue is that in order to do this, we would need to add Astropy (7 MB) as a dependency, which also brings in NumPy (10 MB). So it uses a lot more disk space to install on its own. This is something to consider, whether it is worth it for a relatively small feature.

Or it could be optional, only if using Astropy.