Skip to content

Conversation

@jourdain
Copy link
Collaborator

@jourdain jourdain commented Dec 1, 2023

WIP DO NOT MERGE

@jourdain jourdain marked this pull request as draft December 1, 2023 19:59
@jarrah42
Copy link

jarrah42 commented Dec 4, 2023

I get the following on macOS:

 JS Error => [object Object]
Exception raised
AttributeError("'NoneType' object has no attribute 'read_file'")
Traceback (most recent call last):
  File "/Users/xxx/.pyenv/versions/3.9.15/lib/python3.9/site-packages/wslink/protocol.py", line 334, in onMessage
    results = await results
  File "/Users/xxx/.pyenv/versions/3.9.15/lib/python3.9/site-packages/trame_server/protocol.py", line 186, in trigger
    result = self.server._triggers[name](*args, **kwargs)
  File "/Users/xxx/.pyenv/versions/3.9.15/lib/python3.9/site-packages/air_sans-0.2.2-py3.9.egg/air_sans/app/core.py", line 160, in selected_file
    self._selected_device.read_file(self._active_directory, state.file)
AttributeError: 'NoneType' object has no attribute 'read_file'

@patrickoleary
Copy link
Member

I just did a fresh download of 0.2.2 (pip install air-sans) in a fresh conda env (python 3.9) on macos 14.1.1 (23B81) and it worked as expected.

Have we mixed versions here?

@jourdain
Copy link
Collaborator Author

jourdain commented Dec 4, 2023

Just did the following. Can you explain what you did?

mkdir test
cd test
git clone https://github.com/Kitware/air-sans.git
cd air-sans
git checkout vtk-rendering
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install .

air-sans --data ./data
Screenshot 2023-12-04 at 08 49 29

@jourdain
Copy link
Collaborator Author

jourdain commented Dec 4, 2023

Thinking more about your error, it seems that you did not select a device (D11+) but you tried to read a file. So we call read_file on the active device that is None.

A lot can be improved for sure. Like not allowing to pick a directory and browse if a device is not selected.

@jarrah42
Copy link

jarrah42 commented Dec 4, 2023

Ok, I figured it out. It happens if you don't select a device but open a data file. However, if I select D11+ and then "mask" from the dropdown, I get the following:

$ air-sans --data ./data
pixel_ratio 2.0
FIXME no more plotly....
And to prevent your browser from opening, add '--server' to your command line.

App running at:
 - Local:   http://localhost:8080/
 - Network: http://10.158.10.106:8080/

Note that for multi-users you need to use and configure a launcher.
Exception raised
TypeError("set_center_data() missing 2 required positional arguments: 'x' and 'y'")
Traceback (most recent call last):
  File "/Users/xxx/.pyenv/versions/3.9.15/lib/python3.9/site-packages/wslink/protocol.py", line 332, in onMessage
    results = func(*args, **kwargs)
  File "/Users/xxx/.pyenv/versions/3.9.15/lib/python3.9/site-packages/trame_server/protocol.py", line 208, in update_state
    self.server.state.update(client_state)
  File "/Users/xxx/.pyenv/versions/3.9.15/lib/python3.9/site-packages/trame_server/state.py", line 226, in __exit__
    self.flush()
  File "/Users/xxx/.pyenv/versions/3.9.15/lib/python3.9/site-packages/trame_server/state.py", line 199, in flush
    coroutine = callback(**self._pushed_state)
  File "/Users/xxx/.pyenv/versions/3.9.15/lib/python3.9/site-packages/air_sans/app/core.py", line 197, in show_imask
    self._viz.set_center_data(self._selected_device.detector1_imask_data)
TypeError: set_center_data() missing 2 required positional arguments: 'x' and 'y'

Then if I open the data directory and click on 028160.nxs, I see the following:

Screenshot 2023-12-04 at 11 02 12 AM

I also see these errors:

/D11//beamstop/bx1_actual 142.4980010986328
/D11//beamstop/by1_actual 947.89697265625
/D11//beamstop/bx2_actual 142.49099731445312
/D11//beamstop/by2_actual 947.89697265625
/D11//beamstop/bx3_actual 142.4980010986328
/D11//beamstop/by3_actual 947.89697265625
/D11/attenuator/attenuation_value b'0'
/D11/collimation/ap_size 0.045 0.045
pixel_ratio 2.0
FIXME no more plotly....
pixel_ratio 2.0
FIXME no more plotly....
Exception raised
TypeError("set_center_data() missing 2 required positional arguments: 'x' and 'y'")
Traceback (most recent call last):
  File "/Users/gw6/.pyenv/versions/3.9.15/lib/python3.9/site-packages/wslink/protocol.py", line 334, in onMessage
    results = await results
  File "/Users/gw6/.pyenv/versions/3.9.15/lib/python3.9/site-packages/trame_server/protocol.py", line 189, in trigger
    return result
  File "/Users/gw6/.pyenv/versions/3.9.15/lib/python3.9/site-packages/trame_server/state.py", line 226, in __exit__
    self.flush()
  File "/Users/gw6/.pyenv/versions/3.9.15/lib/python3.9/site-packages/trame_server/state.py", line 199, in flush
    coroutine = callback(**self._pushed_state)
  File "/Users/gw6/.pyenv/versions/3.9.15/lib/python3.9/site-packages/air_sans/app/core.py", line 197, in show_imask
    self._viz.set_center_data(self._selected_device.detector1_imask_data)
TypeError: set_center_data() missing 2 required positional arguments: 'x' and 'y'

 JS Error => [object Object]
 JS Error => error: TypeError: undefined is not an object (evaluating 't.eventPool[r]')
 JS Error => error: TypeError: undefined is not an object (evaluating 't.eventPool[r]')
 JS Error => error: TypeError: undefined is not an object (evaluating 't.eventPool[r]')

@jourdain
Copy link
Collaborator Author

jourdain commented Dec 4, 2023

I am aware of the missing x, y scaling information for the mask/efficiency/error.
Those informations are read from the file but are static in the case of the device information and I wasn't sure where to get them from. So I let the error so we can easily find the location of the call to properly provide the right information (once we know where to get it).

Do you want to have a quick chat to review were we are and what you might be missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants