IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changes between Initial Version and Version 1 of EssenceTest


Ignore:
Timestamp:
Feb 24, 2009, 4:23:55 PM (17 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • EssenceTest

    v1 v1  
     1=== Summary ===
     2The ESSENCE survey from the CTIO 4m telescope in Chile provides a good dataset for testing the IPP. This page details the steps required to run the ESSENCE data through the IPP.
     3
     4----
     5Previous version that was a bit more for IPP 2.0 is available at [wiki:EssenceTest_IPP_2.0 EssenceTest_IPP_2.0]
     6----
     7Latest updates are applicable to IPP 2.4 & 2.5 (S.Rodney, 2008-04-07)
     8----
     9
     10=== Annotated ESSENCE test walkthrough ===
     11
     12==== Configuration: ====
     13 * ~/.ipprc
     14  * in this file you should be pointing to the site.config and system.config files, installed in the master config directory.
     15  * also be sure to correctly set your PATH, as well as your LOG and TRACE levels.
     16
     17 * site.config 
     18  * in the following we assume you have set up the paths to your raw data and to your base working directory in the DATAPATH metadata block  with the entries for DATA,WORK. e.g. :
     19
     20 # place your data directories here and refer to as path://PATH/remainder
     21 DATAPATH        METADATA
     22 [...]
     23        DATA   STR     /gpfs1/Panstarrs/smsn/data/v9.0/W/rawdata
     24        WORK   STR     /gpfs1/Panstarrs/data/W/
     25 END
     26
     27When making program calls on the command line, refer to the first directory as path://DATA/ and the second as path://WORK/.
     28
     29 *system.config  : 
     30  * set up the entries for DBSERVER, DBNAME, DBUSER, DBPASSWORD, E.g.,
     31
     32 DBSERVER        STR     tscdb                   # Database host name (for psDBInit)
     33 DBNAME          STR     XXX                 # Database name (for psDBInit)
     34 DBUSER           STR      ps1ipp                  # Database user name (for psDBInit)
     35 DBPASSWORD    STR     somepassword            # Database password (for psDBInit), no quotes!
     36
     37NOTE: In the following we will assume that the dbname is not set to the database of interest.  This should be the case if you have more than one database in use on your installation, e.g. if there are multiple users or if one user has several projects going at once.
     38
     39 * Check ~/.ptolemyrc (which should be copied from ippconfig/dvo.site if it doesn't already exist) for:
     40  * CONFDIR, e.g.,
     41
     42 CONFDIR                 /gpfs1/Panstarrs/code/ipp-2.2.lin64/share/ippconfig
     43
     44 * NOTE:  As of IPP 2.5, the 'ippconfig' directory contains a 'mosaic2' subdirectory with some good guesses at the configuration options in the files within.  This was formally the 'ctio_mosaic2' directory, but the name has been changed to be consistent with the internal naming conventions.
     45  * in this mosaic2 config directory, you should have a camera.config file
     46  * In that camera.config file you can set up the parameters that ipp uses to recognize and interact with files originating on the mosaic2 camera. In camera.config you must point to a format.config file, which tells the IPP what your camera's fits file format looks like. These formats must match up with what ppImage.config expects.  This should already be set in the distributed 'ippconfig/mosaic2' files.  Your camera.config file will also point to a filerules-mef.mdc file which defines how the various output files are named and what format they are written in (i.e. how they are compressed, binned, etc) 
     47
     48==== Initiating a database. ====
     49
     50Create an empty database: the dbadmin tool is a shell script that creates an SQL database and populates it with the tables needed by ippMonitor for user administration. The dbadmin script is probably not in your path, so find it in the ippMonitor source code directory and link to it or copy it somewhere.  Call dbadmin with no options for syntax help.
     51
     52 > dbadmin project [host] [password] essence
     53
     54Then initiate the new database
     55 > pxadmin -create -dbname essence
     56
     57See [wiki:Simtest#Initiating_a_database Simtest#Initiating_a_database] for alternate methods.
     58
     59==== Injecting data ====
     60
     61Now we will inject our image files into the database, producing one db entry per imfile.
     62
     63'''WORKDIRS''' :  It is worth considering how you want your directory structure to be organized at this point.  If you have a lot of data you may not want everything to be planted in the same workdir.  For example, with the ESSENCE data it is useful to create subdirectories for each year of the survey, and a further level of subdirectories for the SuperMacho and the w-project data. The inject command might then look like:
     64
     65 > ipp_serial_inject.pl --telescope BLANCO --camera MOSAIC2 --workdir path://WORK/2003/SM/ --dbname essence /data/ipp003.0/SM_W/SM_SN03/*/sm*.fits
     66 > ipp_serial_inject.pl --telescope BLANCO --camera MOSAIC2 --workdir path://WORK/2003/W/ --dbname essence /data/ipp003.0/SM_W/SM_SN03/*/w*.fits
     67 > ipp_serial_inject.pl --telescope BLANCO --camera MOSAIC2 --workdir path://WORK/2004/SM/ --dbname essence /data/ipp003.0/SM_W/SM_SN04/*/sm*.fits
     68 ...
     69
     70'''LABELS''' : The '''--label''' argument is useful for separating your data into subsets within the database. For example, with the ESSENCE data we may want to apply the same label to each year of the survey,  or perhaps to all the images of a given field  (See the ESSENCE collaboration site for more details: [http://www.ctio.noao.edu/wproject/fields/ ESSENCE fields]).   We can then use these labels to prevent that subset from being processed by using the '''-block''' option in chiptool or camtool.   
     71
     72These labels can be changed later from within the mySQL database, but it is easier to manage if you think about how to divide your data now.   For the example below I will assume that the label waa1 has been applied to all the images of the waa1 field from the w-project survey, regardless of the date of observation.    (This does not impact the process until we get to the chip and camera stage).
     73
     74
     75First test: inject a single file into the db:
     76 > ipp_serial_inject.pl --telescope BLANCO --camera MOSAIC2 --workdir path://WORK/ --dbname essence /data/ipp003.0/SM_W/SM_SN03/sm030927/dflat021.fits
     77
     78You should see the newly injected file on the ippMonitor under "New Exp."  Then do the whole set:
     79 > ipp_serial_inject.pl --telescope BLANCO --camera MOSAIC2 --workdir path://WORK/ --dbname essence /data/ipp003.0/SM_W/SM_SN03/sm030927/[dflat,w,zero]*.fits
     80
     81(You may want to erase the previously injected file from the database, or else you will get multiple copies)
     82
     83
     84==== Start pantasks ====
     85
     86See [wiki:Simtest#Start_pantasks Simtest#Start_pantasks] for details.
     87
     88 pantasks: module pantasks.pro
     89 pantasks: module.tasks
     90 pantasks: add.database [mydatabase]
     91 [ add controller hosts]
     92 
     93==== Registration ====
     94
     95Follow the steps in [wiki:Simtest#Registration Simtest#Registration]:
     96
     97  pantasks: all.off
     98  pantasks: register.on
     99  pantasks: run
     100
     101==== Detrend Construction ====
     102
     103The procedure here is essentially the same as for the [wiki:Simtest Simtest] walkthrough. You must substitute the appropriate path and database names in your calls to dettool, and we want to pay more attention to the final products.
     104
     105When you create a detrend run using the dettool commands given below, the ipp by default sets it up in the "master" mode. It is trying to make a master bias frame using the set of input bias frames you have specified (with, e.g., the "-select_exp_type zero" option).  It will go through the input bias frames and iteratively reject some of them based on criteria set out in the rejections.config file. The base version of rejections.config is kept in the recipes directory.  You may specify a camera-level rejections.config file in your ctio_mosaic2/ directory that will override the recipes/ version.
     106
     107When working with a large multi-epoch dataset such as ESSENCE, we want to construct multiple detrend images to be applied to different subsets of data.  In the examples shown here, we are building detrends appropriate for the second year of the survey, 2003.  We limit the time range from which this detrend run can draw its input exposures by setting the -select_dateobs_begin/end arguments. We dictate which science exposures will use this detrend by setting the -time_begin/end dettool arguments.
     108
     109See [wiki:EssenceDetrendLog EssenceDetrendLog] for a complete log of S.Rodney's detrend creation commands.
     110
     111==== BIAS ====
     112
     113 dettool -definebyquery -det_type BIAS -filelevel FPA -workdir path://WORK -telescope BLANCO -inst MOSAIC2 -select_exp_type zero -select_dateobs_begin 2003-09-25 -select_dateobs_end 2003-10-01 -time_begin 2003-09-25 -time_end 2003-10-01 -dbname essence
     114
     115 pantasks: register.off
     116 pantasks: detrend.on
     117 pantasks: run
     118
     119==== Bad Pixel Mask ====
     120To build a bad pixel mask, we will go through five steps.  First we need a pre-mask DARK, which is then used to build a DARKMASK.  Then we make a pre-mask FLAT, followed by a FLATMASK.  Finally, we can combine the DARKMASK and FLATMASK together.  For more details of the process, and an explanation of the mask creation logic, see [wiki:Bad_Pixel_Masks Bad Pixel Masks].
     121
     122===== DARK and DARKMASK =====
     123To find pixels that can not be reliably dark corrected, we take a set of dark images, apply a dark correction, and do some statistics on each image and on the stack of images.  Based on statistical cuts (which are set up in the recipes/rejections.config file) we flag some pixels to be masked.  The first step is to create a temporary 'master' DARK, which will be used to dark correct all the images in our input stack.  This dark can be created from the same dark images that it is about to be applied to.
     124
     125Now we can start a detRun to create our pre-mask DARK with no rejections:
     126
     127 dettool -simple -definebyquery -det_type DARK -dbname essence  -filelevel FPA -workdir path://WORK/2003/DET -telescope BLANCO -inst MOSAIC2 -select_exp_type dark -select_dateobs_begin 2003-09-25T12:00:00 -select_dateobs_end 2004-01-02T12:00:00 -time_begin 2003-09-25T12:00:00 -time_end 2004-01-02T12:00:00
     128
     129When that is finished, we can apply our new pre-mask DARK to a set of darks to get our DARKMASK:
     130
     131 dettool -simple -definebyquery -det_type DARKMASK -dbname essence  -filelevel FPA -workdir path://WORK/2003/DET -telescope BLANCO -inst MOSAIC2 -select_exp_type dark -select_dateobs_begin 2003-09-25T12:00:00 -select_dateobs_end 2004-01-02T12:00:00 -time_begin 2003-09-25T12:00:00 -time_end 2004-01-02T12:00:00
     132
     133===== FLAT and FLATMASK =====
     134Essentially the same process:
     135
     136 * make a pre-mask FLAT
     137 # Make a pre-flatmask FLAT in the VR filter using a few early images
     138 dettool -definebyquery -det_type FLAT -filelevel FPA -workdir path://WORK/2003/DET  -telescope BLANCO -inst MOSAIC2 -select_exp_type 'sky flat' -filter VR -select_filter 'VR SuperMacho c6027' -select_dateobs_begin 2003-09-25T12:00:00 -select_dateobs_end 2003-10-15T12:00:00 -time_begin 2003-09-25T12:00:00 -time_end 2003-10-15T12:00:00 -simple
     139
     140 * make a FLATMASK
     141 # 2003 : Make a FLATMASK from the first few nights of data
     142 dettool -definebyquery -det_type FLATMASK -filelevel FPA -workdir path://WORK/2003/DET  -telescope BLANCO -inst MOSAIC2 -select_exp_type 'sky flat' -filter VR -select_filter 'VR SuperMacho c6027' -select_dateobs_begin 2003-09-25T12:00:00 -select_dateobs_end 2003-10-15T12:00:00 -time_begin 2003-09-25T12:00:00 -time_end 2003-10-15T12:00:00 -simple -pretend | wc -l
     143
     144===== Combined MASK =====
     145
     146Now we use a serial perl script to 'OR' the two masks together, making a MASK that can be applied to all future detrend and science images:
     147
     148 ipp_detrend_combine.pl --det_type MASK --filelevel FPA --inst MOSAIC2 --telescope BLANCO --det_id1 43 --iteration1 0 --det_id2 56 --iteration2 0 --workdir file://data/ipp003.0/rodney/sresswork/2003/ --operation '|' --mask
     149 
     150
     151==== FLATs ====
     152
     153 dettool -definebyquery -det_type FLAT -filelevel FPA -workdir path://WORK/ -inst CTIO_MOSAIC2 -telescope BLANCO -filter "R Harris c6004" -select_exp_type "dome flat" -select_filter "R Harris c6004"
     154
     155 dettool -definebyquery -det_type FLAT -filelevel FPA -workdir path://WORK/ -inst CTIO_MOSAIC2 -telescope BLANCO -filter "I c6028" -select_exp_type "dome flat" -select_filter "I c6028"
     156
     157'''NOTE ON FILTERS:''' The -select_filter argument specifies which files will be accepted into the input list.  It must match the filter name exactly, and it is case specific.  If you want to combine input images that have been registered with slightly different filter names (e.g. "VR SuperMacho c6027"  and "VR supermacho c6027") then you will have to use a different dettool mode.  Try dettool -definebytag to provide an explicit list of exposure ids.
     158The -filter argument tells dettool what to list as the filter name for the output FLAT image.  This should generally be a more general bandpass name (like 'VR' or 'i') and it should be listed in your camera.config file under the FILTER.ID metadata section.  A 'VR' flat will only be applied to science images that have filter names which translate back to 'VR' in the FILTER.ID metadata table.
     159We expect the filter concept to be expanded and clarified somewhat in future releases.
     160
     161
     162==== Detrend Analysis ====
     163
     164After creating a first master bias, you will want to examine the residuals from the component bias images used as input. In ippMonitor, go to Detrend Steps - Detrend Frames and click on the 'resid' link next to the bias you've just created. This will show you the residuals from the component images. Check out the jpeg images and the reported stats: background, stdev of components, stdev of image, stdev of binned image, S/N, etc.   
     165
     166You might want to make some plots of the statistics shown in this - or some other - ippMonitor table. For this we use the '''dvo''' program. '''dvo''' is a mongo-like plotting program that can also access SQL databases to ingest data. Within '''dvo''', you connect to a database with 'dbconnect', and you can issue sql commands with 'dbselect {sql command}'.  (Useful SQL queries can be grabbed from the bottom of the ippMonitor pages.) The results of the sql command are returned as '''dvo''' vectors (but all values are floats, so you can't retrieve string-valued data cells). Use 'help {cmd}' to get some command help.  In particular, try 'help style' for plotting style parameters. Here is an example of how to plot the raw detrend image backgrounds against their exposure times:
     167
     168 > dvo
     169 dvo: dbconnect (hostname) (username) (database)
     170 dvo: dbselect exp_time,bg FROM rawExp WHERE rawExp.exp_type != 'OBJECT'
     171 dvo: vectors
     172    N       name      size
     173    0   exp_time         60
     174    1         bg         60
     175 dvo: limits bg exp_time
     176 dvo: box
     177 dvo: plot bg exp_time -x 2 -pt 7 -sz 2
     178
     179If you pick out some bad images that are degrading your master bias, you will want to make a new detrun that excludes those bad eggs. There are a ton of dettool modes and options available to pick out your desired subset of images.  Call dettool with no options to get a list of major modes. You can only run dettool with one of these major modes at a time.  Use "dettool -(major_mode)" to get a list of the options for the mode you are interested in. Some are required, others optional.  Here is an example that makes a master bias by calling out a couple of input frames explicitly using their exposure tags:
     180
     181 dettool -definebytag -det_type BIAS -workdir path://WORK/ -exptag zero001.53 -exptag zero010.62 -exptag zero018.70
     182
     183(I grabbed the exposure tags from the ippMonitor tables)
     184
     185==== Chip and camera processing ====
     186
     187The next step is to apply the detrending to the science images. The available detrend steps are:
     188 * overscan subtraction
     189 * bias subtraction
     190 * dark subtraction
     191 * flat field normalization
     192 * mask bad pixels
     193 * fringe subtraction
     194 * source identification and photometry
     195 * astrometry on each chip
     196 * astrometry for a mosaic of multiple chips
     197 * save detrended image(s)
     198
     199All of these steps can be turned on or off by editing this camera's version of ppImage.config, which should contain switches for the various steps used in the creation of detrend images as well as in the creation of detrended science images. Remember to point to the modified version of ppImage.config in your .ipprc and camera.config files!
     200From within pantasks, starting the chip and camera level processing is simple:
     201 
     202 pantasks: chip.on
     203 pantasks: camera.on
     204 pantasks: detrend.off
     205 pantasks: run
     206
     207==== WARP ====
     208
     209The next stage is to warp the detrended images onto a common tangent plane projection of the sky.  The first step is to define the SKYCELLS onto which our images will be warped.  This is done with the skycells program, which will create two fits tables that hold all the skycell info : Images.dat and Photcodes.dat.
     210
     211<pre>
     212 USAGE:
     213 skycells (level) [-scale arcsec/pix] [-nx (Nx cells)] [-ny (Ny cells)]
     214
     215  -v                              : verbose mode
     216  -triangles                  : save base triangles instead of skycells
     217  -fix-ns                     : orient skycells with y-axis aligned with Dec
     218  -scale                      : set pixel scale (default 1.0 arcsec / pixel)
     219  -padding                    : pad skycells by this fraction in each dimension
     220  -nmax                           : only keep nmax skycells in memory
     221  -nx                             : subdivide skycell projection in x
     222  -ny                             : subdivide skycell projection in y
     223  -help                           : this list
     224  -h                              : this list
     225</pre>
     226
     227The required 'level' argument defines (something important)...
     228
     229Use the "-D CATDIR <dir>"  option to specify the directory where Images.dat and Photcodes.dat should be written.  The default is to make a subdirectoy called "default" in your cwd.
     230
     231After you've created the Images.dat and Photcodes.dat catalogs, be sure to point to them in your camera.config file:
     232
     233 TESSELLATIONS   METADATA
     234       # Tessellation name with corresponding DVO catdir
     235       Skycells        STR     file://path/to/catidir
     236 END
     237
     238
     239=== Required commands ===
     240
     241 skycells -D CATDIR skycells 8 -scale 0.2
     242 
     243 ipp_serial_inject.pl --telescope BLANCO --camera MOSAIC2 --workdir path://PAP/WORK/DETREND --dbname pap DETREND/*.fits
     244 ipp_serial_inject.pl --telescope BLANCO --camera MOSAIC2 --workdir path://PAP/WORK/R --dbname pap R/*.fits --label R --tess_id SKYCELLS
     245 ipp_serial_inject.pl --telescope BLANCO --camera MOSAIC2 --workdir path://PAP/WORK/I --dbname pap I/*.fits --label I --tess_id SKYCELLS
     246 
     247 dettool -dbname pap -definebyquery -det_type DARK -filelevel FPA -telescope BLANCO -inst MOSAIC2 -workdir path://PAP/WORK/DETREND/ -select_exp_type 'dark'
     248 dettool -dbname pap -definebyquery -det_type FLAT -filelevel FPA -telescope BLANCO -inst MOSAIC2 -workdir path://PAP/WORK/DETREND/ -select_exp_type 'dome flat' -select_filter 'R Harris c6004' -filter 'R'
     249 dettool -dbname pap -definebyquery -det_type FLAT -filelevel FPA -telescope BLANCO -inst MOSAIC2 -workdir path://PAP/WORK/DETREND/ -select_exp_type 'dome flat' -select_filter 'I c6028' -filter 'I'
     250 
     251 dettool -dbname pap -definebyquery -det_type FLATMASK -filelevel FPA -telescope BLANCO -inst MOSAIC2 -workdir path://PAP/WORK/DETREND/ -select_exp_type 'dome flat' -select_filter 'R Harris c6004' -filter R
     252 dettool -dbname pap -definebyquery -det_type FLATMASK -filelevel FPA -telescope BLANCO -inst MOSAIC2 -workdir path://PAP/WORK/DETREND/ -select_exp_type 'dome flat' -select_filter 'I c6028' -filter I
     253 dettool -register_detrend -parent 5 -det_type MASK -filelevel FPA -filter R -inst MOSAIC2
     254 dettool -register_detrend_imfile -det_id 7 -uri path://PAP/WORK/DETREND//MOSAIC2.FLATMASK.5/MOSAIC2.FLATMASK.norm.5.0.fits -class_id fpa
     255 
     256 dettool -register_detrend -parent 6 -det_type MASK -filelevel FPA -filter I -inst MOSAIC2
     257 dettool -register_detrend_imfile -det_id 8 -uri path://PAP/WORK/DETREND//MOSAIC2.FLATMASK.6/MOSAIC2.FLATMASK.norm.6.0.fits -class_id fpa
     258 
     259 stacktool -dbname pap -queue -select_telescope BLANCO -select_inst MOSAIC2 -select_filter 'R Harris c6004' -workdir path://PAP/WORK/ -select_good_frac_min 0.2
     260 stacktool -dbname pap -queue -select_telescope BLANCO -select_inst MOSAIC2 -select_filter 'I c6028' -workdir path://PAP/WORK/ -select_good_frac_min 0.2