Eomys / SciDataTool

SciDataTool is an open-source Python package for scientific data handling. The objective is to provide a user-friendly, unified, flexible module to postprocess any kind of signal. It is meant to be used by researchers, R&D engineers and teachers in any scientific area. This package allows to efficiently store data fields in the time/space or in the frequency domain, to easily perform Fourier Transforms, to extract slices, to convert units, to compare several fields, etc. It therefore leads to simplified plot commands.
Apache License 2.0
26 stars 21 forks source link

Bug: Units rpm and do not match #97

Open SebGue opened 2 years ago

SebGue commented 2 years ago

Hello @helene-t ,

I got some data object but I'm not able to use plot method due to an error. My object is as follows

from SciDataTool import Data1D, DataND
import numpy as np

spd = np.linspace(0, 1000, 20)
current = np.ones((20,1))

speed = Data1D(name="Speed", unit="rpm", values=spd, is_components=True)

axes = [speed]
kwargs = dict(name="Current RMS", unit="A", symbol="I")
data = DataND(axes=axes, values=current, **kwargs)

data.plot()

What am I doing wrong?

Best regards, Sebastian

helene-t commented 2 years ago

Hello @SebGue ,

Sorry for the late reply. Units are initialized from unit_dict, a dict defined in Functions/Plot/init.py The default unit for the speed axis is "rpm", but it uses the name "speed" instead of "Speed". We should improve the code in order to use the unit from the axis itself. In the meantime, you can simply rename your axis "speed".

Best regards, Hélène