读取多扩展名的问题。适合文件
我正在尝试阅读/打开一些多extension .fits文件。但是我打开它们有问题。这是我用来打开的COD的一部分。适用于同一文件夹中的文件:
imgs = sorted(glob.glob('location_of_the_files/*.fits'))
for location in imgs:
hdul = fits.open(imgs)
original = hdul[1].data
model = hdul[2].data
residual = hdul[3].data
运行此文件时,我会得到此信息:
OSError: File-like object does not have a 'write' method, required for mode 'ostream'.
我尝试在Internet上检查,但我不明白发生了什么。 关于如何解决这个问题有帮助吗?
在尝试使用此代码打开单个.fits文件时
hdul = fits.open("location_of_the_files/image_data.fits")
original = hdul[1].data
model = hdul[2].data
residual = hdul[3].data
,请务必提及。 一切都没有任何问题。 。
谢谢。
I am trying to read/open some multi-extension .fits files. But I have a problem opening them. Here is the part of the cod I am using to open .fits files located in the same folder:
imgs = sorted(glob.glob('location_of_the_files/*.fits'))
for location in imgs:
hdul = fits.open(imgs)
original = hdul[1].data
model = hdul[2].data
residual = hdul[3].data
When running this I am getting this:
OSError: File-like object does not have a 'write' method, required for mode 'ostream'.
I try to check on the internet, but I do not understand what is going on.
Any help on how to solve this?
Maybe it is important to mention when trying to open single .fits file with this code everything works without any problem:
hdul = fits.open("location_of_the_files/image_data.fits")
original = hdul[1].data
model = hdul[2].data
residual = hdul[3].data
If needed let me know and I can upload .fits files (in that case, please just tell me how to do this here).
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您试图做这样的事情:
注意
位置
而不是imgs
作为open> open
方法的参数。I suppose that you were trying to do something like this:
Note the
location
instead ofimgs
as an argument ofopen
method.