int-brain-lab / iblapps

pyqt5 dependent applications for IBL sessions
MIT License
23 stars 15 forks source link

External user installation update / Type error during data coversion #66

Closed takacsflora closed 2 years ago

takacsflora commented 2 years ago

Hi Mayo,

I am installing the IBL atlasephys on a new computer -- I have noticed that the iblenv installation guide has changed, might you be able to update the IBL atlasephys installation guilde, please? I have tried to follow iblenv installation guide and use the developbranch of iblappsand the devbranch of iblenv, but I get the following error during extract_data():

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [4], in <cell line: 15>()
     10 # Save path
     11 out_path = Path(r'Z:\AV014\2022-07-05\ephys\AV014_2022-07-05_Spontaneous1_g0\AV014_2022-07-05_Spontaneous1_g0_imec0\ibl_format')
---> 15 extract_data(ks_path, ephys_path, out_path)

File c:\users\experiment\documents\github\int-brain-lab\iblapps\atlaselectrophysiology\extract_files.py:137, in extract_data(ks_path, ephys_path, out_path)
    133 if efile.get('ap') and efile.ap.exists():
    134     ks2_to_alf(ks_path, ephys_path, out_path, bin_file=efile.ap,
    135                ampfactor=_sample2v(efile.ap), label=None, force=True)
--> 137     extract_rmsmap(efile.ap, out_folder=out_path, spectra=False)
    138 if efile.get('lf') and efile.lf.exists():
    139     extract_rmsmap(efile.lf, out_folder=out_path)

File c:\users\experiment\documents\github\int-brain-lab\iblapps\atlaselectrophysiology\extract_files.py:93, in extract_rmsmap(fbin, out_folder, spectra)
     90 alf_object_freq = f'ephysSpectralDensity{sglx.type.upper()}'
     92 # crunch numbers
---> 93 rms = rmsmap(fbin, spectra=spectra)
     94 # output ALF files, single precision with the optional label as suffix before extension
     95 if not out_folder.exists():

File c:\users\experiment\documents\github\int-brain-lab\iblapps\atlaselectrophysiology\extract_files.py:45, in rmsmap(fbin, spectra)
     43 win['spectral_density'] = np.zeros((len(win['fscale']), sglx.nc))
     44 # loop through the whole session
---> 45 with tqdm(total=wingen.firstlast) as pbar:
     46     for first, last in wingen.firstlast:
     47         D = sglx.read_samples(first_sample=first, last_sample=last)[0].transpose()

File ~\anaconda3\envs\iblenv\lib\site-packages\tqdm\std.py:1109, in tqdm.__init__(self, iterable, desc, total, leave, file, ncols, mininterval, maxinterval, miniters, ascii, disable, unit, unit_scale, dynamic_ncols, smoothing, bar_format, initial, position, postfix, unit_divisor, write_bytes, lock_args, nrows, colour, delay, gui, **kwargs)
   1107     self.sp = self.status_printer(self.fp)
   1108     if delay <= 0:
-> 1109         self.refresh(lock_args=self.lock_args)
   1111 # Init the time counter
   1112 self.last_print_t = self._time()

File ~\anaconda3\envs\iblenv\lib\site-packages\tqdm\std.py:1361, in tqdm.refresh(self, nolock, lock_args)
   1359     else:
   1360         self._lock.acquire()
-> 1361 self.display()
   1362 if not nolock:
   1363     self._lock.release()

File ~\anaconda3\envs\iblenv\lib\site-packages\tqdm\std.py:1509, in tqdm.display(self, msg, pos)
   1507 if pos:
   1508     self.moveto(pos)
-> 1509 self.sp(self.__str__() if msg is None else msg)
   1510 if pos:
   1511     self.moveto(-pos)

File ~\anaconda3\envs\iblenv\lib\site-packages\tqdm\std.py:1165, in tqdm.__str__(self)
   1164 def __str__(self):
-> 1165     return self.format_meter(**self.format_dict)

File ~\anaconda3\envs\iblenv\lib\site-packages\tqdm\std.py:425, in tqdm.format_meter(n, total, elapsed, ncols, prefix, ascii, unit, unit_scale, rate, bar_format, postfix, unit_divisor, initial, colour, **extra_kwargs)
    359 """
    360 Return a string-based progress bar given some parameters
    361 
   (...)
    421 out  : Formatted meter and stats, ready to display.
    422 """
    424 # sanity check: total
--> 425 if total and n >= (total + 0.5):  # allow float imprecision (#849)
    426     total = None
    428 # apply custom scale if necessary

TypeError: unsupported operand type(s) for +: 'generator' and 'float'

Thank you for the help in advance! Flora

mayofaulkner commented 2 years ago

Hi Flora,

Thanks for pointing that out. I have updated the install instructions so they point to the iblenv. Can you try pulling the latest changes from iblapps develop and see if the problem you were having above is fixed

Thanks

mschottdorf commented 2 years ago

Hi Flora,

I stumbled into the same issue with #65. It's just the progress bar that got stuck.

takacsflora commented 2 years ago

Hi Mayo and Manuel, Thanks for the fast response. For me this issue is fixed, pulling the latest update. However, I now have issues with loading the GUI:

Traceback (most recent call last):
  File "C:\Users\Experiment\Documents\GitHub\int-brain-lab\iblapps\atlaselectrophysiology\ephys_atlas_gui.py", line 1268, in data_button_pressed
    self.img_rms_APdata, self.probe_rms_APdata = self.plotdata.get_rms_data_img_probe('AP')
  File "c:\users\experiment\documents\github\int-brain-lab\iblapps\atlaselectrophysiology\plot_data.py", line 468, in get_rms_data_img_probe
    probe_img, probe_scale, probe_offset = self.arrange_channels2banks(rms_avg)
  File "c:\users\experiment\documents\github\int-brain-lab\iblapps\atlaselectrophysiology\plot_data.py", line 696, in arrange_channels2banks
    _bnk_vals[idx_full] = data[bnk_idx]
ValueError: shape mismatch: value array of shape (192,) could not be broadcast to indexing result of shape (0,)
mschottdorf commented 2 years ago

What is your electrode geometry? Seems like there might be a misunderstanding of atlas and the shape of the probe. Are these 1.0 probes?

takacsflora commented 2 years ago

Npix 2.0 single shank configuration.

mayofaulkner commented 2 years ago

Hi Flora, do you mind providing me with the files

So I can take a quick look at whats going on

takacsflora commented 2 years ago

Thanks Mayo, I emailed them just now!