Bertin-fap / raman-hyperspectra-examples

Examples of use of the package raman_hyperspectra
MIT License
0 stars 0 forks source link

xrviz usage #2

Open martindurant opened 4 years ago

martindurant commented 4 years ago

(replying here to make the conversation public and searchable)

I’m currently working on a package for the hyperspectral processing of Raman spectra/hyperspectra (see https://github.com/Bertin-fap/raman-hyperspectra-examples/blob/master/raman_hyperspectra%20examples.ipynb ) I would like to use xrwiz to visualize the hyperspectra. Under Jupyter I use :

from xrviz.dashboard import Dashboard
dash = Dashboard(da_full_spectrum)
dash.panel

all works fine the the plot button is non active

Since I don’t have access to your raw data, I am not certain what data type you are passing to xrviz, but you should note that it only works with xarray DataSets, not simple NumPy arrays. Of course, you can create these datasets from simple arrays, if you want. However, I suspect your data may be a data frame, in which case you want the dfviz package instead. In any case, you generally have to select the variables/fields that you want to plot before being able to click on the plot button.

Please note further, that xrviz was a summer project from last year, and the main author is continuing his studies, so all help would be appreciated in maintaining the project! I particular, it would make sense to automatically convert a numpy array to xarray when appropriate.

martindurant commented 4 years ago

cc @Bertin-fap

Bertin-fap commented 4 years ago

In fact it's work. I'm not categoric, but it seems that xrviz requires the coordinates to be expressed with physical unities.

martindurant commented 4 years ago

I don't believe that should be the case, so long as they are defined. There is some logic to try to infer whether the coordinates are geo-location, and that could perhaps get tripped up on coordinate units.

Bertin-fap commented 4 years ago

I just retry. When the unit of x and y are u.a. (number of pixels) no plot is possible. But when the unit of x and y are expressed in µm the plot works fine.

martindurant commented 4 years ago

If you could generate a minimal, reproducible example, it should be posted as a bug at xrviz.

Bertin-fap commented 4 years ago

The bug comme from a "wrong interpretation" of the unit cm-1 which is used in spectroscopy. This link, https://github.com/Bertin-fap/bug-xrviz/blob/master/xrviz_test.ipynb, , provides a minimal reproducible example. (I'm a newcomer in Github and and I dont know how to post a bug...)

martindurant commented 4 years ago

I'm sure... cm-1 not the same as 1/cm :)

The xrviz project was pushed by the geospatial/climate community, so it tends to be more correct around latitude/longitude and such rather than physical units. I can see from your example that removing the units attributes does make plotting work.