Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mabaisen opened this issue Aug 10, 2023 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@mabaisen
Copy link

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 pravirkr self-assigned this Feb 20, 2024
@pravirkr
Copy link
Collaborator

pravirkr commented Apr 3, 2024

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.

@pravirkr pravirkr added the bug Something isn't working label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants