int-brain-lab / iblenv

Unified environment and Issue tracker for all IBL
MIT License
12 stars 10 forks source link

[Bug report] - Running task QC on local server #134

Closed GaelleChapuis closed 3 years ago

GaelleChapuis commented 3 years ago

Describe the bug

Together with @guidomeijer , we were trying to run the task QC (both to get the overview plots and the GUI viewer), and ran into issues.

When following the guidelines to run the task QC on a local server and get the overview plots:

from ibllib.qc.task_metrics import TaskQC
from ibllib.qc.qcplots import plot_results
session_path = r'/home/nico/Downloads/FlatIron/mrsicflogellab/Subjects/SWC_023/2020-02-14/001'
qc = TaskQC(session_path)
qc.load_data(download_data=False)  # Load data without downloading
qc.run()
plot_results(qc, save_path=session_path)

this error occurs:

2020-12-09 13:06:27.803 WARNING  [base.py:72] Failed to determine eID from session path
2020-12-09 13:06:27.804 INFO     [task_extractors.py:95] Loading raw data from /mnt/s0/Data/Subjects/ZFM-01507/2020-11-06/001
2020-12-09 13:06:27.823 WARNING  [raw_data_loaders.py:95] No data loaded: could not find raw data file
---------------------------------------------------------------------------
ALFObjectNotFound                         Traceback (most recent call last)
<ipython-input-1-e7de865d2d02> in <module>
      3 session_path = r'/mnt/s0/Data/Subjects/ZFM-01507/2020-11-06/001'
      4 qc = TaskQC(session_path)
----> 5 qc.load_data(download_data=False)  # Load data without downloading
      6 qc.run()
      7 plot_results(qc, save_path=session_path)
~/Documents/PYTHON/envs/iblenv/lib/python3.8/site-packages/ibllib/qc/task_metrics.py in load_data(self, bpod_only, download_data)
     91         :param download_data: if True, any missing raw data is downloaded via ONE.
     92         """
---> 93         self.extractor = TaskQCExtractor(
     94             self.session_path, one=self.one, download_data=download_data, bpod_only=bpod_only)
     95 
~/Documents/PYTHON/envs/iblenv/lib/python3.8/site-packages/ibllib/qc/task_extractors.py in __init__(self, session_path, lazy, one, download_data, bpod_only)
     49 
     50         if not lazy:
---> 51             self.load_raw_data()
     52             self.extract_data()
     53 
~/Documents/PYTHON/envs/iblenv/lib/python3.8/site-packages/ibllib/qc/task_extractors.py in load_raw_data(self)
    101                 self.session_path, data=self.raw_data)
    102         else:  # Extract from FPGA
--> 103             sync, chmap = _get_main_probe_sync(self.session_path)
    104 
    105             def channel_events(name):
~/Documents/PYTHON/envs/iblenv/lib/python3.8/site-packages/ibllib/io/extractors/ephys_fpga.py in _get_main_probe_sync(session_path, bin_exists)
    499     :return:
    500     """
--> 501     ephys_files = _get_all_probes_sync(session_path, bin_exists=bin_exists)
    502     if not ephys_files:
    503         raise FileNotFoundError(f"No ephys files found in {session_path}")
~/Documents/PYTHON/envs/iblenv/lib/python3.8/site-packages/ibllib/io/extractors/ephys_fpga.py in _get_all_probes_sync(session_path, bin_exists)
    487     # attach the sync information to each binary file found
    488     for ef in ephys_files:
--> 489         ef['sync'] = alf.io.load_object(ef.path, 'sync', namespace='spikeglx', short_keys=True)
    490         ef['sync_map'] = get_ibl_sync_map(ef, version)
    491     return ephys_files
~/Documents/PYTHON/envs/iblenv/lib/python3.8/site-packages/alf/io.py in load_object(alfpath, object, short_keys, **kwargs)
    273     if Path(alfpath).is_dir() and object is None:
    274         raise ValueError('If a directory is provided, the object name should be provided too')
--> 275     files_alf, parts = _ls(alfpath, object, **kwargs)
    276     # Take attribute and timescale from parts list
    277     attributes = [p[2] if not p[3] else '_'.join(p[2:4]) for p in parts]
~/Documents/PYTHON/envs/iblenv/lib/python3.8/site-packages/alf/io.py in _ls(alfpath, object, **kwargs)
    216     if not files_alf:
    217         err_str = 'object "%s" ' % object if object else 'ALF files'
--> 218         raise ALFObjectNotFound(f'No {err_str} found in {alfpath}')
    219 
    220     return [alfpath.joinpath(f) for f in files_alf], attributes
ALFObjectNotFound: No object "sync"  found in /mnt/s0/Data/Subjects/ZFM-01507/2020-11-06/001/raw_ephys_data/probe00 
 The ALF object was not found.  This may occur if the object or namespace or incorrectly formatted e.g. the object "_ibl_trials.intervals.npy" would be found with the filters `object="trials", namespace="ibl"` 

Should extraction be run manually in this case? If yes, how?

The task QC viewer launched on server with option --local also fails:

(iblenv) (base) ibladmin@iblserver:~/Documents/PYTHON/iblapps/task_qc_viewer$ ipython task_qc.py "/mnt/s0/Data/Subjects/ZFM-01507/2020-11-06/001" --local
usage: ipython [-h] [--debug] [--quiet] [--init] [--autoindent] [--no-autoindent] [--automagic] [--no-automagic]
               [--pdb] [--no-pdb] [--pprint] [--no-pprint] [--color-info] [--no-color-info] [--ignore-cwd]
               [--no-ignore-cwd] [--nosep] [--autoedit-syntax] [--no-autoedit-syntax] [--simple-prompt]
               [--no-simple-prompt] [--banner] [--no-banner] [--confirm-exit] [--no-confirm-exit] [--term-title]
               [--no-term-title] [--classic] [--quick] [-i] [--profile-dir ProfileDir.location]
               [--profile TerminalIPythonApp.profile] [--ipython-dir TerminalIPythonApp.ipython_dir]
               [--log-level TerminalIPythonApp.log_level] [--config TerminalIPythonApp.extra_config_file]
               [--autocall TerminalInteractiveShell.autocall] [--colors TerminalInteractiveShell.colors]
               [--logfile TerminalInteractiveShell.logfile] [--logappend TerminalInteractiveShell.logappend]
               [-c TerminalIPythonApp.code_to_run] [-m TerminalIPythonApp.module_to_run]
               [--ext TerminalIPythonApp.extra_extensions] [--gui TerminalIPythonApp.gui]
               [--pylab [TerminalIPythonApp.pylab]] [--matplotlib [TerminalIPythonApp.matplotlib]]
               [--cache-size TerminalInteractiveShell.cache_size]
               [extra_args [extra_args ...]]
ipython: error: argument --local: expected one argument
mayofaulkner commented 3 years ago

Can you try python task_qc.py "/mnt/s0/Data/Subjects/ZFM-01507/2020-11-06/001" --local

oliche commented 3 years ago

or ipython task_qc.py -- /mnt/s0/Data/Subjects/ZFM-01507/2020-11-06/001 --local There is an ipython flag for arguments, I've updated the doc accordingly