These are chat archives for astropy/astropy

15th
Mar 2017
Mohan Agrawal
@mohanagr
Mar 15 2017 13:28
Can someone tell me how to delete a necessary keyword from a FITS file? For. eg. EXTEND kwrd.
I tried opening with mode = update, output_verify = 'ignore' then del the hdu keyword and then using hdulist.flush(output_verify='ignore') followed by hdulist.close(output_verify='ignore')
to no avail. Similar thing with using writeto
Mohan Agrawal
@mohanagr
Mar 15 2017 14:19
Turns out there's no simple way to remove EXTEND keyword and save the file. (In my case I'm trying to non-standardize a file which has 4 Image extensions)
deep inside fits/card.py , it's hardcoded for each card in the HDU to be fixed.
Is there a way to generate non-standard FITS file using astropy?
@MSeifert04 @saimn @bsipocz
matrixbot
@matrixbot
Mar 15 2017 14:24
saimn on Freenode No idea, as it tries hard to avoid generating a non-standard FITS file !
Mohan Agrawal
@mohanagr
Mar 15 2017 14:27
yes. I wanted to generate a one to test the compliance fixing of fitscheck script.
jehturner
@jehturner
Mar 15 2017 14:33
Replace the entry with blanks using a text editor?
Mohan Agrawal
@mohanagr
Mar 15 2017 14:36
yes but here's the weird thing. I ran all that's mentioned above ^^. Now everytime I open using astropy (or fitsheader for that sake) I see EXTEND keyword is present, but can't see it in a text editor.
jehturner
@jehturner
Mar 15 2017 14:37
Is it not just adding it back in when it reads the file (hopefully not before fitscheck tells you whether it's good or not...)?
Mohan Agrawal
@mohanagr
Mar 15 2017 14:42
that's what I think. unable to pinpoint though. It's doing so when we flush or writeto. Figuring how that happens for read i.e. open
yes, sadly before fitscheck can tell, is what I think
jehturner
@jehturner
Mar 15 2017 14:44
Sounds like a bug to me, but I'm not the io.fits expert (just passing by...).
Mohan Agrawal
@mohanagr
Mar 15 2017 14:57
yes. Verified this. My file contains a blank in place of EXTEND. fitscheck doesn't do a thing. this is because as soon as one opens the file, it adds the keyword back.
Mohan Agrawal
@mohanagr
Mar 15 2017 15:24
I have opened an issue ( #5877 ) for this. I'll complete the tests for fitscheck and then see into this.