comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » how to replace fits variable and store back into same fits file??
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
how to replace fits variable and store back into same fits file?? [message #93439] Tue, 19 July 2016 04:48 Go to next message
Sapna Mishra is currently offline  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 #93440 is a reply to message #93439] Tue, 19 July 2016 05:50 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
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
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 Go to previous messageGo to next message
Sapna Mishra is currently offline  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 Go to previous messageGo to next message
wlandsman is currently offline  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 Go to previous message
Craig Markwardt is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Plotting time as x-axis
Next Topic: Poltting with TVSCL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:06:54 PDT 2025

Total time taken to generate the page: 0.00467 seconds