Hi,

I have a huge PDL that eats up a lot of memory, and I want to flag some
values in it as BAD, doing the following.

  $skycube =
    $skycube->setbadif(abs($skycube-$median) > $clippedmedian*$prms);

  print "CUBE BAD: ", $skycube->nbad, "\n";
  CUBE BAD = 914036

which seems to be working fine:

  CUBE BAD = 914036

However, since the PDL is so big, and 'setbadif' does not work inplace,
I tried the following approach to reduce the memory consumption at the
price of speed:

  my @cubedims = $skycube->dims;
  for (my $kk=0; $kk<$cubedims[2]; $kk++) {
    my $slice = $skycube(:,:,($kk));
    $skycube(:,:,($kk)) .=
      $slice->setbadif(abs($slice-$median) > $clippedmedian*$prms);
  }
  print "CUBE BAD: ", $skycube->nbad, "\n";

which gives

  CUBE BAD = 0
      
Am I doing something wrong, or is there anyway around this problem?

Cheers,

  Rahman



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to