IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 10, 2007, 3:18:44 PM (19 years ago)
Author:
eugene
Message:

applying the update to Stats.pm using dtype and new methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/register_exp.pl

    r14080 r14115  
    5959   [   
    6060       #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
    61        { name => "exp_name",       type => "constant",   flag => "-exp_name" }, # File level
    62        { name => "telescope",      type => "constant",   flag => "-telescope" }, # File level
    63        { name => "camera",         type => "constant",   flag => "-inst" }, # File level
    64        { name => "filelevel",      type => "constant",   flag => "-filelevel" }, # File level
    65        { name => "object",         type => "constant",   flag => "-object" },
    66        { name => "exp_type",       type => "constant",   flag => "-exp_type" }, # File level
    67        { name => "filter",         type => "constant",   flag => "-filter" }, # File level
    68        { name => "dateobs",        type => "constant",   flag => "-dateobs" }, # File level
    69        { name => "ccd_temp",       type => "mean",       flag => "-ccd_temp" }, # CCD temperature
    70        { name => "exp_time",       type => "mean",       flag => "-exp_time" }, # Exposure time
    71        { name => "sat_pixel_frac", type => "mean",       flag => "-sat_pixel_frac" }, # Fraction of saturated pixels
    72        { name => "airmass",        type => "mean",       flag => "-airmass" }, # Airmass
    73        { name => "ra",             type => "mean",       flag => "-ra" }, # Right ascension
    74        { name => "decl",           type => "mean",       flag => "-decl" }, # Declination
    75        { name => "posang",         type => "mean",       flag => "-posang" }, # Position angle
    76        { name => "alt",            type => "mean",       flag => "-alt" }, # Altitude
    77        { name => "az",             type => "mean",       flag => "-az" }, # Azimuth
    78        { name => "bg",             type => "mean",       flag => "-bg" }, # Azimuth
    79        { name => "bg",             type => "stdev",      flag => "-bg_mean_stdev" }, # Azimuth
    80        { name => "bg_stdev",       type => "rms",        flag => "-bg_stdev" }, # Azimuth
     61       { name => "exp_name",       type => "constant",   flag => "-exp_name",       dtype => "string" }, # File level
     62       { name => "telescope",      type => "constant",   flag => "-telescope",      dtype => "string" }, # File level
     63       { name => "camera",         type => "constant",   flag => "-inst",           dtype => "string" }, # File level
     64       { name => "filelevel",      type => "constant",   flag => "-filelevel",      dtype => "string" }, # File level
     65       { name => "object",         type => "constant",   flag => "-object",         dtype => "string" },
     66       { name => "exp_type",       type => "constant",   flag => "-exp_type",       dtype => "string" }, # File level
     67       { name => "filter",         type => "constant",   flag => "-filter",         dtype => "string" }, # File level
     68       { name => "dateobs",        type => "constant",   flag => "-dateobs",        dtype => "string" }, # File level
     69       { name => "ccd_temp",       type => "mean",       flag => "-ccd_temp",       dtype => "float" }, # CCD temperature
     70       { name => "exp_time",       type => "mean",       flag => "-exp_time",       dtype => "float" }, # Exposure time
     71       { name => "sat_pixel_frac", type => "mean",       flag => "-sat_pixel_frac", dtype => "float" }, # Fraction of saturated pixels
     72       { name => "airmass",        type => "mean",       flag => "-airmass",        dtype => "float" }, # Airmass
     73       { name => "ra",             type => "mean",       flag => "-ra",             dtype => "float" }, # Right ascension
     74       { name => "decl",           type => "mean",       flag => "-decl",           dtype => "float" }, # Declination
     75       { name => "posang",         type => "mean",       flag => "-posang",         dtype => "float" }, # Position angle
     76       { name => "alt",            type => "mean",       flag => "-alt",            dtype => "float" }, # Altitude
     77       { name => "az",             type => "mean",       flag => "-az",             dtype => "float" }, # Azimuth
     78       { name => "bg",             type => "mean",       flag => "-bg",             dtype => "float"  }, # background
     79       { name => "bg",             type => "stdev",      flag => "-bg_mean_stdev",  dtype => "float" }, # Azimuth
     80       { name => "bg_stdev",       type => "rms",        flag => "-bg_stdev",       dtype => "float" }, # Azimuth
    8181       ];
     82my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
    8283
    8384# Look for commands we need
     
    117118
    118119    # extract the stats from the metadata
    119     my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
    120120    unless ($stats->parse($metadata)) {
    121121        &my_die ("Unable to find all values", $exp_id, $PS_EXIT_CONFIG_ERROR);
     
    124124
    125125# we require at a minimum: -telescope, -inst, -filelevel, -class_id, -exp_type
    126 if (uc(&STATS_value_for_flag ($STATS, "-telescope")) eq "NAN") { &my_die ("telescope not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
    127 if (uc(&STATS_value_for_flag ($STATS, "-inst"))      eq "NAN") { &my_die ("inst      not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
    128 if (uc(&STATS_value_for_flag ($STATS, "-filelevel")) eq "NAN") { &my_die ("filelevel not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
    129 if (uc(&STATS_value_for_flag ($STATS, "-exp_type"))  eq "NAN") { &my_die ("exp_type  not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
    130 if (uc(&STATS_value_for_flag ($STATS, "-exp_name"))  eq "NAN") { &my_die ("exp_name  not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
     126if (uc($stats->value_for_flag ("-telescope")) eq "NULL") { &my_die ("telescope not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
     127if (uc($stats->value_for_flag ("-inst"))      eq "NULL") { &my_die ("inst      not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
     128if (uc($stats->value_for_flag ("-filelevel")) eq "NULL") { &my_die ("filelevel not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
     129if (uc($stats->value_for_flag ("-exp_type"))  eq "NULL") { &my_die ("exp_type  not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
     130if (uc($stats->value_for_flag ("-exp_name"))  eq "NULL") { &my_die ("exp_name  not found", $exp_id, $PS_EXIT_CONFIG_ERROR); }
    131131
    132132my $command = "$regtool -addprocessedexp";
     
    134134$command .= " -exp_tag $exp_tag";
    135135$command .= " -dbname $dbname" if defined $dbname;
     136$command .= $stats->cmdflags();
    136137
    137 # add in the elements from the selected stats above
    138 foreach my $entry (@$STATS) {
    139     my $value = $entry->{value};
    140     my $flag = $entry->{flag};
    141     $command .= " $flag '$value'";
    142 }
    143 
    144 my $exp_type = &STATS_value_for_flag ($STATS, "-exp_type");
     138my $exp_type = $stats->value_for_flag ("-exp_type");
    145139
    146140# Add the detrend flag, if needed
     
    196190}
    197191
    198 sub STATS_value_for_flag
    199 {
    200     my $STATS = shift;
    201     my $flag  = shift;
    202 
    203     foreach my $entry (@$STATS) {
    204         if ($flag eq $entry->{flag}) {
    205             return $entry->{value};
    206         }
    207     }
    208     return 'NAN';
    209 }
    210 
    211192END {
    212193    my $exit = $?;
Note: See TracChangeset for help on using the changeset viewer.