Re: combing fits files and taking the median average [message #80896 is a reply to message #80895] |
Tue, 17 July 2012 07:45   |
Mandy Bailey
Messages: 3 Registered: July 2012
|
Junior Member |
|
|
On Tuesday, 17 July 2012 15:24:07 UTC+1, Craig Markwardt wrote:
> On Tuesday, July 17, 2012 10:09:10 AM UTC-4, Mandy Bailey wrote:
> > I'm new to IDL but slowly getting the hang of things. I have four fits files, each being spectra of the same targets taken on consecutive nights. I would like to combine these into one file to analyse but I want the median average not just the average. For the latter I could simply add each file together and divide by 4 of course but I cannot see a way to take the median average when combining the files.
> >
> > The routine MEDIAN doesn't appear to work for combining multiple images as far as I can see.
> >
> > Any ideas gratefully received, thanks
> > Mandy
>
> You can stack the images into a 3D image, and then use the DIMENSION keyword of MEDIAN().
>
> Example,
> img_3d = dblarr(nx,ny,3)
> img_3d(*,*,0) = img_1
> img_3d(*,*,1) = img_2
> img_3d(*,*,2) = img_3
>
> img_med = median(img_3d, 3)
>
> You may have bigger problems though. If your images need to be registered then the problem becomes a lot harder.
>
> Craig
Thanks Craig
I'm not sure if the images need to be registered to be honest. Also each fits file actually contains the information from 400 separate fibres which I think is complicating things too. I have been able to read each fibre from the fits file and plot the individual spectra but I think I can improve my s/n in each spectrum by stacking the files and taking the median average which would be more accurate for my purposes than simply taking the average.
I'll try what you suggest and see what happens though.
Thanks, Mandy
|
|
|