Changeset 2520 for trunk/archive/scripts/phase2.pl
- Timestamp:
- Nov 29, 2004, 10:18:55 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/scripts/phase2.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/phase2.pl
r2519 r2520 2 2 3 3 sub 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"; 5 7 exit 2; 6 8 } … … 8 10 if (@ARGV != 4) { &usage; } 9 11 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); 11 14 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); 16 17 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); 18 21 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 20 24 21 $config = psMetadataReadFile (NULL, $configfile); 25 # load only the headers from the given file input a list of headers 26 @headers = psFITSReadHeaderSet ($input); 22 27 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); 30 32 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? 35 34 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); 36 38 39 ### now we work on individual readouts: 37 40 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 39 43 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); 43 46 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); 52 50 53 # convolution kernel is applied to:54 # - flat55 # - fringe56 # - 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) 57 55 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"); 82 58 $overscan = psImageSubsection ($image, $metaitem->data.void); 83 59 … … 88 64 $image_b = pmSubtractBias ($image, NULL, $overlist, PM_OVERSCAN_COLUMNS, $stats, 0, PM_FIT_NONE, $bias); 89 65 90 91 92 #######################93
Note:
See TracChangeset
for help on using the changeset viewer.
