From 9e4d3ad6bfa60bfc378556fe6f33f6894d917183 Mon Sep 17 00:00:00 2001 From: Bryce Kalmbach Date: Thu, 5 May 2016 17:51:49 -0500 Subject: [PATCH 1/3] Added array test instead of two separate float tests. --- code/createImage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/createImage.py b/code/createImage.py index 1b804e2a3..501eda05a 100644 --- a/code/createImage.py +++ b/code/createImage.py @@ -377,7 +377,7 @@ def findLikelyTrajectories(self, psiArray, phiArray, testVel = topVel[rankings][objNum] keepVal = True for t0, vel in zip(keepT0, keepVel): - if ((np.sqrt(np.sum(np.power(testT0-t0,2))) < psfSigma) and (testVel[0] == vel[0]) and (testVel[1] == vel[1])): + if ((np.sqrt(np.sum(np.power(testT0-t0,2))) < psfSigma) and (np.array_equal(testVel, vel))): keepVal=False if keepVal == True: keepT0[resultsSet] = testT0 From 549e5bb7f045371fff893f62a334c8448641e8ac Mon Sep 17 00:00:00 2001 From: Bryce Kalmbach Date: Thu, 5 May 2016 18:09:52 -0500 Subject: [PATCH 2/3] Use scipy euclidean to measure distance. --- code/createImage.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/createImage.py b/code/createImage.py index 501eda05a..b335ba395 100644 --- a/code/createImage.py +++ b/code/createImage.py @@ -3,6 +3,7 @@ import astropy.convolution as conv import matplotlib.pyplot as plt from astropy.io import fits +from scipy.spatial.distance import euclidean class createImage(object): @@ -377,7 +378,7 @@ def findLikelyTrajectories(self, psiArray, phiArray, testVel = topVel[rankings][objNum] keepVal = True for t0, vel in zip(keepT0, keepVel): - if ((np.sqrt(np.sum(np.power(testT0-t0,2))) < psfSigma) and (np.array_equal(testVel, vel))): + if ((euclidean(testT0, t0) < psfSigma) and (np.array_equal(testVel, vel))): keepVal=False if keepVal == True: keepT0[resultsSet] = testT0 From 6f796efe18de3b2ba7dbc15a5b26c7eea2b1d088 Mon Sep 17 00:00:00 2001 From: Bryce Kalmbach Date: Thu, 5 May 2016 18:41:21 -0500 Subject: [PATCH 3/3] Added finishing position information as a way to reduce overlap. --- code/createImage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/createImage.py b/code/createImage.py index b335ba395..23bb9057b 100644 --- a/code/createImage.py +++ b/code/createImage.py @@ -333,7 +333,7 @@ def findLikelyTrajectories(self, psiArray, phiArray, velArr = np.array([vRow, vCol]).T psfPixelArea = np.pi*(psfSigma**2) - tempResults = int(np.ceil(psfPixelArea)*numResults) + tempResults = int(np.ceil(psfPixelArea)*numResults)*2 topVel = np.zeros((tempResults, 2)) topT0 = np.zeros((tempResults,2)) @@ -378,7 +378,8 @@ def findLikelyTrajectories(self, psiArray, phiArray, testVel = topVel[rankings][objNum] keepVal = True for t0, vel in zip(keepT0, keepVel): - if ((euclidean(testT0, t0) < psfSigma) and (np.array_equal(testVel, vel))): + if ((euclidean(testT0, t0) <= psfSigma) and ((euclidean(testT0+(testVel*timeArr[-1]), + t0+(vel*timeArr[-1])) <= psfSigma))): keepVal=False if keepVal == True: keepT0[resultsSet] = testT0