- Timestamp:
- Nov 26, 2010, 10:33:29 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101103/tools/czartool/Gpc1Db.pm
r28924 r29834 60 60 ########################################################################### 61 61 # 62 # Returns the number of science exposures taken 'last night' for a given day 63 # 64 # Notes: 65 # 66 # - 03:00 HST = 17:00 last night UTC 67 # - 17:00 HST = 07:00 this morning UTC 68 # - 'OBJECT' = science exposures 69 # 70 ########################################################################### 71 sub countScienceExposuresFromLastNight { 72 my ($self, $day) = @_; 73 74 my $begin = "$day 03"; 75 my $end = "$day 17"; 76 77 my $query = $self->{_db}->prepare(<<SQL); 78 SELECT COUNT(*) 79 FROM summitExp 80 WHERE dateobs > '$begin' 81 AND dateobs < '$end' AND 82 exp_type = 'OBJECT'; 83 SQL 84 85 $query->execute; 86 return scalar $query->fetchrow_array(); 87 } 88 89 ########################################################################### 90 # 91 # Returns the number of exposures between two dates that have been registered with chip 92 # 93 # Notes: 94 # 95 # necessary to convert times as rawExp.dateobs is in UTC 96 # 97 ########################################################################### 98 sub getProcessedExposures { 99 my ($self, $beginDate, $endDate, $expIds) = @_; 100 101 $beginDate = "$beginDate 03"; 102 $endDate = "$endDate 17"; 103 104 my $query = $self->{_db}->prepare(<<SQL); 105 SELECT rawExp.exp_id 106 FROM chipRun, rawExp 107 WHERE chipRun.exp_id = rawExp.exp_id 108 AND rawExp.dateobs >= '$beginDate' 109 AND rawExp.dateobs <= '$endDate'; 110 SQL 111 112 $query->execute; 113 ${$expIds} = $query->fetchall_arrayref(); 114 115 return 1; 116 } 117 118 ########################################################################### 119 # 62 120 # Returns count of faults for this stage and label 63 121 # … … 158 216 } 159 217 160 161 218 $query->execute; 162 219 return scalar $query->fetchrow_array(); 163 220 } 221 222 ########################################################################### 223 # 224 # Returns magic mask fraction across all chips for a particular exposure 225 # 226 ########################################################################### 227 sub getMagicMaskFraction { 228 my ($self, $exp_id, $fracs) = @_; 229 230 my $query = $self->{_db}->prepare(<<SQL); 231 SELECT component, streak_frac 232 FROM magicDSFile 233 JOIN magicDSRun USING(magic_ds_id) 234 JOIN camRun USING(cam_id) 235 JOIN chipRun USING(chip_id) 236 WHERE exp_id = $exp_id 237 AND camRun.label LIKE "%nightlyscience" 238 AND component LIKE "XY%"; 239 SQL 240 $query->execute; 241 ${$fracs} = $query->fetchall_arrayref(); 242 243 return 1; 244 } 245 246 ########################################################################### 247 # 248 # Returns average magic mask fraction across all chips for a particular exposure 249 # 250 ########################################################################### 251 sub getAverageMagicMaskFraction { 252 my ($self, $exp_id) = @_; 253 254 my $query = $self->{_db}->prepare(<<SQL); 255 SELECT AVG(streak_frac) 256 FROM magicDSFile 257 JOIN magicDSRun USING(magic_ds_id) 258 JOIN camRun USING(cam_id) 259 JOIN chipRun USING(chip_id) 260 WHERE exp_id = $exp_id 261 AND camRun.label LIKE "%nightlyscience" 262 AND component LIKE "XY%"; 263 SQL 264 $query->execute; 265 return scalar $query->fetchrow_array(); 266 } 164 267 1;
Note:
See TracChangeset
for help on using the changeset viewer.
