From 4822e7a286a4d733ea5fafd3699b226af086ac47 Mon Sep 17 00:00:00 2001 From: "Olivier J.N. Bertrand" <olivier.bertrand@uni-bielefeld.de> Date: Thu, 6 Dec 2018 14:04:00 +0100 Subject: [PATCH] Update boundary check --- .../tutorials/02-recording-animal-trajectory.ipynb | 2 +- navipy/processing/pcode.py | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/doc/source/tutorials/02-recording-animal-trajectory.ipynb b/doc/source/tutorials/02-recording-animal-trajectory.ipynb index 9cd0c0a..e04c035 100644 --- a/doc/source/tutorials/02-recording-animal-trajectory.ipynb +++ b/doc/source/tutorials/02-recording-animal-trajectory.ipynb @@ -694,7 +694,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.3" + "version": "3.6.6" } }, "nbformat": 4, diff --git a/navipy/processing/pcode.py b/navipy/processing/pcode.py index 41d7220..f0d4371 100644 --- a/navipy/processing/pcode.py +++ b/navipy/processing/pcode.py @@ -134,16 +134,14 @@ def pcv(place_code, viewing_directions): should be 1'.format(place_code.shape[component_dim])) elevation = viewing_directions[..., __spherical_indeces__['elevation']] azimuth = viewing_directions[..., __spherical_indeces__['azimuth']] - if (np.any(elevation < -np.pi / 2) or np.any(elevation > np.pi / 2)): - # if (np.any(elevation < -2*np.pi) or np.any(elevation > 2*np.pi)): - raise ValueError(" Elevation must be radians in range [-2*pi;2*pi]") - if (np.max(elevation) - np.min(elevation) > 2 * np.pi): + if (np.any(elevation <= -np.pi) or np.any(elevation >= np.pi)): + raise ValueError(" Elevation must be radians in range [-pi;pi]") + if (np.max(elevation) - np.min(elevation) >= 2 * np.pi): raise ValueError(" max difference in elevation must be < 2*pi") - if (np.any(azimuth < -np.pi) or np.any(azimuth > np.pi)): - # if (np.any(azimuth < -2*np.pi) or np.any(azimuth > np.pi*2)): + if (np.any(azimuth <= -2*np.pi) or np.any(azimuth >= 2*np.pi)): raise ValueError(" Azimuth must be radians in range [-2*pi;2*pi]") if (np.max(azimuth) - np.min(azimuth) > 2 * np.pi): - raise ValueError(" max difference in azimuth must be < 2*pi") + raise ValueError(" max difference in azimuth must be <= 2*pi") x, y, z = spherical_to_cartesian(elevation, azimuth, radius=1) unscaled_lv = np.zeros((viewing_directions.shape[0], viewing_directions.shape[1], -- GitLab