IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20434


Ignore:
Timestamp:
Oct 28, 2008, 9:25:52 AM (18 years ago)
Author:
Paul Price
Message:

Add option to create input list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/stack_inputs.pl

    r20432 r20434  
    1212
    1313# Extensions of the path_base to grab
    14 use constant EXTENSIONS => [ '.fits', # Image
    15                              '.mask.fits', # Mask
    16                              '.wt.fits', # Weight
    17                              '.cmf', # Sources
    18                              '.psf', # PSF
    19                              ];
     14use constant EXTENSIONS => { 'IMAGE' => '.fits', # Image
     15                             'MASK' => '.mask.fits', # Mask
     16                             'WEIGHT' => '.wt.fits', # Weight
     17                             'SOURCES' => '.cmf', # Sources
     18                             'PSF' => '.psf', # PSF
     19                         };
    2020
    2121use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    2323my ($db_host, $db_name, $db_user, $db_pw); # Database details
    2424my ($stack_id);                 # Stack of interest
     25my ($input);                    # Input list
    2526
    2627GetOptions(
     
    3031           'dbpass=s' => \$db_pw, # Database p/w
    3132           'stack_id=s' => \$stack_id, # Stack identifier
     33           'input=s'  => \$input, # Input list to generate
    3234           ) or die "Unable to parse arguments.\n";
    3335die "Unknown option: @ARGV\n" if @ARGV;
     
    5961$db->disconnect;
    6062
     63my $list;                       # List of inputs
     64if (defined $input) {
     65    open $list, "> $input";
     66    print $list "INPUT MULTI\n\n";
     67}
     68
    6169foreach my $warp_path ( @$warps ) {
    62     foreach my $ext ( @{EXTENSIONS()} ) {
     70    print $list "INPUT METADATA\n" if defined $input;
     71    foreach my $type ( keys @{EXTENSIONS()} ) {
     72        my $ext = ${EXTENSIONS()}{$type}; # Extension
    6373        my $neb = "$warp_path$ext"; # Nebulous file
    6474        my $source = `neb-locate --path $neb` or die "Unable to locate $neb\n"; # Actual file
     
    6676        my ($target) = $source =~ m|^.*:(.*)|; # Target name
    6777        !system "cp $source $target" or die "Unable to copy $source\n";
     78        print $list "\t$type\tSTR\t$target\n" if defined $input;
    6879    }
     80    print $list "END\n\n" if defined $input;
    6981}
     82
Note: See TracChangeset for help on using the changeset viewer.