【问题标题】:Pyraf rspectext RuntimeError: dictionary keys changed during iterationPyraf rspectext RuntimeError:字典键在迭代期间更改
【发布时间】:2022-10-25 16:38:32
【问题描述】:

我必须将具有两列(波长和通量)的经典 ascii 文件转换为拟合文件,并且我在 python 脚本中使用了 pyraf 中的 rspectext(使用 dtype=interp),但我收到以下错误消息:

Traceback (innermost last):
File "<CL script CL1>", line 1, in <module>
File "<CL script onedspec.rspectext>", line 54, in rspectext
    iraf.hedit(Vars.specout, 'title', Vars.title, add=yes, 
    addonly=no,PYdel=no,update=yes,verify=no,show=no)
RuntimeError: dictionary keys changed during iteration

我无法理解出了什么问题。我更新了所有内容,按照指南安装了 iraf 和 pyraf,在 iraf 上,rspectext 有效。在其他 python 脚本中,我使用其他命令,如 continuum、splot 等,它们可以工作。

我的测试脚本很简单:

from pyraf.iraf import onedspec,rspectext
onedspec
rspectext(input='test.dat',output='spectrum',dtype='interp')

我正在测试的频谱的一个非常短的版本是:

5530.01708984375 0.9749500155448914
5530.0498046875 0.9674800038337708
5530.0830078125 0.9679499864578247
5530.1162109375 0.968280017375946
5530.1474609375 0.9703999757766724
5530.18115234375 0.9549300074577332
5530.21435546875 0.9670699834823608
5530.2470703125 0.9639800190925598
5530.2802734375 0.953029990196228
5530.31298828125 0.9535700082778931
5530.34619140625 0.9583899974822998
5530.37890625 0.9467300176620483
5530.412109375 0.9565500020980835

蟒蛇版本 3.10.6 pyraf 版本 2.2.0 伊朗空军 2.17 操作系统 Ubuntu 22.04.1 LTS 64 位

如果您对使用 python 标准化光谱的替代方法有建议,也可以。 提前致谢。

【问题讨论】:

  • 迭代期间更改的字典键意味着在rspectext 中,您正在迭代字典,并且在执行此操作时,您正在修改该字典。

标签: python bash iraf


【解决方案1】:

这实际上是 PyRAF 2.2.0 中的一个错误,在 2.2.1 中已修复。有关详细信息,请参阅iraf-community/pyraf#146。所以解决这个问题的方法是升级到 2.2.1。

【讨论】:

    猜你喜欢
    • 2021-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-26
    • 1970-01-01
    • 2021-07-05
    相关资源
    最近更新 更多