IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33522 for trunk


Ignore:
Timestamp:
Mar 14, 2012, 9:23:58 AM (14 years ago)
Author:
bills
Message:

Add pod documentation. Add --data_group option to use to select
stacks instead of label. If data_group or label begins with MD
and tess_id isn't provided guess MDxx.V3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/dlapstacks

    r33521 r33522  
    2424use IPC::Cmd 0.36 qw( can_run run );
    2525
    26 
    2726my $ipprc = PS::IPP::Config->new();
    2827my $dbh = getDBHandle();
    2928
    3029my ($requested_filter, $no_display, $skycell_id, $verbose, $ra, $dec, $convolved);
    31 my ($singleframe, $fitToFrame, $deasin, $save_temps);
     30my ($singleframe, $fitToFrame, $deasin, $save_temps, $data_group);
    3231
    3332my $temproot = '/local/ipp/tmp';
    3433my $outdir;
    3534
    36 
    3735GetOptions(
    3836    'filter|f=s'    => \$requested_filter,  # restrict to a single filter
    39     'skycell_id|s=s'=> \$skycell_id,        # don't bother with
     37    'skycell_id|s=s'=> \$skycell_id,        # specificly sset skycell_id of interest
    4038    'convolved|c'   => \$convolved,         # display convolved stack images instead of unconvolved
    41     'fit'           => \$fitToFrame,
    42     'deasin|d'      => \$deasin,
     39    'fit'           => \$fitToFrame,        # scale the images to fit the ds9 frame
     40    'single'        => \$singleframe,       # set ds9 to singleframe mode
     41    'deasin|d'      => \$deasin,            # run ppstamp to remove the ASIN scaling from the stacks
    4342    'label|l=s'     => \$label,             # use a different label (careful!)
    44     'tess_id|t=s'   => \$tess_id,           #
    45     'outdir|o=s'    => \$outdir,
    46     'no-display|n'  => \$no_display,        # don't run ds9 just print the filenames
    47     'single'        => \$singleframe,
    48     'save-temps'    => \$save_temps,
    49     'verbose|v'     => \$verbose,
     43    'data_group=s'  => \$data_group,        # select stacks by data_group
     44    'tess_id|t=s'   => \$tess_id,           # set tess_id
     45    'outdir|o=s'    => \$outdir,            # if deasin save de-asined images to given directory
     46    'no-display|n'  => \$no_display,        # don't run ds9 just print the nebulous pathnames
     47    'save-temps'    => \$save_temps,        # save temporary files
     48    'verbose|v'     => \$verbose,           # print lots of information
    5049) or pod2usage( 2 );
    5150
     
    5857pod2usage( -msg => 'if ra is suplied <dec> must be supplied as well', -exitval => 2)
    5958    if (defined $ra and ! defined $dec);
     59
     60if ($skycell_id and !($skycell_id =~ /^skycell/)) {
     61    if (length($skycell_id) < 3) {
     62        # two character skycell_id NM should probably be 0NM
     63        $skycell_id = "0$skycell_id";
     64    }
     65    $skycell_id = "skycell.$skycell_id";
     66}
    6067
    6168my $missing_tools;
     
    7885# don't allow MD label unless it's a refstack.
    7986# Nightly stacks have too many images
    80 if (($label =~ /MD/) and !(uc($label) =~ /REF/)) {
    81     die "cannot use this program for label $label because we will probably too many matches. Talk to Bill\n";
     87if (($data_group && ($data_group =~ /MD/)) or ($label =~ /^MD/)) {
     88    unless ($data_group or uc($label) =~ /REF/) {
     89        die "cannot use this program for label $label without data_group because that will most likely select nightly stacks and we will match an unreasonably large number of matches. Talk to Bill\n";
     90    }
     91    # if tess_id hasn't been set to an MD field, guess that it's a V3 stack
     92    unless ($tess_id =~ /MD/) {
     93        my $tag = $data_group ? $data_group : $label;
     94        my $field = substr $tag, 0, 4;
     95        $tess_id = "$field.V3";
     96        print "Setting tess_id to $tess_id\n";
     97    }
    8298}
    8399
     
    100116my $query = "SELECT skycell_id, filter, stack_id, quality, state, path_base
    101117    FROM stackRun join stackSumSkyfile USING(stack_id)
    102     WHERE stackRun.state ='full' AND label = '$label' AND skycell_id = ?";
     118    WHERE stackRun.state ='full' AND skycell_id = ?";
     119if ($data_group) {
     120    $query .= " AND data_group = '$data_group'";
     121} else {
     122    $query .= " AND label = '$label'";
     123}
    103124
    104125if ($requested_filter) {
     
    281302}
    282303
     304__END__
     305
     306=pod
     307=head1 NAME
     308dlapstacks - display stack images from the PS1 first Grand Reprocessing (LAP)
     309
     310=head1 SYNOPSIS
     311   
     312    dlapstacks <ra> <decl> [options]
     313    dlapstacks --skycell_id <skycell_id> [<ra> <decl>] [options]
     314
     315
     316=head1 DESCRIPTION
     317
     318Query the gpc1 database to find stacks containing a given RA and DEC or for a specific skycell_id.
     319Display the images using ds9. If coordinates are supplied the display is centered there.
     320
     321=head1 OPTIONS
     322
     323=over 4
     324
     325=item * -s, --skycell_id <skycell_id>
     326
     327The skycell_id to display. Note if skycell_id does not begin with "skycell", "skycell" is prepended to the supplied value before querying the database.
     328
     329
     330=item * <ra>   
     331
     332Right Ascension. Format: decimal degrees or HH:MM:SS
     333Required unless skycell_id is supplied
     334
     335
     336=item * <decl>
     337
     338Declination. Format: decimal degrees or DD:MM:SS
     339Required unless skycell_id is supplied
     340
     341=item * -f, --filter <filter>
     342
     343Only display images for the given filter. The SQL wild card character '%' is appended to single character values.
     344
     345=item * -c, --convolved
     346
     347Display convolved stacks. Default is to display unconvolved stack images.
     348
     349=item * --fit
     350
     351Instruct ds9 to fit the image to the frame.
     352
     353=item * --single
     354
     355Set ds9 to single frame mode
     356
     357=item * -d, --deasin
     358
     359Display images tha have had the ASIN scaling removed.
     360
     361=item *-o, --outdir <outdir>
     362
     363If --deasin is selected the unscaled images are preserved in the provided directory.
     364The directory created if it does not exist.
     365
     366=item * -l, --label <label>
     367
     368Chose stacks with the provided label. The default is LAP.ThreePi.20110809.
     369NOTE: If the label begins with MD and --data_group is not provided the label must contain "ref" or "REF". This prevents
     370users from selecting the hundreds of nightly stack images.
     371
     372=item * --data_group <data_group>
     373
     374Select stacks with the provided data_group. By default stacks are selected by label.
     375
     376
     377=item * -t, --tess_id <tess_id>
     378
     379Set the tessellation that skycells are selected from. Default RINGS.V3. Note if data_group or label begins with MDnn tess_id is set to MDnn.V3 by
     380default.
     381
     382=item * -n, --no-display
     383
     384Look up the stack images using the provided parameters but rather than displaying them with ds9 print out some information about the stacks.
     385
     386=item * --save-temps
     387
     388For debugging deasin mode do not delete temporary images. Ignored if --deasin is not supplied or if --outdir is supplied.
     389
     390=item * -v, --verbose
     391
     392Print information about the progress of the program.
     393
     394=cut
Note: See TracChangeset for help on using the changeset viewer.