FRBs / sigpyproc3

Python3 version of Ewan Barr's sigpyproc library
https://sigpyproc3.readthedocs.io
MIT License
14 stars 11 forks source link

UnboundLocalError: local variable 'data' referenced before assignment #32

Open mabaisen opened 1 year ago

mabaisen commented 1 year ago

When i use "PFITSReader" to read a fits file, then use "read_block" get the data, i have the problem:

Traceback (most recent call last): File "/home/mbs/Desktop/mycode/ASTROSOFT/sigpyproc3/read_fil.py", line 13, in c = fil.read_block(start=1000, nsamps=2000) File "/home/mbs/Desktop/mycode/ASTROSOFT/sigpyproc3/sigpyproc/readers.py", line 208, in read_block data = self._fitsfile.read_subints(startsub, nsubs) File "/home/mbs/Desktop/mycode/ASTROSOFT/sigpyproc3/sigpyproc/io/pfits.py", line 412, in read_subints sdata = self.read_subint_pol( File "/home/mbs/Desktop/mycode/ASTROSOFT/sigpyproc3/sigpyproc/io/pfits.py", line 464, in read_subint_pol return data UnboundLocalError: local variable 'data' referenced before assignment

How can i fix it.

pravirkr commented 7 months ago

It looks like the poln_state is not included in read_subint_pol yet. I should raise the correct exception in the function.

The PFITSReader is still experimental and does not support all types of PSRFITS files as of yet.