[AstroPy] an image fitting problem
Joe Philip Ninan
indiajoe at gmail.com
Thu Aug 8 14:15:56 EDT 2013
Hi Hang,
If the background is smooth enough, may be the following approach will work.
Once you have loaded a rectangular region around the star as a numpy matrix.
First mask out some radius (say 1 times FWHM) around the star using the
'ma' module in numpy.
You can then create three 1D array containing X, Y and flux count Z from
the remaining unmasked pixels.
For interpolating 2d mesh with gaps I usually use 2D Radial Basis Function
linear interpolation using scipy.interpolate.Rbf().
For example
rbfi = scipy.interpolate.Rbf(X,Y, Z,
smooth=2,epsilon=2,function='linear')
You can generate a mesh on which we have to do interpolation using
np.meshgrid()
Say XI, YI = np.meshgrid(Xvector,Yvector)
And you can use your rbfi() to obtain the interpolated values at those X
and Y coordinate matrix.
ZI = rbfi(YI, XI)
Which you can put back into your fits image to get the interpolated
background.
I will be eager to know if anybody has other better methods.
-cheers
joe
On 6 August 2013 20:15, gonghang.naoc <ghang.naoc at gmail.com> wrote:
> Hi everybody,
>
> If a star is in the outskirt of a galaxy,how to estimate its background
> reasonably?The final target is to do photometry correctly.The background
> is sort of bright and the star is difficult to be seen visually.
> I plan to to remove the region around the star ,then make a local
> thin-plate background fitting.
> Does anybody have any suggestions?Fitting methods or existing python
> scripts ,both are welcome.
>
> Best regards
>
> hang
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>
>
--
/---------------------------------------------------------------
"GNU/Linux: because a PC is a terrible thing to waste" - GNU Generation
************************************************
Joe Philip Ninan http://sites.google.com/site/jpninan/
Research Scholar /________________\
DAA, | Vadakeparambil |
TIFR, | Pullad P.O. |
Mumbai-05, India. | Kerala, India |
Ph: +917738438212 | PIN:689548 |
------------------------------\_______________/--------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20130808/4db3c61d/attachment.html>
More information about the AstroPy
mailing list