IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 29, 2004, 10:18:55 AM (22 years ago)
Author:
eugene
Message:

new versions of phase2 scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/scripts/phase2.pl

    r2519 r2520  
    22
    33sub usage {
    4     print STDERR "USAGE: phase2.pl\n";
     4    # input is foo.fits
     5    # outputs are outroot.im.fits (image) outroot.ob.fits (object list), outroot.log, etc
     6    print STDERR "USAGE: phase2 (input) (outroot)\n";
    57    exit 2;
    68}
     
    810if (@ARGV != 4) { &usage; }
    911
    10 # phase2.pl has extensive intelligence about data sources
     12# base file needs to be hardwired, from environment, or based on program name
     13$base   = psMetadataParseConfig (NULL, basefile, FALSE); 
    1114
    12 # input: filename.fits
    13 # output: flattened image: filename.f.fits? filename.flt? (chosen externally?)
    14 # output: extracted stars: filename.p.tbl
    15 # output: constructed kernel: filename.k.fits
     15# probably defined in the base file?
     16$site   = psMetadataParseConfig (NULL, sitefile, FALSE); 
    1617
    17 # determine camera from image or externally?
     18# this should be optionally specified as part of the command-line options
     19# alternatively, this should be derived from the input file header data
     20$camera = psMetadataParseConfig (NULL, camerafile, FALSE);
    1821
    19 # load configuration information:
     22# we need a way to define an optional alternative recipe
     23$recipe = psMetadataParseConfig (NULL, recipefile, FALSE);  # defined in the camera file
    2024
    21 $config = psMetadataReadFile (NULL, $configfile);
     25# load only the headers from the given file input a list of headers
     26@headers = psFITSReadHeaderSet ($input);
    2227
    23 # check image:
    24 # is it a FITS image?
    25 # find camera
    26 # find mode:
    27 #  one cell per extension
    28 #  one chip per extension
    29 #  one FPA per extension
     28# check the validity of the given set of headers based on expectactions for this camera
     29# ** where does camera come from?
     30# ** how do we do this if the camera is derived from the header info?
     31$status = pmCameraValidateHeaders ($headers, $camera);
    3032
    31 @chips = getChips ($input);
    32 foreach $chip () {
    33     @cells = getCells ($input, $chip);
    34 }
     33# this gets a bit tenuous: what do we do with the collection? 
    3534
     35# construct a complete, empty (ie, no pixel data) FPA structure for this camera / header set
     36# we need to construct the output container.  is it big enough to fit in memory?  assume so?
     37$FPA = pmFPAfromHeader ($headers, $camera);
    3638
     39### now we work on individual readouts:
    3740
    38 # construct kernel
     41# we have the FPA, already validated
     42# as part of the FPA, we have access to a specified READOUT and we know the corresponding EXTNAME
    3943
    40 # load bias
    41 # load dark
    42 # apply bias and dark
     44# load in the complete readout:
     45$image    = psImageReadSection (NULL, 0, 0, 0, 0, 0, $extname, $Nreadout, $input);
    4346
    44 # all possible detrend operations
    45 #   - bias
    46 #   - dark
    47 #   - trim
    48 #   - mask bad pixels (astrometry independent)
    49 #   - mask artifacts (astrometry dependent)
    50 #   - flatten
    51 #   - fringe correct
     47# load in the complete corresponding bias image (this should be done once per cell)
     48# in this form, we are implying that the bias image is guaranteed to have the corresponding EXTNAME
     49$bias     = psImageReadSection (NULL, 0, 0, 0, 0, 0, $extname, 0, $biasname);
    5250
    53 # convolution kernel is applied to:
    54 #   - flat
    55 #   - fringe
    56 #   - bias?
     51# overscan options:
     52# - overscan is defined by the recipe (BIAS.OVERSCAN has form [Xs,Xe:Ys:Ye])
     53# - overscan is defined by the header (BIAS.OVERSCAN has value BIASSEC)
     54# - overscan is not used (BIAS.OVERSCAN has value NONE)
    5755
    58 #
    59 
    60 
    61 $out = pmSubtractBias ($in, $fit);
    62 
    63 
    64 ##### example: single chip, single cell, single readout:
    65 
    66 # input filename: $input
    67 
    68 # bias recipe:
    69 #   bias image: filename
    70 #   overscan: header BIASSE
    71 
    72 # bias subtraction options:
    73 # - use a bias image?
    74 # -
    75 
    76 
    77 
    78 $image    = psImageReadSection (NULL, 0, 0, 0, 0, 0, $extname, -1, $input);
    79 $metadata = psMetadataReadHeader (NULL, $extname, -1, $input);
    80 
    81 $metaitem = psMetadataLookup ($metadata, "BIASSEC");
     56# bias section from header:
     57$ = psMetadataLookup ($readout->metadata, "BIASSEC");
    8258$overscan = psImageSubsection ($image, $metaitem->data.void);
    8359
     
    8864$image_b = pmSubtractBias ($image, NULL, $overlist, PM_OVERSCAN_COLUMNS, $stats, 0, PM_FIT_NONE, $bias);
    8965
    90 
    91 
    92 #######################
    93 
Note: See TracChangeset for help on using the changeset viewer.