ecogVIS icon indicating copy to clipboard operation
ecogVIS copied to clipboard

Axes not displaying correctly on external monitor

Open kristinksellers opened this issue 4 years ago • 16 comments

The error below occurs after selecting the file 'CP3Rt_2019_07_15_16_51_45__MR_9.nwb' upon start up of ecogvis. This file is shared via Box (ChangLabData_ShareWithCatalystNeuro/CP3)

No 'preprocessed' data in 'processing' group.
No 'high_gamma' data in 'processing' group.
C:\Anaconda\envs\ecogVIS_CatalystNeuro\lib\site-packages\hdmf\spec\namespace.py:470: UserWarning: ignoring namespace 'hdmf-common' because it already exists
  warn("ignoring namespace '%s' because it already exists" % ns['name'])
C:\Anaconda\envs\ecogVIS_CatalystNeuro\lib\site-packages\hdmf\spec\namespace.py:470: UserWarning: ignoring namespace 'core' because it already exists
  warn("ignoring namespace '%s' because it already exists" % ns['name'])
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-8-1fba33462e73> in <module>
----> 1 main('')

C:\Anaconda\envs\ecogVIS_CatalystNeuro\lib\site-packages\ecogvis\ecogvis.py in main(filename)
    969     if app is None:
    970         app = QApplication(sys.argv)  # instantiate a QtGui (holder for the app)
--> 971     ex = Application(filename=filename)
    972     sys.exit(app.exec_())
    973 

C:\Anaconda\envs\ecogVIS_CatalystNeuro\lib\site-packages\ecogvis\ecogvis.py in __init__(self, filename, parent)
     70 
     71         # Run the main function
---> 72         self.model = TimeSeriesPlotter(self)
     73 
     74     def closeEvent(self, event):

C:\Anaconda\envs\ecogVIS_CatalystNeuro\lib\site-packages\ecogvis\functions\subFunctions.py in __init__(self, par)
     83 
     84         self.current_rect = []
---> 85         self.badChannels = np.where( self.nwb.electrodes['bad'][:] )[0].tolist()
     86 
     87         # Load invalid intervals from NWB file

C:\Anaconda\envs\ecogVIS_CatalystNeuro\lib\site-packages\hdmf\common\table.py in __getitem__(self, key)
    502                 return self.__indices[key]
    503             else:
--> 504                 raise KeyError(key)
    505         else:
    506             # index by int, list, or slice --> return pandas Dataframe consisting of one or more rows

KeyError: 'bad'

kristinksellers avatar May 08 '20 20:05 kristinksellers

How did you create that NWB file? Looks like that file is missing some columns in the electrodes table potentially. If you open up that file and do something like: nwbfile.electrodes.to_dataframe() we should be able to see what the columns are. That functionality is so the "bad" elecs are turned red in the main GUI.

jessierliu avatar May 08 '20 21:05 jessierliu

@jrliu95 I don't think I added the 'bad' column -- so it appears that having that column is mandatory? image

kristinksellers avatar May 08 '20 22:05 kristinksellers

Yeah you need to have it in the current implementation of ecogVIS. I think we had discussed moving bad electrode annotating out of the file and to instead write to a csv like how bad time intervals are currently implemented. So that if one person marks it as bad, it's not marked bad for everyone.

I don't know if you (or maybe Matt) have specific thoughts on this? If so, let's open a separate issue.

jessierliu avatar May 09 '20 00:05 jessierliu

Also, I'm assuming the contacts column woudn't be there anymore once the bipolar scheme is finalized?

jessierliu avatar May 09 '20 00:05 jessierliu

This was fixed in 6cb430b58cbc454d7d45a2e8e0ddca3ee418fb03 Can you try using the latest repo version and let me know if the problem persists on your side?

luiztauffer avatar May 09 '20 01:05 luiztauffer

@jrliu95 Yes - contacts is just temporary until we have bipolar scheme

kristinksellers avatar May 09 '20 05:05 kristinksellers

@luiztauffer I pip uninstalled ecogvis and installed using github version. Launched ecogvis from command line, selected the file, and got the following:

(ecogVIS_CatalystNeuro) C:\Users\Kristin Sellers>ecogvis
c:\anaconda\envs\ecogvis_catalystneuro\lib\site-packages\hdmf\spec\namespace.py:470: UserWarning: ignoring namespace 'hdmf-common' because it already exists
  warn("ignoring namespace '%s' because it already exists" % ns['name'])
c:\anaconda\envs\ecogvis_catalystneuro\lib\site-packages\hdmf\spec\namespace.py:470: UserWarning: ignoring namespace 'core' because it already exists
  warn("ignoring namespace '%s' because it already exists" % ns['name'])
No 'preprocessed' data in 'processing' group.
No 'high_gamma' data in 'processing' group.
Traceback (most recent call last):
  File "c:\anaconda\envs\ecogvis_catalystneuro\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\anaconda\envs\ecogvis_catalystneuro\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Anaconda\envs\ecogVIS_CatalystNeuro\Scripts\ecogvis.exe\__main__.py", line 7, in <module>
  File "c:\anaconda\envs\ecogvis_catalystneuro\lib\site-packages\ecogvis\ecogvis.py", line 1003, in main
    ex = Application(filename=filename)
  File "c:\anaconda\envs\ecogvis_catalystneuro\lib\site-packages\ecogvis\ecogvis.py", line 85, in __init__
    self.model = TimeSeriesPlotter(self)
  File "c:\anaconda\envs\ecogvis_catalystneuro\lib\site-packages\ecogvis\functions\subFunctions.py", line 132, in __init__
    self.updateCurXAxisPosition()
  File "c:\anaconda\envs\ecogvis_catalystneuro\lib\site-packages\ecogvis\functions\subFunctions.py", line 363, in updateCurXAxisPosition
    self.refreshScreen()
  File "c:\anaconda\envs\ecogvis_catalystneuro\lib\site-packages\ecogvis\functions\subFunctions.py", line 184, in refreshScreen
    self.TimeSeries_plotter()
  File "c:\anaconda\envs\ecogvis_catalystneuro\lib\site-packages\ecogvis\functions\subFunctions.py", line 313, in TimeSeries_plotter
    plt3.setYRange(np.min(stimData), np.max(stimData))
UnboundLocalError: local variable 'stimData' referenced before assignment

kristinksellers avatar May 09 '20 06:05 kristinksellers

I found the problem, thanks for informing me! This doesn't happen in the shared file though. Is it possible to share this one as well, so it will be easier to reproduce future error?

edit: Sorry I automatically closed the issue on commit. I'll wait to see if things are working on your side!

luiztauffer avatar May 09 '20 06:05 luiztauffer

@luiztauffer I'm now able to open this file - thanks! However, I'm again experiencing the x- and y-axis misalignment

The file I'm testing is in our shared Box folder (ChangLabData_ShareWithCatalystNeuro) in the subfolder 'CP3'

image

kristinksellers avatar May 09 '20 17:05 kristinksellers

I can't reproduce the error here: gif_137

what's your OS?

luiztauffer avatar May 14 '20 04:05 luiztauffer

I'm running Windows 10 Pro

Interestingly, the axes are fine when I have the GUI window on my laptop screen, but the problem occurs when I drag (the exact same GUI window) over to my external monitor. Problem goes away when I move back to my laptop screen

kristinksellers avatar May 14 '20 18:05 kristinksellers

@kristinksellers does it happen if you open directly on the external monitor, instead of dragging it?

luiztauffer avatar Jun 17 '20 16:06 luiztauffer

@luiztauffer

In trying to test this, I first pulled the latest repo version of ecogvis. In trying to install, it said I needed to update PyQt5 and PyQt5-sip, which I did (to versions 5.14.2 and 12.8.0, respectively) and then pulled ecogvis again.

Now I'm not able to launch ecogvis -- do I need to revert to a previous version of a library?

image

kristinksellers avatar Jun 22 '20 17:06 kristinksellers

@kristinksellers

I’m sorry for these problems, but unfortunately they’re common with pyqt and windows… in the most current version we’ve added PyQtWebEngine as a dependency and that’s what seems to be causing the error. Usually a fresh install in a new environment solves it. But let’s try a couple of different solutions:

Option 1. In your current env

pip uninstall PyQt5
pip uninstall PyQt5-sip
pip uninstall PyQtWebEngine
pip install PyQt5
pip install PyQt5-sip
pip install PyQtWebEngine

then if you enter pip freeze you should see these versions:

PyQt5==5.15.0
PyQt5-sip==12.8.0
PyQtWebEngine==5.15.0

Option 2. Install in a fresh new environment, from the root dir of the ecogvis project:

conda create -n <your-env-name> python=3.7 pip
conda activate <your-env-name>
pip install .

let me know if the problem got solved then

luiztauffer avatar Jun 23 '20 02:06 luiztauffer

@luiztauffer The first option worked to fix my environment -- thanks!!

Re the earlier problem (x-axis not displaying correctly on external monitor) - this is still occurring when I open directly on the external monitor. Fixing this is low priority because there is a manageable workaround (just use laptop monitor), so don't spend too much time on it.

kristinksellers avatar Jun 23 '20 22:06 kristinksellers

the new monitor problem seems to be a known issue with pyqtgraph, leaving some references here: https://github.com/pyqtgraph/pyqtgraph/issues/756 https://stackoverflow.com/questions/45108069/pyqtgraph-axes-not-displaying-correctly

I tried solutions proposed on both links, but they actually worsened the GUI. Let's keep an eye on those Issues.

luiztauffer avatar Jul 02 '20 10:07 luiztauffer