Little endian 编译器 Python 不支持 Big Endian如何转换为大端编译器

问题描述

我在 python kde plot 中使用了 seaborn 模块。为此,我使用了 fits 文件和 astropy table。 这是我的代码。当我运行代码时,它说 Little Endian 不支持 Big Endian。我可以在我以前的 Jupiter 笔记本中运行它,但我再次重新安装了 anaconda jupyter,现在它不工作了。如何使它工作?有什么办法可以让我们拥有 BIG ENDIAN 编译器。我从 astropy table 更改为 panda,但它没有正确给出结果。我想使用天文台。请帮忙。谢谢

import numpy as np
import matplotlib.pyplot as plt
from astropy.table import Table
import seaborn as sb 
plt.figure(figsize=(14,12))
X=data['ra']
Y=data['dec']
levels=np.arange(0,0.3,0.02)

sb.kdeplot(X,Y,cmap='Reds',hue_order=False,levels=levels,shade=False,shade_lowest=True,gridsize=500,cbar=False,fill=True,annot = True)

plt.scatter(X,s=1.2,color='red')



s=plt.scatter(X,edgecolor='k',lw=3,label='NB926 [OII] emitters',facecolor='None')


plt.xlabel('RA[deg]')
plt.ylabel('DEC[deg]')
plt.gca().invert_xaxis()

解决方法

如果没有看到更多细节,如异常堆栈跟踪,则有点难以确定。但是,这可能会在 https://github.com/astropy/astropy/issues/11286 中讨论并在 https://github.com/astropy/astropy/pull/11288 中修复。

一种解决方法可能是

data = Table(data.as_array().byteswap().newbyteorder('='))