File | /wise/base/deliv/dev/lib/perl/x86_64-linux-thread-multi/WISE/CHealPix.pm | Statements Executed | 6933879 | Total Time | 27.0712799999284 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
---|---|---|---|---|---|---|
1969086 | 2 | 1 | 14.54291 | 22.38690 | WISE::CHealPix:: | ang2pix_ring |
1969087 | 1 | 2 | 7.84399 | 7.84399 | WISE::CHealPix:: | ang2pix_ring_stub (xsub) |
998561 | 2 | 1 | 7.77615 | 11.79713 | WISE::CHealPix:: | pix2ang_ring |
998562 | 1 | 2 | 4.02098 | 4.02098 | WISE::CHealPix:: | pix2ang_ring_stub (xsub) |
2 | 1 | 2 | 4.3e-5 | 4.3e-5 | WISE::CHealPix:: | bootstrap (xsub) |
2 | 1 | 2 | 2.3e-5 | 2.3e-5 | WISE::CHealPix:: | side2nsides_deg (xsub) |
2 | 1 | 2 | 2.2e-5 | 2.2e-5 | WISE::CHealPix:: | c2cdist_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:: | neighbors_ring |
0 | 0 | 0 | 0 | 0 | WISE::CHealPix:: | nside2npix |
0 | 0 | 0 | 0 | 0 | WISE::CHealPix:: | pix2ang_nest |
0 | 0 | 0 | 0 | 0 | WISE::CHealPix:: | pix_withinr_ring |
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | #! /usr/bin/env perl | |||
2 | ||||
3 | 3 | 3.0e-5 | 1.0e-5 | use strict; # spent 13µs making 1 call to strict::import |
4 | 3 | 3.4e-5 | 1.1e-5 | use warnings; # spent 28µs making 1 call to warnings::import |
5 | ||||
6 | 1 | 1.0e-5 | 1.0e-5 | use WISE::Env (cfglib => '<:LIB:>' , # spent 588µ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.00056 | 0.00019 | use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); # spent 96µs making 1 call to vars::import |
12 | ||||
13 | 1 | 2.0e-6 | 2.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 | 0 | 0 | require DynaLoader; |
17 | ||||
18 | 1 | 1.1e-5 | 1.1e-5 | @ISA = qw(Exporter DynaLoader); |
19 | ||||
20 | 1 | 0 | 0 | @EXPORT = qw(); |
21 | 1 | 3.0e-6 | 3.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 | 0 | 0 | my $PI = atan2(1.0,1.0) * 4.0; |
29 | 1 | 2.0e-6 | 2.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 | 3.2e-5 | 3.2e-5 | bootstrap WISE::CHealPix $VERSION; # spent 2.11ms 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 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 | |||
48 | 1969086 | 3.59025 | 1.8e-6 | my ($nside,$lon,$lat) = @_; |
49 | 1969086 | 14.01854 | 7.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 | |||
53 | 998561 | 1.64135 | 1.6e-6 | my ($nside,$pix) = @_; |
54 | 998561 | 5.78207 | 5.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 |
55 | 998561 | 2.03834 | 2.0e-6 | return ($lon*$R2D, 90 - $lat*$R2D); |
56 | } | |||
57 | ||||
58 | sub nside2npix { | |||
59 | my $nside = shift; | |||
60 | return nside2npix_stub($nside); | |||
61 | } | |||
62 | ||||
63 | sub neighbors_ring { | |||
64 | my ($nside, $pix) = @_; | |||
65 | my %there = ($pix=>1); | |||
66 | return (grep { ! $there{$_}++ } | |||
67 | neighbors_ring_dups($nside,$pix) | |||
68 | ); | |||
69 | } | |||
70 | ||||
71 | sub 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 | ||||
# 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 | ||||
# 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 | ||||
# 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 | ||||
# 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 |