【问题标题】:Computing the FWHM of a star profile计算星形轮廓的 FWHM
【发布时间】:2019-06-27 18:13:52
【问题描述】:

我的目标是计算星形轮廓的 FWHM。

我有一张图片和一颗星,作为输入。位置 (x, y) 处的每个像素都有一个介于 0 和 1 之间的强度。

我的想法是计算整个数据集的标准差,然后使用以下公式:

f(x, y)=[1/(√(2π)σ)]exp(-[(x - X)^2 + (y - Y)^2]/2σ^2])

解方程:

fmax/2=1/[2√(2π)σ]=[1/(√(2π)σ)]exp(-[(x - X)^2 + (y - Y)^2]/2σ^2]) =>

FWHM=2σ√(2ln2)

使用这种方法,我在查看数据时没有得到预期的结果。

我有什么遗漏吗?还有什么建议吗?

【问题讨论】:

    标签: gaussian astronomy


    【解决方案1】:

    您可能会使用插值获得更好的结果,从而实现亚像素精度。由于您的数据介于 0-1 之间,并且质心的强度为 1,因此您可以通过该点提取配置文件。首先,将您的图像导入为 2D numpy 数组,如果它还不是那种形式的话。如果您从 FITS 文件开始:

    from astropy.io import fits
    filename = 'your_image_file.fits'
    image = fits.getdata(filename)
    

    提取您的个人资料并获取 FWHM:

    import numpy as np
    from scipy.interpolate import UnivariateSpline
    
    def profiles(image):
        ypix, xpix = np.where(image==1)
        x = np.take(image, ypix[0], axis=0)
        y = np.take(image, xpix[0], axis=1)
    
        return x, y #these are the horizontal and vertical profiles through the star's centroid
    
    def interpolate_width(axis):
        half_max = 1/2
        x = np.linspace(0, len(axis), len(axis))
    
        # Do the interpolation
        spline = UnivariateSpline(x, axis-half_max, s=0)
        r1, r2 = spline.roots()
    
        return r2-r1 #this is the FWHM along the specified axis
    
    horizontal, vertical = profiles(image)
    fwhm_x = interpolate_width(horizontal)
    fwhm_y = interpolate_width(vertical)
    

    这是假设星星没有旋转——或者如果是,你只需要沿水平轴和垂直轴的 FWHM。如果星形相对于水平面旋转,并且您想要沿半长轴和半短轴的 FWHM,则必须通过采用由两点连接的线段来提取轮廓。然后,您可以使用 interpolate_width 函数以相同的方式获取 FWHM。有关此方法的配置文件提取部分,请参见此处:How to extract an arbitrary line of values from a numpy array?

    【讨论】:

    • 没错。我或多或少地按照你描述的方式做了。谢谢
    猜你喜欢
    • 2023-03-21
    • 2012-09-19
    • 2015-07-05
    • 2014-11-20
    • 2018-08-12
    • 2010-11-01
    • 2010-10-20
    • 2021-08-01
    • 1970-01-01
    相关资源
    最近更新 更多