I am trying to read a FITS file containing ROSAT data from the website (https://python4astronomers.github.io/astropy/tables.html).
Under Practical Exercises the first exercise statement: Try and find a way to make a table of the ROSAT point source catalog that contains only the RA, Dec, and count rate. Hint: you can see what methods are available on an object by typing e.g. t. and then pressing . You can also find help on a method by typing e.g. t.add_column?.
But my code: (my_env) C:\Users\labus\Documents\Curtin\Python\pyproj>ipython --matplotlib Python 3.13.1 (tags/v3.13.1:0671451, Dec 3 2024, 19:06:28) [MSC v.1942 64 bit (AMD64)] Type 'copyright', 'credits' or 'license' for more information IPython 8.30.0 -- An enhanced Interactive Python. Type '?' for help. Using matplotlib backend: tkagg
In [1]: import matplotlib.pyplot as plt ...: import numpy as np ...: import astropy ...: import tarfile ...: from urllib import request ...: from astropy.table import Table ...: from astropy.io import ascii ...:
In [2]: from astropy.table import Table, Column
In [3]: f = open('ROSAT.fits', 'r')
UnicodeDecodeError Traceback (most recent call last) Cell In[4], line 1 ----> 1 f.read()
File c:\users\labus\documents\curtin\python\pyver\python313\Lib\encodings\cp1252.py:23, in IncrementalDecoder.decode(self, input, final) 22 def decode(self, input, final=False): ---> 23 return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 18179: character maps to
In [5]: Is giving the above UnicodeDecodeError
Could someone please provide some guidance and maybe an answer as to why this problem is occurring?
Any assistance is greatly appreciated. Thank you - Cobus Labuschagne