IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changes between Initial Version and Version 1 of DVO_Challenge


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

--

Legend:

Unmodified
Added
Removed
Modified
  • DVO_Challenge

    v1 v1  
     1This page contains scripts made by Mike Liu, which aren't really a cookbook but show examples for many dvo commands. [http://ps1sc.ifa.hawaii.edu/PS1wiki/images/Liu_dvo_practice.pdf Mike Liu's three dvo challenge slides from the 2008 Heidelberg meeting] also contain useful examples.
     2
     3If you have questions, the most sensible forum is the [http://pan-starrs.ifa.hawaii.edu/mailman/listinfo/ps-ipp-users ps-ipp-users@ifa.hawaii.edu mailing list (subscription page)], and the [http://pan-starrs.ifa.hawaii.edu/mailman/private/ps-ipp-users/threads.html ps-ipp-users@ifa.hawaii.edu list archive (accessible to subscribers)] for looking for previous answers. You need a username/pw to be able to see the web page, the usual combination for the science consortium pages works; and then you need your email address and mail list password to be able to see the archive.
     4
     5__TOC__
     6
     7== FAQ / Suggestions for Changes ==
     8
     9Please post both new questions about dvo, as well as answers to old ones if you have them!
     10
     11=== Questions === 
     12 * what is the comment character for DVO?
     13 * errors in 2MASS phot?
     14 * line continuation character (for extra long lines)
     15 * is it possible to extract the detection limit for a given ra,dec or image,x,y?
     16
     17=== Change requests/suggestions ===
     18
     19 * command to clear all variables from memory
     20 * change command name from 'vstat' to 'vstats' (or create an alias)
     21 * 'czplot' should be able to work without specifying a min or max value
     22 * need columnar printing tool for printing vectors
     23 * major nuisance: how to know which variables are available for current catalog? Need "help catdir" or something like that
     24 * when writing to file with 'write', should generate column headings (or able to add comments)
     25 * consistency needed between input files and typing on command line, e.g. "#" and "!" usage
     26
     27== Examples ==
     28
     29These examples assume that you have a local IPP installation.
     30
     31=== DVO tutorial ===
     32
     33 ============================================================
     34 DVO tutorial with Gene Magnier
     35 03/10/08
     36 ============================================================
     37 
     38 
     39 http://kiawe.ifa.hawaii.edu/Elixir/Ohana/DVO/
     40 
     41 **ra values are in DEGREES**
     42 
     43 
     44 ssh host_with_dvo_installed
     45 
     46 Make sure you source the psconfig script that's appropriate for your shell,
     47 and set up your environment for using ipp, e.g.:
     48   psconfig ipp-2.5
     49 
     50 
     51 Mucking around with dvo
     52 
     53   > script dvo.logfile      make recording of session
     54   > dvo
     55 
     56   # Set up variables with catdir names
     57   $catdir_2mass =  /local/path/to/catdir.2mass                  2MASS catalog
     58   $catdir_merge =  /local/path/to/catdir.2mass/catdir.merge     2MASS+USNOB catalog
     59 
     60 
     61   $a = 0      set scalar
     62   echo $a     
     63   $a = 5*6    do math
     64 
     65   echo {5*6}           things in {} mean math operation
     66   
     67   create x 0 100 0.1   make an array full of values
     68   echo x[]
     69   echo x[0]
     70   echo x[999]
     71 
     72   set y = x^2          do an array operation
     73   set b = $a^2         need to handle scalars with "$", but not arrays 
     74     
     75   create x 0 100 0.1
     76   set x = y
     77   limits x y           set limits for plotting box
     78   box
     79   set y = x^2
     80   plot x y
     81   png -name plot.png
     82   ps -name plot.ps
     83 
     84   mcreate foo 100 100    make array of 100x100 ("m" = matrix)
     85   set xr = xramp(foo)    'xramp' is a function, makes 2d image as a slope in x-axis
     86   set yr = xramp(foo)    'xramp' is a function, makes 2d image as a slope in y-axis
     87   set zr = xr^2 + yr^2   
     88   stats xr               give image statistics
     89 
     90   tv xr 0 100            display the results with a range (must give a range)
     91   clear -image
     92   clear -graph
     93 
     94   buffers               list all arrays
     95   vectors               list all images
     96   ??                    list all scalars
     97 
     98 
     99 Messing around with databases
     100 
     101    catdir $catdir_2mass     2MASS catalog
     102    catdir $catdir_merge     2MASS+USNOB catalog
     103 
     104    region 0 0 0.5       set center of region to (RA,Dec)=(0,0) with 0.5 deg half-box size
     105    region 0 0 0.5 sin   sine projection
     106    region 0 0 0.5 tan   tan projection
     107    region 0 0 90 ait ; cgrid     Aitoff projection of the whole sky & show celestial grid
     108 
     109    region 0 0 0.5 tan   tan projection
     110    pmeasure -all -m 10 15 -pt 7 -c blue    plot all mag=[10,15] detections (J, H, and K)
     111                                            using blue point symbol
     112 
     113    pmeasure -all -m 10 15 -pt 7 -c blue -photcode 2MASS_J   plot only J-band (bigger symbol = brighter)
     114    pmeasure -all -m 10 15 -pt 7 -c red -photcode 2MASS_K
     115 
     116    mextract -region ra, dec, photcode, mag     extract info from define plotting region
     117    region                                      show current value of region
     118    vectors                                     show results
     119    cplot ra dec        plot results on celestial sky
     120 
     121    pcat -c red         overlay box sizes for sub-regions
     122 
     123    skyregion 0 1 0 1   set search region (alternative to using 'region' command)
     124    mextract RA, DEC, MAG   now don't have to use "-region" flag
     125                            use capitals to define different input arrays
     126                            (but catalog fields are case-insensitive)
     127 
     128    czplot ra dec mag 10 15    plot {ra,dec} results with mag value encoded in symbol size
     129                               must be given the min & max value
     130 
     131    mextract -region RA, DEC, MAG where (MAG < 12.0)      restricted extraction
     132    mextract -region RA, DEC, MAG where (MAG < 12.0) && (MAG > 2.0) && (RA < 0.25)
     133    cplot RA DEC -c red
     134 
     135    delete ra dec photcode mag RA DEC MAG
     136    avextract -region ra dec 2MASS_J 2MASS_K   
     137    avextract -region ra dec 2MASS_J 2MASS_K 2MASS_J:err
     138    vectors           (note that resulting array names can't start with a number, so "v_" appended)
     139    clear
     140    czplot ra dec v_2MASS_J 15 10 -c blue -pt 7
     141    pmeasure -all -m 10 15 -pt 7 -c red -photcode 2MASS_J
     142 
     143    avextract ra, dec, 2MASS_J, glon, glat where (abs(glat) > 10)     extract based on galactic latitude
     144 
     145    limits -n 1 -0.5 3.5 17.0 8.0; clear; box
     146    plot {v_2MASS_J - v_2MASS_K} v_2MASS_K
     147         NOTE: now that window 1 is active, this will be the default range for "-region"
     148    dev -n 0       change back to device 0
     149    avextract -region ra, dec, 2MASS_J, 2MASS_K where (2MASS_J-2MASS_K > 0) && (2MASS_J-2MASS_K < 0.5)
     150    plot -n 1 -c red {v_2MASS_J - v_2MASS_K} v_2MASS_K
     151 
     152    cursor     poke plotting window, click on mouse to return coordinates
     153               "q" to quit
     154 
     155    write -f "%10.6f %10.6f %7.3f" test.dat ra dec      dump to file
     156    !more test.dat         "!" is shell escape
     157    exec more test.dat     also shell escape
     158 
     159    list data -x "head test.dat"                        input files
     160 
     161    subset r = ra if (dec < 0.2)
     162    subset d = dec if (dec < 0.2)
     163    subset m = mag if (dec < 0.2)
     164   
     165    set bool = (dec < 0.2)       create boolean variable for selection
     166    setset r = ra if bool
     167 
     168    macro foo                    create a macro
     169      echo $1
     170      for i 0 10
     171      echo $i
     172      end
     173      end
     174    foo 5
     175    foo sdf sdfsd sdfdsf
     176 
     177    input filename               import file of commands
     178      in the file, can use "#" as comment character (though this doesn't work on the command line directly)
     179      cannot use "!" in the file as shell escape, must use "exec"
     180     
     181    vstat              get statistics for a vector (no "s" on the command name)
     182                         results are stored in variables $MEAN, $MIN, etc.
     183    stats              get statistics for a scalar
     184 
     185    sort ra dec mag    will re-sort the variables using first variable as the sorting field
     186 
     187 
     188 
     189 ----------------------------------------------------------------------
     190 
     191 
     192 the 'date' command is what you want here:
     193 
     194 dvo: date -h
     195 USAGE: date [-var variable] [-seconds] [-reftime seconds]
     196 
     197 * by itself, just echoes the date & time
     198 * to set a variable with the date, add -var name, where 'name' is the
     199 name of your variable.  by default, this is a human readable date, eg
     200 Wed Mar 12 08:30:11 2008
     201 * to calculate time differences, add the -seconds flag, and the value
     202 will be in seconds since 1970 Jan 01 00:00:00.  NOTE: There is a bug
     203 in that the variable is represented as a float, and the value is now >
     204 1.2e9 seconds.  The difference is thus not very accurate.  To get
     205 around this, use the -reftime feature to report the seconds since a
     206 more recent date.  A value of something like 1205340000 works at the
     207 moment.
     208 
     209 examples:
     210 
     211 dvo: date
     212 Wed Mar 12 08:30:11 2008
     213 
     214 dvo: date -var foo -seconds
     215 dvo: echo $foo
     216 1205346664
     217 
     218 dvo: date -var foo -seconds -reftime 1205340000
     219 dvo: echo $foo
     220 6700
     221 dvo: date -var bar -seconds -reftime 1205340000
     222 dvo: echo $bar
     223 6708
     224 dvo: echo {$bar - $foo}
     225 8
     226 
     227
     228=== Sample dvo script ===
     229
     230You can save this as nstars.dvo and then execute all the commands from the dvo shell with
     231
     232 input nstars.dvo
     233
     234 
     235 #---------------------------------------------------------------------------#
     236 # Re-create 2MASS part of extraction used by Reid et al (2007, Paper XI)
     237 #   used to find mid-M dwarfs
     238 # 02/11/08 M. Liu
     239 #---------------------------------------------------------------------------#
     240 
     241 
     242 # define sky region and output file
     243 # (remember that RA is in *degrees*)
     244 $OUTFILE = junk
     245 #$OUTFILE = nstars.2mass
     246 $RA_MIN = 0*15 
     247 $RA_MAX = 1*15
     248 $DEC_MIN = -0
     249 $DEC_MAX = 20
     250 
     251 
     252 #$OUTFILE = big.2mass
     253 #$RA_MIN = 0*15 
     254 #$RA_MAX = 4*15
     255 #$DEC_MIN = -0
     256 #$DEC_MAX = 20
     257 
     258 
     259 # cut by galactic latitude
     260 $GLAT_MIN = 10 
     261 
     262 
     263 # define selection criteria
     264 $SELECT =  (2MASS_J < 12) && (2MASS_H - 2MASS_K > 0.23) && (abs(glat) > $GLAT_MIN)
     265 
     266 
     267 #----------------------------------------------------------------------
     268 # choose 2MASS
     269 catdir $catdir_2mass
     270 
     271 # define region
     272 skyregion $RA_MIN $RA_MAX $DEC_MIN $DEC_MAX
     273 clear
     274 limits $RA_MIN $RA_MAX $DEC_MIN $DEC_MAX
     275 box
     276 grid
     277 
     278 # do extraction and keep track of time
     279 echo "running AVEXTRACT"
     280 echo "extraction area (sq.degs) = " {($RA_MAX- $RA_MIN) * ($DEC_MAX - $DEC_MIN)}
     281 date
     282 date -var d1 -seconds
     283 avextract ra dec 2MASS_J 2MASS_H 2MASS_K glon glat  where $SELECT
     284 echo "  found" ra[] "objects"
     285 date -var d2 -seconds
     286 echo "  run time =" {$d2-$d1} "seconds"
     287 
     288 # plot results
     289 vstat v_2MASS_J
     290 zplot ra dec v_2MASS_J $MAX $MIN
     291 zplot ra dec v_2MASS_J $MIN $MAX -c red
     292 zplot ra dec v_2MASS_J $MAX $MIN -c blue -pt 7
     293 
     294 # print results to file and sort by RA
     295 write -f "%10.6f%+010.6f %7.3f %7.3f %7.3f %12.6f %10.6f" tmp.dat ra dec v_2MASS_J v_2MASS_H v_2MASS_K glon glat
     296 exec sort -nk 1,1 tmp.dat > $OUTFILE
     297 
     298 echo " "
     299 echo "** FINISHED **"
     300 echo "wrote results to outfile = " $OUTFILE
     301 echo " "
     302
     303
     304 
     305=== DVO tutorial (old) ===
     306
     307Since this tutorial is from 2007, some information here may be outdated by now.
     308
     309 ==================================================
     310 DVO tutorial with Gene Magnier
     311 02/13/07
     312 ==================================================
     313 
     314 
     315 ssh local_host_with_dvo_installed
     316 
     317 copy over test materials (works only on IfA cluster, if at all)
     318   > cp -r ~ipp/715624o .
     319 
     320 DVO overview
     321   sky is stored in tables, can adjust density of RA/DEC divisions
     322   default divisions are based on those used for HST Guide Star Catalog
     323 
     324   photometry systems stored in ~ipp/psconfig/share/ippconfig/dvo.photcodes 
     325     1st five lines give *average* magnitudes systems (not for any specific night)
     326     "ref" lines are externally provided photometry
     327     "dep" lines are average measurements for a given instrument (e.g. one Megacam chip)
     328       data from specific nights are strapped onto this average
     329       these can then be set onto the master photometric system
     330 
     331 info for DVO commands
     332    http://kiawe.ifa.hawaii.edu/Elixir/Ohana/DVO/
     333 
     334 goofing around DVO
     335   module navigate                      tool for graphically exploring database
     336 
     337   catdir $catdir_merge    point to catalog of interest
     338         each subdirectoy is a band in DEC, containing FITS photometry tables
     339         "Images.dat" = contains list of images in directory (none in this case)             
     340        this test directory is Tycho, 2MASS, and USNO-B merged
     341 
     342   region 0 30 90 sin                 set viewing region
     343      0,0 = center of the field in degrees
     344      90 = radius of view
     345      sin = sin projection (ait = Aitoff projection, also "tan", "par", "gls")
     346    cgrid                     show celetial sphere
     347 
     348   region 0 0 0.5 tan; cgrid     zoom into a region
     349   
     350   pmeasure -all -m 10 15        plot a bunch of data
     351 
     352   help style                   show all plotting options
     353 
     354   style -pt 7                   set for circles
     355   clear; pmeasure -all -m 10 15  redraw
     356 
     357   region 0 0 0.05 tan; cgrid        choose smaller region
     358   clear; pmeasure -all -m 10 15     redraw
     359   $MAG = 10                         set plotting region info
     360   $dMAG = 5
     361   navigate                         poke around
     362     go into plotting window
     363         m      show data for a given object
     364                 shows "final" grizy magnitude
     365                 then shows individual measurements from diff catalogs
     366        x      quit navigate
     367        h      show list of commands
     368        S      redraw the stars
     369 
     370   pcat         show boundaries of catalogs that contribute to region
     371 
     372   mextract     extract vector of measurements from database (e.g. RA, DEC)
     373   avextract    extract vector of measurements averaged for the merged catalog
     374   imextract    extract statistics about images (e.g. rms)
     375 
     376   mextract help      show list of all possible columns
     377   mextract ra        get list of RAs that overlap the defined region
     378   mextract mag:inst 
     379   mextract mag:cat
     380   avextract RA     get lists of RAs for merged catalog ("RA" is new name)
     381   vectors          show list of defined vectors 
     382 
     383   echo ra[]        show number of elements
     384   echo ra[5000]    show value for an individual element
     385 
     386   for i 0 10
     387   echo ra[$i]      print first 10 elements
     388 
     389   ra[7] = 10       change value of vector
     390 
     391   mextract dec
     392   lim -n 1 ra dec ; clear ; box ; plot ra dec -x 2 -pt 7     plot data
     393 
     394   write        show list of options
     395   write <file> <list of vectors> -f "format (C-style)"    write to file
     396 
     397 
     398 
     399 Look around the 715624o/ stuff
     400   *.sx are Sextractor output
     401   *.smp has header info, data in ASCII (reorganization of Sextractor output), astrometry
     402   *.xmp has astrometry info
     403 
     404 and let's put some data into DVO
     405   > cd 715642o/
     406   > addstar -D CAMERA megacam
     407   > addstar -D CAMERA megacam -help
     408   > addstar -D CAMERA megacam  715624o00.smp
     409        produces "default/" directory which contains the database
     410   > addstar -D CAMERA megacam "715624o??.smp"    enter them all into the database
     411 
     412 go into dvo
     413    imlist      show list of images entered in default/
     414               (works b/c have set "default/" as nominal setting in "catdir" command")
     415               gives field center {RA,DEC}, date, photcode info, airmass, relative phot info
     416 
     417    region 280.4 0.15 1       set plotting region
     418    images                    show image regions
     419    pmeasure -all -m 10 20     plot all data
     420    cursor                    poke around images and mark locations
     421      can press any key (e.g. "1", "g", whatever) and location is saved
     422      "q" to quit this
     423    echo $R1    show results from 'cursor' results
     424    echo $Rg
     425 
     426    region $R1 $D1 0.1
     427    pmeasure -all -m 10 20
     428    ctrl-R  search old command history
     429 
     430 
     431 make some CMDs from 2MASS
     432   catdir $catdir_merge   
     433   region 0 0 2
     434   cmd 2MASS_J - 2MASS_H : 2MASS_H     generate vectors for plotting CMD ("xv" and "yv")
     435   vectors                                 
     436   lim -n 1 xv yv           set box limits based on vectors (for window 1)
     437   plot xv yv -x 2 -pt 2    plot CMD
     438 
     439   lim -1 4 18 5            set plotting limits
     440   clear; box; plot xv yv
     441   cursor
     442       eyeball two regions, type "1" and "2"
     443   subset hs = yv if (xv > $X1) && (xv < $X2) && (yv < $Y1) && (yv > $Y2)  select subset of data
     444   subset jhs = xv if (xv > $X1) && (xv < $X2) && (yv < $Y1) && (yv > $Y2)  select subset of data
     445   plot -c red jhs hs
     446 
     447   do extraction along a line
     448     set yl = 11 - xv      vector that defines a line
     449     subset jhs = xv if (yv< yl)
     450     subset hhs = xv if (yv< yl)
     451     plot -c blue jhs hs -n 1
     452 
     453   set a boolean expression to do selection
     454     set flag = (xv > $1)
     455     subset jhs = xv if flag
     456     subset hs = xv if flag
     457     plot -c green jhs hs -n 1
     458 
     459 
     460 can also do data extraction in original 'mextract' commands
     461 
     462 
     463 can input file to dvo
     464    input <filename>
     465 
     466 
     467 to add data from an external source   
     468   make a copy of the "dvo.photcodes" file for yourself
     469     add new data are "ref" data, assign a unique number for 1st column
     470     choose a unique name, e.g. "othercamera"
     471   make a file with columns of {RA DEC magnitude error}
     472 
     473    > addstar -D RADIUS 2.0 -help
     474    > addstar -D RADIUS 2.0 -ref <filename> -photcode <othercamera> -time 2007/02/13,00:300:00