IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25086


Ignore:
Timestamp:
Aug 16, 2009, 9:18:31 PM (17 years ago)
Author:
Sebastian Jester
Message:

More elegant, tested versions of filterGoodVal2 and filterGoodVal3

File:
1 edited

Legend:

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

    r25085 r25086  
    619619def goodValBool(col):
    620620    """Return a bool array that contains True where
    621     col1 doesn't have  NaNs nor SDSS "no-value" and
     621    col doesn't have  NaNs nor SDSS "no-value" and
    622622    "no-error" flags -9999 and -1000."""
    623623    from numpy import isfinite,array
     
    632632    "no-error" flags -9999 and -1000 filtered out."""
    633633    from numpy import isfinite,logical_and,array
    634     goodcondition = isfinite(col1) & isfinite(col2)
    635     for val in [-9999,-1000]:
    636         goodcondition &= (col1 != val)
    637         goodcondition &= (col2 != val)
     634    goodcondition = goodValBool(col1) & goodValBool(col2)
    638635    col1 = col1[goodcondition]
    639     # For some reason, the following line used to be
    640     # col2_good = col2[goodcondition]
    641     # which looks like an error
    642636    col2 = col2[goodcondition]
    643637    return col1,col2
    644     #
    645     #... so I'm doing this:
    646     good1_l = []
    647     good2_l = []
    648     for v1,v2 in zip(col1,col2):
    649         if isfinite(v1) and isfinite(v2) and v1 not in [-9999,-1000] and v2 not in [-9999,-1000]:
    650             good1_l.append(v1)
    651             good2_l.append(v2)
    652     return array(good1_l),array(good2_l)
    653638   
    654639def filterGoodVal3(col1,col2,col3):
     
    656641    col1 and col2 have  NaNs and SDSS "no-value" and
    657642    "no-error" flags -9999 and -1000 filtered out."""
    658     from numpy import isfinite,array
    659     #
    660     #... so I'm doing this:
    661     good1_l = []
    662     good2_l = []
    663     good3_l = []
    664     for i in range(len(col1)):
    665         v1 = col1[i]
    666         v2 = col2[i]
    667         v3 = col3[i]
    668         if isfinite(v1) and isfinite(v2) and isfinite(v3) and \
    669                 v1 not in [-9999,-1000] and v2 not in [-9999,-1000] and \
    670                 v3 not in [-9999,-1000]:
    671             good1_l.append(v1)
    672             good2_l.append(v2)
    673             good3_l.append(v3)
    674     return array(good1_l),array(good2_l),array(good3_l)
     643    from numpy import isfinite,logical_and,array
     644    goodcondition = goodValBool(col1) & goodValBool(col2) & goodValBool(col3)
     645    col1 = col1[goodcondition]
     646    col2 = col2[goodcondition]
     647    col3 = col3[goodcondition]
     648    return col1,col2,col3
    675649   
    676650def matchSdssPs1(SDSSfpObjc,PS1cmf,xoff=0.5,yoff=0.5,matchrad=0.7,skipMatch=False):
Note: See TracChangeset for help on using the changeset viewer.