From 9c6ed0ff61fbc4cd912a2cf150de73aa4075f813 Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 16 Dec 2021 14:45:55 -0500 Subject: [PATCH 1/5] remove use of deprecated np.float --- Ska/Matplotlib/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ska/Matplotlib/core.py b/Ska/Matplotlib/core.py index 87652f2..8ccbe58 100644 --- a/Ska/Matplotlib/core.py +++ b/Ska/Matplotlib/core.py @@ -239,8 +239,8 @@ def hist_outline(dataIn, *args, **kwargs): stepSize = binsIn[1] - binsIn[0] - bins = np.zeros(len(binsIn)*2 + 2, dtype=np.float) - data = np.zeros(len(binsIn)*2 + 2, dtype=np.float) + bins = np.zeros(len(binsIn)*2 + 2, dtype=np.float64) + data = np.zeros(len(binsIn)*2 + 2, dtype=np.float64) for bb in range(len(binsIn)): bins[2*bb + 1] = binsIn[bb] bins[2*bb + 2] = binsIn[bb] + stepSize From a02e9f84313e4b13c1d187e142dae15b3d09d795 Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 6 Jan 2022 09:37:38 -0500 Subject: [PATCH 2/5] replace np.float64 by float --- Ska/Matplotlib/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ska/Matplotlib/core.py b/Ska/Matplotlib/core.py index 8ccbe58..2112c98 100644 --- a/Ska/Matplotlib/core.py +++ b/Ska/Matplotlib/core.py @@ -239,8 +239,8 @@ def hist_outline(dataIn, *args, **kwargs): stepSize = binsIn[1] - binsIn[0] - bins = np.zeros(len(binsIn)*2 + 2, dtype=np.float64) - data = np.zeros(len(binsIn)*2 + 2, dtype=np.float64) + bins = np.zeros(len(binsIn)*2 + 2, dtype=float) + data = np.zeros(len(binsIn)*2 + 2, dtype=float) for bb in range(len(binsIn)): bins[2*bb + 1] = binsIn[bb] bins[2*bb + 2] = binsIn[bb] + stepSize From 12b6269363c374298e4f90ea7346c13752676af3 Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 6 Jan 2022 09:44:36 -0500 Subject: [PATCH 3/5] mpl.epoch2num is deprecated in 3.3.0 and un-deprecated in 3.3.1, but still one can use date2num in any case. --- Ska/Matplotlib/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ska/Matplotlib/core.py b/Ska/Matplotlib/core.py index 2112c98..d03e622 100644 --- a/Ska/Matplotlib/core.py +++ b/Ska/Matplotlib/core.py @@ -3,7 +3,7 @@ from matplotlib.dates import (YearLocator, MonthLocator, DayLocator, HourLocator, MinuteLocator, SecondLocator, - DateFormatter, epoch2num) + DateFormatter, date2num) from matplotlib.ticker import FixedLocator, FixedFormatter from Chandra.Time import DateTime from cxotime import CxoTime @@ -186,7 +186,7 @@ def cxctime2plotdate(times): # Find the plotdate of first time and use a relative offset from there times = times.ravel() t0 = CxoTime(times[0]).unix - plotdate0 = epoch2num(t0) + plotdate0 = date2num(t0) * 1e6 out = (times - times[0]) / 86400. + plotdate0 return out.reshape(shape) From 0c75a581c14ef9e3ae0bccb3bcad6d574910cab9 Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Wed, 12 Jan 2022 10:12:03 -0500 Subject: [PATCH 4/5] move conversion to usec into function call, and add comment --- Ska/Matplotlib/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ska/Matplotlib/core.py b/Ska/Matplotlib/core.py index d03e622..8b4f2f1 100644 --- a/Ska/Matplotlib/core.py +++ b/Ska/Matplotlib/core.py @@ -186,7 +186,7 @@ def cxctime2plotdate(times): # Find the plotdate of first time and use a relative offset from there times = times.ravel() t0 = CxoTime(times[0]).unix - plotdate0 = date2num(t0) * 1e6 + plotdate0 = date2num(t0 * 1e6) # Float arg to date2num is in microsecs out = (times - times[0]) / 86400. + plotdate0 return out.reshape(shape) From 9f062fc0a441c3f6614d8f55c7cceaa991139026 Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Tue, 18 Jan 2022 12:39:54 -0500 Subject: [PATCH 5/5] correct call to date2num --- Ska/Matplotlib/core.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Ska/Matplotlib/core.py b/Ska/Matplotlib/core.py index 8b4f2f1..0bb41f5 100644 --- a/Ska/Matplotlib/core.py +++ b/Ska/Matplotlib/core.py @@ -185,8 +185,7 @@ def cxctime2plotdate(times): # Find the plotdate of first time and use a relative offset from there times = times.ravel() - t0 = CxoTime(times[0]).unix - plotdate0 = date2num(t0 * 1e6) # Float arg to date2num is in microsecs + plotdate0 = date2num(CxoTime(times[0]).datetime) out = (times - times[0]) / 86400. + plotdate0 return out.reshape(shape)