Bad.pm (PDL-2.081) | : | Bad.pm (PDL-2.082) | ||
---|---|---|---|---|
skipping to change at line 266 | skipping to change at line 266 | |||
# assume it's a number | # assume it's a number | |||
$num = $self; | $num = $self; | |||
} | } | |||
PDL::_default_badvalue_int($num); | PDL::_default_badvalue_int($num); | |||
} | } | |||
############################################################ | ############################################################ | |||
############################################################ | ############################################################ | |||
#line 287 "Bad.pm" | #line 287 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 isbad | =head2 isbad | |||
=for sig | =for sig | |||
Signature: (a(); int [o]b()) | Signature: (a(); int [o]b()) | |||
=for ref | =for ref | |||
Returns a binary mask indicating which values of | Returns a binary mask indicating which values of | |||
skipping to change at line 300 | skipping to change at line 300 | |||
=for bad | =for bad | |||
This method works with input ndarrays that are bad. The output ndarray | This method works with input ndarrays that are bad. The output ndarray | |||
will never contain bad values, but its bad value flag will be the | will never contain bad values, but its bad value flag will be the | |||
same as the input ndarray's flag. | same as the input ndarray's flag. | |||
=cut | =cut | |||
#line 327 "Bad.pm" | #line 327 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*isbad = \&PDL::isbad; | *isbad = \&PDL::isbad; | |||
#line 334 "Bad.pm" | #line 334 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 isgood | =head2 isgood | |||
=for sig | =for sig | |||
Signature: (a(); int [o]b()) | Signature: (a(); int [o]b()) | |||
=for ref | =for ref | |||
Is a value good? | Is a value good? | |||
skipping to change at line 338 | skipping to change at line 338 | |||
=for bad | =for bad | |||
This method works with input ndarrays that are bad. The output ndarray | This method works with input ndarrays that are bad. The output ndarray | |||
will never contain bad values, but its bad value flag will be the | will never contain bad values, but its bad value flag will be the | |||
same as the input ndarray's flag. | same as the input ndarray's flag. | |||
=cut | =cut | |||
#line 373 "Bad.pm" | #line 373 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*isgood = \&PDL::isgood; | *isgood = \&PDL::isgood; | |||
#line 380 "Bad.pm" | #line 380 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 nbadover | =head2 nbadover | |||
=for sig | =for sig | |||
Signature: (a(n); indx [o] b()) | Signature: (a(n); indx [o] b()) | |||
=for ref | =for ref | |||
Find the number of bad elements along the 1st dimension. | Find the number of bad elements along the 1st dimension. | |||
skipping to change at line 378 | skipping to change at line 378 | |||
=for bad | =for bad | |||
nbadover processes input values that are bad. The output ndarray will not have | nbadover processes input values that are bad. The output ndarray will not have | |||
any bad values, but the bad flag will be set if the input ndarray had its bad | any bad values, but the bad flag will be set if the input ndarray had its bad | |||
flag set. | flag set. | |||
=cut | =cut | |||
#line 421 "Bad.pm" | #line 421 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*nbadover = \&PDL::nbadover; | *nbadover = \&PDL::nbadover; | |||
#line 428 "Bad.pm" | #line 428 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 ngoodover | =head2 ngoodover | |||
=for sig | =for sig | |||
Signature: (a(n); indx [o] b()) | Signature: (a(n); indx [o] b()) | |||
=for ref | =for ref | |||
Find the number of good elements along the 1st dimension. | Find the number of good elements along the 1st dimension. | |||
skipping to change at line 419 | skipping to change at line 419 | |||
=for bad | =for bad | |||
ngoodover processes input values that are bad. The output ndarray will not have | ngoodover processes input values that are bad. The output ndarray will not have | |||
any bad values, but the bad flag will be set if the input ndarray had its bad | any bad values, but the bad flag will be set if the input ndarray had its bad | |||
flag set. | flag set. | |||
=cut | =cut | |||
#line 470 "Bad.pm" | #line 470 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*ngoodover = \&PDL::ngoodover; | *ngoodover = \&PDL::ngoodover; | |||
#line 477 "Bad.pm" | #line 477 "Bad.pm" | |||
#line 533 "bad.pd" | #line 533 "bad.pd" | |||
*nbad = \&PDL::nbad; | *nbad = \&PDL::nbad; | |||
sub PDL::nbad { | sub PDL::nbad { | |||
my($x) = @_; my $tmp; | my($x) = @_; my $tmp; | |||
$x->clump(-1)->nbadover($tmp=PDL->nullcreate($x) ); | $x->clump(-1)->nbadover($tmp=PDL->nullcreate($x) ); | |||
skipping to change at line 522 | skipping to change at line 522 | |||
*setbadat = \&PDL::setbadat; | *setbadat = \&PDL::setbadat; | |||
sub PDL::setbadat { | sub PDL::setbadat { | |||
barf 'Usage: setbadat($pdl, $x, $y, ...)' if $#_<1; | barf 'Usage: setbadat($pdl, $x, $y, ...)' if $#_<1; | |||
my $self = shift; | my $self = shift; | |||
PDL::Core::set_c ($self, [@_], $self->badvalue); | PDL::Core::set_c ($self, [@_], $self->badvalue); | |||
$self->badflag(1); | $self->badflag(1); | |||
return $self; | return $self; | |||
} | } | |||
#line 584 "Bad.pm" | #line 584 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 setbadif | =head2 setbadif | |||
=for sig | =for sig | |||
Signature: (a(); int mask(); [o]b()) | Signature: (a(); int mask(); [o]b()) | |||
=for ref | =for ref | |||
Set elements bad based on the supplied mask, otherwise | Set elements bad based on the supplied mask, otherwise | |||
skipping to change at line 568 | skipping to change at line 568 | |||
any bad values (use L</check_badflag> to check | any bad values (use L</check_badflag> to check | |||
whether there are any bad values in the output). | whether there are any bad values in the output). | |||
The input ndarray can have bad values: any bad values in the input ndarrays | The input ndarray can have bad values: any bad values in the input ndarrays | |||
are copied across to the output ndarray. | are copied across to the output ndarray. | |||
Also see L</setvaltobad> and L</setnantobad>. | Also see L</setvaltobad> and L</setnantobad>. | |||
=cut | =cut | |||
#line 636 "Bad.pm" | #line 636 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*setbadif = \&PDL::setbadif; | *setbadif = \&PDL::setbadif; | |||
#line 643 "Bad.pm" | #line 643 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 setvaltobad | =head2 setvaltobad | |||
=for sig | =for sig | |||
Signature: (a(); [o]b(); double value) | Signature: (a(); [o]b(); double value) | |||
=for ref | =for ref | |||
Set bad all those elements which equal the supplied value. | Set bad all those elements which equal the supplied value. | |||
skipping to change at line 606 | skipping to change at line 606 | |||
=for bad | =for bad | |||
The output always has its bad flag set, even if it does not contain | The output always has its bad flag set, even if it does not contain | |||
any bad values (use L</check_badflag> to check | any bad values (use L</check_badflag> to check | |||
whether there are any bad values in the output). | whether there are any bad values in the output). | |||
Any bad values in the input ndarrays are copied across to the output ndarray. | Any bad values in the input ndarrays are copied across to the output ndarray. | |||
=cut | =cut | |||
#line 682 "Bad.pm" | #line 682 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*setvaltobad = \&PDL::setvaltobad; | *setvaltobad = \&PDL::setvaltobad; | |||
#line 689 "Bad.pm" | #line 689 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 setnantobad | =head2 setnantobad | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
Sets NaN values (for complex, where either is NaN) in the input ndarray bad | Sets NaN values (for complex, where either is NaN) in the input ndarray bad | |||
skipping to change at line 642 | skipping to change at line 642 | |||
This method can process ndarrays with bad values: those bad values | This method can process ndarrays with bad values: those bad values | |||
are propagated into the output ndarray. Any value that is not a number | are propagated into the output ndarray. Any value that is not a number | |||
(before version 2.040 the test was for "not finite") | (before version 2.040 the test was for "not finite") | |||
is also set to bad in the output ndarray. If all values from the input | is also set to bad in the output ndarray. If all values from the input | |||
ndarray are good, the output ndarray will B<not> have its | ndarray are good, the output ndarray will B<not> have its | |||
bad flag set. | bad flag set. | |||
=cut | =cut | |||
#line 726 "Bad.pm" | #line 726 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*setnantobad = \&PDL::setnantobad; | *setnantobad = \&PDL::setnantobad; | |||
#line 733 "Bad.pm" | #line 733 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 setinftobad | =head2 setinftobad | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
Sets non-finite values (for complex, where either is non-finite) in | Sets non-finite values (for complex, where either is non-finite) in | |||
skipping to change at line 677 | skipping to change at line 677 | |||
This method can process ndarrays with bad values: those bad values | This method can process ndarrays with bad values: those bad values | |||
are propagated into the output ndarray. Any value that is not finite | are propagated into the output ndarray. Any value that is not finite | |||
is also set to bad in the output ndarray. If all values from the input | is also set to bad in the output ndarray. If all values from the input | |||
ndarray are finite, the output ndarray will B<not> have its | ndarray are finite, the output ndarray will B<not> have its | |||
bad flag set. | bad flag set. | |||
=cut | =cut | |||
#line 769 "Bad.pm" | #line 769 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*setinftobad = \&PDL::setinftobad; | *setinftobad = \&PDL::setinftobad; | |||
#line 776 "Bad.pm" | #line 776 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 setnonfinitetobad | =head2 setnonfinitetobad | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
Sets non-finite values (for complex, where either is non-finite) in | Sets non-finite values (for complex, where either is non-finite) in | |||
skipping to change at line 712 | skipping to change at line 712 | |||
This method can process ndarrays with bad values: those bad values | This method can process ndarrays with bad values: those bad values | |||
are propagated into the output ndarray. Any value that is not finite | are propagated into the output ndarray. Any value that is not finite | |||
is also set to bad in the output ndarray. If all values from the input | is also set to bad in the output ndarray. If all values from the input | |||
ndarray are finite, the output ndarray will B<not> have its | ndarray are finite, the output ndarray will B<not> have its | |||
bad flag set. | bad flag set. | |||
=cut | =cut | |||
#line 812 "Bad.pm" | #line 812 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*setnonfinitetobad = \&PDL::setnonfinitetobad; | *setnonfinitetobad = \&PDL::setnonfinitetobad; | |||
#line 819 "Bad.pm" | #line 819 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 setbadtonan | =head2 setbadtonan | |||
=for sig | =for sig | |||
Signature: (a(); [o] b();) | Signature: (a(); [o] b();) | |||
=for ref | =for ref | |||
Sets Bad values to NaN | Sets Bad values to NaN | |||
skipping to change at line 747 | skipping to change at line 747 | |||
=for bad | =for bad | |||
This method processes input ndarrays with bad values. The output ndarrays will | This method processes input ndarrays with bad values. The output ndarrays will | |||
not contain bad values (insofar as NaN is not Bad as far as PDL is concerned) | not contain bad values (insofar as NaN is not Bad as far as PDL is concerned) | |||
and the output ndarray does not have its bad flag set. As an inplace | and the output ndarray does not have its bad flag set. As an inplace | |||
operation, it clears the bad flag. | operation, it clears the bad flag. | |||
=cut | =cut | |||
#line 855 "Bad.pm" | #line 855 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*setbadtonan = \&PDL::setbadtonan; | *setbadtonan = \&PDL::setbadtonan; | |||
#line 862 "Bad.pm" | #line 862 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 setbadtoval | =head2 setbadtoval | |||
=for sig | =for sig | |||
Signature: (a(); [o]b(); double newval) | Signature: (a(); [o]b(); double newval) | |||
=for ref | =for ref | |||
Replace any bad values by a (non-bad) value. | Replace any bad values by a (non-bad) value. | |||
skipping to change at line 782 | skipping to change at line 782 | |||
=for bad | =for bad | |||
The output always has its bad flag cleared. | The output always has its bad flag cleared. | |||
If the input ndarray does not have its bad flag set, then | If the input ndarray does not have its bad flag set, then | |||
values are copied with no replacement. | values are copied with no replacement. | |||
=cut | =cut | |||
#line 897 "Bad.pm" | #line 897 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*setbadtoval = \&PDL::setbadtoval; | *setbadtoval = \&PDL::setbadtoval; | |||
#line 904 "Bad.pm" | #line 904 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 badmask | =head2 badmask | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c()) | Signature: (a(); b(); [o]c()) | |||
=for ref | =for ref | |||
Clears all C<infs> and C<nans> in C<$a> to the corresponding value in C<$b>. | Clears all C<infs> and C<nans> in C<$a> to the corresponding value in C<$b>. | |||
skipping to change at line 811 | skipping to change at line 811 | |||
badmask($x->inplace,0); | badmask($x->inplace,0); | |||
$x->inplace->badmask(0); | $x->inplace->badmask(0); | |||
=for bad | =for bad | |||
If bad values are present, these are also cleared. | If bad values are present, these are also cleared. | |||
=cut | =cut | |||
#line 933 "Bad.pm" | #line 933 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*badmask = \&PDL::badmask; | *badmask = \&PDL::badmask; | |||
#line 940 "Bad.pm" | #line 940 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 copybad | =head2 copybad | |||
=for sig | =for sig | |||
Signature: (a(); mask(); [o]b()) | Signature: (a(); mask(); [o]b()) | |||
=for ref | =for ref | |||
Copies values from one ndarray to another, setting them | Copies values from one ndarray to another, setting them | |||
skipping to change at line 855 | skipping to change at line 855 | |||
=for bad | =for bad | |||
This handles input ndarrays that are bad. If either C<$x> | This handles input ndarrays that are bad. If either C<$x> | |||
or C<$mask> have bad values, those values will be marked | or C<$mask> have bad values, those values will be marked | |||
as bad in the output ndarray and the output ndarray will have | as bad in the output ndarray and the output ndarray will have | |||
its bad value flag set to true. | its bad value flag set to true. | |||
=cut | =cut | |||
#line 985 "Bad.pm" | #line 985 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*copybad = \&PDL::copybad; | *copybad = \&PDL::copybad; | |||
#line 992 "Bad.pm" | #line 992 "Bad.pm" | |||
#line 949 "../../blib/lib/PDL/PP.pm" | #line 958 "../../blib/lib/PDL/PP.pm" | |||
=head2 locf | =head2 locf | |||
=for sig | =for sig | |||
Signature: (a(n); [o]b(n)) | Signature: (a(n); [o]b(n)) | |||
=for ref | =for ref | |||
Last Observation Carried Forward - replace | Last Observation Carried Forward - replace | |||
skipping to change at line 882 | skipping to change at line 882 | |||
Any leading BADs will be set to 0. | Any leading BADs will be set to 0. | |||
=for bad | =for bad | |||
locf processes bad values. | locf processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1020 "Bad.pm" | #line 1020 "Bad.pm" | |||
#line 951 "../../blib/lib/PDL/PP.pm" | #line 960 "../../blib/lib/PDL/PP.pm" | |||
*locf = \&PDL::locf; | *locf = \&PDL::locf; | |||
#line 1027 "Bad.pm" | #line 1027 "Bad.pm" | |||
#line 1091 "bad.pd" | #line 1091 "bad.pd" | |||
=head1 AUTHOR | =head1 AUTHOR | |||
Doug Burke (djburke@cpan.org), 2000, 2001, 2003, 2006. | Doug Burke (djburke@cpan.org), 2000, 2001, 2003, 2006. | |||
End of changes. 28 change blocks. | ||||
28 lines changed or deleted | 28 lines changed or added |