[AstroPy] question on saving fits files

Doug Burke dburke.gw at gmail.com
Wed Feb 10 12:37:18 EST 2016


Apologies for the noise; the perils of sending an email from a long,
technical meeting -Doug


On Wed, Feb 10, 2016, 11:42 Doug Burke <dburke.gw at gmail.com> wrote:

>
> Grigoris,
>
> If you change 'dt = dt * 1000' to 'dt *= 1000' do you get what you expect?
>
> Doug
>
> On Wed, Feb 10, 2016 at 11:30 AM Grigoris Maravelias <
> gr.maravelias at gmail.com> wrote:
>
>> Hello!
>>
>> I have a problem with a rather simple process, but I cannot understand
>> what I am doing wrong. I have an image in a fits file that i want to
>> open and process its data values, and save it as another file (including
>> some extra information on the header for what I did). So according to
>> the astropy docs [1] I did the following:
>>
>> hdulist = fits.open('small.fits')
>> hdu = hdulist[0]
>> hd = hdu.header
>> dt = hdu.data
>>
>> hd.append(('HISTORY', 'blabla '), bottom=True)
>>
>> print dt            # check data before
>> dt = dt*1000
>> print dt            # and after
>>
>> hdulist.writeto('small_mod.fits')
>>
>> If I print dt before and after their modification (multiplied by 1000) I
>> can see that they are indeed different (properly multiplied), but when I
>> save the fits file I just see the original data values (however, the
>> HISTORY line is added properly in the primary header).
>>
>> What am I missing here?
>>
>> Best
>> Grigoris
>>
>>
>> [1] http://docs.astropy.org/en/stable/io/fits/usage/headers.html
>>
>>
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy at scipy.org
>> https://mail.scipy.org/mailman/listinfo/astropy
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20160210/1d5070d8/attachment.html>


More information about the AstroPy mailing list