← Index
Performance Profile   « block view • line view • sub view »
For /wise/base/deliv/dev/bin/framedepth
  Run on Fri May 28 15:23:26 2010
Reported on Fri May 28 15:26:28 2010

File/wise/base/deliv/dev/lib/perl/x86_64-linux-thread-multi/WISE/CHealPix.pm
Statements Executed6933879
Total Time27.0712799999284 seconds

Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
19690862114.5429122.38690WISE::CHealPix::ang2pix_ring
1969087127.843997.84399WISE::CHealPix::ang2pix_ring_stub (xsub)
998561217.7761511.79713WISE::CHealPix::pix2ang_ring
998562124.020984.02098WISE::CHealPix::pix2ang_ring_stub (xsub)
2124.3e-54.3e-5WISE::CHealPix::bootstrap (xsub)
2122.3e-52.3e-5WISE::CHealPix::side2nsides_deg (xsub)
2122.2e-52.2e-5WISE::CHealPix::c2cdist_deg (xsub)
00000WISE::CHealPix::BEGIN
00000WISE::CHealPix::ang2pix_nest
00000WISE::CHealPix::neighbors_ring
00000WISE::CHealPix::nside2npix
00000WISE::CHealPix::pix2ang_nest
00000WISE::CHealPix::pix_withinr_ring

LineStmts.Exclusive
Time
Avg.Code
1#! /usr/bin/env perl
2
333.0e-51.0e-5use strict;
# spent 13µs making 1 call to strict::import
433.4e-51.1e-5use warnings;
# spent 28µs making 1 call to warnings::import
5
611.0e-51.0e-5use WISE::Env (cfglib => '<:LIB:>' ,
# spent 588µs making 1 call to WISE::Env::import
723.4e-51.7e-5 import => [qw/$opslib $staticlib/]);
8
9package WISE::CHealPix;
10
1130.000560.00019use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
# spent 96µs making 1 call to vars::import
12
1312.0e-62.0e-6my $version = '$Id: CHealPix.pm 5619 2009-08-21 20:30:50Z tim $ ';
14
1511.0e-61.0e-6require Exporter;
16100require DynaLoader;
17
1811.1e-51.1e-5@ISA = qw(Exporter DynaLoader);
19
20100@EXPORT = qw();
2113.0e-63.0e-6@EXPORT_OK = qw(ang2pix_ring pix2ang_ring neighbors_ring
22 nside2npix
23 c2cdist_deg nsides2side_deg side2nsides_deg
24 pix_withinr_ring
25 );
2611.0e-61.0e-6%EXPORT_TAGS = ();
27
28100my $PI = atan2(1.0,1.0) * 4.0;
2912.0e-62.0e-6my $R2D = 180.0 / $PI;
3011.0e-61.0e-6my $S2 = sqrt(2.0);
31
32100$VERSION = '1.00';
33
3413.2e-53.2e-5bootstrap WISE::CHealPix $VERSION;
# spent 2.11ms making 1 call to DynaLoader::bootstrap
35
36sub ang2pix_nest {
37 my ($nside,$lon,$lat) = @_;
38 return ang2pix_nest_stub($nside,(90-$lat)/$R2D,$lon/$R2D);
39}
40
41sub pix2ang_nest {
42 my ($nside,$pix) = @_;
43 my ($lat,$lon) = pix2ang_nest_stub($nside,$pix);
44 return ($lon*$R2D, 90 - $lat*$R2D);
45}
46
47
# spent 22.4s (14.5+7.84) within WISE::CHealPix::ang2pix_ring which was called 1969086 times, avg 11µs/call: # 984543 times (8.06s+4.03s) at line 192 of /wise/base/deliv/dev/bin/framedepth, avg 12µs/call # 984543 times (6.48s+3.81s) at line 202 of /wise/base/deliv/dev/bin/framedepth, avg 10µs/call
sub ang2pix_ring {
4819690863.590251.8e-6 my ($nside,$lon,$lat) = @_;
49196908614.018547.1e-6 return ang2pix_ring_stub($nside,(90-$lat)/$R2D,$lon/$R2D);
# spent 7.84s making 1969086 calls to WISE::CHealPix::ang2pix_ring_stub, avg 4µs/call
50}
51
52
# spent 11.8s (7.78+4.02) within WISE::CHealPix::pix2ang_ring which was called 998561 times, avg 12µs/call: # 984543 times (7.66s+3.96s) at line 204 of /wise/base/deliv/dev/bin/framedepth, avg 12µs/call # 14018 times (112ms+62.5ms) at line 238 of /wise/base/deliv/dev/bin/framedepth, avg 12µs/call
sub pix2ang_ring {
539985611.641351.6e-6 my ($nside,$pix) = @_;
549985615.782075.8e-6 my ($lat,$lon) = pix2ang_ring_stub($nside,$pix);
# spent 4.02s making 998561 calls to WISE::CHealPix::pix2ang_ring_stub, avg 4µs/call
559985612.038342.0e-6 return ($lon*$R2D, 90 - $lat*$R2D);
56}
57
58sub nside2npix {
59 my $nside = shift;
60 return nside2npix_stub($nside);
61}
62
63sub neighbors_ring {
64 my ($nside, $pix) = @_;
65 my %there = ($pix=>1);
66 return (grep { ! $there{$_}++ }
67 neighbors_ring_dups($nside,$pix)
68 );
69}
70
71sub pix_withinr_ring {
72 my $nside= shift;
73 my $pix0 = shift;
74 my $r = shift;
75 my $side = c2cdist_deg($nside);
76 my $niter= int($r/$side + 1);
77 my ($lon0,$lat0) = pix2ang_ring($nside,$pix0);
78 my %got;
79 my @outer = ($pix0);
80 require WISE::CoUtils;
81 $got{$pix0}++;
82 for my $iter (1..$niter) {
83 my @new;
84 for my $pix (@outer) {
85 my @neighbors = neighbors_ring($nside,$pix);
86 for my $pix_neighbor (@neighbors) {
87 next if $got{$pix_neighbor};
88 my ($lon,$lat) = pix2ang_ring($nside,$pix_neighbor);
89 my $d = WISE::CoUtils::angdist($lon0,$lat0,$lon,$lat);
90 next if $d > $r;
91 $got{$pix_neighbor}++;
92 push @new, $pix_neighbor;
93 }
94 }
95 @outer = @new;
96 last if ! @new;
97 }
98 return (sort {$a<=>$b} keys %got);
99}
# spent 7.84s within WISE::CHealPix::ang2pix_ring_stub which was called 1969086 times, avg 4µs/call: # 1969086 times (7.84s+0) by WISE::CHealPix::ang2pix_ring at line 49 of /wise/base/deliv/dev/lib/perl/x86_64-linux-thread-multi/WISE/CHealPix.pm, avg 4µs/call
sub WISE::CHealPix::ang2pix_ring_stub; # xsub
# spent 43µs within WISE::CHealPix::bootstrap which was called # once (43µs+0) by DynaLoader::bootstrap at line 226 of /opt/wise/lib/perl5/5.10.0/x86_64-linux-thread-multi/DynaLoader.pm
sub WISE::CHealPix::bootstrap; # xsub
# spent 22µs within WISE::CHealPix::c2cdist_deg which was called # once (22µs+0) at line 156 of /wise/base/deliv/dev/bin/framedepth
sub WISE::CHealPix::c2cdist_deg; # xsub
# spent 4.02s within WISE::CHealPix::pix2ang_ring_stub which was called 998561 times, avg 4µs/call: # 998561 times (4.02s+0) by WISE::CHealPix::pix2ang_ring at line 54 of /wise/base/deliv/dev/lib/perl/x86_64-linux-thread-multi/WISE/CHealPix.pm, avg 4µs/call
sub WISE::CHealPix::pix2ang_ring_stub; # xsub
# spent 23µs within WISE::CHealPix::side2nsides_deg which was called # once (23µs+0) at line 155 of /wise/base/deliv/dev/bin/framedepth
sub WISE::CHealPix::side2nsides_deg; # xsub