Commit dec10f3e authored by Wei Chengliang's avatar Wei Chengliang
Browse files

update style-PEP8

parent f9c38528
Pipeline #7094 failed with stage
in 0 seconds
...@@ -19,7 +19,7 @@ NPSF = 900 # ***# 30*30 ...@@ -19,7 +19,7 @@ NPSF = 900 # ***# 30*30
PixSizeInMicrons = 5. # ***# in microns PixSizeInMicrons = 5. # ***# in microns
### find neighbors-KDtree### # find neighbors-KDtree #
def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True): def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True):
""" """
find nearest neighbors by 2D-KDTree find nearest neighbors by 2D-KDTree
...@@ -40,9 +40,9 @@ def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True): ...@@ -40,9 +40,9 @@ def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True):
dataq = [] dataq = []
rr = dr rr = dr
if OnlyDistance == True: if OnlyDistance is True:
dataq = tree.query_ball_point([tx, ty], rr) dataq = tree.query_ball_point([tx, ty], rr)
if OnlyDistance == False: if OnlyDistance is False:
while len(dataq) < dn: while len(dataq) < dn:
dataq = tree.query_ball_point([tx, ty], rr) dataq = tree.query_ball_point([tx, ty], rr)
rr += dr rr += dr
...@@ -51,7 +51,7 @@ def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True): ...@@ -51,7 +51,7 @@ def findNeighbors(tx, ty, px, py, dr=0.1, dn=1, OnlyDistance=True):
dataq = np.array(dataq)[ddSortindx[0:dn]] dataq = np.array(dataq)[ddSortindx[0:dn]]
return dataq return dataq
### find neighbors-hoclist### # find neighbors-hoclist#
def hocBuild(partx, party, nhocx, nhocy, dhocx, dhocy): def hocBuild(partx, party, nhocx, nhocy, dhocx, dhocy):
...@@ -139,7 +139,7 @@ def findNeighbors_hoclist(px, py, tx=None, ty=None, dn=4, hoc=None, hoclist=None ...@@ -139,7 +139,7 @@ def findNeighbors_hoclist(px, py, tx=None, ty=None, dn=4, hoc=None, hoclist=None
return neigh 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): def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=True, hoc=None, hoclist=None, PSFCentroidWgt=False):
""" """
psf interpolation by IDW psf interpolation by IDW
...@@ -163,7 +163,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru ...@@ -163,7 +163,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru
npsf = PSFMat[:, :, :].shape[0] npsf = PSFMat[:, :, :].shape[0]
psfWeight = np.zeros([npsf]) psfWeight = np.zeros([npsf])
if OnlyNeighbors == True: if OnlyNeighbors is True:
if hoc is None: if hoc is None:
neigh = findNeighbors(px, py, cen_col, cen_row, neigh = findNeighbors(px, py, cen_col, cen_row,
dr=5., dn=4, OnlyDistance=False) dr=5., dn=4, OnlyDistance=False)
...@@ -175,7 +175,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru ...@@ -175,7 +175,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru
neighFlag[neigh] = 1 neighFlag[neigh] = 1
for ipsf in range(npsf): for ipsf in range(npsf):
if OnlyNeighbors == True: if OnlyNeighbors is True:
if neighFlag[ipsf] != 1: if neighFlag[ipsf] != 1:
continue continue
...@@ -195,7 +195,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru ...@@ -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) psfMaker = np.zeros([ngy, ngx], dtype=np.float32)
for ipsf in range(npsf): for ipsf in range(npsf):
if OnlyNeighbors == True: if OnlyNeighbors is True:
if neighFlag[ipsf] != 1: if neighFlag[ipsf] != 1:
continue continue
...@@ -208,7 +208,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru ...@@ -208,7 +208,7 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=Tru
return psfMaker return psfMaker
### define PSFInterp### # define PSFInterp#
class PSFInterp(PSFModel): 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): 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 self.LOG_DEBUG = LOG_DEBUG
...@@ -223,7 +223,7 @@ class PSFInterp(PSFModel): ...@@ -223,7 +223,7 @@ class PSFInterp(PSFModel):
self.iccd = int(chip.getChipLabel(chipID=chip.chipID)) self.iccd = int(chip.getChipLabel(chipID=chip.chipID))
# self.iccd = chip.chip_name # self.iccd = chip.chip_name
if PSF_data_file == None: if PSF_data_file is None:
print('Error - PSF_data_file is None') print('Error - PSF_data_file is None')
sys.exit() sys.exit()
...@@ -402,7 +402,7 @@ class PSFInterp(PSFModel): ...@@ -402,7 +402,7 @@ class PSFInterp(PSFModel):
Spinned PSF: g1, g2 and axis ratio 'a/b' Spinned PSF: g1, g2 and axis ratio 'a/b'
""" """
a2Rad = np.pi/(60.0*60.0*180.0) a2Rad = np.pi/(60.0*60.0*180.0)
ff = self.sigGauss * 0.107 * (1000.0/10.0) # in unit of [pixels] ff = self.sigGauss * 0.107 * (1000.0/10.0) # in unit of [pixels]
rc = np.sqrt(x*x + y*y) rc = np.sqrt(x*x + y*y)
cpix = rc*(self.sigSpin*a2Rad) cpix = rc*(self.sigSpin*a2Rad)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment