gnudatalanguage / gdl

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

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

Closed jaymurthy closed 5 months ago

jaymurthy commented 6 months 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 6 months 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 6 months 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 6 months ago

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

now we will try to solved it

alaingdl commented 6 months ago

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

alaingdl commented 6 months ago

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

alaingdl commented 6 months 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 6 months ago

Great work, Alain.

alaingdl commented 5 months 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 5 months ago

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