File | /wise/base/deliv/dev/lib/perl/x86_64-linux-thread-multi/WISE/CHealPix.pm | Statements Executed | 184741289 | Total Time | 547.369136894443 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
---|---|---|---|---|---|---|
13870 | 2 | 2 | 262.52285 | 613.22701 | WISE::CHealPix:: | pix_withinr_ring |
5993283 | 1 | 1 | 130.60194 | 198.16257 | WISE::CHealPix:: | neighbors_ring |
5993284 | 1 | 2 | 67.56063 | 67.56063 | WISE::CHealPix:: | neighbors_ring_dups (xsub) |
5994837 | 2 | 1 | 48.15751 | 72.76986 | WISE::CHealPix:: | pix2ang_ring |
5994838 | 1 | 2 | 24.61235 | 24.61235 | WISE::CHealPix:: | pix2ang_ring_stub (xsub) |
13871 | 3 | 2 | 0.17557 | 0.26029 | WISE::CHealPix:: | ang2pix_ring |
13872 | 1 | 2 | 0.08472 | 0.08472 | WISE::CHealPix:: | ang2pix_ring_stub (xsub) |
13872 | 2 | 3 | 0.05866 | 0.05866 | WISE::CHealPix:: | c2cdist_deg (xsub) |
2 | 1 | 2 | 0.00011 | 0.00011 | WISE::CHealPix:: | bootstrap (xsub) |
2 | 1 | 2 | 2.3e-5 | 2.3e-5 | WISE::CHealPix:: | nsides2side_deg (xsub) |
2 | 1 | 2 | 1.2e-5 | 1.2e-5 | WISE::CHealPix:: | side2nsides_deg (xsub) |
0 | 0 | 0 | 0 | 0 | WISE::CHealPix:: | BEGIN |
0 | 0 | 0 | 0 | 0 | WISE::CHealPix:: | ang2pix_nest |
0 | 0 | 0 | 0 | 0 | WISE::CHealPix:: | nside2npix |
0 | 0 | 0 | 0 | 0 | WISE::CHealPix:: | pix2ang_nest |
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | #! /usr/bin/env perl | |||
2 | ||||
3 | 3 | 5.6e-5 | 1.9e-5 | use strict; # spent 31µs making 1 call to strict::import |
4 | 3 | 4.4e-5 | 1.5e-5 | use warnings; # spent 32µs making 1 call to warnings::import |
5 | ||||
6 | 1 | 1.2e-5 | 1.2e-5 | use WISE::Env (cfglib => '<:LIB:>' , # spent 655µs making 1 call to WISE::Env::import |
7 | 2 | 3.4e-5 | 1.7e-5 | import => [qw/$opslib $staticlib/]); |
8 | ||||
9 | package WISE::CHealPix; | |||
10 | ||||
11 | 3 | 0.00059 | 0.00020 | use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); # spent 75µs making 1 call to vars::import |
12 | ||||
13 | 1 | 1.0e-6 | 1.0e-6 | my $version = '$Id: CHealPix.pm 5619 2009-08-21 20:30:50Z tim $ '; |
14 | ||||
15 | 1 | 1.0e-6 | 1.0e-6 | require Exporter; |
16 | 1 | 1.0e-6 | 1.0e-6 | require DynaLoader; |
17 | ||||
18 | 1 | 1.4e-5 | 1.4e-5 | @ISA = qw(Exporter DynaLoader); |
19 | ||||
20 | 1 | 1.0e-6 | 1.0e-6 | @EXPORT = qw(); |
21 | 1 | 2.0e-6 | 2.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 | ); | |||
26 | 1 | 1.0e-6 | 1.0e-6 | %EXPORT_TAGS = (); |
27 | ||||
28 | 1 | 1.0e-6 | 1.0e-6 | my $PI = atan2(1.0,1.0) * 4.0; |
29 | 1 | 1.0e-6 | 1.0e-6 | my $R2D = 180.0 / $PI; |
30 | 1 | 1.0e-6 | 1.0e-6 | my $S2 = sqrt(2.0); |
31 | ||||
32 | 1 | 0 | 0 | $VERSION = '1.00'; |
33 | ||||
34 | 1 | 2.7e-5 | 2.7e-5 | bootstrap WISE::CHealPix $VERSION; # spent 2.97ms making 1 call to DynaLoader::bootstrap |
35 | ||||
36 | sub ang2pix_nest { | |||
37 | my ($nside,$lon,$lat) = @_; | |||
38 | return ang2pix_nest_stub($nside,(90-$lat)/$R2D,$lon/$R2D); | |||
39 | } | |||
40 | ||||
41 | sub 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 260ms (176+84.7) within WISE::CHealPix::ang2pix_ring which was called 13871 times, avg 19µs/call:
# 13869 times (176ms+84.7ms) by WISE::CoUtils::posmatch at line 718 of /wise/base/deliv/dev/lib/perl/WISE/CoUtils.pm, avg 19µs/call
# once (14µs+26µs) by WISE::DB::FrameIndex::_neighbor_hp at line 514 of /wise/base/deliv/dev/lib/perl/WISE/DB/FrameIndex.pm
# once (15µs+6µs) by WISE::CoUtils::posmatch at line 754 of /wise/base/deliv/dev/lib/perl/WISE/CoUtils.pm | |||
48 | 13871 | 0.04270 | 3.1e-6 | my ($nside,$lon,$lat) = @_; |
49 | 13871 | 0.15389 | 1.1e-5 | return ang2pix_ring_stub($nside,(90-$lat)/$R2D,$lon/$R2D); # spent 84.7ms making 13871 calls to WISE::CHealPix::ang2pix_ring_stub, avg 6µs/call |
50 | } | |||
51 | ||||
52 | sub pix2ang_ring { | |||
53 | 5994837 | 8.63038 | 1.4e-6 | my ($nside,$pix) = @_; |
54 | 5994837 | 35.11341 | 5.9e-6 | my ($lat,$lon) = pix2ang_ring_stub($nside,$pix); # spent 24.6s making 5994837 calls to WISE::CHealPix::pix2ang_ring_stub, avg 4µs/call |
55 | 5994837 | 12.77821 | 2.1e-6 | return ($lon*$R2D, 90 - $lat*$R2D); |
56 | } | |||
57 | ||||
58 | sub nside2npix { | |||
59 | my $nside = shift; | |||
60 | return nside2npix_stub($nside); | |||
61 | } | |||
62 | ||||
63 | # spent 198s (131+67.6) within WISE::CHealPix::neighbors_ring which was called 5993283 times, avg 33µs/call:
# 5993283 times (131s+67.6s) by WISE::CHealPix::pix_withinr_ring at line 85, avg 33µs/call | |||
64 | 5993283 | 8.87358 | 1.5e-6 | my ($nside, $pix) = @_; |
65 | 5993283 | 6.23809 | 1.0e-6 | my %there = ($pix=>1); |
66 | 5993283 | 167.98851 | 2.8e-5 | return (grep { ! $there{$_}++ } # spent 67.6s making 5993283 calls to WISE::CHealPix::neighbors_ring_dups, avg 11µs/call |
67 | neighbors_ring_dups($nside,$pix) | |||
68 | ); | |||
69 | } | |||
70 | ||||
71 | # spent 613s (263+351) within WISE::CHealPix::pix_withinr_ring which was called 13870 times, avg 44.2ms/call:
# 13869 times (262s+351s) by WISE::CoUtils::posmatch at line 723 of /wise/base/deliv/dev/lib/perl/WISE/CoUtils.pm, avg 44.2ms/call
# once (95.3ms+151ms) by WISE::DB::FrameIndex::_neighbor_hp at line 518 of /wise/base/deliv/dev/lib/perl/WISE/DB/FrameIndex.pm | |||
72 | 13870 | 0.01685 | 1.2e-6 | my $nside= shift; |
73 | 13870 | 0.01013 | 7.3e-7 | my $pix0 = shift; |
74 | 13870 | 0.01332 | 9.6e-7 | my $r = shift; |
75 | 13870 | 0.08194 | 5.9e-6 | my $side = c2cdist_deg($nside); # spent 58.6ms making 13870 calls to WISE::CHealPix::c2cdist_deg, avg 4µs/call |
76 | 13870 | 0.02395 | 1.7e-6 | my $niter= int($r/$side + 1); |
77 | 13870 | 0.06724 | 4.8e-6 | my ($lon0,$lat0) = pix2ang_ring($nside,$pix0); # spent 179ms making 13870 calls to WISE::CHealPix::pix2ang_ring, avg 13µs/call |
78 | 13870 | 0.00792 | 5.7e-7 | my %got; |
79 | 13870 | 0.01364 | 9.8e-7 | my @outer = ($pix0); |
80 | 13870 | 0.02086 | 1.5e-6 | require WISE::CoUtils; |
81 | 13870 | 0.01863 | 1.3e-6 | $got{$pix0}++; |
82 | 13870 | 0.01755 | 1.3e-6 | for my $iter (1..$niter) { |
83 | 147642 | 0.06629 | 4.5e-7 | my @new; |
84 | 147642 | 0.20052 | 1.4e-6 | for my $pix (@outer) { |
85 | 5993283 | 97.75313 | 1.6e-5 | my @neighbors = neighbors_ring($nside,$pix); # spent 198s making 5993283 calls to WISE::CHealPix::neighbors_ring, avg 33µs/call |
86 | 5993283 | 71.74747 | 1.2e-5 | for my $pix_neighbor (@neighbors) { |
87 | 106103862 | 56.71364 | 5.3e-7 | next if $got{$pix_neighbor}; |
88 | 5980967 | 29.05833 | 4.9e-6 | my ($lon,$lat) = pix2ang_ring($nside,$pix_neighbor); # spent 72.6s making 5980967 calls to WISE::CHealPix::pix2ang_ring, avg 12µs/call |
89 | 5980967 | 24.80157 | 4.1e-6 | my $d = WISE::CoUtils::angdist($lon0,$lat0,$lon,$lat); # spent 79.7s making 5980967 calls to WISE::CoUtils::angdist, avg 13µs/call |
90 | 5980967 | 2.94436 | 4.9e-7 | next if $d > $r; |
91 | 5979413 | 5.34461 | 8.9e-7 | $got{$pix_neighbor}++; |
92 | 5979413 | 9.54498 | 1.6e-6 | push @new, $pix_neighbor; |
93 | } | |||
94 | } | |||
95 | 147642 | 1.81336 | 1.2e-5 | @outer = @new; |
96 | 147642 | 0.80578 | 5.5e-6 | last if ! @new; |
97 | } | |||
98 | 13870 | 6.46352 | 0.00047 | return (sort {$a<=>$b} keys %got); |
99 | } | |||
# spent 84.7ms within WISE::CHealPix::ang2pix_ring_stub which was called 13871 times, avg 6µs/call:
# 13871 times (84.7ms+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 6µs/call | ||||
# spent 110µs within WISE::CHealPix::bootstrap which was called
# once (110µs+0) by DynaLoader::bootstrap at line 226 of /opt/wise/lib/perl5/5.10.0/x86_64-linux-thread-multi/DynaLoader.pm | ||||
# spent 58.7ms within WISE::CHealPix::c2cdist_deg which was called 13871 times, avg 4µs/call:
# 13870 times (58.6ms+0) by WISE::CHealPix::pix_withinr_ring at line 75 of /wise/base/deliv/dev/lib/perl/x86_64-linux-thread-multi/WISE/CHealPix.pm, avg 4µs/call
# once (26µs+0) by WISE::DB::FrameIndex::_neighbor_hp at line 503 of /wise/base/deliv/dev/lib/perl/WISE/DB/FrameIndex.pm | ||||
# spent 67.6s within WISE::CHealPix::neighbors_ring_dups which was called 5993283 times, avg 11µs/call:
# 5993283 times (67.6s+0) by WISE::CHealPix::neighbors_ring at line 66 of /wise/base/deliv/dev/lib/perl/x86_64-linux-thread-multi/WISE/CHealPix.pm, avg 11µs/call | ||||
# spent 23µs within WISE::CHealPix::nsides2side_deg which was called
# once (23µs+0) by WISE::CoUtils::posmatch at line 710 of /wise/base/deliv/dev/lib/perl/WISE/CoUtils.pm | ||||
# spent 24.6s within WISE::CHealPix::pix2ang_ring_stub which was called 5994837 times, avg 4µs/call:
# 5994837 times (24.6s+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 | ||||
# spent 12µs within WISE::CHealPix::side2nsides_deg which was called
# once (12µs+0) by WISE::CoUtils::posmatch at line 666 of /wise/base/deliv/dev/lib/perl/WISE/CoUtils.pm |