gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
270 stars 61 forks source link

Problem with PRTARR() (was : pb with FITS Binary tables) #1837

Closed jaymurthy closed 1 month ago

jaymurthy commented 1 month ago

This started when I installed 1.0.6 and I've tried it with multiple FITS binary tables. Here is the link to one file: https://www.dropbox.com/scl/fi/vh2cq627zsrvwttsqviuo/FIG17.fits?rlkey=cjfye0btesovq573jg6qm9ezz&dl=0

I'm trying to isolate the error but haven't had success yet. It works ok with FL.

GDL> d=mrdfits('publicdata/FIG17.fits',0,hdr) MRDFITS: Null image, NAXIS=0 GDL> d=mrdfits('publicdata/FIG17.fits',1,hdr) % MRD_TABLE: Unable to dereference NULL pointer: <POINTER ()> % Error occurred at: MRD_TABLE 2320 /Users/jayanth/Dropbox/user/idluser/idllib/IDLAstro/pro/mrdfits.pro % MRDFITS 2736 /Users/jayanth/Dropbox/user/idluser/idllib/IDLAstro/pro/mrdfits.pro % $MAIN$ % Execution halted at: $MAIN$

jaymurthy commented 1 month ago

I think it is something to do with line 458 in mrdfits.pro where it calls match, keyword, scales_names, mkey_scales, mscales, count = N_mscales The problem is because there are no matches (no TSCALnn) in the header.

jaymurthy commented 1 month ago

The problem is because scales = ptrarr(n_mforms, /all) (line ~446 in mrdfits.pro) gives print,scales

(NullPointer)(NullPointer)

This is what it should be (in gdl 1.0.3 and in fl) FL> print,scales (PtrHeapVar1)(PtrHeapVar2)

The nullpointer causes it to break. Note that I replaced < with ( above to get it to show up.

alaingdl commented 1 month ago

OK, thanks you @jaymurthy I can reproduce your bug :crying_cat_face:

now we will try to solved it

alaingdl commented 1 month ago

OK, the problem appeared between April 25 and 26, when I try to clean up the keywords (by name/by number)

alaingdl commented 1 month ago

OK, I think I got it. In fact PTRARR() has one and only one keyword ... "ALLOCATE_HEAP"

alaingdl commented 1 month ago

OK @jaymurthy , I solved it, I have the feeling we had a pending bug in the past ... My problem now is to do a clean PR !

jaymurthy commented 1 month ago

Great work, Alain.

alaingdl commented 1 month ago

The bug should be solved in #1838

In fact, it is related to my changes within keywords by index / keyword by name. I created a bug in PTRARR() function. But the initial code did not work in detail as it should. Fortunately we had a test covering the other side effect.

Nevertheless we need to add more tests related to PTRARR() to cover the problem reported here

alaingdl commented 1 month ago

Again thanks @jaymurthy for rapid feedback and clear bug report. I can go quickly to the culprit.