Closed galenlynch closed 1 year ago
This code in databook/visual-behavior/VBO-Tutorial-Compare_trial_types.md
doesn't seem to work:
trial = ophys_experiment.trials.query('hit').sample()
fig, axes = make_trial_plot(trial)
Here is the output:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[27], line 2
1 trial = ophys_experiment.trials.query('miss').sample(random_state = 2)
----> 2 fig, axes = make_trial_plot(trial)
Cell In[23], line 77, in make_trial_plot(trial)
74 fig, axes = plt.subplots(4, 1, figsize = (15, 8), sharex=True)
76 for ax in axes:
---> 77 plot_stimuli(trial, ax)
79 plot_running(trial, axes[0])
81 plot_licks(trial, axes[1])
Cell In[23], line 6, in plot_stimuli(trial, ax)
2 '''
3 plot stimuli as colored bars on specified axis
4 '''
5 stimuli = stimulus_presentations.copy()
----> 6 stimuli = stimuli[(stimuli.end_time >= trial['start_time']) &
7 (stimuli.start_time <= trial['stop_time'])]
8 for idx, stimulus in stimuli.iterrows():
9 ax.axvspan(stimulus['start_time'], stimulus['end_time'], color=stimulus['color'], alpha=0.5)
File /opt/envs/allensdk/lib/python3.8/site-packages/pandas/core/ops/common.py:72, in _unpack_zerodim_and_defer.<locals>.new_method(self, other)
68 return NotImplemented
70 other = item_from_zerodim(other)
---> 72 return method(self, other)
File /opt/envs/allensdk/lib/python3.8/site-packages/pandas/core/arraylike.py:62, in OpsMixin.__ge__(self, other)
60 @unpack_zerodim_and_defer("__ge__")
61 def __ge__(self, other):
---> 62 return self._cmp_method(other, operator.ge)
File /opt/envs/allensdk/lib/python3.8/site-packages/pandas/core/series.py:6237, in Series._cmp_method(self, other, op)
6234 res_name = ops.get_op_result_name(self, other)
6236 if isinstance(other, Series) and not self._indexed_same(other):
-> 6237 raise ValueError("Can only compare identically-labeled Series objects")
6239 lvalues = self._values
6240 rvalues = extract_array(other, extract_numpy=True, extract_range=True)
ValueError: Can only compare identically-labeled Series objects
I just disabled it...
@corbennett