From 14a8e14d378b257341dc7689e6d35252fe2ede49 Mon Sep 17 00:00:00 2001 From: cmcipinko Date: Tue, 9 Feb 2016 16:02:00 -0700 Subject: [PATCH 1/7] Assignemnt 3 --- point_pattern.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/point_pattern.py b/point_pattern.py index 9ae56ee..932df64 100644 --- a/point_pattern.py +++ b/point_pattern.py @@ -27,7 +27,7 @@ def manhattan_distance(a, b): distance : float The Manhattan distance between the two points """ - distance = None # Add the algorithm to compute manhattan distance here + distance = abs(a[0] - b[0]) + abs(a[1] - b[1]) # Add the algorithm to compute manhattan distance here return distance @@ -49,7 +49,8 @@ def euclidean_distance(a, b): distance : float The Euclidean distance between the two points """ - distance = None # Add the euclidean distance algorithm here + from scipy.spatial import distance + distance = distance.euclidean(a,b) # Add the euclidean distance algorithm here return distance @@ -87,8 +88,8 @@ def shift_point(point, x_shift, y_shift): x = getx(point) y = gety(point) - x_new = None # Add the logic to shift x here - y_new = None # Add the logic to shift y here + x_new = x + x_shift # Add the logic to shift x here + y_new = y + y_shift # Add the logic to shift y here return x_new, y_new @@ -109,7 +110,13 @@ def check_coincident(a, b): equal : bool Whether the points are equal """ - return None # Add the logic to check if coincident here + if (a[0] == b[0] and a[1] == b[1]): + coincident = True + + else: + coincident = False + + return coincident # Add the logic to check if coincident here def check_in(point, point_list): @@ -124,7 +131,12 @@ def check_in(point, point_list): point_list : list in the form [point, point_1, point_2, ..., point_n] """ - return None # Add the logic to check if a point is in the point list here + if (point in point_list): + inlist = True + + else: + inlist = False + return inlist # Add the logic to check if a point is in the point list here def getx(point): From d752a5cc94ffb68462c06c84adda7fcb5d8e0af8 Mon Sep 17 00:00:00 2001 From: cmcipinko Date: Tue, 9 Feb 2016 17:21:05 -0700 Subject: [PATCH 2/7] Update point_pattern.py --- point_pattern.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/point_pattern.py b/point_pattern.py index 932df64..2cda10c 100644 --- a/point_pattern.py +++ b/point_pattern.py @@ -1,3 +1,9 @@ +yml +language: python +python: + - "3.5" +script: nosetests + import math # I am guessing that you will need to use the math module """ From c498fff8f3dd681356639be589024387d18e37fc Mon Sep 17 00:00:00 2001 From: cmcipinko Date: Tue, 9 Feb 2016 17:23:51 -0700 Subject: [PATCH 3/7] Update point_pattern.py --- point_pattern.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/point_pattern.py b/point_pattern.py index 2cda10c..932df64 100644 --- a/point_pattern.py +++ b/point_pattern.py @@ -1,9 +1,3 @@ -yml -language: python -python: - - "3.5" -script: nosetests - import math # I am guessing that you will need to use the math module """ From cd06b6034e03b2ea8774b7c2a048687c9e574c3e Mon Sep 17 00:00:00 2001 From: cmcipinko Date: Tue, 9 Feb 2016 17:34:01 -0700 Subject: [PATCH 4/7] Delete .travis.yml --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9aa63d2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: python -python: - - "3.5" - -#command to run tests -script: nosetests From 2152d534df886e6471d059f057177242a83092b7 Mon Sep 17 00:00:00 2001 From: cmcipinko Date: Tue, 9 Feb 2016 17:34:16 -0700 Subject: [PATCH 5/7] Create .travis.yml --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5721750 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ + +yml ++language: python ++python: ++ - "3.5" ++ ++#command to run tests ++script: nosetests + From d4b64164eb7d5ec3f1fbffde6fe58d58d441aa4d Mon Sep 17 00:00:00 2001 From: cmcipinko Date: Tue, 9 Feb 2016 17:39:56 -0700 Subject: [PATCH 6/7] Update .travis.yml --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5721750..e3fca2b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ - +yml -+language: python -+python: -+ - "3.5" -+ -+#command to run tests -+script: nosetests + yml +language: python +python: + - "3.5" + +#command to run tests +script: nosetests From 2a183a5758e1469513f2970f380b543a3af2a506 Mon Sep 17 00:00:00 2001 From: cmcipinko Date: Wed, 10 Feb 2016 21:48:08 -0700 Subject: [PATCH 7/7] Delete .travis.yml --- .travis.yml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e3fca2b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ - yml -language: python -python: - - "3.5" - -#command to run tests -script: nosetests -