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

GUI functionallity and usage #93

Open SebGue opened 2 years ago

SebGue commented 2 years ago

Hello @helene-t ,

do you have some documentation the SciDataTool GUI? I tried to visualize e.g. phase fluxlinkage and their FFT but I was not able to do that. Or at least it seems to be not intuitive to me. Further the 'Filter' button seem to have no functionallity (at least for now).

Best regards, Sebastian

helene-t commented 2 years ago

Hello @SebGue ,

Unfortunately we did not have the time to write a documentation for the GUI yet.

To perform FFT, you should have the option "FFT" available in the combobox for the x-axis (instead of None). If you do not check "auto-refresh", you must not forget to click on "Refresh" to see the actualization on the graph.

The filter button is designed for string axes (with is_components=True). It opens a dialog with filtering options.

Do not hesitate to ask for further information. Helene

SebGue commented 2 years ago

Hello @helene-t ,

I think I finally understand at least some of the GUI (fig. I). 'Axes Selection' (blue section) is 'Plot Axes Selection'. 'Axes Operation' (red section) means 'Other Axes Operations'.

grafik Figure I

Now if I select 'overlay/filter' for phase axes as 'Axes Operations', I get the expected result (fig. II). Nevertheless it would be more convenient if this was the default setting. At least for fluxlinkage this makes sense, but maybe for your needs 'rms' is the better choise?!

grafik Figure II

Still I'm don't really know how to get a valid FFT of the 3 phases fluxlinkage. If I do a FFT with 'Phase=rms' I get a bin of a senseful magnitude but it is only one bin and there are no other frequency components (fig. III).

grafik Figure III

If I select 'overlay/filter' instead, there is an error:

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\GUI\DDataPlotter\DDataPlotter.py", line 149, in auto_update
    self.update_plot()
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\GUI\DDataPlotter\DDataPlotter.py", line 488, in update_plot
    self.data.plot_2D_Data(
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\Methods\DataND\plot_2D_Data.py", line 493, in plot_2D_Data
    indices = [
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\Methods\DataND\plot_2D_Data.py", line 496, in <listcomp>
    if abs(y) > abs(thresh * np_max(Ydatas[0]))
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Further there is an issue if I select 'phase' axes for X:

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\GUI\DDataPlotter\DDataPlotter.py", line 149, in auto_update
    self.update_plot()
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\GUI\DDataPlotter\DDataPlotter.py", line 488, in update_plot
    self.data.plot_2D_Data(
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\Methods\DataND\plot_2D_Data.py", line 213, in plot_2D_Data
    result = d.get_along(
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\Methods\DataND\get_along.py", line 36, in get_along
    axes_list, transforms = self._comp_axes(axes_list)
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\Methods\DataND\_comp_axes.py", line 67, in _comp_axes
    axis_requested.get_axis(self.axes[axis_requested.index], is_real=self.is_real)
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\Methods\RequestedAxis\get_axis.py", line 46, in get_axis
    values = axis.get_values(unit=self.unit)
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\Methods\Data1D\get_values.py", line 122, in get_values
    values = convert(values, self.unit, unit)
  File "C:\Program Files\Python38\lib\site-packages\SciDataTool\Functions\conversions.py", line 256, in convert
    raise UnitError(
SciDataTool.Functions.UnitError: Units rad and  do not match

Thanks for you help in advance. Sebastian

helene-t commented 2 years ago

Do you have is_overlay=True in your "phase" axis? It should help solve all the above issues.

SebGue commented 2 years ago

Is this an axis attribute? The SciData Object I try to plot is the 'default' Pyleecan fluxlinkage (i.e. Out.Mag.Phi_wind_stator).

helene-t commented 2 years ago

Yes it is an attribute of Data1D. In the latest versions of Pyleecan and SciDataTool, it should be set correctly. You can also try to initialize the GUI with Phi_wind_stator.plot("time", "phase[]")

SebGue commented 2 years ago

Thank you, setting the attribute helped. Nevertheless there is only one freqency. Is there a round off before plotting?

SebGue commented 2 years ago

... btw auto refresh should refresh even at checking this option. Also the filter is disabled now. Is there an option to only analyze a single (string) axis value? Regarding export, what's your default decimal seperator? Would you mind to enable at least the option for default 'comma'?

helene-t commented 2 years ago

There is a filter of low amplitude harmonics. You should maybe try the simple plot Phi_wind_stator.plot_2D_Data("freqs", "phase[0]") to check if the issue comes from the GUI or from the plot itself. You can use the plot_2D_Data options (x_max, is_auto_ticks, is_auto_range, etc) to check your data.

The filter should be available on your phase axis, through the "overlay" button.

Concerning exports, it is for now only available in csv format, therefore with "." decimal separator.