我正在做一个项目,我在一个名为Prismatic的程序中进行模拟,以获取我以后要使用的文件,Prismatic以h5格式输出文件,我可以使用Python从中提取数据,模拟生成一个图像,保存在两个数据集(dim1,dim2)中,每一个都是大小为219的numpy数组,我试图再次从中创建图像,但我不确定这是如何工作的,我尝试堆叠numpy数组,但我只是在图像中得到一行,我刚刚了解了numpy数组,我对它们知之甚少,有人能帮忙吗?这是我的密码
fi = h5py.File('ty.h5')
a = fi['4DSTEM_simulation']['data']['realslices']['annular_detector_depth0000']['dim1'][:]
b = fi['4DSTEM_simulation']['data']['realslices']['annular_detector_depth0000']['dim2'][:]
merge_arr = numpy.stack((a, b), axis=0)
data = Image.fromarray(merge_arr)
if data.mode != 'RGB':
data = data.convert('RGB')
好的,根据你的数据集,我找到了一张图片
解决这个问题的真正工具是查看文件
f
的给定级别上的键是什么,如f.keys()
或f['4DSTEM_simulation'].keys()
等等,然后通过提取这些键访问的可用对象来查看其中的项的形状。最后我发现了一个是图像。我对这些数据一无所知,所以可能还有更多。看来你原来的问题实际上并不是什么需要解决的问题。两个246x1阵列绝对不会以独特的方式形成图像相关问题 更多 >
编程相关推荐