in reply to Spurious `undefined' values and conversion issues

I also note that the assignment routine in your 'for ($chn=0;$chn<16384;$chn++)' loop is not (or at least not obviously) definitive: '$energy_before[$chn]' could end up empty for various values of '$chn'. E.g., if $i was greater than $calib_points (I don't know if there's anything in your surrounding code that would prevent that.) This would cause line 1148 (at the very least) to throw an 'undefined' warning.


-- 
Human history becomes more and more a race between education and catastrophe. -- HG Wells
  • Comment on Re: Spurious `undefined' values and conversion issues

Replies are listed 'Best First'.
Re^2: Spurious `undefined' values and conversion issues
by sf_ashley (Sexton) on May 30, 2008 at 18:45 UTC

    A further thank you for your comment, oko1.

    $i should always be in range, as it is defined before the loop and can only be incremented if it is in an 'if' loop where $i < $calib_points. When $i == $calib_points, it will only go into the first loop. The reason for this is quite nice as it basically infers a particular set of interpolated data up to the last calibration point and beyond. Obviously, this isn't a great extrapolation, however, as this aforementioned calibration point is conveniently the last point on the spectrum, if does just the trick.

    Also, printing the values of $energy_before[] to a file showed that there weren't any non NULL events. Sadly, it was down to $j later on in the code.

    However, my sincere thanks for going through the code and for your comments.

    Steve