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
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.