Non ASCII characters in solution

15 views
Skip to first unread message

Dmitriy Blinov

unread,
Nov 6, 2018, 1:26:41 PM11/6/18
to astrometry
Dear Dustin!

I have problems using output files of the latest version from github (b6c762ab). When i read the .new file with wcs solution and pass its header to astropy.wcs.WCS()  (astropy ver.2.0.2) i get the following exception:
ValueError: FITS header values must contain standard printable ASCII characters; 'Created by the Astrometry.net suite.\nFor more details, see http://astrom' contains characters/bytes that do not represent printable characters in ASCII.

This problem is easy to solve by removing all "COMMENT" and "HISTORY" keywords from the header of .new file, but it is not very convenient. It would be great if it could be fixed in future versions.

Thanks,
Dmitry

Dustin Lang

unread,
Nov 6, 2018, 1:54:02 PM11/6/18
to astrometry
Hi,

Can you run the "fitsverify" command on the .new file (I think there is also a web version of the service)?  That is my go-to utility for determining if a FITS file is valid.

Can you tell which character is causing problems?  Is it the '\n'?

thanks,
--dustin

Matt Craig

unread,
Nov 6, 2018, 4:11:19 PM11/6/18
to astrometry
Hi,

I've hit this in the past (I wrote \n into FITS headers on my own, it wasn't an astrometry.net thing) so I happen to have the FITS standard handy. Non-printing ASCII characters like \n may not appear in FITS headers; it is discussed in section 3.2 of the most recent FITS standards paper.

Matt Craig 

Dmitriy Blinov

unread,
Nov 6, 2018, 4:17:17 PM11/6/18
to astro...@googlegroups.com
Thanks for clarification Matt,

at the same time fitsverify does not complain about new line symbols:
 HDU#  Name (version)       Type             Warnings  Errors 
1                          Primary Array    0         0   

Dustin Lang

unread,
Nov 6, 2018, 5:15:45 PM11/6/18
to astrometry
Hi,

I just inspected the Astrometry.net and checked out the results of a simple example case, and I don't see a "\n" character in the .new file.

You say you "read the .new file and pass its header to astropy..." ...... how are you doing the reading??  I'm wondering if your code is adding "\n".

cheers,
--dustin



Dmitriy Blinov

unread,
Nov 6, 2018, 5:44:59 PM11/6/18
to astrometry
hdulist = pyfits.open('J0000+0000.new')
header = hdulist[0].header
hdulist.close()

wcs_solved = pywcs.WCS(header)

Dustin Lang

unread,
Nov 6, 2018, 8:24:24 PM11/6/18
to astrometry
Ok, that should work, I would have thought...

Could you please check whether the .new file actually contains a '\n' character?

Or, could you attach the file here?  And also the .wcs file?

Thanks!
--dustin


Dmitriy Blinov

unread,
Nov 6, 2018, 8:42:43 PM11/6/18
to astrometry


On Wednesday, 7 November 2018 03:24:24 UTC+2, Dustin Lang wrote:
Ok, that should work, I would have thought...

Could you please check whether the .new file actually contains a '\n' character?

I don't see any  '\n' 

Or, could you attach the file here?  And also the .wcs file?

Attached the .wcs
Another one was too heavy so i shared it here https://drive.google.com/open?id=19hnLRNobNGdUMmLJPazQ4SdMbWsutJtJ

Thanks!
 

Thanks!
--dustin


J0019262+461407-0001.wcs

Dustin Lang

unread,
Nov 7, 2018, 1:18:34 PM11/7/18
to astrometry
In pyfits, it looks like depending on how you access the values, it will glue together repeated entries like HISTORY or COMMENT:

print(str(header['HISTORY'])

produces:
'Created by the Astrometry.net suite.\nFor more details, see http://astrometry.net.\nGit URL https://github.com/dstndstn/astrometry.net\nGit revision\nGit date\nThis WCS header was created by the program "blind".'

cheers,
--dustin


Reply all
Reply to author
Forward
0 new messages