[AstroPy] modifying FITS data

Taro Sato taro at ap.smu.ca
Wed Jun 1 11:49:57 EDT 2011


On Wed, Jun 1, 2011 at 12:01 PM, Jean-Luc Menut <jeanluc.menut at free.fr> wrote:
> Le 31/05/2011 18:17, Erik Bray a écrit :
>> orig['OI_VIS'].data['VISAMP'][:] = the_value
>
> Thanks a lot to you and Frédéric.
>
> I actually must type :
> orig['OI_VIS'].data.field('VISAMP')[:] = the_value
>
> But it works.


I used to have related issues and what Jean-Luc wrote here is the solution.

This actually makes me wonder why PyFITS doesn't allow a "standard"
scheme of updating values in a named array.

Sometimes, I want to write a simple function or something that takes
in a numpy named array and do some processing.  And reuse it for the
array read via PyFITS.   Since the "right" way of accessing the values
in PyFITS bintable is to use the field method, I often need to write a
wrapper to take care of those cases separately.  Or convert the array
to a standard numpy array before feeding to the function.

Is there any reason PyFITS require us to use the field method?  I
guess I should make a feature request.

Cheers,
Taro



More information about the AstroPy mailing list