Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SessionLoader sess_loader.load_trials() ... DataFrame objects with inconsistent size... #904

Open
mschart opened this issue Jan 11, 2025 · 0 comments
Assignees

Comments

@mschart
Copy link
Contributor

mschart commented Jan 11, 2025

Greetings,

I was trying to load trials via SessionLoader and get the following error (not just for this eid but for most in the BWM):

In [2]: from brainbox.io.one import SessionLoader

In [3]: one = ONE()
   ...: eid = '69c9a415-f7fa-4208-887b-1417c1479b48'
   ...: sess_loader = SessionLoader(one=one, eid=eid)
   ...: sess_loader.load_trials()
Inconsistent dimensions for object: trials 
(637,),	goCueTrigger_times
(637, 2),	intervals_bpod
(637,),	quiescencePeriod
(636,),	stimOffTrigger_times
(636,),	stimOff_times
(636,),	stimOnTrigger_times
(636,),	goCue_times
(636,),	response_times
(636,),	choice
(636,),	stimOn_times
(636,),	contrastLeft
(636,),	contrastRight
(636,),	probabilityLeft
(636,),	feedback_times
(636,),	feedbackType
(636,),	rewardVolume
(636,),	firstMovement_times
(636, 2),	intervals
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[3], line 4
      2 eid = '69c9a415-f7fa-4208-887b-1417c1479b48'
      3 sess_loader = SessionLoader(one=one, eid=eid)
----> 4 sess_loader.load_trials()

File ~/miniforge3/envs/iblenv/lib/python3.10/site-packages/brainbox/io/one.py:1475, in SessionLoader.load_trials(self, collection)
   1472 # itiDuration frequently has a mismatched dimension, and we don't need it, exclude using regex
   1473 self.one.wildcards = False
   1474 self.trials = self.one.load_object(
-> 1475     self.eid, 'trials', collection=collection, attribute=r'(?!itiDuration).*', revision=self.revision or None).to_df()
   1476 self.one.wildcards = True
   1477 self.data_info.loc[self.data_info['name'] == 'trials', 'is_loaded'] = True

File ~/miniforge3/envs/iblenv/lib/python3.10/site-packages/one/alf/io.py:90, in AlfBunch.to_df(self)
     88 def to_df(self) -> pd.DataFrame:
     89     """Return DataFrame with data keys as columns"""
---> 90     return dataframe(self)

File ~/miniforge3/envs/iblenv/lib/python3.10/site-packages/one/alf/io.py:117, in dataframe(adict)
    102 """
    103 Converts an Bunch conforming to size conventions into a pandas DataFrame.
    104 For 2-D arrays, stops at 10 columns per attribute.
   (...)
    114     A pandas DataFrame of data
    115 """
    116 if check_dimensions(adict) != 0:
--> 117     raise ValueError('Can only convert to DataFrame objects with consistent size')
    118 # easy case where there are only vectors
    119 if all([len(adict[k].shape) == 1 for k in adict]):

ValueError: Can only convert to DataFrame objects with consistent size

In [5]: ibllib.version
Out[5]: '3.2.0'

Any insights are greatly appreciated!

@k1o0 k1o0 self-assigned this Jan 16, 2025
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

No branches or pull requests

2 participants