python提取图片中的曲线_如何从fits图像中提取点扩散函数?

你说“从中提取PSF”是什么意思?你想找到它的位置吗?你想在它周围切一个盒子吗?你到底想用它做什么?在

假设您有一个图像image.fits,那么您可以使用astropy.modeling来拟合PSF,在计算出它在所提供图像中的中心位置之后,就可以使用astropy.modeling来拟合PSF。在import numpy as np

import matplotlib.pyplot as plt

from astropy.modeling import models, fitting

from astropy.io import fits

# Load the data and find center of PSF

image = fits.getdata('path/image.fits')

cents = np.where(image == np.max(image))

xc = int(cents[1])

yc = int(cents[0])

# Cut out smaller box around PSF

bb = 30

box = image[yc-bb:yc+bb,xc-bb:xc+bb]

yp, xp = box.shape

# Generate grid of same size like box to put the fit on

y, x, = np.mgrid[:yp, :xp]

# Declare what function you want to fit to your data

f_init = models.Gaussian2D()

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值