BCDA-APS / mdaviz

Data visualization for mda
https://bcda-aps.github.io/mdaviz/
Other
3 stars 0 forks source link

Load data without a positioner #52

Closed rodolakis closed 9 months ago

rodolakis commented 9 months ago
Traceback (most recent call last):
  File "/home/beams22/29IDUSER/bin/mdaviz/mdaviz/mda_folder_table_model.py", line 60, in data
    return action(file)
           ^^^^^^^^^^^^
  File "/home/beams22/29IDUSER/bin/mdaviz/mdaviz/mda_folder_table_model.py", line 24, in <lambda>
    "Positioner": lambda file: self.get_file_pos(file),
                               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/beams22/29IDUSER/bin/mdaviz/mdaviz/mda_folder_table_model.py", line 99, in get_file_pos
    pv = utils.byte2str(readMDA(str(filepath))[1].p[0].name)
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
rodolakis commented 9 months ago

This error occurs over and over since get_file_pos is called by mda_folder_table_model.py for the table view.

rodolakis commented 9 months ago

Loading fixed by commit 31dd2cf.

Now when selecting a file with no positioner, it tries to plot the default scan (1st detector vs 1st positionner) and returns:

(mdaviz) [clueless ~/bin/mdaviz] mdaviz
Settings are saved in: /home/beams/29IDUSER/.config/BCDA-APS/mdaviz.ini
Application started ...
Folder path: '/net/s29data/export/data_29idc/2023_1/Kawasaki/mda'
Selected file: ARPES_0004.mda
Could not find a positioner or detector to plot.

Ok, this is fine, but index does not show up as an option in the list:

image

rodolakis commented 9 months ago
(mdaviz) iMac:mdaviz fannysimoes$ mdaviz &
[1] 61986
(mdaviz) iMac:mdaviz fannysimoes$ Settings are saved in: /Users/fannysimoes/.config/BCDA-APS/mdaviz.ini
Application started ...
Folder path: '/Users/fannysimoes/src/mdaviz/mdaviz/data'
Folder path: '/Users/fannysimoes/src/mdaviz/mdaviz/data/test_no_positioner'
Selected file: ARPES_0002.mda
Could not find a (positioner,detector) pair to plot.
{'Y': ['D01']}
doPlot called with action: add, args: ('add', {'Y': [0]})
doPlot called with action: replace, args: ('replace', {'Y': [0]})
image
prjemian commented 9 months ago

thought: Could/should the positioner list always start with index?

prjemian commented 9 months ago

... for n-dimensional data, an index for each dimension...

rodolakis commented 9 months ago

Yes that is my thought. At the moment, not having P01 checked plots with index by default, but I think a P00 line by default sounds better. We can still leave the capabilities to plot vs index when no positioner is selected.

rodolakis commented 9 months ago

@prjemian I want to make my P00 a scanPositioner object (from https://github.com/EPICS-synApps/utils/blob/master/mdaPythonUtils/mda.py), so it has all the attribute of the other positioner. I feel that this would be cleaner, and that way I just create it in utils.get_det and it is done. But I can't figure out how to import the scanPOsitioner class.

prjemian commented 9 months ago
from mda import scanPositioner

If this fails, it may be because the mda library is not installed?

pip install https://raw.githubusercontent.com/EPICS-synApps/support/master/utils/mdaPythonUtils/mdalib-2022.post9-py2.py3-none-any.whl
prjemian commented 9 months ago
(tiled) prjemian@arf:~/.../BCDA-APS/tiled-template$ python
Python 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:40:35) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mda import scanPositioner
>>> sp = scanPositioner()
>>> print(f"{sp=}")
sp=<mda.scanPositioner object at 0x7f306fa574d0>
>>> 
prjemian commented 9 months ago

from https://github.com/EPICS-synApps/utils/blob/master/mdaPythonUtils/mda.py

FYI: That repo was archived in 2022 and is now read-only. It has been replaced here: https://github.com/EPICS-synApps/support/blob/master/utils/mdaPythonUtils/mda.py

prjemian commented 9 months ago

The pip install command above uses the new location.

rodolakis commented 9 months ago

OK I will update the env.yml with the new link.

And I was using the wrong import: mdalib instead of mda. Confused the name of the package with the name of the module (is a mda a module?)

prjemian commented 9 months ago

Yes

On Thu, Feb 1, 2024, 5:42 PM Fanny Rodolakis @.***> wrote:

OK I will update the env.yml with the new link.

And I was using the wrong import: mdalib instead of mda. Confused the name of the package with the name of the module (is a mda a module?)

— Reply to this email directly, view it on GitHub https://github.com/BCDA-APS/mdaviz/issues/52#issuecomment-1922493691, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARMUMCW7TMENVZPWBFHG7LYRQR67AVCNFSM6AAAAABCRXDABKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRSGQ4TGNRZGE . You are receiving this because you were mentioned.Message ID: @.***>

prjemian commented 9 months ago

The line for your env.yml file should look like this line from our tiled template: https://github.com/BCDA-APS/tiled-template/blob/main/environment.yml#L35

prjemian commented 9 months ago

Looks like it may be there already.

rodolakis commented 9 months ago

ok

rodolakis commented 9 months ago

I wasn't working without the quote with the previous link, but I remove them, we can see how that goes.