79338722

Date: 2025-01-08 10:19:44
Score: 7.5 🚩
Natty: 5
Report link

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')

In [4]: f.read()

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

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Blacklisted phrase (1): appreciated
  • Blacklisted phrase (1): I am trying to
  • RegEx Blacklisted phrase (2.5): Could someone please provide some
  • Contains signature (1):
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Cobus Labuschagne