[AstroPy] modifying FITS data

Taro Sato taro at ap.smu.ca
Wed Jun 1 12:22:41 EDT 2011


On Wed, Jun 1, 2011 at 1:13 PM, Erik Bray <embray at stsci.edu> wrote:
> On 06/01/2011 11:49 AM, Taro Sato wrote:
>>
>> 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.
>
> I'm not sure I understand.  Are you saying mapping-like indexing should be
> possible on tables?  (i.e. data['COLUMN_NAME'])  Because that is already
> implemented in PyFITS 2.4.0 and up.  data['COLUMN_NAME'] is exactly the same
> as data.field('COLUMN_NAME').
>
> Erik
>
>


Oh I see... it's been changed...  I definitely had the issue with an
older version of PyFITS.  Thanks for letting me know.


-- 
Taro Sato
Department of Astronomy & Physics
Saint Mary's University             email: taro at ap.smu.ca
Halifax, NS B3H 3C3                 phone: (902)420-5027
Canada                                web: http://ap.smu.ca/~taro



More information about the AstroPy mailing list