On 8/30/2010 8:49 PM, P Kishor wrote: > On Mon, Aug 30, 2010 at 7:02 PM, Chris Marshall<[email protected]> wrote: >> On 8/30/2010 7:00 PM, P Kishor wrote: >>> On Mon, Aug 30, 2010 at 2:39 PM, P Kishor<[email protected]> wrote: >>>> This is driving me nuts... >>>> >>>> print "Info for lut : " . $lu->info . "\n"; >>>> print "Info for year: " . $yr->info . "\n"; >>>> $ypdl->wpic("model_output/$file", {LUT => $lut}); >>>> >>>> prints... >>>> >>>> >>>> Info for lut : PDL: Byte D [3,256] >>>> Info for year: PDL: Byte D [252,189] >>>> PDL::index: invalid index -2147483648 (valid range 0..255) at >>>> /usr/local/lib/perl5/site_perl/5.12.1/darwin-2level/PDL/ImageRGB.pm >>>> line 147. >> >> First, the piddle you are writing as an image is >> not the piddle you are listing information about. >> It is not possible for a byte value to be -2147483648. >> I suggest writing a small test script and trace it >> under the debugger to see what is going on. Maybe >> something is not what you think it is. >> > > > Unfortunately, I don't know how to use the debugger, but I did write a > test script. With the help of Craig's bigstring() sub, I get the > following --
perldoc perldebug Basically you start the program: perl -d myproblem.pl Perl will run with the debugger and stop at the first line of your program. Then you can use the n and s commands to step a line at a time or to step into a subroutine to continue the evaluation there. The first thing would be to run the program to completion/failure with the c (continue) command. That should give you the same error and some backtrace info that could tell you what file the problem is in (and what line). The c command can take a line number argument so you can quickly run to the line of interest. For example, if the error was in sub xxx which was called at line 53 of the file you could start the debugger and then type c 53 to get to that line and follow with either n or s as appropriate. It is not that difficult to do but you'll actually have to try it to get the hang of it. Alternatively, you could post a working example program with the problem and hope that someone can see somthing helpful. So far, you've only shown snippets here and there---not enough to go on. Hope this helps, Chris > ------------ > print "In my program\n" . "=" x 50 . "\n"; > print "Info for piddle pdl: " . $pdl->info . "\n"; > print bigstring($pdl,"%3g") . "\n"; > > > > my $foo = $lut->xchg(0,1); > > print "Info for piddle foo: " . $foo->info . "\n"; > print $foo . "\n"; > > > > my $bar = $pdl->dummy(0); > > print "Info for piddle bar: " . $bar->info . "\n"; > print bigstring($bar,"%3g") . "\n"; > > > > my $res = index($foo, $bar); > > print "Info for piddle res0: " . $res->info . "\n"; > print bigstring($res,"%3g") . "\n"; > ------------ > > > In my program > ================================================== > Info for piddle pdl: PDL: Byte D [252,189] > [ > [ 0 0 0 .. 0 ] > [ 0 0 0 .. 0 ] > [ 0 0 0 .. 0 ] > .. > ] > Info for piddle foo: PDL: Byte D [256,3] > > [ > [ 0 1 2 3 .. 255] > [255 255 255 255 .. 255] > [ 0 0 0 0 .. 0] > ] > > Info for piddle bar: PDL: Byte D [1,252,189] > [ > [ > [ 0 ] > .. > ] > ] > Info for piddle res: PDL: Byte D [3,252,189] > PDL::index: invalid index -2147483648 (valid range 0..255) at > /usr/local/lib/perl5/site_perl/5.12.1/darwin-2level/PDL/Core.pm line > 2408. > > > > There is something wrong with $res created with index($lut, $bar), and > I don't quite know what to do. This has become a show-stopper for me > as I have to use lookup tables to create color images. The program > works just fine, and images are created just fine if I don't use a > LUT. Is there something wrong with my LUT? After a day of struggling > with this, I am at a loss. > > >> --Chris >> >>>> As far as I can see, $yr has nothing funky in it. I used Craig's >>>> bigstring method to print out the bighonkingpdl, and it is mostly a >>>> bunch of zeroes. >> > > > > > > > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 9.0.851 / Virus Database: 271.1.1/3102 - Release Date: 08/30/10 > 02:35:00 > _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
