CaImAn icon indicating copy to clipboard operation
CaImAn copied to clipboard

error when use caiman_gui.py after running demo_pipeline.py

Open J0eky opened this issue 2 years ago • 2 comments

For better support, please use the template below to submit your issue. When your issue gets resolved please remember to close it.

Sometimes errors while running CNMF occur during parallel processing which prevents the log to provide a meaningful error message. Please reproduce your error with setting dview=None.

If you need to upgrade CaImAn follow the instructions given in the documentation.

  • Tell us a bit about your setup:
  1. Operating system (Linux/macOS/Windows): win10

  2. Python version (3.x): 3.9

  3. Working environment (Python IDE/Jupyter Notebook/other):command line

  4. Which of the demo scripts you're using for your analysis (if applicable):demp_pipieline.py

  5. CaImAn version*: 1.9.9

  6. CaImAn installation process (pip install ./pip install -e ./conda): conda

*You can get the CaImAn version by creating a params object and then typing params.data['caiman_version']. If the field doesn't exist, type N/A and consider upgrading)

  • Describe the issue that you are experiencing I couldn't sucessfully run caiman_gui.py when loaded the memmap__d1_170_d2_170_d3_1_order_C_frames_3000_.hdf5 and memmap__d1_170_d2_170_d3_1_order_C_frames_3000_.mmap which were generated by demo_pipeline.py

  • Copy error log below (caiman) PS C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin> python .\caiman_gui.py C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py:20: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QApplication instead. app = QtGui.QApplication([]) Not launched under iPython C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py:136: DeprecationWarning: np.int is a deprecated alias for the builtin int. To silence this warning, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations estimates.accepted_list = np.array([], dtype=np.int) C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py:137: DeprecationWarning: np.int is a deprecated alias for the builtin int. To silence this warning, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations estimates.rejected_list = np.array([], dtype=np.int) C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py:140: DeprecationWarning: Please use center_of_mass from the scipy.ndimage namespace, the scipy.ndimage.measurements namespace is deprecated. estimates.cms = np.array([scipy.ndimage.measurements.center_of_mass(comp) for comp in estimates.img_components]) C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py:244: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QWidget instead. w = QtGui.QWidget() C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py:247: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QPushButton instead. btn = QtGui.QPushButton('press me') C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py:248: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QLineEdit instead. text = QtGui.QLineEdit('enter text') C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py:259: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QGridLayout instead. action_layout = QtGui.QGridLayout() C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py:177: DeprecationWarning: np.int is a deprecated alias for the builtin int. To silence this warning, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations contours = [cv2.findContours(cv2.threshold(img, np.int(thrshcomp_line.value()), 255, 0)[1], cv2.RETR_TREE, C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py:312: DeprecationWarning: Deprecated Qt API, will be removed in 0.13.0. img.scale(1, 1) USING MODEL:C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\model\cnn_model.json 2022-05-20 10:21:22.625224: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2022-05-20 10:21:22.625897: I tensorflow/core/common_runtime/process_util.cc:146] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance. Traceback (most recent call last): File "C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py", line 620, in change(None, None) # set params to default File "C:\Users\huangjun\anaconda3\pkgs\caiman-1.9.9-py39h2e25243_1\share\caiman\bin\caiman_gui.py", line 611, in change estimates.filter_components(mov, params_obj, dview=None, File "C:\Users\huangjun\anaconda3\envs\caiman\lib\site-packages\caiman\source_extraction\cnmf\estimates.py", line 1142, in filter_components select_components_from_metrics(self.A, dims, params.get('init', 'gSig'), File "C:\Users\huangjun\anaconda3\envs\caiman\lib\site-packages\caiman\components_evaluation.py", line 673, in select_components_from_metrics predictions = np.maximum(predictions, evaluate_components_CNN(A, dims, size_range)[0][:, neuron_class]) File "C:\Users\huangjun\anaconda3\envs\caiman\lib\site-packages\caiman\components_evaluation.py", line 321, in evaluate_components_CNN half_crop = np.minimum(gSig[0] * 4 + 1, patch_size), np.minimum(gSig[1] * 4 + 1, patch_size) TypeError: 'int' object is not subscriptable

  • If you're not reporting an error, type your message below

J0eky avatar May 20 '22 02:05 J0eky

Apparently in your case gSig is an int but should be a tuple, list or array. When initializing the parameters, did you set gSig = [4,4] (line 166 in the demo_pipeline.py)?

Also check which value is stored in the hdf5 file:

cnm = caiman.source_extraction.cnmf.cnmf.load_CNMF(fpath)
cnm.params.get('init', 'gSig')

where fpath is the path to memmap__d1_170_d2_170_d3_1_order_C_frames_3000_.hdf5

j-friedrich avatar May 26 '22 17:05 j-friedrich

Hi, I have checked the gSig according to your suggestions, they are both [4,4]. @j-friedrich

J0eky avatar Jun 09 '22 01:06 J0eky

We should probably decide what to do with this GUI moving forward. People ask questions about it periodically, but it isn't actively supported, it uses PyQtGraph which is a pretty ugly dependency. As there has been no movement on this issue I'm closing it, even though it isn't resolved. We hope to have a shiny new GUI interface eventually, but we have no official news on that yet.

EricThomson avatar May 18 '23 17:05 EricThomson