From 47374abc0c53ceaafe3c1bbb7d9fc1c92d076ad8 Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Sat, 14 Sep 2019 15:17:55 -0400 Subject: [PATCH] PEP8 / flake8 fixes --- sparkles/__init__.py | 2 +- sparkles/core.py | 10 ++++------ sparkles/roll_optimize.py | 7 +++---- sparkles/tests/test_checks.py | 1 - 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sparkles/__init__.py b/sparkles/__init__.py index 67e928d..3ad9d38 100644 --- a/sparkles/__init__.py +++ b/sparkles/__init__.py @@ -1,6 +1,6 @@ __version__ = '4.3' -from .core import run_aca_review, ACAReviewTable +from .core import run_aca_review, ACAReviewTable # noqa def test(*args, **kwargs): diff --git a/sparkles/core.py b/sparkles/core.py index ac580e7..ca340a9 100644 --- a/sparkles/core.py +++ b/sparkles/core.py @@ -14,7 +14,7 @@ import matplotlib -matplotlib.use('Agg') +matplotlib.use('Agg') # noqa import matplotlib.pyplot as plt from matplotlib.patches import Circle @@ -174,7 +174,7 @@ def _run_aca_review(load_name=None, *, acars=None, make_html=True, report_dir=No if roll_level == 'all' or aca.messages >= roll_level: try: aca.get_roll_options() # sets roll_options, roll_info attributes - except Exception: # as err: + except Exception: # as err: err = traceback.format_exc() aca.add_message('critical', text=f'Running get_roll_options() failed: \n{err}') aca.roll_options = None @@ -607,7 +607,7 @@ def plot(self, ax=None, **kwargs): # Draw a circle at 735 pixels showing extent of CCD corners circle = Circle((0, 0), radius=735, facecolor='none', - edgecolor='g', alpha=0.5, lw=3) + edgecolor='g', alpha=0.5, lw=3) ax.add_patch(circle) # Plot a circle around stars that were not already candidates @@ -849,7 +849,7 @@ def sign(axis): # } def add_message(self, category, text, **kwargs): - """Add message to internal messages list. + r"""Add message to internal messages list. :param category: message category ('info', 'caution', 'warning', 'critical') :param text: message text @@ -916,7 +916,6 @@ def check_guide_count(self): msg += f' (likely MON star, check OR list)' self.add_message('caution', msg) - def check_pos_err_guide(self, star): """Warn on stars with larger POS_ERR (warning at 1" critical at 2") @@ -972,7 +971,6 @@ def check_too_bright_guide(self, star): agasc_id = star['id'] idx = self.get_id(agasc_id)['idx'] mag_err = star['mag_err'] - mag_aca_err = star['MAG_ACA_ERR'] * 0.01 for mult, category in ((2, 'critical'), (3, 'caution')): if star['mag'] - (mult * mag_err) < 5.8: diff --git a/sparkles/roll_optimize.py b/sparkles/roll_optimize.py index ad6fd24..fa3e83a 100644 --- a/sparkles/roll_optimize.py +++ b/sparkles/roll_optimize.py @@ -12,8 +12,7 @@ from astropy.table import Table, vstack from chandra_aca.star_probs import acq_success_prob, guide_count from chandra_aca.transform import (radec_to_yagzag, yagzag_to_pixels, - calc_aca_from_targ, calc_targ_from_aca, - snr_mag_for_t_ccd) + calc_aca_from_targ, calc_targ_from_aca) from Quaternion import Quat from proseco.characteristics import CCD @@ -222,8 +221,8 @@ def get_ids_list(roll_offsets): for uniq_ids in uniq_ids_sets: # print(uniq_ids - ids0, ids0 - uniq_ids) # for sid in uniq_ids - ids0: - # star = self.stars.get_id(sid) - # print(f'{sid} {star["mag"]} {star["yang"]} {star["zang"]}') + # star = self.stars.get_id(sid) + # print(f'{sid} {star["mag"]} {star["yang"]} {star["zang"]}') # This says that ``uniq_ids`` is a subset of available ``ids`` in # FOV for roll_offset in the list comprehension below. So everywhere diff --git a/sparkles/tests/test_checks.py b/sparkles/tests/test_checks.py index 008c9fb..7889d72 100644 --- a/sparkles/tests/test_checks.py +++ b/sparkles/tests/test_checks.py @@ -2,7 +2,6 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import agasc -import numpy as np from chandra_aca.transform import mag_to_count_rate from proseco import get_aca_catalog