From 56e7044ad34524e700e9fcde8c7b16d22d899057 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 16:28:12 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v3.2.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v3.2.0...v4.6.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04cdf048..bf81bcb0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ exclude: '^/ccdproc/extern/.*.py|.*\.fits?$' # | .*\.fits?$ # Ignore FITS files repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.6.0 hooks: - id: check-yaml - id: end-of-file-fixer From 308f031723205029b8dc475c5e5b245ab35f747b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 16:29:10 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ccdproc/extern/bitfield.py | 75 ++++++++++++++------------ ccdproc/tests/data/README.rst | 1 - docs/_static/ccdproc.css | 1 - docs/_templates/autosummary/base.rst | 2 +- docs/_templates/autosummary/class.rst | 2 +- docs/_templates/autosummary/module.rst | 2 +- docs/conf.py | 48 +++++++++-------- docs/reduction_examples.rst | 1 - 8 files changed, 69 insertions(+), 63 deletions(-) diff --git a/ccdproc/extern/bitfield.py b/ccdproc/extern/bitfield.py index 13a194fe..427dfb90 100644 --- a/ccdproc/extern/bitfield.py +++ b/ccdproc/extern/bitfield.py @@ -15,12 +15,12 @@ import numpy as np -__version__ = '1.1.1' -__vdate__ = '30-January-2018' -__author__ = 'Mihai Cara' +__version__ = "1.1.1" +__vdate__ = "30-January-2018" +__author__ = "Mihai Cara" -__all__ = ['bitfield_to_boolean_mask', 'interpret_bit_flags', 'is_bit_flag'] +__all__ = ["bitfield_to_boolean_mask", "interpret_bit_flags", "is_bit_flag"] # Revision history: @@ -52,11 +52,16 @@ # the argument `bitfield` can hold. # 1.1.1 (30-January-2018) - Improved filtering of high bits in flags. # -INT_TYPE = (int, long,) if sys.version_info < (3,) else (int,) +INT_TYPE = ( + ( + int, + long, + ) + if sys.version_info < (3,) + else (int,) +) MAX_UINT_TYPE = np.uint64 -SUPPORTED_FLAGS = int(np.bitwise_not( - 0, dtype=MAX_UINT_TYPE, casting='unsafe' -)) +SUPPORTED_FLAGS = int(np.bitwise_not(0, dtype=MAX_UINT_TYPE, casting="unsafe")) def is_bit_flag(n): @@ -79,13 +84,12 @@ def is_bit_flag(n): if n < 1: return False - return bin(n).count('1') == 1 + return bin(n).count("1") == 1 def _is_int(n): - return ( - (isinstance(n, INT_TYPE) and not isinstance(n, bool)) or - (isinstance(n, np.generic) and np.issubdtype(n, np.integer)) + return (isinstance(n, INT_TYPE) and not isinstance(n, bool)) or ( + isinstance(n, np.generic) and np.issubdtype(n, np.integer) ) @@ -152,7 +156,7 @@ def interpret_bit_flags(bit_flags, flip_bits=None): allow_non_flags = False if _is_int(bit_flags): - return (~int(bit_flags) if flip_bits else int(bit_flags)) + return ~int(bit_flags) if flip_bits else int(bit_flags) elif bit_flags is None: if has_flip_bits: @@ -172,12 +176,12 @@ def interpret_bit_flags(bit_flags, flip_bits=None): bit_flags = str(bit_flags).strip() - if bit_flags.upper() in ['', 'NONE', 'INDEF']: + if bit_flags.upper() in ["", "NONE", "INDEF"]: return None # check whether bitwise-NOT is present and if it is, check that it is # in the first position: - bitflip_pos = bit_flags.find('~') + bitflip_pos = bit_flags.find("~") if bitflip_pos == 0: flip_bits = True bit_flags = bit_flags[1:].lstrip() @@ -188,8 +192,8 @@ def interpret_bit_flags(bit_flags, flip_bits=None): # basic check for correct use of parenthesis: while True: - nlpar = bit_flags.count('(') - nrpar = bit_flags.count(')') + nlpar = bit_flags.count("(") + nrpar = bit_flags.count(")") if nlpar == 0 and nrpar == 0: break @@ -197,22 +201,24 @@ def interpret_bit_flags(bit_flags, flip_bits=None): if nlpar != nrpar: raise ValueError("Unbalanced parantheses in bit flag list.") - lpar_pos = bit_flags.find('(') - rpar_pos = bit_flags.rfind(')') + lpar_pos = bit_flags.find("(") + rpar_pos = bit_flags.rfind(")") if lpar_pos > 0 or rpar_pos < (len(bit_flags) - 1): - raise ValueError("Incorrect syntax (incorrect use of " - "parenthesis) in bit flag list.") + raise ValueError( + "Incorrect syntax (incorrect use of " + "parenthesis) in bit flag list." + ) bit_flags = bit_flags[1:-1].strip() - if ',' in bit_flags: - bit_flags = bit_flags.split(',') + if "," in bit_flags: + bit_flags = bit_flags.split(",") - elif '+' in bit_flags: - bit_flags = bit_flags.split('+') + elif "+" in bit_flags: + bit_flags = bit_flags.split("+") else: - if bit_flags == '': + if bit_flags == "": raise ValueError( "Empty bit flag lists not allowed when either bitwise-NOT " "or parenthesis are present." @@ -221,7 +227,7 @@ def interpret_bit_flags(bit_flags, flip_bits=None): allow_non_flags = len(bit_flags) == 1 - elif hasattr(bit_flags, '__iter__'): + elif hasattr(bit_flags, "__iter__"): if not all([_is_int(flag) for flag in bit_flags]): raise TypeError("Each bit flag in a list must be an integer.") @@ -235,8 +241,9 @@ def interpret_bit_flags(bit_flags, flip_bits=None): bitmask = 0 for v in bitset: if not is_bit_flag(v) and not allow_non_flags: - raise ValueError("Input list contains invalid (not powers of two) " - "bit flags") + raise ValueError( + "Input list contains invalid (not powers of two) " "bit flags" + ) bitmask += v if flip_bits: @@ -245,8 +252,9 @@ def interpret_bit_flags(bit_flags, flip_bits=None): return bitmask -def bitfield_to_boolean_mask(bitfield, ignore_flags=0, flip_bits=None, - good_mask_value=True, dtype=np.bool_): +def bitfield_to_boolean_mask( + bitfield, ignore_flags=0, flip_bits=None, good_mask_value=True, dtype=np.bool_ +): r""" bitfield_to_boolean_mask(bitfield, ignore_flags=None, flip_bits=None, \ good_mask_value=True, dtype=numpy.bool\_) @@ -438,11 +446,10 @@ def bitfield_to_boolean_mask(bitfield, ignore_flags=0, flip_bits=None, ignore_mask = ignore_mask & SUPPORTED_FLAGS # invert the "ignore" mask: - ignore_mask = np.bitwise_not(ignore_mask, dtype=bitfield.dtype, - casting='unsafe') + ignore_mask = np.bitwise_not(ignore_mask, dtype=bitfield.dtype, casting="unsafe") mask = np.empty_like(bitfield, dtype=np.bool_) - np.bitwise_and(bitfield, ignore_mask, out=mask, casting='unsafe') + np.bitwise_and(bitfield, ignore_mask, out=mask, casting="unsafe") if good_mask_value: np.logical_not(mask, out=mask) diff --git a/ccdproc/tests/data/README.rst b/ccdproc/tests/data/README.rst index 732b274e..19905a3c 100644 --- a/ccdproc/tests/data/README.rst +++ b/ccdproc/tests/data/README.rst @@ -4,4 +4,3 @@ Data directory This directory contains data files included with the affiliated package source code distribution. Note that this is intended only for relatively small files - large files should be externally hosted and downloaded as needed. - diff --git a/docs/_static/ccdproc.css b/docs/_static/ccdproc.css index 78f60493..ed1fe4de 100644 --- a/docs/_static/ccdproc.css +++ b/docs/_static/ccdproc.css @@ -8,4 +8,3 @@ div.topbar a.brand { background-size: 32px 32px; } - diff --git a/docs/_templates/autosummary/base.rst b/docs/_templates/autosummary/base.rst index 9cabaf52..16217194 100644 --- a/docs/_templates/autosummary/base.rst +++ b/docs/_templates/autosummary/base.rst @@ -1,2 +1,2 @@ {% extends "autosummary_core/base.rst" %} -{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} \ No newline at end of file +{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} diff --git a/docs/_templates/autosummary/class.rst b/docs/_templates/autosummary/class.rst index 6b214a5c..0fa59f28 100644 --- a/docs/_templates/autosummary/class.rst +++ b/docs/_templates/autosummary/class.rst @@ -1,2 +1,2 @@ {% extends "autosummary_core/class.rst" %} -{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} \ No newline at end of file +{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} diff --git a/docs/_templates/autosummary/module.rst b/docs/_templates/autosummary/module.rst index f38315b2..230cd6e2 100644 --- a/docs/_templates/autosummary/module.rst +++ b/docs/_templates/autosummary/module.rst @@ -1,2 +1,2 @@ {% extends "autosummary_core/module.rst" %} -{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} \ No newline at end of file +{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} diff --git a/docs/conf.py b/docs/conf.py index cef63e81..94f48169 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # # Astropy documentation build configuration file. @@ -33,7 +32,9 @@ try: from sphinx_astropy.conf.v1 import * # noqa except ImportError: - print('ERROR: the documentation requires the sphinx-astropy package to be installed') + print( + "ERROR: the documentation requires the sphinx-astropy package to be installed" + ) sys.exit(1) if sys.version_info < (3, 11): @@ -50,7 +51,7 @@ # -- General configuration ---------------------------------------------------- # By default, highlight as Python 3. -highlight_language = 'python3' +highlight_language = "python3" # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.2' @@ -61,7 +62,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns.append('_templates') +exclude_patterns.append("_templates") # This is added to the end of RST files - a good place to put substitutions to # be used globally. @@ -103,64 +104,65 @@ # Add any paths that contain custom themes here, relative to this directory. # To use a different custom theme, add the directory containing the theme. -#html_theme_path = [] +# html_theme_path = [] # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. To override the custom theme, set this to the # name of a builtin theme or the name of a custom theme in html_theme_path. -#html_theme = 'bootstrap-ccdproc' +# html_theme = 'bootstrap-ccdproc' html_theme_options = { - 'logotext1': 'ccd', # white, semi-bold - 'logotext2': 'proc', # orange, light - 'logotext3': ':docs' # white, light + "logotext1": "ccd", # white, semi-bold + "logotext2": "proc", # orange, light + "logotext3": ":docs", # white, light } # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = '' +# html_logo = '' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = '' +# html_favicon = '' from os.path import join -html_favicon = join('_static', 'ccd_proc.ico') + +html_favicon = join("_static", "ccd_proc.ico") # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '' +# html_last_updated_fmt = '' # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -html_title = '{0} v{1}'.format(project, release) +html_title = f"{project} v{release}" # Output file base name for HTML help builder. -htmlhelp_basename = project + 'doc' +htmlhelp_basename = project + "doc" # Static files to copy after template files -html_static_path = ['_static'] -html_style = 'ccdproc.css' +html_static_path = ["_static"] +html_style = "ccdproc.css" # -- Options for LaTeX output ------------------------------------------------- # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [('index', project + '.tex', project + u' Documentation', - author, 'manual')] +latex_documents = [ + ("index", project + ".tex", project + " Documentation", author, "manual") +] # -- Options for manual page output ------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [('index', project.lower(), project + u' Documentation', - [author], 1)] +man_pages = [("index", project.lower(), project + " Documentation", [author], 1)] # -- Options for the edit_on_github extension --------------------------------- @@ -179,7 +181,7 @@ # edit_on_github_doc_root = "docs" # -- Resolving issue number to links in changelog ----------------------------- -github_issues_url = 'https://github.com/astropy/ccdproc/issues/' +github_issues_url = "https://github.com/astropy/ccdproc/issues/" # -- Turn on nitpicky mode for sphinx (to warn about references not found) ---- # diff --git a/docs/reduction_examples.rst b/docs/reduction_examples.rst index 4dcd24c3..c1a59c34 100644 --- a/docs/reduction_examples.rst +++ b/docs/reduction_examples.rst @@ -18,4 +18,3 @@ Here are some examples and different repositories using `ccdproc`. .. _reduceccd: https://github.com/rgbIAA/reduceccd .. _astrolib: https://github.com/yucelkilic/astrolib .. _mont4k_reduction: https://github.com/bjweiner/ARTN/tree/master/mont4k_pipeline -