IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19802


Ignore:
Timestamp:
Oct 2, 2008, 3:00:44 AM (18 years ago)
Author:
Sebastian Jester
Message:

add first sm plotting routine for scatter plots (overplotting allowed)

File:
1 edited

Legend:

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

    r19801 r19802  
    3434#     + histograms of everything - recovery fractions, means, medians, quartiles
    3535#     + Trends with field number, seeing etc.
     36
     37def smdefaults():
     38    # Will these be persistent across multiple imports and going out
     39    # of scope? Perhaps only if I do a global 'import sm'. Or it
     40    # should work if called from something where sm is in scope?
     41    sm.expand(1.8)
     42    sm.lweight(5)
     43
     44# Plotting convention will be like in sm: you need to open a file,
     45# then you plot to it with one or multiple commands, then you close it
     46# to write the file.
     47
     48def scatterplot(x,y,ptype,xlab,ylab,xrange='',yrange='',append=False,close=True,dev='x11'):
     49    """Make an sm scatter plot on current device."""
     50    import sm
     51    sm.expand(1.8)
     52    sm.lweight(5)
     53    # Silently ignore any problems with plot generation
     54    try:
     55        if not append:
     56            sm.device(dev)
     57            sm.erase()
     58            if xrange == '':
     59                xrange = x
     60            if yrange == '':
     61                yrange = y
     62            sm.limits(x,y)
     63            sm.box()
     64            sm.xlabel(xlab)
     65            sm.ylabel(ylab)
     66        sm.ptype(ptype)
     67        sm.points(x,y)
     68        # Close active device - maybe add flag to skip this so plot
     69        # remains appendable, or use meta? but can't use colour in meta...
     70        if close:
     71            sm.device('nodevice')
     72    except:
     73        pass
    3674
    3775def compIPPphoto(summaryTable,mode):
     
    178216        'd_x':['colc','x_psf']
    179217        ,'d_y':['rowc','y_psf']
    180         ,'d_mag':['psfcounts','PSF_INST_MAG']
    181         ,'d_magerr':['psfcountserr','PSF_INST_MAG_SIG']
    182218        ,'d_sky':['sky_sdss','SKY_ps1']
    183219        ,'d_skyerr':['skyErr','SKY_SIGMA']
    184220        ,'d_pointsource':['prob_psf','pointsource_ps1']
     221        ,'d_mag':['psfcounts','PSF_INST_MAG']
     222        ,'d_magerr':['psfcountserr','PSF_INST_MAG_SIG']
    185223        }
    186224
     
    216254            SDSScol_good,PS1col_good,SDSScounts_good = filterGoodVal3(SDSScol,PS1col,SDSScounts)
    217255            SDSScol_good = 2.5/log(10.)*SDSScol_good/SDSScounts_good
     256            scatterplot(PS1col_good,SDSScol_good,43,'PS1 inst mag','SDSS inst mag',dev='postfile test.eps',append=True,close=True)
     257        if outcol == 'd_x':
     258            scatterplot(PS1col_good,SDSScol_good,43,'PS1 inst mag','SDSS inst mag',dev='postfile test.eps',append=False,close=False)
     259        else:
     260            scatterplot(PS1col_good,SDSScol_good,43,'PS1 inst mag','SDSS inst mag',dev='postfile test.eps',append=True,close=False)           
    218261        delta = SDSScol_good - PS1col_good
    219262        avg = delta.mean()
Note: See TracChangeset for help on using the changeset viewer.