Here is a pdl2 shell session log showing the various bad value features discussed.
The main point of confusion seems to come from the fact that some of the bad value methods return a new PDL and some just set state on an existing PDL. If a new PDL is returned (i.e., setbadat(), setbadtoval(), then you'll need touse inplace() to make the change to the original PDL. The bad value state changing routines or query routines: badflag() and badvalue(), mutate the current PDL. HTH, Chris > pdl> $x = indx(1,2,3)->setbadat(1); > > pdl> p $x > [1 BAD 3] > > pdl> p $x->badvalue > -9223372036854775808 > > pdl> p $x > [1 BAD 3] > > pdl> $x->setbadtoval(100); > > pdl> p $x > [1 BAD 3] > > pdl> p $x->setbadtoval(100); > [1 100 3] > > pdl> p $x->badflag > 1 > > pdl> $x->inplace->setbadtoval(100); > > pdl> p $x > [1 100 3] > > pdl> p $x->badflag > 0 > > pdl> p $x->badvalue > -9223372036854775808 > > pdl> $x->badvalue(100) > > pdl> p $x->badvalue > 100 > > pdl> p $x > [1 100 3] > > pdl> $x->badflag(1) > > pdl> p $x > [1 BAD 3] On Wed, Jun 12, 2019 at 1:48 PM Ingo Schmid <[email protected]> wrote: > > Ah, maybe I got it wrong. I thought he wanted to change the value of BAD > to something else instead of replacing it with a genuine number. I read > setbadval (which is actually badvalue) instead of setbadtoval. > > Ingo > > > On 12.06.19 18:34, Ed . wrote: > > Doesn't that render setbadtoval entirely pointless? > > > > Or is the problem actually that Stephan didn't do > > > > $x->inplace->setbadtoval(23); > > > > so what he wanted would be: > > > > use 5.010; > > use PDL; > > my $x = indx(1,2,3)->setbadat(1); > > say $x; # [1 BAD 3] > > my $y = $x->setbadtoval(100); > > say $x; # still [1 BAD 3] > > say $y; # [1 100 3] > > > > Best regards, > > Ed > > > > -----Original Message----- > > From: Ingo Schmid > > Sent: Wednesday, June 12, 2019 5:25 PM > > To: [email protected] > > Subject: Re: [Pdl-general] Several problems with PDL > > > > Hi, > > let me comment the easy one, this is a feature, I think. Once an element > > is flagged bad, bad sticks. Bad value should be a value that is normally > > never present in your data. In particular for the smaller integer types > > this can be a problem, of course. > > At least that was my take on bad values. They indicate missing/corrupt data. > > > > Best wishes > > Ingo > > > > On 12.06.19 17:53, Stephan Loyd wrote: > >> > >> 4. setbadtoval() does not work well with some PDL types. For example, > >> > >> use 5.010; > >> use PDL; > >> my $x = indx(1,2,3)->setbadat(1); > >> say $x; # [1 BAD 3] > >> $x->setbadtoval(100); > >> say $x; # still [1 BAD 3] > >> > >> Is this a bug or a feature? > > > > > > > > _______________________________________________ > > pdl-general mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/pdl-general > > > > > > _______________________________________________ > pdl-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pdl-general _______________________________________________ pdl-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pdl-general
