how to replace fits variable and store back into same fits file?? [message #93439] |
Tue, 19 July 2016 04:48  |
Sapna Mishra
Messages: 66 Registered: December 2015
|
Member |
|
|
Hello all,
I am reading a file as:
aa=mrdfits('spec.fits',1,h)
in that i have an array: aa.FLUX
which is an array of 40000 float numbers.
I want to change the all values inside the array say aa.FLUX with some another
array say B of size 40000 such that
new aa.FLUX becomes:
aa.FLUX=B
and I want to store in back in file spec.fits with new values of aa.FLUX.
Can any one suggest me how to replace it and save it in fits files???
I tried with:
sxaddpar,1,aa.FLUX,B
but its not working.
Any help please
|
|
|
|
Re: how to replace fits variable and store back into same fits file?? [message #93445 is a reply to message #93440] |
Tue, 19 July 2016 07:57   |
Sapna Mishra
Messages: 66 Registered: December 2015
|
Member |
|
|
On Tuesday, July 19, 2016 at 6:20:26 PM UTC+5:30, wlandsman wrote:
> On Tuesday, July 19, 2016 at 7:48:15 AM UTC-4, Sapna Mishra wrote:
>
>>
>> new aa.FLUX becomes:
>> aa.FLUX=B
>> and I want to store in back in file spec.fits with new values of aa.FLUX.
>>
>
> mwrfits,'spec.fits',aa,h
No its not working that way i tried it.
actually I have :
aa=mrdfits('spec-3819-55540-0876.fits',1,h)
IDL> help,aa,/str
** Structure <a469504>, 8 tags, length=32, data length=32, refs=1:
FLUX FLOAT 12.7965
LOGLAM FLOAT 3.55550
IVAR FLOAT 0.0395813
AND_MASK LONG 0
OR_MASK LONG 851968
WDISP FLOAT 1.55296
SKY FLOAT 4.95728
MODEL FLOAT 18.1191
now I only want to change value of aa.FLUX.
doing mwrfits,'spec.fits',aa,h as you suggested is changing value of all variables. Is any one getting my problem???
|
|
|
Re: how to replace fits variable and store back into same fits file?? [message #93446 is a reply to message #93445] |
Tue, 19 July 2016 08:07   |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Tuesday, July 19, 2016 at 10:57:08 AM UTC-4, Sapna Mishra wrote:
> On Tuesday, July 19, 2016 at 6:20:26 PM UTC+5:30, wlandsman wrote:
>> On Tuesday, July 19, 2016 at 7:48:15 AM UTC-4, Sapna Mishra wrote:
>>
>>>
>>> new aa.FLUX becomes:
>>> aa.FLUX=B
>>> and I want to store in back in file spec.fits with new values of aa.FLUX.
>>>
>>
>> mwrfits,'spec.fits',aa,h
>
> No its not working that way i tried it.
> actually I have :
> aa=mrdfits('spec-3819-55540-0876.fits',1,h)
>
> IDL> help,aa,/str
> ** Structure <a469504>, 8 tags, length=32, data length=32, refs=1:
> FLUX FLOAT 12.7965
> LOGLAM FLOAT 3.55550
> IVAR FLOAT 0.0395813
> AND_MASK LONG 0
> OR_MASK LONG 851968
> WDISP FLOAT 1.55296
> SKY FLOAT 4.95728
> MODEL FLOAT 18.1191
>
> now I only want to change value of aa.FLUX.
> doing mwrfits,'spec.fits',aa,h as you suggested is changing value of all variables. Is any one getting my problem???
you say you only changed the value of aa.flux. The other structure tags remained the same. Why would you think that they changed?
|
|
|
Re: how to replace fits variable and store back into same fits file?? [message #93447 is a reply to message #93445] |
Tue, 19 July 2016 09:42  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Tuesday, July 19, 2016 at 10:57:08 AM UTC-4, Sapna Mishra wrote:
> now I only want to change value of aa.FLUX.
> doing mwrfits,'spec.fits',aa,h as you suggested is changing value of all variables. Is any one getting my problem???
Did you change the values of any of the other columns stored in AA? If you did not make any changes to AA, then writing out with MWRFITS will just create a new file with the same column values you started with.
CM
|
|
|