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

GBTFITSLoad.write() can write bad intnum's and the multifile=False does not always work #425

Open
teuben opened this issue Nov 6, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@teuben
Copy link
Collaborator

teuben commented Nov 6, 2024

Describe the bug
This started out as a case where multifile=False caused in index error, but when playing with more options, when it did work, it would write bad intnums. See example below.

How to Reproduce

The snippet of code has 4 cases, 1 fails, 2 are suspect (bad intnum's)

from dysh.util import get_project_testdata

fn = get_project_testdata() / "AGBT18B_354_03/AGBT18B_354_03.raw.vegas"

sdf=GBTFITSLoad(fn)
sdf.write("write_test1.fits", ifnum=0, overwrite=True, multifile=False)   # fails  'list index out of range'
sdf.write("write_test2.fits", plnum=0, overwrite=True, multifile=False)   # ok  write_test1.fits (multiHDU)
sdf.write("write_test3.fits", plnum=0, overwrite=True)                    # ok, write_test10,11,12,13.fits
sdf.write("write_test4.fits", plnum=0, overwrite=True, multifile=False)   # write_test1.fits
sdf.summary()
sdf.summary(verbose=True)

sdf1 = GBTFITSLoad("write_test1.fits")    **# this failed to write (the index error)**
sdf1.summary()
sdf1.summary(verbose=True)

sdf2 = GBTFITSLoad("write_test2.fits")  #   4 HDU's, each one an IF
sdf2.summary()
sdf2.summary(verbose=True)    **# has bad intnum's**


sdf3 = GBTFITSLoad("write_test30.fits")
sdf3.summary()
sdf3.summary(verbose=True)

sdf4 = GBTFITSLoad("write_test4.fits")     #   4 HDU's
sdf4.summary()
sdf4.summary(verbose=True)   **# has bad intnums**

Environment

  • Dysh version 0.4.0
  • Python version 3.12.4
  • OS ubuntu 22.04
@teuben teuben added the bug Something isn't working label Nov 6, 2024
@mpound
Copy link
Collaborator

mpound commented Nov 6, 2024

in gbtfitsload.write() I think this line
hdu = self._sdf[fi[0]]._hdu[fi[0]].copy()
should be
hdu = self._sdf[fi[0]]._hdu[0].copy()

@teuben
Copy link
Collaborator Author

teuben commented Nov 6, 2024

yes, a lot better. still not all intnum values makes sense. looking into it.

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

When branches are created from issues, their pull requests are automatically linked.

2 participants