Changeset 29763
- Timestamp:
- Nov 12, 2010, 3:09:01 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/tools/czartool/Gpc1Db.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/czartool/Gpc1Db.pm
r29686 r29763 89 89 ########################################################################### 90 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 # 91 120 # Returns count of faults for this stage and label 92 121 # … … 190 219 return scalar $query->fetchrow_array(); 191 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 } 192 267 1;
Note:
See TracChangeset
for help on using the changeset viewer.
