From 59e05fd479c18befb4c7d21bce6677b7c41e932d Mon Sep 17 00:00:00 2001 From: Bill Little Date: Tue, 3 May 2022 13:29:11 +0100 Subject: [PATCH] fix locator (#78) * fix formatters and locator * reinstate formatters --- tephi/__init__.py | 9 ++++----- tephi/tests/results/imagerepo.json | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/tephi/__init__.py b/tephi/__init__.py index d6500eb..caea6e5 100644 --- a/tephi/__init__.py +++ b/tephi/__init__.py @@ -283,7 +283,7 @@ def __init__(self, step): >>> from tephi import Locator >>> locator = Locator(10) >>> locator(-45, 23) - (array([-45., -35., -25., -15., -5., 5., 15., 25.]), 8, 1) + (array([-50, -40, -30, -20, -10, 0, 10, 20]), 8, 1) Args: @@ -296,10 +296,9 @@ def __call__(self, start, stop): """Calculate the axis ticks given the provided tick range.""" step = self.step - start = (int(start) / step) * step - stop = (int(stop) / step) * step - ticks = np.arange(start, stop + step, step) - + start = (int(start) // step) * step + stop = (int(stop) // step) * step + ticks = np.arange(start, stop + step, step, dtype=int) return ticks, len(ticks), 1 diff --git a/tephi/tests/results/imagerepo.json b/tephi/tests/results/imagerepo.json index 37bb836..b039ed0 100644 --- a/tephi/tests/results/imagerepo.json +++ b/tephi/tests/results/imagerepo.json @@ -33,22 +33,28 @@ "https://scitools.github.io/test-tephi-imagehash/images/e85a992d90c56630cced39afc6198cf6c734e26197997a9269669d8d387330e6.png" ], "test_tephigram.TestTephigramPlot.test_plot_dews_locator_adiabat_numeric.0": [ - "https://scitools.github.io/test-tephi-imagehash/images/e85a9e0c91a3663ccda5398c965a9cf6cb3462619b9c3f134c66cd099e737346.png" + "https://scitools.github.io/test-tephi-imagehash/images/e85a9e0c91a3663ccda5398c965a9cf6cb3462619b9c3f134c66cd099e737346.png", + "https://scitools.github.io/test-tephi-imagehash/images/e85a9f0991a76639cca53989965d98d6cf3462619b893f124c664b9c9c7b7256.png" ], "test_tephigram.TestTephigramPlot.test_plot_dews_locator_adiabat_object.0": [ - "https://scitools.github.io/test-tephi-imagehash/images/e85a9e0c91a3663ccda5398c965a9cf6cb3462619b9c3f134c66cd099e737346.png" + "https://scitools.github.io/test-tephi-imagehash/images/e85a9e0c91a3663ccda5398c965a9cf6cb3462619b9c3f134c66cd099e737346.png", + "https://scitools.github.io/test-tephi-imagehash/images/e85a9f0991a76639cca53989965d98d6cf3462619b893f124c664b9c9c7b7256.png" ], "test_tephigram.TestTephigramPlot.test_plot_dews_locator_isotherm_numeric.0": [ - "https://scitools.github.io/test-tephi-imagehash/images/e85a8f2c90c56630cce539ad96591c96cf347a6795986a924966cd8dbc73e1e4.png" + "https://scitools.github.io/test-tephi-imagehash/images/e85a8f2c90c56630cce539ad96591c96cf347a6795986a924966cd8dbc73e1e4.png", + "https://scitools.github.io/test-tephi-imagehash/images/e85a9f2d90c56630cce539ac96599cf6c7b46a6195986a924d66cd8d1e23363e.png" ], "test_tephigram.TestTephigramPlot.test_plot_dews_locator_isotherm_object.0": [ - "https://scitools.github.io/test-tephi-imagehash/images/e85a8f2c90c56630cce539ad96591c96cf347a6795986a924966cd8dbc73e1e4.png" + "https://scitools.github.io/test-tephi-imagehash/images/e85a8f2c90c56630cce539ad96591c96cf347a6795986a924966cd8dbc73e1e4.png", + "https://scitools.github.io/test-tephi-imagehash/images/e85a9f2d90c56630cce539ac96599cf6c7b46a6195986a924d66cd8d1e23363e.png" ], "test_tephigram.TestTephigramPlot.test_plot_dews_locator_numeric.0": [ - "https://scitools.github.io/test-tephi-imagehash/images/e85a9e0c91e3663ccda5398c965b1cd6cb346a639a9c27334c664d099c78e3f6.png" + "https://scitools.github.io/test-tephi-imagehash/images/e85a9e0c91e3663ccda5398c965b1cd6cb346a639a9c27334c664d099c78e3f6.png", + "https://scitools.github.io/test-tephi-imagehash/images/e85a9f0991e76639c5a53989965d1cd6cf346a63939867b30c664bcc1e1b7216.png" ], "test_tephigram.TestTephigramPlot.test_plot_dews_locator_object.0": [ - "https://scitools.github.io/test-tephi-imagehash/images/e85a9e0c91e3663ccda5398c965b1cd6cb346a639a9c27334c664d099c78e3f6.png" + "https://scitools.github.io/test-tephi-imagehash/images/e85a9e0c91e3663ccda5398c965b1cd6cb346a639a9c27334c664d099c78e3f6.png", + "https://scitools.github.io/test-tephi-imagehash/images/e85a9f0991e76639c5a53989965d1cd6cf346a63939867b30c664bcc1e1b7216.png" ], "test_tephigram.TestTephigramPlot.test_plot_dews_temps.0": [ "https://scitools.github.io/test-tephi-imagehash/images/e969cc3992c76726cd973326c65869c6c3319e4d9c9849333c2c6399e5a7a7a4.png"