IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29763


Ignore:
Timestamp:
Nov 12, 2010, 3:09:01 PM (15 years ago)
Author:
rhenders
Message:

added methiods to get exposure list for given night; added two methods to return magic mask

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czartool/Gpc1Db.pm

    r29686 r29763  
    8989###########################################################################
    9090#
     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###########################################################################
     98sub 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';
     110SQL
     111
     112    $query->execute;
     113    ${$expIds} = $query->fetchall_arrayref();
     114
     115    return 1;
     116}
     117
     118###########################################################################
     119#
    91120# Returns count of faults for this stage and label
    92121#
     
    190219    return scalar $query->fetchrow_array();
    191220}
     221
     222###########################################################################
     223#
     224# Returns magic mask fraction across all chips for a particular exposure
     225#
     226###########################################################################
     227sub 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%";
     239SQL
     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###########################################################################
     251sub 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%";
     263SQL
     264    $query->execute;
     265    return scalar $query->fetchrow_array();
     266}
    1922671;
Note: See TracChangeset for help on using the changeset viewer.