"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "GENERATED/PDL/Transform.pm" between
PDL-2.080.tar.gz and PDL-2.081.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

Transform.pm  (PDL-2.080):Transform.pm  (PDL-2.081)
skipping to change at line 358 skipping to change at line 358
croak "Inverting a PDL::Transform with no inverse! Oops.\n" unless(defined ($me->{inv}) and ref($me->{inv}) eq 'CODE'); croak "Inverting a PDL::Transform with no inverse! Oops.\n" unless(defined ($me->{inv}) and ref($me->{inv}) eq 'CODE');
my $result = &{$me->{inv}}($data, $me->{params}); my $result = &{$me->{inv}}($data, $me->{params});
$result->is_inplace(0); # make sure inplace flag is clear. $result->is_inplace(0); # make sure inplace flag is clear.
return $result; return $result;
} else { } else {
croak("invert requires a PDL and a PDL::Transform (did you want 'inverse' instead?)\n"); croak("invert requires a PDL and a PDL::Transform (did you want 'inverse' instead?)\n");
} }
} }
#line 377 "Transform.pm" #line 377 "Transform.pm"
#line 948 "../../blib/lib/PDL/PP.pm" #line 949 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
=head2 map =head2 map
=for sig =for sig
Signature: (k0(); pdl *in; pdl *out; pdl *map; SV *boundary; SV *method; Signature: (k0(); pdl *in; pdl *out; pdl *map; SV *boundary; SV *method;
long big; double blur; double sv_min; char flux; SV *bv) long big; double blur; double sv_min; char flux; SV *bv)
=head2 match =head2 match
skipping to change at line 703 skipping to change at line 703
pixel gets marked bad. pixel gets marked bad.
=for bad =for bad
map does not process bad values. map does not process 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 731 "Transform.pm" #line 731 "Transform.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 950 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1573 "transform.pd" #line 1573 "transform.pd"
sub PDL::match { sub PDL::match {
# Set default for rectification to 0 for simple matching... # Set default for rectification to 0 for simple matching...
push @_, {} if ref($_[-1]) ne 'HASH'; push @_, {} if ref($_[-1]) ne 'HASH';
my @k = grep(m/^r(e(c(t)?)?)?/,sort keys %{$_[-1]}); my @k = grep(m/^r(e(c(t)?)?)?/,sort keys %{$_[-1]});
#line 957 "../../blib/lib/PDL/PP.pm" #line 958 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 957 "../../blib/lib/PDL/PP.pm" #line 958 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 959 "../../blib/lib/PDL/PP.pm" #line 960 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1578 "transform.pd" #line 1578 "transform.pd"
unless(@k) { unless(@k) {
$_[-1]->{rectify} = 0; $_[-1]->{rectify} = 0;
} }
t_identity()->map(@_); t_identity()->map(@_);
} }
*PDL::map = \↦ *PDL::map = \↦
sub map { sub map {
my ($me, $in, $tmp, $opt) = @_; my ($me, $in, $tmp, $opt) = @_;
skipping to change at line 744 skipping to change at line 744
croak("PDL::Transform::map: Option 'p' was ambiguous and has been removed. You probably want 'pix' or 'phot'.") if exists($opt->{'p'}); croak("PDL::Transform::map: Option 'p' was ambiguous and has been removed. You probably want 'pix' or 'phot'.") if exists($opt->{'p'});
$tmp = [$in->dims] unless defined $tmp; # no //= because of Devel::Cover bug $tmp = [$in->dims] unless defined $tmp; # no //= because of Devel::Cover bug
# Generate an appropriate output ndarray for values to go in # Generate an appropriate output ndarray for values to go in
my ($out, @odims, $ohdr); my ($out, @odims, $ohdr);
if(UNIVERSAL::isa($tmp,'PDL')) { if(UNIVERSAL::isa($tmp,'PDL')) {
@odims = $tmp->dims; @odims = $tmp->dims;
my($x); my($x);
if(defined ($x = $tmp->gethdr)) { if(defined ($x = $tmp->gethdr)) {
my(%b) = %{$x}; my(%b) = %{$x};
#line 991 "../../blib/lib/PDL/PP.pm" #line 992 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 989 "../../blib/lib/PDL/PP.pm" #line 990 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 993 "../../blib/lib/PDL/PP.pm" #line 994 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1608 "transform.pd" #line 1608 "transform.pd"
$ohdr = \%b; $ohdr = \%b;
} }
} elsif(ref $tmp eq 'HASH') { } elsif(ref $tmp eq 'HASH') {
# (must be a fits header -- or would be filtered above) # (must be a fits header -- or would be filtered above)
for my $i(1..$tmp->{NAXIS}){ for my $i(1..$tmp->{NAXIS}){
push(@odims,$tmp->{"NAXIS$i"}); push(@odims,$tmp->{"NAXIS$i"});
} }
# deep-copy fits header into output # deep-copy fits header into output
my %foo = %{$tmp}; my %foo = %{$tmp};
#line 1004 "../../blib/lib/PDL/PP.pm" #line 1005 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1000 "../../blib/lib/PDL/PP.pm" #line 1001 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1006 "../../blib/lib/PDL/PP.pm" #line 1007 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1617 "transform.pd" #line 1617 "transform.pd"
$ohdr = \%foo; $ohdr = \%foo;
} elsif(ref $tmp eq 'ARRAY') { } elsif(ref $tmp eq 'ARRAY') {
@odims = @$tmp; @odims = @$tmp;
} else { } else {
barf("map: confused about dimensions of the output array...\n"); barf("map: confused about dimensions of the output array...\n");
} }
if(scalar(@odims) < scalar($in->dims)) { if(scalar(@odims) < scalar($in->dims)) {
my @idims = $in->dims; my @idims = $in->dims;
skipping to change at line 955 skipping to change at line 955
} }
$out->hdr->{"NAXIS"} = $nd; $out->hdr->{"NAXIS"} = $nd;
$out->hdr->{"SIMPLE"} = 'T'; $out->hdr->{"SIMPLE"} = 'T';
$out->hdr->{"HISTORY"} .= "Header written by PDL::Transform::Cartograp hy::map"; $out->hdr->{"HISTORY"} .= "Header written by PDL::Transform::Cartograp hy::map";
### Eliminate fancy newfangled output header pointing tags if they exi st ### Eliminate fancy newfangled output header pointing tags if they exi st
### These are the CROTA<n>, PCi_j, and CDi_j. ### These are the CROTA<n>, PCi_j, and CDi_j.
delete @{$out->hdr}{ delete @{$out->hdr}{
grep /(^CROTA\d*$)|(^(CD|PC)\d+_\d+[A-Z]?$)/, keys %{$out->hdr} grep /(^CROTA\d*$)|(^(CD|PC)\d+_\d+[A-Z]?$)/, keys %{$out->hdr}
#line 1205 "../../blib/lib/PDL/PP.pm" #line 1206 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1199 "../../blib/lib/PDL/PP.pm" #line 1200 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1207 "../../blib/lib/PDL/PP.pm" #line 1208 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1814 "transform.pd" #line 1814 "transform.pd"
}; };
} else { } else {
# Non-rectified output -- generate a CDi_j matrix instead of the simpl e formalism. # Non-rectified output -- generate a CDi_j matrix instead of the simpl e formalism.
# We have to deal with a linear transformation: we've got: (scaling) x !input x (t x input), # We have to deal with a linear transformation: we've got: (scaling) x !input x (t x input),
# where input is a linear transformation with offset and scaling is a simple scaling. We have # where input is a linear transformation with offset and scaling is a simple scaling. We have
# the scaling parameters and the matrix for !input -- we have only to merge them and then we # the scaling parameters and the matrix for !input -- we have only to merge them and then we
# can write out the FITS header in CDi_j form. # can write out the FITS header in CDi_j form.
print "non-rectify\n" if($PDL::Transform::debug); print "non-rectify\n" if($PDL::Transform::debug);
my $midpoint_val = (pdl(($out->dims)[0..$nd-1])/2 * $scale)->apply( $f _in ); my $midpoint_val = (pdl(($out->dims)[0..$nd-1])/2 * $scale)->apply( $f _in );
skipping to change at line 1003 skipping to change at line 1003
|| ""); || "");
for my $e(1..$nd) { for my $e(1..$nd) {
$out->hdr->{"CD${d}_${e}"} = $mat->at($d-1,$e-1); $out->hdr->{"CD${d}_${e}"} = $mat->at($d-1,$e-1);
print "setting CD${d}_${e} to ".$mat->at($d-1,$e-1)."\n" if($P DL::Transform::debug); print "setting CD${d}_${e} to ".$mat->at($d-1,$e-1)."\n" if($P DL::Transform::debug);
} }
} }
## Eliminate competing header pointing tags if they exist ## Eliminate competing header pointing tags if they exist
delete @{$out->hdr}{ delete @{$out->hdr}{
grep /(^CROTA\d*$)|(^(PC)\d+_\d+[A-Z]?$)|(CDELT\d*$)/, keys %{$out ->hdr} grep /(^CROTA\d*$)|(^(PC)\d+_\d+[A-Z]?$)|(CDELT\d*$)/, keys %{$out ->hdr}
#line 1253 "../../blib/lib/PDL/PP.pm" #line 1254 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1245 "../../blib/lib/PDL/PP.pm" #line 1246 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1255 "../../blib/lib/PDL/PP.pm" #line 1256 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1858 "transform.pd" #line 1858 "transform.pd"
}; };
} }
} }
$out->hdrcpy(1); $out->hdrcpy(1);
############################## ##############################
# Sandwich the transform between the input and output plane FITS headers. # Sandwich the transform between the input and output plane FITS headers.
unless($nofits) { unless($nofits) {
skipping to change at line 1117 skipping to change at line 1117
$in2, $o2, $idx, $in2, $o2, $idx,
$bound, $method, $big, $blur, $svmin, $flux, $bv); $bound, $method, $big, $blur, $svmin, $flux, $bv);
my @rdims = (@iddims[1..$#iddims], @idims[$#iddims..$#idims]); my @rdims = (@iddims[1..$#iddims], @idims[$#iddims..$#idims]);
{ {
my $tmp; # work around perl -d "feature" my $tmp; # work around perl -d "feature"
($tmp = $out->slice(":")) .= $o2->reshape(@rdims); ($tmp = $out->slice(":")) .= $o2->reshape(@rdims);
} }
return $out; return $out;
} }
#line 1367 "../../blib/lib/PDL/PP.pm" #line 1368 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
#line 1155 "Transform.pm" #line 1155 "Transform.pm"
#line 950 "../../blib/lib/PDL/PP.pm" #line 951 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
*map = \&PDL::map; *map = \&PDL::map;
#line 1162 "Transform.pm" #line 1162 "Transform.pm"
#line 1975 "transform.pd" #line 1975 "transform.pd"
###################################################################### ######################################################################
=head2 unmap =head2 unmap
skipping to change at line 1770 skipping to change at line 1770
NOTES NOTES
the type/unit fields are currently ignored by t_linear. the type/unit fields are currently ignored by t_linear.
=cut =cut
{ package PDL::Transform::Linear; { package PDL::Transform::Linear;
our @ISA = ('PDL::Transform'); our @ISA = ('PDL::Transform');
*_opt = \&PDL::Transform::_opt; *_opt = \&PDL::Transform::_opt;
*identity = \&PDL::MatrixOps::identity;
sub PDL::Transform::t_linear { PDL::Transform::Linear->new(@_); } sub PDL::Transform::t_linear { PDL::Transform::Linear->new(@_); }
sub new { sub new {
my($class) = shift; my($class) = shift;
my($o) = $_[0]; my($o) = $_[0];
pop @_ if (($#_ % 2 ==0) && !defined($_[-1])); pop @_ if (($#_ % 2 ==0) && !defined($_[-1]));
#suppresses a warning if @_ has an odd number of elements and the #suppresses a warning if @_ has an odd number of elements and the
#last is undef #last is undef
skipping to change at line 1814 skipping to change at line 1815
my $o_dims = _opt($o,['d','dim','dims','Dims']); my $o_dims = _opt($o,['d','dim','dims','Dims']);
$o_dims = PDL->pdl($o_dims) if defined($o_dims); $o_dims = PDL->pdl($o_dims) if defined($o_dims);
my $scale = _opt($o,['s','scale','Scale']); my $scale = _opt($o,['s','scale','Scale']);
$scale = PDL->pdl($scale) if defined($scale); $scale = PDL->pdl($scale) if defined($scale);
# Figure out the number of dimensions to transform, and, # Figure out the number of dimensions to transform, and,
# if necessary, generate a new matrix. # if necessary, generate a new matrix.
my $rot = $me->{params}{rot};
if(defined($me->{params}{matrix})) { if(defined($me->{params}{matrix})) {
my $mat = $me->{params}{matrix} = $me->{params}{matrix}->slice(":,:"); my $mat = $me->{params}{matrix} = $me->{params}{matrix}->slice(":,:");
$me->{idim} = $mat->dim(0); $me->{idim} = $mat->dim(0);
$me->{odim} = $mat->dim(1); $me->{odim} = $mat->dim(1);
} else { } else {
if(defined($me->{params}->{rot}) && if(defined($me->{params}->{rot}) &&
UNIVERSAL::isa($me->{params}->{rot},'PDL')) { UNIVERSAL::isa($me->{params}->{rot},'PDL')) {
$me->{idim} = $me->{odim} = 2 if($me->{params}{rot}->nelem == 1); $me->{idim} = $me->{odim} = 2 if($me->{params}{rot}->nelem == 1);
$me->{idim} = $me->{odim} = 3 if($me->{params}{rot}->nelem == 3); $me->{idim} = $me->{odim} = 3 if($me->{params}{rot}->nelem == 3);
skipping to change at line 1843 skipping to change at line 1845
UNIVERSAL::isa($me->{params}{pre},'PDL') && UNIVERSAL::isa($me->{params}{pre},'PDL') &&
$me->{params}{pre}->getndims > 0) { $me->{params}{pre}->getndims > 0) {
$me->{idim} = $me->{odim} = $me->{params}{pre}->dim(0); $me->{idim} = $me->{odim} = $me->{params}{pre}->dim(0);
} elsif(defined($me->{params}{post}) && } elsif(defined($me->{params}{post}) &&
UNIVERSAL::isa($me->{params}{post},'PDL') && UNIVERSAL::isa($me->{params}{post},'PDL') &&
$me->{params}{post}->getndims > 0) { $me->{params}{post}->getndims > 0) {
$me->{idim} = $me->{odim} = $me->{params}{post}->dim(0); $me->{idim} = $me->{odim} = $me->{params}{post}->dim(0);
} elsif(defined($o_dims)) { } elsif(defined($o_dims)) {
$me->{idim} = $me->{odim} = $o_dims; $me->{idim} = $me->{odim} = $o_dims;
} elsif (UNIVERSAL::isa($rot,'PDL') && (my $nrots = $rot->nelem) > 1) {
$me->{idim} = $me->{odim} = $nrots;
} else { } else {
print "PDL::Transform::Linear: assuming 2-D transform (set dims option to change)\n" if($PDL::Transform::debug); print "PDL::Transform::Linear: assuming 2-D transform (set dims option to change)\n" if($PDL::Transform::debug);
$me->{idim} = $me->{odim} = 2; $me->{idim} = $me->{odim} = 2;
} }
$me->{params}->{matrix} = PDL->zeroes($me->{idim},$me->{odim}); $me->{params}->{matrix} = PDL->zeroes($me->{idim},$me->{odim});
my $tmp; # work around perl -d "feature" my $tmp; # work around perl -d "feature"
($tmp = $me->{params}->{matrix}->diagonal(0,1)) .= 1; ($tmp = $me->{params}->{matrix}->diagonal(0,1)) .= 1;
} }
### Handle rotation option ### Handle rotation option
my $rot = $me->{params}{rot};
if(defined($rot)) { if(defined($rot)) {
# Subrotation closure -- rotates from axis $d->(0) --> $d->(1). # Subrotation closure -- rotates from axis $d->(0) --> $d->(1).
my $subrot = sub { my $subrot = sub {
my($d,$angle,$m)=@_; my($d,$angle,$m)=@_;
my($i) = identity($m->dim(0)); my($i) = identity($m->dim(0));
my($subm) = $i->dice($d,$d); my($subm) = $i->dice($d,$d);
$angle = $angle->at(0) $angle = $angle->at(0)
if(UNIVERSAL::isa($angle,'PDL')); if(UNIVERSAL::isa($angle,'PDL'));
skipping to change at line 1972 skipping to change at line 1975
if(defined $mp->{inverse}); if(defined $mp->{inverse});
$out .= "Inverse matrix:".($mp->{matrix}) $out .= "Inverse matrix:".($mp->{matrix})
if(defined $mp->{matrix}); if(defined $mp->{matrix});
} }
$out =~ s/\n/\n /go; $out =~ s/\n/\n /go;
$out; $out;
} }
} }
#line 2038 "Transform.pm" #line 2041 "Transform.pm"
#line 2846 "transform.pd" #line 2849 "transform.pd"
=head2 t_scale =head2 t_scale
=for usage =for usage
$f = t_scale(<scale>) $f = t_scale(<scale>)
=for ref =for ref
Convenience interface to L</t_linear>. Convenience interface to L</t_linear>.
t_scale produces a transform that scales around the origin by a fixed t_scale produces a transform that scales around the origin by a fixed
amount. It acts exactly the same as C<t_linear(Scale=>\<scale\>)>. amount. It acts exactly the same as C<t_linear(Scale=>\<scale\>)>.
=cut =cut
sub t_scale { sub t_scale {
my($scale) = shift; my($scale) = shift;
my($y) = shift; my($y) = shift;
return t_linear(scale=>$scale,%{$y}) return t_linear(scale=>$scale,%{$y})
#line 2064 "Transform.pm" #line 2067 "Transform.pm"
#line 2867 "transform.pd" #line 2870 "transform.pd"
if(ref $y eq 'HASH'); if(ref $y eq 'HASH');
t_linear(Scale=>$scale,$y,@_); t_linear(Scale=>$scale,$y,@_);
} }
#line 2069 "Transform.pm" #line 2072 "Transform.pm"
#line 2874 "transform.pd" #line 2877 "transform.pd"
=head2 t_offset =head2 t_offset
=for usage =for usage
$f = t_offset(<shift>) $f = t_offset(<shift>)
=for ref =for ref
Convenience interface to L</t_linear>. Convenience interface to L</t_linear>.
t_offset produces a transform that shifts the origin to a new location. t_offset produces a transform that shifts the origin to a new location.
It acts exactly the same as C<t_linear(Pre=>\<shift\>)>. It acts exactly the same as C<t_linear(Pre=>\<shift\>)>.
=cut =cut
sub t_offset { sub t_offset {
my($pre) = shift; my($pre) = shift;
my($y) = shift; my($y) = shift;
return t_linear(pre=>$pre,%{$y}) return t_linear(pre=>$pre,%{$y})
#line 2095 "Transform.pm" #line 2098 "Transform.pm"
#line 2895 "transform.pd" #line 2898 "transform.pd"
if(ref $y eq 'HASH'); if(ref $y eq 'HASH');
t_linear(pre=>$pre,$y,@_); t_linear(pre=>$pre,$y,@_);
} }
#line 2101 "Transform.pm" #line 2104 "Transform.pm"
#line 2903 "transform.pd" #line 2906 "transform.pd"
=head2 t_rot =head2 t_rot
=for usage =for usage
$f = t_rot(<rotation-in-degrees>) $f = t_rot(\@rotation_in_degrees)
=for ref =for ref
Convenience interface to L</t_linear>. Convenience interface to L</t_linear>.
t_rot produces a rotation transform in 2-D (scalar), 3-D (3-vector), or t_rot produces a rotation transform in 2-D (scalar), 3-D (3-vector), or
N-D (matrix). It acts exactly the same as C<t_linear(Rot=>\<shift\>)>. N-D (matrix). It acts exactly the same as C<t_linear(rot=>shift)>.
=cut =cut
*t_rot = \&t_rotate; *t_rot = \&t_rotate;
sub t_rotate { sub t_rotate {
my $rot = shift; my $rot = shift;
my($y) = shift; my($y) = shift;
return t_linear(rot=>$rot,%{$y}) return t_linear(rot=>$rot,%{$y})
#line 2128 "Transform.pm" #line 2131 "Transform.pm"
#line 2925 "transform.pd" #line 2928 "transform.pd"
if(ref $y eq 'HASH'); if(ref $y eq 'HASH');
t_linear(rot=>$rot,$y,@_); t_linear(rot=>$rot,$y,@_);
} }
#line 2134 "Transform.pm" #line 2137 "Transform.pm"
#line 2935 "transform.pd" #line 2938 "transform.pd"
=head2 t_fits =head2 t_fits
=for usage =for usage
$f = t_fits($fits,[option]); $f = t_fits($fits,[option]);
=for ref =for ref
FITS pixel-to-scientific transformation with inverse FITS pixel-to-scientific transformation with inverse
skipping to change at line 2224 skipping to change at line 2227
$me->{ounit} = \@ounit; $me->{ounit} = \@ounit;
$me->{iunit} = \@iunit; $me->{iunit} = \@iunit;
# Check for nonlinear projection... # Check for nonlinear projection...
# if($hdr->{CTYPE1} =~ m/(\w\w\w\w)\-(\w\w\w)/) { # if($hdr->{CTYPE1} =~ m/(\w\w\w\w)\-(\w\w\w)/) {
# print "Nonlinear transformation found... ignoring nonlinear part...\n"; # print "Nonlinear transformation found... ignoring nonlinear part...\n";
# } # }
return $me; return $me;
} }
#line 2303 "Transform.pm" #line 2306 "Transform.pm"
#line 3107 "transform.pd" #line 3110 "transform.pd"
=head2 t_code =head2 t_code
=for usage =for usage
$f = t_code(<func>,[<inv>],[options]); $f = t_code(<func>,[<inv>],[options]);
=for ref =for ref
Transform implementing arbitrary perl code. Transform implementing arbitrary perl code.
skipping to change at line 2318 skipping to change at line 2321
$me->{params} = _opt($o,['p','params','Params']) || {}; $me->{params} = _opt($o,['p','params','Params']) || {};
$me->{idim} = _opt($o,['i','idim']) || 2; $me->{idim} = _opt($o,['i','idim']) || 2;
$me->{odim} = _opt($o,['o','odim']) || 2; $me->{odim} = _opt($o,['o','odim']) || 2;
$me->{itype} = _opt($o,['itype']) || []; $me->{itype} = _opt($o,['itype']) || [];
$me->{otype} = _opt($o,['otype']) || []; $me->{otype} = _opt($o,['otype']) || [];
$me->{iunit} = _opt($o,['iunit']) || []; $me->{iunit} = _opt($o,['iunit']) || [];
$me->{ounit} = _opt($o,['ounit']) || []; $me->{ounit} = _opt($o,['ounit']) || [];
$me; $me;
} }
#line 2400 "Transform.pm" #line 2403 "Transform.pm"
#line 3206 "transform.pd" #line 3209 "transform.pd"
=head2 t_cylindrical =head2 t_cylindrical
C<t_cylindrical> is an alias for C<t_radial> C<t_cylindrical> is an alias for C<t_radial>
=head2 t_radial =head2 t_radial
=for usage =for usage
$f = t_radial(<options>); $f = t_radial(<options>);
skipping to change at line 2491 skipping to change at line 2494
my($os) = $out->slice("0:1"); my($os) = $out->slice("0:1");
$os .= append(cos($d0)->dummy(0,1),-sin($d0)->dummy(0,1)); $os .= append(cos($d0)->dummy(0,1),-sin($d0)->dummy(0,1));
$os *= defined $o->{r0} ? ($o->{r0} * exp($d1)) : $d1; $os *= defined $o->{r0} ? ($o->{r0} * exp($d1)) : $d1;
$os += $o->{origin}; $os += $o->{origin};
$out; $out;
}; };
$me; $me;
} }
#line 2579 "Transform.pm" #line 2582 "Transform.pm"
#line 3384 "transform.pd" #line 3387 "transform.pd"
=head2 t_quadratic =head2 t_quadratic
=for usage =for usage
$t = t_quadratic(<options>); $t = t_quadratic(<options>);
=for ref =for ref
Quadratic scaling -- cylindrical pincushion (n-d; with inverse) Quadratic scaling -- cylindrical pincushion (n-d; with inverse)
skipping to change at line 2607 skipping to change at line 2610
/ 2 / $s * $l) * (1 - 2*($d < $o)); / 2 / $s * $l) * (1 - 2*($d < $o));
$d += $o; $d += $o;
if($data->is_inplace) { if($data->is_inplace) {
$data .= $dd; $data .= $dd;
return $data; return $data;
} }
$dd; $dd;
}; };
$me; $me;
} }
#line 2699 "Transform.pm" #line 2702 "Transform.pm"
#line 3503 "transform.pd" #line 3506 "transform.pd"
=head2 t_cubic =head2 t_cubic
=for usage =for usage
$t = t_cubic(<options>); $t = t_cubic(<options>);
=for ref =for ref
Cubic scaling - cubic pincushion (n-d; with inverse) Cubic scaling - cubic pincushion (n-d; with inverse)
skipping to change at line 2748 skipping to change at line 2751
if($data->is_inplace) { if($data->is_inplace) {
$data .= $dd; $data .= $dd;
return $data; return $data;
} else { } else {
return $dd; return $dd;
} }
}; };
$me; $me;
} }
#line 2845 "Transform.pm" #line 2848 "Transform.pm"
#line 3649 "transform.pd" #line 3652 "transform.pd"
=head2 t_quartic =head2 t_quartic
=for usage =for usage
$t = t_quartic(<options>); $t = t_quartic(<options>);
=for ref =for ref
Quartic scaling -- cylindrical pincushion (n-d; with inverse) Quartic scaling -- cylindrical pincushion (n-d; with inverse)
skipping to change at line 2868 skipping to change at line 2871
/ 2 / $s * $l) * (1 - 2*($d < $o)); / 2 / $s * $l) * (1 - 2*($d < $o));
$d += $o; $d += $o;
if($data->is_inplace) { if($data->is_inplace) {
$data .= $dd; $data .= $dd;
return $data; return $data;
} }
$dd; $dd;
}; };
$me; $me;
} }
#line 2969 "Transform.pm" #line 2972 "Transform.pm"
#line 3772 "transform.pd" #line 3775 "transform.pd"
=head2 t_spherical =head2 t_spherical
=for usage =for usage
$t = t_spherical(<options>); $t = t_spherical(<options>);
=for ref =for ref
Convert Cartesian to spherical coordinates. (3-D; with inverse) Convert Cartesian to spherical coordinates. (3-D; with inverse)
skipping to change at line 3003 skipping to change at line 3006
$x .= $r * cos($ph); $x .= $r * cos($ph);
$y .= $x * sin($th); $y .= $x * sin($th);
$x *= cos($th); $x *= cos($th);
$out += $o->{origin}; $out += $o->{origin};
$out; $out;
}; };
$me; $me;
} }
#line 3108 "Transform.pm" #line 3111 "Transform.pm"
#line 3910 "transform.pd" #line 3913 "transform.pd"
=head2 t_projective =head2 t_projective
=for usage =for usage
$t = t_projective(<options>); $t = t_projective(<options>);
=for ref =for ref
Projective transformation Projective transformation
skipping to change at line 3157 skipping to change at line 3160
$me->{inv} = sub { $me->{inv} = sub {
my($data,$o) = @_; my($data,$o) = @_;
my($id) = $data->dim(0); my($id) = $data->dim(0);
my($d) = $data->glue(0,ones($data->slice("0"))); my($d) = $data->glue(0,ones($data->slice("0")));
my($out) = ($o->{matinv} x $d->slice("*1"))->slice("(0)"); my($out) = ($o->{matinv} x $d->slice("*1"))->slice("(0)");
return ($out->slice("0:".($id-1))/$out->slice("$id")); return ($out->slice("0:".($id-1))/$out->slice("$id"));
}; };
$me; $me;
} }
#line 3266 "Transform.pm" #line 3269 "Transform.pm"
#line 244 "transform.pd" #line 244 "transform.pd"
=head1 AUTHOR =head1 AUTHOR
Copyright 2002, 2003 Craig DeForest. There is no warranty. You are allowed Copyright 2002, 2003 Craig DeForest. There is no warranty. You are allowed
to redistribute this software under certain conditions. For details, to redistribute this software under certain conditions. For details,
see the file COPYING in the PDL distribution. If this file is see the file COPYING in the PDL distribution. If this file is
separated from the PDL distribution, the copyright notice should be separated from the PDL distribution, the copyright notice should be
included in the file. included in the file.
skipping to change at line 3224 skipping to change at line 3227
# call this routine first then append auxiliary information. # call this routine first then append auxiliary information.
# #
sub stringify { sub stringify {
my($me) = shift; my($me) = shift;
my($mestr) = (ref $me); my($mestr) = (ref $me);
$mestr =~ s/PDL::Transform:://; $mestr =~ s/PDL::Transform:://;
my $out = $mestr . " (" . $me->{name} . "): "; my $out = $mestr . " (" . $me->{name} . "): ";
$out .= "fwd ". ((defined ($me->{func})) ? ( (ref($me->{func}) eq 'CODE') ? "o k" : "non-CODE(!!)" ): "missing")."; "; $out .= "fwd ". ((defined ($me->{func})) ? ( (ref($me->{func}) eq 'CODE') ? "o k" : "non-CODE(!!)" ): "missing")."; ";
$out .= "inv ". ((defined ($me->{inv})) ? ( (ref($me->{inv}) eq 'CODE') ? "ok " : "non-CODE(!!)" ):"missing").".\n"; $out .= "inv ". ((defined ($me->{inv})) ? ( (ref($me->{inv}) eq 'CODE') ? "ok " : "non-CODE(!!)" ):"missing").".\n";
} }
#line 3339 "Transform.pm" #line 3342 "Transform.pm"
# Exit with OK status # Exit with OK status
1; 1;
 End of changes. 42 change blocks. 
52 lines changed or deleted 55 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)