IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11575


Ignore:
Timestamp:
Feb 1, 2007, 7:25:46 PM (19 years ago)
Author:
eugene
Message:

adding psastro and addstar

File:
1 edited

Legend:

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

    r11492 r11575  
    132132
    133133# Generate the file list, and get the statistics
    134 my $outputRoot = $exp_tag . '.p3'; # Root output name
    135 $outputRoot = File::Spec->catfile( $workdir, $outputRoot );
     134my $outputFile =  "$exp_tag.p3";
     135my $outputRoot = File::Spec->catfile( $workdir, $exp_tag, $outputFile );
     136
    136137my $list1Name = $outputRoot . '.b1.list'; # Name for the input file list for binning 1
    137138my $list2Name = $outputRoot . '.b2.list'; # Name for the input file list for binning 2
     139my $list3Name = $outputRoot . '.b3.list'; # Name for the input file list for chip astrometry
     140
    138141my @means;                      # Array of means
    139142my @stdevs;                     # Array of stdevs
    140143open my $list1File, '>' . $list1Name;
    141144open my $list2File, '>' . $list2Name;
     145open my $list3File, '>' . $list3Name;
     146
     147my $chipObjects;
    142148foreach my $file (@$files) {
    143149    # use the b1_uri as OUTPUT root and convert the filenames
     
    145151    my $class_id = $file->{class_id};
    146152    my $origRoot = $ipprc->convert_filename_absolute( $file->{b1_uri} ); # Original root name
     153
     154    # if there is only one chip, we use this name for the input to addstar
     155    $chipObjects = $ipprc->filename("PSASTRO.OUTPUT", $origRoot, $class_id);
    147156    print $list1File $ipprc->filename("PPIMAGE.BIN1", $origRoot, $class_id);
    148157    print $list2File $ipprc->filename("PPIMAGE.BIN2", $origRoot, $class_id);
    149     print $list1File $ipprc->filename("PSPHOT.OUTPUT", $origRoot, $class_id);
    150     print $list1File $ipprc->filename("PSASTRO.OUTPUT", $origRoot, $class_id);
    151     # XXX PSASTRO.OUTPUT is explicitly a CHIP output file
    152     # XXX below the PSASTRO.OUTPUT must be an FPA output file
    153     # print $list1File ($ipprc->convert_filename_absolute($file->{b1_uri}) . "\n");
    154     # print $list2File ($ipprc->convert_filename_absolute($file->{b2_uri}) . "\n");
     158    print $list3File $chipObjects;
    155159    push @means, $file->{bg};
    156160    push @stdevs, $file->{bg_stdev};
     
    158162close $list1File;
    159163close $list2File;
     164close $list3File;
    160165
    161166# Output products --- need to synch with the camera configuration!
    162167my $jpeg1 = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1
    163168my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
    164 my $objects = $ipprc->filename("PSASTRO.OUTPUT", $outputRoot); # MEF psastro output
    165 
    166 # if file == CHIP
    167 #    run psastro +mosastro on PSASTRO.OUTPUT.CHIP
    168 #    run addstar on PSASTRO.OUTPUT.FPA
    169 
    170 # if file == FPA
    171 #    run addstar on PSASTRO.OUTPUT.CHIP
     169my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT", $outputRoot); # MEF psastro output
     170
     171# run psastro +mosastro on the set of chips
     172# XXX note that this is wrong if imfiles are cells
     173if (@$files > 1) {
     174    my $command = "$psastro -list $list3Name $outputRoot +mosastro -chipastro";
     175    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     176        run(command => $command, verbose => 1);
     177    unless ($success) {
     178        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     179        &my_die("Unable to perform psastro: $error_code", $exp_tag, $error_code);
     180    }
     181    &my_die("Unable to find expected output file: $fpaObjects", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $fpaObjects;
     182} else {
     183    $fpaObjects = $chipObjects;
     184}
     185
     186# run addstar on either the single chip output or the single fpa output
     187# XXX this construct requires the user to have a valid .ptolemyrc
     188# XXX which in turn points at ippconfig/dvo.site
     189{
     190    my $command = "addstar -D CAMERA $camera $fpaObjects";
     191    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     192        run(command => $command, verbose => 1);
     193    unless ($success) {
     194        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     195        &my_die("Unable to perform addstar: $error_code", $exp_tag, $error_code);
     196    }
     197}
    172198
    173199# Make the jpeg for binning 1
Note: See TracChangeset for help on using the changeset viewer.