IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19932


Ignore:
Timestamp:
Oct 6, 2008, 2:03:10 PM (18 years ago)
Author:
Paul Price
Message:

Adding dtime_script calculation. Updating the database tables.

Location:
trunk/ippScripts/scripts
Files:
6 edited

Legend:

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

    r19665 r19932  
    1010print "\n\n";
    1111print "Starting script $0 on $host\n\n";
     12
     13use DateTime;
     14my $mjd_start = DateTime->now->mjd;   # MJD of starting script
    1215
    1316use vars qw( $VERSION );
     
    353356    $fpaCommand .= $camStats->cmdflags();
    354357    $fpaCommand .= " -hostname $host" if defined $host;
     358    $fpaCommand .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    355359} else {
    356360    $fpaCommand .= " -updaterun -state full";
     
    387391            $command .= " -path_base $outroot";
    388392            $command .= " -path_base $outroot" if defined $outroot;
     393            $command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    389394        } else {
    390395            $command .= " -updateprocessedexp";
  • trunk/ippScripts/scripts/chip_imfile.pl

    r19560 r19932  
    1111print "Starting script $0 on $host\n\n";
    1212
     13use DateTime;
     14my $mjd_start = DateTime->now->mjd;   # MJD of starting script
     15
    1316use vars qw( $VERSION );
    1417$VERSION = '0.01';
     
    2831     $no_update, $no_op, $redirect );
    2932GetOptions(
    30     'exp_id=s'          => \$exp_id,    # Exposure identifier
    31     'chip_id=s'         => \$chip_id,   # Chiptool identifier
    32     'class_id=s'        => \$class_id,  # Class identifier
    33     'uri|u=s'           => \$uri,       # Input FITS file
    34     'camera|c=s'        => \$camera,    # Camera
    35     'outroot|w=s'       => \$outroot,   # output file base name
    36     'dbname|d=s'        => \$dbname,    # Database name
    37     'reduction=s'       => \$reduction, # Reduction class
     33    'exp_id=s'          => \$exp_id,    # Exposure identifier
     34    'chip_id=s'         => \$chip_id,   # Chiptool identifier
     35    'class_id=s'        => \$class_id,  # Class identifier
     36    'uri|u=s'           => \$uri,       # Input FITS file
     37    'camera|c=s'        => \$camera,    # Camera
     38    'outroot|w=s'       => \$outroot,   # output file base name
     39    'dbname|d=s'        => \$dbname,    # Database name
     40    'reduction=s'       => \$reduction, # Reduction class
    3841    'run-state=s'       => \$run_state, # current state of the run (new, update)
    39     'threads=s'         => \$threads,   # Number of threads to use for ppImage
    40     'verbose'           => \$verbose,   # Print to stdout
    41     'no-update'         => \$no_update, # Don't update the database?
    42     'no-op'             => \$no_op,     # Don't do any operations?
     42    'threads=s'         => \$threads,   # Number of threads to use for ppImage
     43    'verbose'           => \$verbose,   # Print to stdout
     44    'no-update'         => \$no_update, # Don't update the database?
     45    'no-op'             => \$no_op,     # Don't do any operations?
    4346    'redirect-output'   => \$redirect,
    4447    ) or pod2usage( 2 );
     
    7376# values to extract from output metadata and the stats to calculate
    7477# XXX commented-out entries are not yet defined in the output files
    75 # XXX EAM : we are removing the astrometry analysis from chip, so we
    76 # do not bother to calculate those stats.
    7778my $STATS =
    7879   [
     
    8687       { name => "FRINGE_RESID_0", type => "rms",   flag => "-fringe_1",       dtype => "float" },
    8788       { name => "FRINGE_ERR_0",   type => "rms",   flag => "-fringe_2",       dtype => "float" },
    88 #      { name => "CERROR",         type => "rms",   flag => "-sigma_ra",       dtype => "float" },
    89 #      { name => "CERROR",         type => "rms",   flag => "-sigma_dec",      dtype => "float" },
    9089       { name => "APMIFIT",        type => "mean",  flag => "-ap_resid",       dtype => "float" },
    9190       { name => "DAPMIFIT",       type => "rms",   flag => "-ap_resid_stdev", dtype => "float" },
    92 #      { name => "ZP??",           type => "mean",  flag => "-zp_mean",        dtype => "float" },
    93 #      { name => "ZP??",           type => "rms",   flag => "-zp_stdev",       dtype => "float" },
    9491       { name => "FWHM_X",         type => "mean",  flag => "-fwhm_major",     dtype => "float" },
    9592       { name => "FWHM_Y",         type => "mean",  flag => "-fwhm_minor",     dtype => "float" },
    9693       { name => "DT_DET",         type => "sum",   flag => "-dtime_detrend",  dtype => "float" },
    9794       { name => "DT_PHOT",        type => "sum",   flag => "-dtime_photom",   dtype => "float" },
    98 #       { name => "DT_ASTR",        type => "sum",   flag => "-dtime_astrom",   dtype => "float" },
     95       { name => "DT_TOTAL",       type => "sum",   flag => "-dtime_total",    dtype => "float" },
    9996       { name => "NSTARS",         type => "sum",   flag => "-n_stars",        dtype => "int"   },
    10097#      { name => "?",              type => "sum",   flag => "-n_extended",     dtype => "int"   },
    10198#      { name => "?",              type => "sum",   flag => "-n_cr",           dtype => "int"   },
    102 #      { name => "NASTRO",         type => "sum",   flag => "-n_astrom",       dtype => "int"   },
    10399   ];
    104100my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
     
    149145
    150146    if ($run_state eq "new") {
    151         $command  = "$ppImage -file $uri $outroot";
    152         $command .= " -recipe PPIMAGE $recipe";
    153         $command .= " -threads $threads" if defined $threads;
    154         $command .= " -dbname $dbname" if defined $dbname;
     147        $command  = "$ppImage -file $uri $outroot";
     148        $command .= " -recipe PPIMAGE $recipe";
     149        $command .= " -threads $threads" if defined $threads;
     150        $command .= " -dbname $dbname" if defined $dbname;
    155151        $command .= " -dumpconfig $configuration";
    156         $command .= " -tracedest $traceDest -log $logDest";
     152        $command .= " -tracedest $traceDest -log $logDest";
    157153        $do_stats = 1;
    158154    } else {
    159         $command  = "$ppImage -file $uri $outroot";
    160         $command .= " -ipprc $configuration";
    161         $command .= " -threads $threads" if defined $threads;
    162         $command .= " -dbname $dbname" if defined $dbname;
    163         $command .= " -tracedest $traceDest -log $logDest";
    164         $command .= " -Db PPIMAGE:PHOTOM FALSE";
     155        $command  = "$ppImage -file $uri $outroot";
     156        $command .= " -ipprc $configuration";
     157        $command .= " -threads $threads" if defined $threads;
     158        $command .= " -dbname $dbname" if defined $dbname;
     159        $command .= " -tracedest $traceDest -log $logDest";
     160        $command .= " -Db PPIMAGE:PHOTOM FALSE";
    165161    }
    166162    if ($do_stats) {
    167         $command .= " -recipe PPSTATS CHIPSTATS";
    168         $command .= " -stats $outputStats";
     163        $command .= " -recipe PPSTATS CHIPSTATS";
     164        $command .= " -stats $outputStats";
    169165    }
    170166
     
    241237    $command .= " -dbname $dbname" if defined $dbname;
    242238    $command .= $stats->cmdflags();
     239    $command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    243240} else {
    244241    $command = "$chiptool -tofullimfile";
     
    279276            $command .= " -path_base $outroot";
    280277            $command .= " -hostname $host" if defined $host;
     278            $command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    281279        } else {
    282280            $command .= "$chiptool -updateprocessedimfile";
  • trunk/ippScripts/scripts/diff_skycell.pl

    r19638 r19932  
    99print "\n\n";
    1010print "Starting script $0 on $host\n\n";
     11
     12use DateTime;
     13my $mjd_start = DateTime->now->mjd;   # MJD of starting script
    1114
    1215use vars qw( $VERSION );
     
    241244        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot";
    242245        $command .= $stats->cmdflags();
     246        $command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    243247        $command .= " -hostname $host" if defined $host;
    244248        $command .= " -dbname $dbname" if defined $dbname;
     
    263267    if (defined $diff_id and not $no_update) {
    264268        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -code $exit_code";
     269        $command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    265270        $command .= " -hostname $host" if defined $host;
    266271        $command .= " -dbname $dbname" if defined $dbname;
  • trunk/ippScripts/scripts/fake_imfile.pl

    r18562 r19932  
    22
    33## this script is run on every imfile to perform the fake source
    4 ## analysis and the forced photometry analysis. 
     4## analysis and the forced photometry analysis.
    55
    66## For the fake source analysis, we load the image, inject a number of
     
    1212
    1313## For the forced photometry, we need to use the measured astrometry
    14 ## to select the desired locations in pixel coord. 
     14## to select the desired locations in pixel coord.
    1515
    1616# XXX : seeing needs to be determined from the input PSF (not currently done in ppSim)
     
    2727print "Starting script $0 on $host\n\n";
    2828
     29use DateTime;
     30my $mjd_start = DateTime->now->mjd;   # MJD of starting script
     31
    2932use vars qw( $VERSION );
    3033$VERSION = '0.01';
     
    4144
    4245# Parse the command-line arguments
    43 my ( $exp_id, $fake_id, $class_id, $chiproot, $camroot, $camera, $outroot, 
     46my ( $exp_id, $fake_id, $class_id, $chiproot, $camroot, $camera, $outroot,
    4447     $dbname, $reduction, $verbose, $no_update, $no_op, $redirect  );
    4548GetOptions(
    46     'exp_id=s'          => \$exp_id,    # Exposure identifier
    47     'fake_id=s'         => \$fake_id,   # Chiptool identifier
    48     'class_id=s'        => \$class_id,  # Class identifier
    49     'chiproot=s'        => \$chiproot,  # Input Chip files (root)
    50     'camroot=s'         => \$camroot,   # Input Camera files (root)
    51     'camera|c=s'        => \$camera,       # Camera
    52     'outroot|w=s'       => \$outroot,   # output file base name
    53     'dbname|d=s'        => \$dbname,    # Database name
    54     'reduction=s'       => \$reduction, # Reduction class
    55     'verbose'           => \$verbose,   # Print to stdout
    56     'no-update'         => \$no_update, # Don't update the database?
    57     'no-op'             => \$no_op,        # Don't do any operations?
     49    'exp_id=s'          => \$exp_id,    # Exposure identifier
     50    'fake_id=s'         => \$fake_id,   # Chiptool identifier
     51    'class_id=s'        => \$class_id,  # Class identifier
     52    'chiproot=s'        => \$chiproot,  # Input Chip files (root)
     53    'camroot=s'         => \$camroot,   # Input Camera files (root)
     54    'camera|c=s'        => \$camera,       # Camera
     55    'outroot|w=s'       => \$outroot,   # output file base name
     56    'dbname|d=s'        => \$dbname,    # Database name
     57    'reduction=s'       => \$reduction, # Reduction class
     58    'verbose'           => \$verbose,   # Print to stdout
     59    'no-update'         => \$no_update, # Don't update the database?
     60    'no-op'             => \$no_op,        # Don't do any operations?
    5861    'redirect-output'   => \$redirect,
    5962    ) or pod2usage( 2 );
     
    6164pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    6265pod2usage( -msg => "Required options: --exp_id --fake_id --class_id --chiproot --camroot --camera --outroot",
    63            -exitval => 3) unless
     66           -exitval => 3) unless
    6467    defined $exp_id and
    6568    defined $fake_id and
     
    104107}
    105108
    106 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     109my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    107110
    108111# outroot examples (HOST components must be set)
     
    120123my $chipPSF       = $ipprc->filename("PSPHOT.PSF.SAVE",     $chiproot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    121124my $cameraObjects = $ipprc->filename("PSASTRO.OUTPUT",      $camroot)             or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    122 my $traceDest     = $ipprc->filename("TRACE.IMFILE",        $outroot, $class_id)  or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     125my $traceDest     = $ipprc->filename("TRACE.IMFILE",        $outroot, $class_id)  or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    123126
    124127# XXX check for existence of input data
     
    128131my $command = "$ppConfigDump -camera $camera -dump-recipe PPSIM -recipe PPSIM $recipe -";
    129132my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    130         run(command => $command, verbose => $verbose);
     133        run(command => $command, verbose => $verbose);
    131134unless ($success) {
    132         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    133         &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $fake_id, $class_id, $PS_EXIT_SYS_ERROR);
     135        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     136        &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $fake_id, $class_id, $PS_EXIT_SYS_ERROR);
    134137}
    135138my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
    136         &my_die("Unable to parse metadata config doc", $exp_id, $fake_id, $class_id, $PS_EXIT_SYS_ERROR);
     139        &my_die("Unable to parse metadata config doc", $exp_id, $fake_id, $class_id, $PS_EXIT_SYS_ERROR);
    137140
    138141## allow the output images to be optional, depending on the recipe / reduction class
     
    156159
    157160    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    158         run(command => $command, verbose => $verbose);
     161        run(command => $command, verbose => $verbose);
    159162    unless ($success) {
    160         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    161         &my_die("Unable to perform ppSim: $error_code", $exp_id, $fake_id, $class_id, $error_code);
     163        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     164        &my_die("Unable to perform ppSim: $error_code", $exp_id, $fake_id, $class_id, $error_code);
    162165    }
    163166
     
    167170    # XXX use this to parse the output metadata : eg, detection limits, Nfakes, Nforced
    168171    # Get the statistics on the processed image
    169     # my $statsFile;            # File handle
     172    # my $statsFile;            # File handle
    170173    # open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $exp_id, $fake_id, $class_id, $PS_EXIT_SYS_ERROR);
    171174    # my @contents = <$statsFile>; # Contents of file
    172175    # close $statsFile;
    173     # 
     176    #
    174177    # # parse the statistics MDC file
    175     # my $mdcParser = PS::IPP::Metadata::Config->new(); # Parser for metadata config files
     178    # my $mdcParser = PS::IPP::Metadata::Config->new(); # Parser for metadata config files
    176179    # my $metadata = $mdcParser->parse(join "", @contents);
    177180    # unless ($metadata) {
    178     #   &my_die("Unable to parse metadata config doc", $exp_id, $fake_id, $class_id, $PS_EXIT_PROG_ERROR);
     181    #   &my_die("Unable to parse metadata config doc", $exp_id, $fake_id, $class_id, $PS_EXIT_PROG_ERROR);
    179182    # }
    180     # 
     183    #
    181184    # # extract the stats from the metadata
    182185    # unless ($stats->parse($metadata)) {
    183     #   &my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $fake_id, $class_id, $PS_EXIT_PROG_ERROR);
     186    #   &my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $fake_id, $class_id, $PS_EXIT_PROG_ERROR);
    184187    # }
    185188} else {
     
    194197$command .= " -path_base $outroot";
    195198$command .= " -dbname $dbname" if defined $dbname;
     199$command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    196200# XXX add this after defined
    197201# $command .= $stats->cmdflags();
     
    200204unless ($no_update) {
    201205    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    202         run(command => $command, verbose => $verbose);
     206        run(command => $command, verbose => $verbose);
    203207    unless ($success) {
    204         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    205         warn("Unable to perform faketool -addprocessedimfile: $error_code\n");
    206         exit($error_code);
     208        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     209        warn("Unable to perform faketool -addprocessedimfile: $error_code\n");
     210        exit($error_code);
    207211    }
    208212} else {
     
    220224    carp($msg);
    221225    if (defined $exp_id and defined $fake_id and defined $class_id and not $no_update) {
    222         my $command = "$faketool -addprocessedimfile";
    223         $command .= " -fake_id $fake_id";
    224         $command .= " -exp_id $exp_id";
    225         $command .= " -class_id $class_id";
    226         $command .= " -path_base $outroot";
    227         $command .= " -code $exit_code";
    228         $command .= " -dbname $dbname" if defined $dbname;
     226        my $command = "$faketool -addprocessedimfile";
     227        $command .= " -fake_id $fake_id";
     228        $command .= " -exp_id $exp_id";
     229        $command .= " -class_id $class_id";
     230        $command .= " -path_base $outroot";
     231        $command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
     232        $command .= " -code $exit_code";
     233        $command .= " -dbname $dbname" if defined $dbname;
    229234        system ($command);
    230235    }
  • trunk/ippScripts/scripts/stack_skycell.pl

    r19689 r19932  
    1010print "\n\n";
    1111print "Starting script $0 on $host\n\n";
     12
     13use DateTime;
     14my $mjd_start = DateTime->now->mjd;   # MJD of starting script
    1215
    1316use vars qw( $VERSION );
     
    264267            $command .= " -uri $outputName -path_base $outroot";
    265268            $command .= " -hostname $host" if defined $host;
     269            $command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    266270        } else {
    267271            $mode = "-updaterun -state full";
     
    294298            $command .= " -addsumskyfile";
    295299            $command .= " -hostname $host" if defined $host;
     300            $command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    296301        } else {
    297302            $command .= " -updatesumskyfile";
  • trunk/ippScripts/scripts/warp_skycell.pl

    r19561 r19932  
    99print "\n\n";
    1010print "Starting script $0 on $host\n\n";
     11
     12use DateTime;
     13my $mjd_start = DateTime->now->mjd;   # MJD of starting script
    1114
    1215use vars qw( $VERSION );
     
    252255            $command .= " -ignore"           if not $accept; # Completed succesfully, but can't produce product
    253256            $command .= " -uri $outputImage" if $accept;
     257            $command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    254258            $command .= $stats->cmdflags()   if $accept;
    255259            $command .= " -hostname $host"   if defined $host;
     
    305309        $command .= " -warp_id $warp_id";
    306310        $command .= " -skycell_id $skycell_id";
     311        $command .= (" -dtime_script " . (($mjd_start - DateTime->now->mjd) * 86400));
    307312        $command .= " -code $exit_code";
    308313        $command .= " -dbname $dbname" if defined $dbname;
Note: See TracChangeset for help on using the changeset viewer.