Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 大脑观察笔记本错误-';数据帧';对象没有属性';方向';_Python_Jupyter Notebook_Allen Sdk - Fatal编程技术网

Python 大脑观察笔记本错误-';数据帧';对象没有属性';方向';

Python 大脑观察笔记本错误-';数据帧';对象没有属性';方向';,python,jupyter-notebook,allen-sdk,Python,Jupyter Notebook,Allen Sdk,我正在使用艾伦·布莱恩天文台的笔记本: 当我运行单元格16和17时,在运行单元格17后,我得到以下错误: AttributeError:“DataFrame”对象没有属性“orientation” 以下是两个单元格的代码: from allensdk.brain_observatory.drifting_gratings import DriftingGratings # example loading drifing grating data #data_set = boc.get_ophy

我正在使用艾伦·布莱恩天文台的笔记本:

当我运行单元格16和17时,在运行单元格17后,我得到以下错误:

AttributeError:“DataFrame”对象没有属性“orientation”

以下是两个单元格的代码:

from allensdk.brain_observatory.drifting_gratings import DriftingGratings

# example loading drifing grating data
#data_set = boc.get_ophys_experiment_data(512326618)
dg = DriftingGratings(data_set)
print("done analyzing drifting gratings")

import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline

# filter for visually responding, selective cells
vis_cells = (dg.peak.ptest_dg < 0.05) &  (dg.peak.peak_dff_dg > 3)
osi_cells = vis_cells & (dg.peak.osi_dg > 0.5) & (dg.peak.osi_dg <= 1.5)
dsi_cells = vis_cells & (dg.peak.dsi_dg > 0.5) & (dg.peak.dsi_dg <= 1.5)

# 2-d tf vs. ori histogram
# tfval = 0 is used for the blank sweep, so we are ignoring it here
os = np.zeros((len(dg.orivals), len(dg.tfvals)-1))
ds = np.zeros((len(dg.orivals), len(dg.tfvals)-1))

for i,trial in dg.peak[osi_cells].iterrows():
    os[trial.ori_dg, trial.tf_dg-1] += 1

for i,trial in dg.peak[dsi_cells].iterrows():
    ds[trial.ori_dg, trial.tf_dg-1] += 1

max_count = max(os.max(), ds.max())

fig, (ax1, ax2) = plt.subplots(1,2)

# plot direction selectivity
im = ax1.imshow(ds, clim=[0,max_count], cmap='hot', interpolation='nearest')
ax1.set_xlabel('temporal frequency')
ax1.set_ylabel('direction')
ax1.set_xticks(np.arange(len(dg.tfvals)-1))
ax1.set_xticklabels(dg.tfvals[1:])
ax1.set_yticks(np.arange(len(dg.orivals)))
ax1.set_yticklabels(dg.orivals)
ax1.set_title('direction selective cells')

# plot orientation selectivity
im = ax2.imshow(os, clim=[0,max_count], cmap='hot', interpolation='nearest')
ax2.set_xlabel('temporal frequency')
ax2.set_ylabel('orientation')
ax2.set_xticks(np.arange(len(dg.tfvals)-1))
ax2.set_xticklabels(dg.tfvals[1:])
ax2.set_yticks(np.arange(len(dg.orivals)))
ax2.set_yticklabels(dg.orivals)
ax2.set_title('orientation selective cells')

# plot a colorbar
fig.subplots_adjust(right=0.9)
cbar_ax = fig.add_axes([0.95, 0.05, 0.05, 0.85])
cbar = fig.colorbar(im, cax=cbar_ax)
cbar.set_ticks(np.arange(0, max_count, 2)+0.5)
cbar.set_ticklabels(np.arange(0, max_count, 2, dtype=int))

plt.show()
来自allensdk.brain\u observation.drifting\u光栅导入漂移光栅
#加载驱动光栅数据的示例
#数据集=boc.获取实验数据(512326618)
dg=漂移光栅(数据集)
打印(“分析漂移光栅完成”)
将numpy作为np导入
从matplotlib导入pyplot作为plt
%matplotlib内联
#用于视觉响应、选择性单元格的过滤器
可视单元=(dg.peak.ptest_dg<0.05)和(dg.peak.peak_dff_dg>3)
osi_单元=可视单元和(dg.peak.osi_dg>0.5)和(dg.peak.osi_dg 0.5)和(dg.peak.dsi_dg 3)

感谢您的帮助。我想使用“allensdk”标签,但我没有声誉

您能帮我确认一下您正在使用python3吗?我们正试图解决一些与py3相关的问题(主要是h5py和PyTables)——事实上,我昨天遇到了这个问题

问题是,在Python3中,刺激表列名是用字节('b')字符串从NWB文件中读取的,这与列索引不兼容

修复方法是修补此线路:

将字符串解码为utf-8。看起来是这样的:

features = [ f.decode('UTF-8') for f in features ]

如果你愿意的话,我现在可以把这个卷到总机上。否则,将在6月份发布另一个包含此修复程序的point版本。我认为届时我们还不能完全支持python3,但我们正在努力。

你能帮我确认一下你正在使用python3吗?我们正试图解决一些与py3相关的问题(主要是h5py和PyTables)——事实上,我昨天遇到了这个问题

问题是,在Python3中,刺激表列名是用字节('b')字符串从NWB文件中读取的,这与列索引不兼容

修复方法是修补此线路:

将字符串解码为utf-8。看起来是这样的:

features = [ f.decode('UTF-8') for f in features ]

如果你愿意的话,我现在可以把这个卷到总机上。否则,将在6月份发布另一个包含此修复程序的point版本。我认为目前还不能完全支持python 3,但我们正在努力。

我正在使用python 2.7。今天晚些时候我会试着补上,谢谢。很有意思。可能是h5py的最新版本?你用的是什么版本?嗨,大卫。我使用的是h5py的2.7.0版。你的配线很好用,非常感谢。很高兴你的配线很好用。这种变化将在一个月左右出现,我正在使用Python2.7。今天晚些时候我会试着补上,谢谢。很有意思。可能是h5py的最新版本?你用的是什么版本?嗨,大卫。我使用的是h5py的2.7.0版。你的配线很好用,非常感谢。很高兴你的配线很好用。这种变化将在一个月左右出现。