Loading observation_sim/psf/PSFInterp.py +11 −11 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ NPSF = 900 # ***# 30*30 PixSizeInMicrons = 5. # ***# in microns ### find neighbors-KDtree### # find neighbors-KDtree # def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True): """ find nearest neighbors by 2D-KDTree Loading @@ -40,9 +40,9 @@ def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True): dataq = [] rr = dr if OnlyDistance == True: if OnlyDistance is True: dataq = tree.query_ball_point([tx, ty], rr) if OnlyDistance == False: if OnlyDistance is False: while len(dataq) < dn: dataq = tree.query_ball_point([tx, ty], rr) rr += dr Loading @@ -51,7 +51,7 @@ def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True): dataq = np.array(dataq)[ddSortindx[0:dn]] return dataq ### find neighbors-hoclist### # find neighbors-hoclist# def hocBuild(partx, party, nhocx, nhocy, dhocx, dhocy): Loading Loading @@ -139,7 +139,7 @@ def findNeighbors_hoclist(px, py, tx=None, ty=None, dn=4, hoc=None, hoclist=None return neigh ### PSF-IDW### # PSF-IDW# def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=True, hoc=None, hoclist=None, PSFCentroidWgt=False): """ psf interpolation by IDW Loading @@ -163,7 +163,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru npsf = PSFMat[:, :, :].shape[0] psfWeight = np.zeros([npsf]) if OnlyNeighbors == True: if OnlyNeighbors is True: if hoc is None: neigh = findNeighbors(px, py, cen_col, cen_row, dr=5., dn=4, OnlyDistance=False) Loading @@ -175,7 +175,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru neighFlag[neigh] = 1 for ipsf in range(npsf): if OnlyNeighbors == True: if OnlyNeighbors is True: if neighFlag[ipsf] != 1: continue Loading @@ -195,7 +195,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru psfMaker = np.zeros([ngy, ngx], dtype=np.float32) for ipsf in range(npsf): if OnlyNeighbors == True: if OnlyNeighbors is True: if neighFlag[ipsf] != 1: continue Loading @@ -208,7 +208,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru return psfMaker ### define PSFInterp### # define PSFInterp# class PSFInterp(PSFModel): def __init__(self, chip, npsf=NPSF, PSF_data=None, PSF_data_file=None, PSF_data_prefix="", sigSpin=0, psfRa=0.15, HocBuild=False, LOG_DEBUG=False): self.LOG_DEBUG = LOG_DEBUG Loading @@ -223,7 +223,7 @@ class PSFInterp(PSFModel): self.iccd = int(chip.getChipLabel(chipID=chip.chipID)) # self.iccd = chip.chip_name if PSF_data_file == None: if PSF_data_file is None: print('Error - PSF_data_file is None') sys.exit() Loading Loading
observation_sim/psf/PSFInterp.py +11 −11 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ NPSF = 900 # ***# 30*30 PixSizeInMicrons = 5. # ***# in microns ### find neighbors-KDtree### # find neighbors-KDtree # def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True): """ find nearest neighbors by 2D-KDTree Loading @@ -40,9 +40,9 @@ def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True): dataq = [] rr = dr if OnlyDistance == True: if OnlyDistance is True: dataq = tree.query_ball_point([tx, ty], rr) if OnlyDistance == False: if OnlyDistance is False: while len(dataq) < dn: dataq = tree.query_ball_point([tx, ty], rr) rr += dr Loading @@ -51,7 +51,7 @@ def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True): dataq = np.array(dataq)[ddSortindx[0:dn]] return dataq ### find neighbors-hoclist### # find neighbors-hoclist# def hocBuild(partx, party, nhocx, nhocy, dhocx, dhocy): Loading Loading @@ -139,7 +139,7 @@ def findNeighbors_hoclist(px, py, tx=None, ty=None, dn=4, hoc=None, hoclist=None return neigh ### PSF-IDW### # PSF-IDW# def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=True, hoc=None, hoclist=None, PSFCentroidWgt=False): """ psf interpolation by IDW Loading @@ -163,7 +163,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru npsf = PSFMat[:, :, :].shape[0] psfWeight = np.zeros([npsf]) if OnlyNeighbors == True: if OnlyNeighbors is True: if hoc is None: neigh = findNeighbors(px, py, cen_col, cen_row, dr=5., dn=4, OnlyDistance=False) Loading @@ -175,7 +175,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru neighFlag[neigh] = 1 for ipsf in range(npsf): if OnlyNeighbors == True: if OnlyNeighbors is True: if neighFlag[ipsf] != 1: continue Loading @@ -195,7 +195,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru psfMaker = np.zeros([ngy, ngx], dtype=np.float32) for ipsf in range(npsf): if OnlyNeighbors == True: if OnlyNeighbors is True: if neighFlag[ipsf] != 1: continue Loading @@ -208,7 +208,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru return psfMaker ### define PSFInterp### # define PSFInterp# class PSFInterp(PSFModel): def __init__(self, chip, npsf=NPSF, PSF_data=None, PSF_data_file=None, PSF_data_prefix="", sigSpin=0, psfRa=0.15, HocBuild=False, LOG_DEBUG=False): self.LOG_DEBUG = LOG_DEBUG Loading @@ -223,7 +223,7 @@ class PSFInterp(PSFModel): self.iccd = int(chip.getChipLabel(chipID=chip.chipID)) # self.iccd = chip.chip_name if PSF_data_file == None: if PSF_data_file is None: print('Error - PSF_data_file is None') sys.exit() Loading