File | /wise/base/deliv/dev/lib/perl/WISE/DB/FrameIndex/Frame.pm | Statements Executed | 124834 | Total Time | 0.281997999999922 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
---|---|---|---|---|---|---|
13869 | 1 | 1 | 0.23358 | 2.25613 | WISE::DB::FrameIndex::Frame:: | qa_factors |
0 | 0 | 0 | 0 | 0 | WISE::DB::FrameIndex::Frame:: | BEGIN |
0 | 0 | 0 | 0 | 0 | WISE::DB::FrameIndex::Frame:: | sqlt_deploy_hook |
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | package WISE::DB::FrameIndex::Frame; | |||
2 | # $Id: Frame.pm 7702 2010-03-31 22:54:58Z heidi $ | |||
3 | ||||
4 | 1 | 1.0e-6 | 1.0e-6 | $VERSION = 1.4; |
5 | 1 | 1.0e-6 | 1.0e-6 | $ID = '$Id: Frame.pm 7702 2010-03-31 22:54:58Z heidi $'; |
6 | ||||
7 | 3 | 0.00069 | 0.00023 | use base qw/DBIx::Class/; # spent 118µs making 1 call to base::import |
8 | ||||
9 | 1 | 1.4e-5 | 1.4e-5 | __PACKAGE__->load_components(qw/Core/); # spent 379µs making 1 call to Class::C3::Componentised::load_components |
10 | 1 | 2.3e-5 | 2.3e-5 | __PACKAGE__->table('frames'); # spent 664µs making 1 call to DBIx::Class::ResultSourceProxy::Table::table |
11 | ||||
12 | 1 | 6.9e-5 | 6.9e-5 | __PACKAGE__->add_columns( # spent 9.52ms making 1 call to DBIx::Class::ResultSourceProxy::add_columns |
13 | ||||
14 | # primary identifiers | |||
15 | scan => {data_type => 'text', is_nullable => 0}, | |||
16 | frame => {data_type => 'integer', is_nullable => 0}, | |||
17 | band => {data_type => 'integer', is_nullable => 0}, | |||
18 | delivery => {data_type => 'text', is_nullable => 0}, | |||
19 | ||||
20 | # instrument / spacecraft parameters | |||
21 | orbit_number => {data_type => 'integer', is_nullable => 1}, | |||
22 | scan_incl => {data_type => 'real', is_nullable => 1}, # scan inclination | |||
23 | scan_rate => {data_type => 'real', is_nullable => 1}, | |||
24 | sciobs_status => {data_type => 'integer', is_nullable => 1}, # a science observation ? | |||
25 | saa_status => {data_type => 'integer', is_nullable => 1}, # in south atlantic anomaly ? | |||
26 | anneal_time => {data_type => 'text', is_nullable => 1}, # time of last anneal | |||
27 | anneal_dt => {data_type => 'real', is_nullable => 1}, # time since last anneal | |||
28 | ||||
29 | # delivery & ingest | |||
30 | delivery_utcs => {data_type => 'integer', is_nullable => 1}, # integer seconds | |||
31 | delivery_file => {data_type => 'text', is_nullable => 1}, # full name of raw delivery | |||
32 | delivery_size => {data_type => 'integer', is_nullable => 1}, # size of delivered file in bytes | |||
33 | ingest_status => {data_type => 'integer', is_nullable => 1}, # ingest return code | |||
34 | l0_file => {data_type => 'text', is_nullable => 1}, # full name of L0 file | |||
35 | ||||
36 | # frame metadata | |||
37 | utcs => {data_type => 'integer', is_nullable => 1}, # integer seconds} , | |||
38 | ra_raw => {data_type => 'real', is_nullable => 1}, # boresite RA | |||
39 | dec_raw => {data_type => 'real', is_nullable => 1}, # boresite DEC | |||
40 | pa_raw => {data_type => 'real', is_nullable => 1}, # boresite position angle | |||
41 | hp_raw => {data_type => 'integer', is_nullable => 1}, # healpix spatial coord based on raw pointing | |||
42 | ra_ref => {data_type => 'real', is_nullable => 1}, # refined RA | |||
43 | dec_ref => {data_type => 'real', is_nullable => 1}, # refined Dec | |||
44 | pa_ref => {data_type => 'real', is_nullable => 1}, # refined position angle | |||
45 | hp_ref => {data_type => 'integer', is_nullable => 1}, # healpix spatial coord based on refined pointing | |||
46 | delay_time => {data_type => 'real', is_nullable => 1}, # time since previous readout | |||
47 | scan_start => {data_type => 'integer', is_nullable => 1}, # flag first frame in scan | |||
48 | scan_end => {data_type => 'integer', is_nullable => 1}, # flag last frame in scan | |||
49 | prev_frame => {data_type => 'integer', is_nullable => 1}, # previous frame in scan | |||
50 | next_frame => {data_type => 'integer', is_nullable => 1}, # next frame in scan | |||
51 | pixel_stat1 => {data_type => 'real', is_nullable => 1}, # pixel statistic #1 | |||
52 | pixel_stat2 => {data_type => 'real', is_nullable => 1}, # pixel statistic #2 | |||
53 | pixel_stat3 => {data_type => 'real', is_nullable => 1}, # pixel statistic #3 | |||
54 | ||||
55 | # pipeline processing | |||
56 | pipe_status => {data_type => 'integer', is_nullable => 1}, # scanframe pipeline return code | |||
57 | pipe_dir => {data_type => 'text', is_nullable => 1}, # full path to pipeline directory | |||
58 | frameset_run_time => {data_type => 'integer', is_nullable => 1}, | |||
59 | coadd_status => {data_type => 'integer', is_nullable => 1}, # has this frame been included in any coadd | |||
60 | archive_status => {data_type => 'integer', is_nullable => 1}, # return status of archive pipeline | |||
61 | archive_dir => {data_type => 'text', is_nullable => 1}, | |||
62 | archive_run_time => {data_type => 'integer', is_nullable => 1}, # Time of last archiving | |||
63 | ||||
64 | # qa info | |||
65 | qa_score => {data_type => 'integer', is_nullable => 1 }, | |||
66 | qa_factors => {data_type => 'text', is_nullable => 1, accessor => '_qa_factors' }, | |||
67 | qa_status => {data_type => 'text', is_nullable => 1, default_value => 'unassigned' }, | |||
68 | qa_reviewer => {data_type => 'text', is_nullable => 1 }, | |||
69 | qa_notes => {data_type => 'text', is_nullable => 1 }, | |||
70 | ||||
71 | # foreign keys | |||
72 | housekeeping => {data_type => 'integer', is_nullable => 1}, # key to housekeeping table | |||
73 | missionops => {data_type => 'integer', is_nullable => 1}, # key to mission ops | |||
74 | ||||
75 | ); | |||
76 | ||||
77 | 1 | 3.0e-5 | 3.0e-5 | __PACKAGE__->set_primary_key(qw/scan frame band/); # spent 231µs making 1 call to DBIx::Class::ResultSourceProxy::set_primary_key |
78 | ||||
79 | # set relationships to other tables. the content and relationships are pretty hazy right now | |||
80 | 1 | 2.5e-5 | 2.5e-5 | __PACKAGE__->has_one( 'scanrec' => 'WISE::DB::FrameIndex::Scan', { 'foreign.scan' => 'self.scan'}); # spent 386µs making 1 call to DBIx::Class::Relationship::HasOne::has_one |
81 | 1 | 1.6e-5 | 1.6e-5 | __PACKAGE__->many_to_many( housekeeping => 'WISE::DB::FrameIndex::HouseKeeping', 'delivery'); # spent 182µs making 1 call to DBIx::Class::Relationship::ManyToMany::many_to_many |
82 | 1 | 7.0e-6 | 7.0e-6 | __PACKAGE__->many_to_many( plan => 'WISE::DB::FrameIndex::MissionPlan', 'orbit_number'); # spent 153µs making 1 call to DBIx::Class::Relationship::ManyToMany::many_to_many |
83 | ||||
84 | sub sqlt_deploy_hook { | |||
85 | my ($self, $sqlt_table) = @_; | |||
86 | ||||
87 | $sqlt_table->add_index(name => 'idx1', fields => ['scan']); | |||
88 | $sqlt_table->add_index(name => 'idx9', fields => ['frame']); | |||
89 | $sqlt_table->add_index(name => 'idx10', fields => ['scan', 'frame']); | |||
90 | $sqlt_table->add_index(name => 'idx2', fields => ['ra_raw']); | |||
91 | $sqlt_table->add_index(name => 'idx3', fields => ['dec_raw']); | |||
92 | $sqlt_table->add_index(name => 'idx4', fields => ['hp_raw']); | |||
93 | $sqlt_table->add_index(name => 'idx5', fields => ['ra_ref']); | |||
94 | $sqlt_table->add_index(name => 'idx6', fields => ['dec_ref']); | |||
95 | $sqlt_table->add_index(name => 'idx7', fields => ['hp_ref']); | |||
96 | ||||
97 | $sqlt_table->add_index(name => 'idx8', fields => ['utcs']); | |||
98 | } | |||
99 | ||||
100 | # accessor for the qa_factors field, which is a text string packed with key=val, entries | |||
101 | # spent 2.26s (234ms+2.02) within WISE::DB::FrameIndex::Frame::qa_factors which was called 13869 times, avg 163µs/call:
# 13869 times (234ms+2.02s) at line 829 of /wise/base/deliv/dev/bin/getfix, avg 163µs/call | |||
102 | 124821 | 0.28107 | 2.3e-6 | my ($self, $value, $attr) = @_; |
103 | ||||
104 | my $overwrite = exists $attr->{overwrite} ? $attr->{overwrite} : 0; | |||
105 | my $append = exists $attr->{append} ? $attr->{append} : ! $overwrite; | |||
106 | die __PACKAGE__."->qa_factors() can't overwrite and append" if($overwrite && $append); | |||
107 | ||||
108 | my %current = (); | |||
109 | my $factors_string = $self->_qa_factors || ""; # spent 1.09s making 13869 calls to Class::Accessor::Grouped::__ANON__[(eval 0)[/wise/base/static/lib/perl5/site_perl/5.10.0/Class/Accessor/Grouped.pm:156]:8], avg 78µs/call | |||
110 | %current = split(/[=,]/, $factors_string) unless $overwrite; | |||
111 | ||||
112 | if(defined $value) { | |||
113 | if(ref($value) eq 'HASH' ) { | |||
114 | my $flat = ""; | |||
115 | my %merged = (%current, %$value); | |||
116 | while ( my ($k, $v) = each %merged ) { | |||
117 | $flat .= "$k=$v,"; | |||
118 | } | |||
119 | $flat =~ s/,$//; | |||
120 | $self->_qa_factors($flat); | |||
121 | } else { | |||
122 | die __PACKAGE__."->qa_factors() expects hash ref as input"; | |||
123 | } | |||
124 | } | |||
125 | ||||
126 | return split( /[=,]/, ( $self->_qa_factors || "")); # spent 935ms making 13869 calls to Class::Accessor::Grouped::__ANON__[(eval 0)[/wise/base/static/lib/perl5/site_perl/5.10.0/Class/Accessor/Grouped.pm:156]:8], avg 67µs/call | |||
127 | } | |||
128 | ||||
129 | ||||
130 | # need to trigger the healpix tile computation | |||
131 | # it should be done whenever the frame is created/inserted, | |||
132 | # or the ra/dec is updated ..... | |||
133 | # (unless the healpix tile has been precomputed & passed in) | |||
134 | ||||
135 | 1 | 5.2e-5 | 5.2e-5 | 1; |
136 |