comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to create synthetic images of stars with gaussian psf in IDL.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
How to create synthetic images of stars with gaussian psf in IDL. [message #92961] Mon, 04 April 2016 00:43 Go to next message
Sonu Tabitha is currently offline  Sonu Tabitha
Messages: 29
Registered: April 2016
Junior Member
I want to create a synthetic image to resemble a stellar field (say covering an area of 255 by 255 pixels, with a total of about 4 stars having Gaussian PSF). The rest of the image has to be filled with constant background and noise, as present in the entire image, but devoid of stars. I want to create this to test a source extraction algorithm that I have developed. I am a beginner in IDL. Can you please help me out in coding?
Re: How to create synthetic images of stars with gaussian psf in IDL. [message #92969 is a reply to message #92961] Mon, 04 April 2016 07:59 Go to previous messageGo to next message
Sonu Tabitha is currently offline  Sonu Tabitha
Messages: 29
Registered: April 2016
Junior Member
On Monday, April 4, 2016 at 1:13:27 PM UTC+5:30, Sonu Tabitha wrote:
> I want to create a synthetic image to resemble a stellar field (say covering an area of 255 by 255 pixels, with a total of about 4 stars having Gaussian PSF). The rest of the image has to be filled with constant background and noise, as present in the entire image, but devoid of stars. I want to create this to test a source extraction algorithm that I have developed. I am a beginner in IDL. Can you please help me out in coding?

Thanks Jeremy! But I am very new to IDL and I am not so familiar with its functions. Can you please give me a sample code?
Re: How to create synthetic images of stars with gaussian psf in IDL. [message #92970 is a reply to message #92961] Mon, 04 April 2016 08:01 Go to previous messageGo to next message
Sonu Tabitha is currently offline  Sonu Tabitha
Messages: 29
Registered: April 2016
Junior Member
On Monday, April 4, 2016 at 1:13:27 PM UTC+5:30, Sonu Tabitha wrote:
> I want to create a synthetic image to resemble a stellar field (say covering an area of 255 by 255 pixels, with a total of about 4 stars having Gaussian PSF). The rest of the image has to be filled with constant background and noise, as present in the entire image, but devoid of stars. I want to create this to test a source extraction algorithm that I have developed. I am a beginner in IDL. Can you please help me out in coding?

Is there any way to do it with FLTARR?
Re: How to create synthetic images of stars with gaussian psf in IDL. [message #92978 is a reply to message #92970] Mon, 04 April 2016 10:43 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 4/4/16 9:01 AM, Sonu Tabitha wrote:
> On Monday, April 4, 2016 at 1:13:27 PM UTC+5:30, Sonu Tabitha wrote:
>> I want to create a synthetic image to resemble a stellar field
>> (say covering an area of 255 by 255 pixels, with a total of about 4
>> stars having Gaussian PSF). The rest of the image has to be filled
>> with constant background and noise, as present in the entire image,
>> but devoid of stars. I want to create this to test a source
>> extraction algorithm that I have developed. I am a beginner in IDL.
>> Can you please help me out in coding?
>
> Is there any way to do it with FLTARR?

FLTARR just makes an array of floats (by default 0.0's) of a given size.
You might use it, but that will the least of your worries.

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Re: How to create synthetic images of stars with gaussian psf in IDL. [message #92980 is a reply to message #92978] Mon, 04 April 2016 21:15 Go to previous messageGo to next message
Sonu Tabitha is currently offline  Sonu Tabitha
Messages: 29
Registered: April 2016
Junior Member
On Monday, April 4, 2016 at 11:13:35 PM UTC+5:30, Michael Galloy wrote:
> On 4/4/16 9:01 AM, Sonu Tabitha wrote:
>> On Monday, April 4, 2016 at 1:13:27 PM UTC+5:30, Sonu Tabitha wrote:
>>> I want to create a synthetic image to resemble a stellar field
>>> (say covering an area of 255 by 255 pixels, with a total of about 4
>>> stars having Gaussian PSF). The rest of the image has to be filled
>>> with constant background and noise, as present in the entire image,
>>> but devoid of stars. I want to create this to test a source
>>> extraction algorithm that I have developed. I am a beginner in IDL.
>>> Can you please help me out in coding?
>>
>> Is there any way to do it with FLTARR?
>
> FLTARR just makes an array of floats (by default 0.0's) of a given size.
> You might use it, but that will the least of your worries.
>
> Mike
> --
> Michael Galloy
> www.michaelgalloy.com
> Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)

I used PSF_gaussian to generate a star with gaussian profile. But while plotting what I am obtaining is a graph. Doesn't look like a star. Infact i need to create a closed object (circular or elliptical) to represent stars. Can you please tell em how to do it?
Re: How to create synthetic images of stars with gaussian psf in IDL. [message #92981 is a reply to message #92978] Mon, 04 April 2016 21:22 Go to previous messageGo to next message
Sonu Tabitha is currently offline  Sonu Tabitha
Messages: 29
Registered: April 2016
Junior Member
On Monday, April 4, 2016 at 11:13:35 PM UTC+5:30, Michael Galloy wrote:
> On 4/4/16 9:01 AM, Sonu Tabitha wrote:
>> On Monday, April 4, 2016 at 1:13:27 PM UTC+5:30, Sonu Tabitha wrote:
>>> I want to create a synthetic image to resemble a stellar field
>>> (say covering an area of 255 by 255 pixels, with a total of about 4
>>> stars having Gaussian PSF). The rest of the image has to be filled
>>> with constant background and noise, as present in the entire image,
>>> but devoid of stars. I want to create this to test a source
>>> extraction algorithm that I have developed. I am a beginner in IDL.
>>> Can you please help me out in coding?
>>
>> Is there any way to do it with FLTARR?
>
> FLTARR just makes an array of floats (by default 0.0's) of a given size.
> You might use it, but that will the least of your worries.
>
> Mike
> --
> Michael Galloy
> www.michaelgalloy.com
> Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)

Is there any IDL code to make the images with gaussian sources?
Re: How to create synthetic images of stars with gaussian psf in IDL. [message #92987 is a reply to message #92969] Tue, 05 April 2016 07:18 Go to previous messageGo to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Monday, April 4, 2016 at 10:59:09 AM UTC-4, Sonu Tabitha wrote:
> On Monday, April 4, 2016 at 1:13:27 PM UTC+5:30, Sonu Tabitha wrote:
>> I want to create a synthetic image to resemble a stellar field (say covering an area of 255 by 255 pixels, with a total of about 4 stars having Gaussian PSF). The rest of the image has to be filled with constant background and noise, as present in the entire image, but devoid of stars. I want to create this to test a source extraction algorithm that I have developed. I am a beginner in IDL. Can you please help me out in coding?
>
> Thanks Jeremy! But I am very new to IDL and I am not so familiar with its functions. Can you please give me a sample code?

1) RANDOMU takes as its first argument a random seed, and then the dimensions of the output array. So, for example, if you wanted to get a 256 x 512 random array, you could do:

seed = 1L ; set it to something so your results are repeatable
noise_image = RANDOMU(seed, 256, 512)

By default RANDOMU gives you a uniform random deviate, but you probably want a Poisson distribution, which requires giving the POISSON keyword with the mean expected value. For example, if your noise level is 2.5 electrons, you might say:

RANDOMU(seed, 256, 512, POISSON=2.5)


2) PSF_GAUSSIAN takes a few options. The ones you care about are:
NPIXEL: The dimensions of the output array. So you could use [256, 512] to make an array the same size as above.
CENTROID: The position on the iamge of the center of the PSF. For example [10.5, 186] for a center at x=10.5, y=186 (note they don't have to be at pixel centers).
FWHM or ST_DEV: Width of the Gaussian -- you can specify it either using the FWHM or Gaussian sigma. For an isotropic PSF, just give one value (e.g. ST_DEV=3.0 for a 3-pixel standard deviation), or for an anisotropic PSF you can give a separate x- and y-width (e.g. FWHM=[4.0, 5.5] for a PSF that is slightly elongated in the y-direction).

e.g. psf1 = PSF_GAUSSIAN(NPIXEL=[256,512], CENTROID=[10.5,186], ST_DEV=3.0)

3) Add them.

image = noise_image + psf1


-Jeremy.
Re: How to create synthetic images of stars with gaussian psf in IDL. [message #92989 is a reply to message #92987] Tue, 05 April 2016 07:24 Go to previous messageGo to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Tuesday, April 5, 2016 at 10:18:17 AM UTC-4, Jeremy Bailin wrote:
> On Monday, April 4, 2016 at 10:59:09 AM UTC-4, Sonu Tabitha wrote:
>> On Monday, April 4, 2016 at 1:13:27 PM UTC+5:30, Sonu Tabitha wrote:
>>> I want to create a synthetic image to resemble a stellar field (say covering an area of 255 by 255 pixels, with a total of about 4 stars having Gaussian PSF). The rest of the image has to be filled with constant background and noise, as present in the entire image, but devoid of stars. I want to create this to test a source extraction algorithm that I have developed. I am a beginner in IDL. Can you please help me out in coding?
>>
>> Thanks Jeremy! But I am very new to IDL and I am not so familiar with its functions. Can you please give me a sample code?
>
> 1) RANDOMU takes as its first argument a random seed, and then the dimensions of the output array. So, for example, if you wanted to get a 256 x 512 random array, you could do:
>
> seed = 1L ; set it to something so your results are repeatable
> noise_image = RANDOMU(seed, 256, 512)
>
> By default RANDOMU gives you a uniform random deviate, but you probably want a Poisson distribution, which requires giving the POISSON keyword with the mean expected value. For example, if your noise level is 2.5 electrons, you might say:
>
> RANDOMU(seed, 256, 512, POISSON=2.5)
>
>
> 2) PSF_GAUSSIAN takes a few options. The ones you care about are:
> NPIXEL: The dimensions of the output array. So you could use [256, 512] to make an array the same size as above.
> CENTROID: The position on the iamge of the center of the PSF. For example [10.5, 186] for a center at x=10.5, y=186 (note they don't have to be at pixel centers).
> FWHM or ST_DEV: Width of the Gaussian -- you can specify it either using the FWHM or Gaussian sigma. For an isotropic PSF, just give one value (e.g. ST_DEV=3.0 for a 3-pixel standard deviation), or for an anisotropic PSF you can give a separate x- and y-width (e.g. FWHM=[4.0, 5.5] for a PSF that is slightly elongated in the y-direction).
>
> e.g. psf1 = PSF_GAUSSIAN(NPIXEL=[256,512], CENTROID=[10.5,186], ST_DEV=3.0)
>
> 3) Add them.
>
> image = noise_image + psf1
>
>
> -Jeremy.

Oh, one obvious bit that I missed -- PSF_GAUSSIAN will give you a peak value of 1 (or, if /NORMALIZE is set, a total integral of 1). To get a different number, just multiply the output of PSF_GAUSSIAN by the actual amplitude you want.

-Jeremy.
Re: How to create synthetic images of stars with gaussian psf in IDL. [message #92993 is a reply to message #92961] Thu, 07 April 2016 05:06 Go to previous message
Sonu Tabitha is currently offline  Sonu Tabitha
Messages: 29
Registered: April 2016
Junior Member
On Monday, April 4, 2016 at 1:13:27 PM UTC+5:30, Sonu Tabitha wrote:
> I want to create a synthetic image to resemble a stellar field (say covering an area of 255 by 255 pixels, with a total of about 4 stars having Gaussian PSF). The rest of the image has to be filled with constant background and noise, as present in the entire image, but devoid of stars. I want to create this to test a source extraction algorithm that I have developed. I am a beginner in IDL. Can you please help me out in coding?

Thanks a lot!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: filtering data data in .txt
Next Topic: Can you please explain me the meaning of the following IDL code?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:23:44 PDT 2025

Total time taken to generate the page: 0.00501 seconds