[AstroPy] Coding in Python to Read/Write a fits file.

Megan Sosey sosey@stsci....
Wed Apr 8 10:51:55 CDT 2009


I mean that once you have an image in JPG format,
you've essentially lost all useful science data information. You
shouldn't then take the image and do a science analysis
on it. As you and Andrew mentioned, JPG is lossy as well, so there's
no way to get back to the original information.

There are more science software options for analyzing FITS
images. If your final goal is something like getting the meteor path
information out of an image, you could probably apply a
scaling to the fits images which would make centroiding easier,
but the absolute flux information has already been lost. With the
jpeg compression, you're probably loosing useful pixels to do
the centroiding as well.

The best approach would be to get the original data numbers
out of your hardware box, or the internal format you mentioned
(if it's not already compressed), and go directly from there to FITS 
images. Then if you have images in multiple wavelength bands you can 
convert those to jpeg, gif or whatever using something of the reverse of 
the recipe I sent you.

cheers,
meg

Wayne Watson wrote:
> Thanks for the code. It looks helpful.
> Are you saying that because a jpg file is lossy that one would need to 
> take that into account by rescaling in some fashion?
> 
> Megan Sosey wrote:
>> Hi Wayne,
>>
>> One caveat I forgot to mention, the script
>> I sent you will transform the JPG (or gif or whatever)
>> image into FITS images, which you can then look
>> at in ds9 if you like, however, the data numbers are
>> not something appropriate to do further analysis with,
>> they are just the RGB scalings. So if you want to take the
>> FITS images and do more science analysis on them, you'll
>> have to rescale the data to something appropriate.
>>
>> cheers
>> meg
>>
>>
>> Megan Sosey wrote:
>>> Hi Wayne,
>>>
>>> something like this work for me, perhaps it will help
>>> get you closer to what you want. I attached the sample
>>> image I used.
>>>
>>>
>>> cheers,
>>> Megan
>>>
>>
> 
> -- 
> 
>            Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
> 
>              (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)****
> 
>           "Less than all cannot satisfy Man." -- William Blake
>           
> 

-- 
Megan Sosey
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
3700 San Martin Drive, Baltimore MD 21218
Phone: +00.1.410.338.4365


More information about the AstroPy mailing list