0

I'm not very familiar with IDL, but am trying to run a code given to me by a colleague. I'm getting strange syntax errors in the generic code snippet genrand2d.pro (downloaded from here) which is preventing the whole thing from running. It's possible that it's a version syntax change thing, since my colleague has IDL version 6.3 while I have 8.6.0 (on Scientific Linux 7.2) but I haven't been able to find a list of syntax changes or similar to check.

The line causing problems is:

randx = arrscl(randomu(seed, nbad, /double), $ 
                     minx, maxx, $ 
                     arrmin=0d, arrmax=1d )

And the error message:

                     arrmin=0d, arrmax=1d )
                            ^
% Syntax error.
  At: /generic/path/genrand2d.pro, Line 114
Astrobot
  • 3
  • 1

1 Answers1

0

My guess is that IDL is confused on whether arrscl is an array or a function. To test if this is the case, compile arrscl, recompile genrand2d, and then try again.

In general, to fix these errors use compile_opt strictarr in all your routines and always use square brackets for array indexing.

mgalloy
  • 2,356
  • 1
  • 12
  • 10
  • Thank you for your help! In trying to follow your advice I found the problem: I didn't have arrscl.pro at all, and the syntax error was preventing IDL from flagging it as missing. – Astrobot Jun 06 '18 at 07:30