如何将目录中的角度值导入 GalSim
How to import angle values from a catalog into GalSim
我正在尝试将星系值(Sersic 指数、半光半径等)从外部 ascii 文件导入 GalSim。我在读取位置角度值 'beta' 时遇到问题,想知道这是否可以使用 YAML 格式。
当我尝试时收到错误消息:
galsim.errors.GalSimConfigValueError: Invalid value_type specified for parameter beta with type=Catalog. Value <class 'coord.angle.Angle'> not in (<class 'float'>, <class 'int'>, <class 'bool'>, <class 'str'>)
我意识到我收到此错误消息是因为我无法在输入后附加字符串 'deg' 以指定此输入的单位为度。
我尝试将 'deg' 直接添加到输入目录(在“”语音标记内),但没有成功。我也尝试直接在代码中的目录读取语句后添加 'deg',但也没有成功。
下面是一个最低限度的工作示例。这依赖于同一目录中名为 'input.dat' 的文件,其中包含一个数字(例如 45)。然后,将下面的代码保存为 'test.yaml' 和 运行 在命令行中保存为 $ galsim test.yaml
:
gal :
type : Sersic
n : 1
half_light_radius : 1
flux : 1
ellip :
type : QBeta
q : 0.5
beta : { type : Catalog , col : 0 }
input :
catalog :
file_name : input.dat
我希望能够从输入的 ascii 目录中读取 beta 位置角参数,并将它们复制到输出的星系剖面中。上面的 MWE 应该产生一个中等椭圆星系的小邮票图像,其位置角为 45 度(或放置在 'input.dat'.
内的任何数字)
提前感谢您在这方面的任何帮助或建议。
试试这个:
gal :
type : Sersic
n : 1
half_light_radius : 1
flux : 1
ellip :
type : QBeta
q : 0.5
beta :
type: Radians
theta: { type : Catalog , col : 0 }
input :
catalog :
file_name : input.dat
还有一个 Degrees
类型,如果您的目录列以度为单位列出角度,它的工作方式相同。
我正在尝试将星系值(Sersic 指数、半光半径等)从外部 ascii 文件导入 GalSim。我在读取位置角度值 'beta' 时遇到问题,想知道这是否可以使用 YAML 格式。
当我尝试时收到错误消息:
galsim.errors.GalSimConfigValueError: Invalid value_type specified for parameter beta with type=Catalog. Value <class 'coord.angle.Angle'> not in (<class 'float'>, <class 'int'>, <class 'bool'>, <class 'str'>)
我意识到我收到此错误消息是因为我无法在输入后附加字符串 'deg' 以指定此输入的单位为度。
我尝试将 'deg' 直接添加到输入目录(在“”语音标记内),但没有成功。我也尝试直接在代码中的目录读取语句后添加 'deg',但也没有成功。
下面是一个最低限度的工作示例。这依赖于同一目录中名为 'input.dat' 的文件,其中包含一个数字(例如 45)。然后,将下面的代码保存为 'test.yaml' 和 运行 在命令行中保存为 $ galsim test.yaml
:
gal :
type : Sersic
n : 1
half_light_radius : 1
flux : 1
ellip :
type : QBeta
q : 0.5
beta : { type : Catalog , col : 0 }
input :
catalog :
file_name : input.dat
我希望能够从输入的 ascii 目录中读取 beta 位置角参数,并将它们复制到输出的星系剖面中。上面的 MWE 应该产生一个中等椭圆星系的小邮票图像,其位置角为 45 度(或放置在 'input.dat'.
内的任何数字)提前感谢您在这方面的任何帮助或建议。
试试这个:
gal :
type : Sersic
n : 1
half_light_radius : 1
flux : 1
ellip :
type : QBeta
q : 0.5
beta :
type: Radians
theta: { type : Catalog , col : 0 }
input :
catalog :
file_name : input.dat
还有一个 Degrees
类型,如果您的目录列以度为单位列出角度,它的工作方式相同。