From 264d50ab506ae5bb26141c8eba981410c8c686a1 Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Wed, 27 Nov 2024 09:08:16 -0500 Subject: [PATCH] Fix ruff --- cheta/tests/test_orbit.py | 2 +- test/compare_regr_vals.py | 4 +++- test/make_plots.py | 42 +++++++++++++++++++-------------------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/cheta/tests/test_orbit.py b/cheta/tests/test_orbit.py index 39ea78ed..98fc689a 100644 --- a/cheta/tests/test_orbit.py +++ b/cheta/tests/test_orbit.py @@ -32,5 +32,5 @@ def test_orbital_elements(): "mean_anomaly": 354.971325, } # 354.9724 in reference (roundoff in example) - for key in expected: + for key in expected: # noqa: PLC0206 assert np.allclose(out[key], expected[key], atol=0.0, rtol=1e-6) diff --git a/test/compare_regr_vals.py b/test/compare_regr_vals.py index 72490063..b0df41ff 100755 --- a/test/compare_regr_vals.py +++ b/test/compare_regr_vals.py @@ -65,7 +65,9 @@ def get_options(): if attr not in f: continue if len(f[attr]) != len(t[attr]): - print(f"[NOT OK] {msid} {stat}: Length mismatch: {len(f[attr])} {len(t[attr])}") + print( + f"[NOT OK] {msid} {stat}: Length mismatch: {len(f[attr])} {len(t[attr])}" + ) all_ok = False continue if attr == "quals": diff --git a/test/make_plots.py b/test/make_plots.py index 325fce85..b62019f8 100755 --- a/test/make_plots.py +++ b/test/make_plots.py @@ -5,31 +5,31 @@ # run in pylab import os -import sys -from matplotlib.pyplot import * -import cheta.fetch_sci as fetch +import matplotlib.pyplot as plt from ska_matplotlib import plot_cxctime -print('Fetch file is', fetch.__file__) -print('ENG_ARCHIVE is', os.environ['ENG_ARCHIVE']) +import cheta.fetch_sci as fetch + +print("Fetch file is", fetch.__file__) +print("ENG_ARCHIVE is", os.environ["ENG_ARCHIVE"]) -msids = ('1crat', 'fptemp_11', 'orbitephem0_x', 'sim_z', 'tephin') +msids = ("1crat", "fptemp_11", "orbitephem0_x", "sim_z", "tephin") rootdir = os.path.dirname(__file__) for ifig, msid in enumerate(msids): - figure(ifig+1) - clf() - dat = fetch.MSID(msid, '2024:002', '2024:008', filter_bad=True) - dat5 = fetch.MSID(msid, '2024:002', '2024:008',stat='5min') - datday = fetch.MSID(msid, '2024:002', '2024:008', stat='daily') - subplot(3, 1, 1) - plot_cxctime(dat.times, dat.vals, '-b') - grid() - subplot(3, 1, 2) - plot_cxctime(dat5.times, dat5.means, '-r') - grid() - subplot(3, 1, 3) - plot_cxctime(datday.times, datday.means, '-c') - grid() - savefig(os.path.join(rootdir, 'plot_{0}.png'.format(msid))) + plt.figure(ifig + 1) + plt.clf() + dat = fetch.MSID(msid, "2024:002", "2024:008", filter_bad=True) + dat5 = fetch.MSID(msid, "2024:002", "2024:008", stat="5min") + datday = fetch.MSID(msid, "2024:002", "2024:008", stat="daily") + plt.subplot(3, 1, 1) + plot_cxctime(dat.times, dat.vals, "-b") + plt.grid() + plt.subplot(3, 1, 2) + plot_cxctime(dat5.times, dat5.means, "-r") + plt.grid() + plt.subplot(3, 1, 3) + plot_cxctime(datday.times, datday.means, "-c") + plt.grid() + plt.savefig(os.path.join(rootdir, "plot_{0}.png".format(msid)))