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

Error randomly occuring while reading FITS file multiple times #191

Open
Baphometsixsixsix opened this issue Jun 16, 2023 · 3 comments
Open

Comments

@Baphometsixsixsix
Copy link

The FITS() function works well for a certain number of times and then suddenly throws up error. Any idea why could this be happening?

using FITSIO
FITS("/home/archisman/FITSfile1.fits")

File: /home/archisman/FITSfile1.fits
Mode: "r" (read-only)
HDUs: Num Name Type
1 Image
2 SPECTRUM Table

j = 0
for i in 1:100000
    FITS("/home/archisman/FITSfile1.fits")
    j+=1
end

CFITSIO has encountered an error while processing /home/archisman/FITSfile1.fits. Error code 104: could not open the named file
Detailed error message follows:
failed to find or open the following file: (ffopen)
/home/archisman/FITSfile1.fits

Stacktrace:
[1] fits_assert_ok
@ ~/.julia/packages/CFITSIO/BfhtD/src/CFITSIO.jl:225 [inlined]
[2] fits_open_file(filename::String, mode::Int64)
@ CFITSIO ~/.julia/packages/CFITSIO/BfhtD/src/CFITSIO.jl:380
[3] FITS(filename::String, mode::String; extendedparser::Bool)
@ FITSIO ~/.julia/packages/FITSIO/ggf1s/src/FITSIO.jl:183
[4] FITS (repeats 2 times)
@ ~/.julia/packages/FITSIO/ggf1s/src/FITSIO.jl:181 [inlined]
[5] top-level scope
@ ./In[3]:3

j
4043
FITSIOerror

@giordano
Copy link
Member

My guess is that you can't open an already opened file? Note that this is failing in the C library CFITSIO underlying this package.

@Baphometsixsixsix
Copy link
Author

Baphometsixsixsix commented Jun 16, 2023

I encountered this error for first time while trying to iterate over thousands of FITS files in a folder. I thought maybe some of those files are corrupted so I tried it on a file which I successfully opened earlier. I've posted what happened next in the original issue.

@giordano
Copy link
Member

Again, this is failing inside CFITSIO, there isn't much we can do about this unless you can prove this only happens in this package and not in a pure C equivalent program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants