IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20510


Ignore:
Timestamp:
Nov 3, 2008, 4:37:48 AM (18 years ago)
Author:
Sebastian Jester
Message:

pass-through of options to makePlan, which is moved to end of file to
find it more quickly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sj_ippTests_branch_20080929/ippTests/compIPPphoto.py

    r20509 r20510  
    106106
    107107def compIPPphoto(summaryTable,mode,plotcol_1frame_tlist=plotcol_1frame_tlist,\
    108                      plotcol_summary_tlist=plotcol_summary_tlist,skip=True):
     108                     plotcol_summary_tlist=plotcol_summary_tlist,\
     109                 cmfDir = '/IPP/data/SDSS/stripe82/coadd/prod/run_ipp_20080815/',\
     110                 skip=True):
    109111    """summaryTable: .fits table for output
    110112    mode: new or append for creating summaryTable new or appending current run's output to it.
     
    134136    column_hash={}
    135137    stats_hash={}
    136     chipfile_l,fpObjc_l = makePlan()
     138    chipfile_l,fpObjc_l = makePlan(cmfDir=cmfDir)
    137139    filters = []
    138140    bandindex_hash = {}
     
    198200    """Make diagnostic plots for a single table, based on values in
    199201    values_hash"""
     202    # XXX Todo: window commands instead of (or in addition to?) psnup
     203    # for putting plots on same paper
    200204    from subprocess import call
    201205    from numpy import concatenate
     
    356360    return outl
    357361
    358 def computeStatistics(tablename,copyfields_list = ['RUN','RERUN','CAMCOL','FIELD','FILTER','FWHM_X','FWHM_Y']):
     362def computeStatistics(tablename,copyfields_list = ['RUN','RERUN','CAMCOL','FIELD','FILTER','FWHM_MAJ','FWHM_MIN']):
    359363    """Compute desired statistics for offsets etc. and add them as
    360364    ESO-style HIERARCH fields to the table header (8 characters are
     
    534538    return array(good1_l),array(good2_l),array(good3_l)
    535539   
    536 def makePlan(lastcamcol=1):
    537     """Make paired list of which fpObjc file to compare to which IPP
    538     .cmf file. Could also think about constructing the fpObjc filename
    539     from run, camcol, field read from .cmf primary header, which
    540     replicates most of the fpC primary header."""
    541      
    542     # For testing:
    543     # return ['1056-0192.421/1056-0192.421.ch.421.CHIP1.cmf'],['1056-0192.421/fpObjc-001056-1-0192.fit']
    544 
    545     from glob import glob
    546     fpObjcDir = '/IPP/data/SDSS/stripe82/coadd/input/fpObjcs/'
    547     cmfDir = '/IPP/data/SDSS/stripe82/coadd/prod/run_ipp/'
    548     runlist = [1056,1755,3388,3434,3465,4145,4192,4203,4247,4263,5052]
    549     firstfield_h = {
    550         1056:192,
    551         1755:329,
    552         3388:273,
    553         3434:306,
    554         3465:185,
    555         4145:63,
    556         4192:309,
    557         4203:358,
    558         4247:62,
    559         4263:69,
    560         5052:62
    561         }
    562     Nfields = 18
    563     camcollist = range(1,lastcamcol+1)
    564     sdsslist = []
    565     ps1list = []
    566     for run in runlist[0:1]:
    567         firstfield = firstfield_h[run]
    568         for field in range(firstfield,firstfield+Nfields+1):
    569             for camcol in camcollist:
    570                 sdssname = fpObjcDir + "fpObjc-%06i-%i-%04i.fit" % ( run, camcol, field)
    571                 # The following should just return 5 files (1 per
    572                 # filter), but just to be sure, let's check and return
    573                 # the correct number of sdss files to match:
    574                 ps1glob = glob(cmfDir + "%i-%04i.*/%i-%04i.*.ch.*.CHIP%i.cmf" %(run,field,run,field,camcol))
    575                 for ps1name in ps1glob:
    576                     ps1list.append(ps1name)
    577                     sdsslist.append(sdssname)
    578                 # Need to remember that CHIPx corresponds to CAMCOLx; could change
    579                 # naming rule to make filter name appear in filename, too.
    580     return ps1list,sdsslist
    581 
    582540def matchSdssPs1(SDSSfpObjc,PS1cmf,xoff=0.5,yoff=0.5,matchrad=0.7,skip=False):
    583541    """Call matchByPos to match an SDSS fpObjc.fits and a PS1 bla.cmf
     
    599557    filters = ['u','g','r','i','z']
    600558    # Read primary  header of PS1 file to work out band
    601     ps1copyfields_hash = headerfieldHash(['FWHM_X','FWHM_Y','FILTER'],PS1cmf,HDU=0)
     559    ps1copyfields_hash = headerfieldHash(['FWHM_MAJ','FWHM_MIN','FILTER'],PS1cmf,HDU=0)
    602560    sdssbandstr = ps1copyfields_hash['FILTER']
    603561    bandindex = filters.index(sdssbandstr)
     
    946904
    947905   
     906def makePlan(fpObjcDir = '/IPP/data/SDSS/stripe82/coadd/input/fpObjcs/',\
     907                 cmfDir = '/IPP/data/SDSS/stripe82/coadd/prod/run_ipp_20080815/',\
     908                 lastcamcol=1,\
     909                 runlist=[1056,1755,3388,3434,3465,4145,4192,4203,4247,4263,5052],\
     910                 firstfield_h = {
     911        1056:192,
     912        1755:329,
     913        3388:273,
     914        3434:306,
     915        3465:185,
     916        4145:63,
     917        4192:309,
     918        4203:358,
     919        4247:62,
     920        4263:69,
     921        5052:62
     922        }, \
     923                 Nfields = 18):
     924    """Make paired list of which fpObjc file to compare to which IPP
     925    .cmf file. Could also think about constructing the fpObjc filename
     926    from run, camcol, field read from .cmf primary header, which
     927    replicates most of the fpC primary header."""
     928    if cmfDir[-1] != '/':
     929        cmfDir += '/'
     930    if fpObjcDir[-1] != '/':
     931        fpObjcDir += '/'
     932    # For testing:
     933    # return ['1056-0192.421/1056-0192.421.ch.421.CHIP1.cmf'],['1056-0192.421/fpObjc-001056-1-0192.fit']
     934
     935    from glob import glob
     936    camcollist = range(1,lastcamcol+1)
     937    sdsslist = []
     938    ps1list = []
     939    for run in runlist:
     940        firstfield = firstfield_h[run]
     941        for field in range(firstfield,firstfield+Nfields+1):
     942            for camcol in camcollist:
     943                sdssname = fpObjcDir + "fpObjc-%06i-%i-%04i.fit" % ( run, camcol, field)
     944                # The following should just return 5 files (1 per
     945                # filter), but just to be sure, let's check and return
     946                # the correct number of sdss files to match:
     947                globstr = cmfDir + "%i-%04i.*/%i-%04i.*.ch.*.CHIP%i.cmf" %(run,field,run,field,camcol)
     948                ps1glob = glob(globstr)
     949                for ps1name in ps1glob:
     950                    ps1list.append(ps1name)
     951                    sdsslist.append(sdssname)
     952                # Need to remember that CHIPx corresponds to CAMCOLx; could change
     953                # naming rule to make filter name appear in filename, too.
     954    return ps1list,sdsslist
     955
Note: See TracChangeset for help on using the changeset viewer.