我适合galsim中的星系,并收到以下错误:
File "/home/luis/Documents/SRC2014/galsim_work/noiseLibrary.py", line 50, in create_galaxy
gal = gal.shear(g1=e1, g2=e2)
File "/usr/lib/python2.7/dist-packages/galsim/base.py", line 572, in shear
shear = galsim.Shear(**kwargs)
File "/usr/lib/python2.7/dist-packages/galsim/shear.py", line 111, in __init__
raise ValueError("Requested shear exceeds 1: %f"%g)
ValueError: Requested shear exceeds 1: 1.007171我试图通过检查e1和e2的值以及在我的程序中通过以下方法创建星系的大小来纠正这一问题:
if e1 > 1:
print "The e1 component of ellipticity is greater than 1."
e1 = 0.99
elif e1 < -1:
print "The e1 component of ellipticity is less than -1."
e1 = -0.99
if e2 > 1:
print "The e2 component of ellipticity is greater than 1."
e2 + 0.99
elif e2 < -1:
print "The e2 component of ellipticity is less than -1."
e2 = -0.99
if np.sqrt(e1**2 + e2**2) > 1:
return create_galaxy(flux, hlr, e1*0.5, e2*0.5, galtype_gal=galtype_gal, sersic_index=sersic_index,
psf_flag=psf_flag, psf_type=psf_type, beta=beta, size_psf=size_psf, flux_psf=flux_psf,
x_len=x_len, y_len=y_len, scale=scale, method=method,seed=seed)虽然此解决方案适用于各个组件,但我怀疑递归调用正在创建以下错误:
File "/usr/lib/python2.7/dist-packages/galsim/base.py", line 1196, in drawImage
image.added_flux = prof.SBProfile.draw(imview.image, gain, wmult)
MemoryError关于如何解决这个问题,有什么建议吗?请注意,对于我的拟合参数化,我将e1和e2结合在-1和1之间。我怀疑我应该围绕着椭圆度的大小(根据单位圆来定界),而不是单位正方形。
谢谢!
发布于 2014-08-22 18:29:38
你是正确的,椭圆度必须在单位圆内有界,所以每个组件的独立边界都不能完成这项工作。这就是ValueError要求剪切超过1的原因。
然而,在缺乏更多细节的情况下,内存错误很难诊断。这是经常发生还是偶尔发生一次?你能给我们一个简短的脚本来重现这个错误,包括所有星系和PSF参数的具体值,以及用来绘制对象的命令吗?
https://stackoverflow.com/questions/25452913
复制相似问题