abeelen/nikamap

View on GitHub

Showing 43 of 72 total issues

File contmap.py has 1495 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import absolute_import, division, print_function

import warnings
from copy import deepcopy
from functools import partial
Severity: Major
Found in nikamap/contmap.py - About 3 days to fix

    ContMap has 37 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ContMap(NDDataArray):
        """A ContMap object represent a continuum map with additionnal capabilities.
    
        It contains the metadata, wcs, and all attribute (data/stddev/time/unit/mask) as well as potential source list detected in these maps.
    
    
    Severity: Minor
    Found in nikamap/contmap.py - About 4 hrs to fix

      File analysis.py has 364 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from __future__ import absolute_import, division, print_function
      
      import os
      import warnings
      import numpy as np
      Severity: Minor
      Found in nikamap/analysis.py - About 4 hrs to fix

        Function phot_sources has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            def phot_sources(
                self,
                sources=None,
                peak=True,
                psf=True,
        Severity: Minor
        Found in nikamap/contmap.py - About 4 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function to_hdus has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            def to_hdus(
                self,
                hdu_data="DATA",
                hdu_mask="MASK",
                hdu_uncertainty="UNCERT",
        Severity: Minor
        Found in nikamap/contmap.py - About 4 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function __init__ has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(
                self,
                major=None,
                minor=None,
                pa=None,
        Severity: Minor
        Found in nikamap/contmap.py - About 4 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function __init__ has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, filenames, n=None, ipython_widget=False, ignore_header=False, dataclass=NikaMap, **kwd):
                self.i = 0
                self.n = n
                self.dataclass = dataclass
                self.kwargs = kwd
        Severity: Minor
        Found in nikamap/analysis.py - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function _gen_reproject has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def _gen_reproject(self, coords, size, type="interp", pixel_scales=None, **kwargs):
                """Generate reprojected 2D cutout from a catalog of coordinates
        
                Parameters
                ----------
        Severity: Minor
        Found in nikamap/contmap.py - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function from_fits_header has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def from_fits_header(cls, hdr, unit=u.deg, pixscale=None):  # pragma: no cover
                """
                Instantiate the beam from a header. Attempts to extract the
                beam from standard keywords. Failing that, it looks for an
                AIPS-style HISTORY entry.
        Severity: Minor
        Found in nikamap/contmap.py - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function plot has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def plot(self, to_plot=None, ax=None, cbar=False, cat=None, levels=None, beam=False, **kwargs):
                """Convenience routine to plot the dataset.
        
                Parameters
                ----------
        Severity: Minor
        Found in nikamap/contmap.py - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function detect_sources has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def detect_sources(self, threshold=3, box_size=5, detect_on="snr"):
                """Detect sources with find local peaks above a specified threshold value.
        
                The detection is made on the SNR map, and return an :class`astropy.table.Table` with columns ``ID, ra, dec, SNR``.
                If fake sources are present, a match is made with a distance threshold of ``beam_fwhm / 3``
        Severity: Minor
        Found in nikamap/contmap.py - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function __init__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, data, *args, **kwargs):
                if "meta" not in kwargs:
                    kwargs["meta"] = kwargs.pop("header", None)
                if "header" in kwargs:
                    raise ValueError("can't have both header and meta.")
        Severity: Minor
        Found in nikamap/contmap.py - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function fake_data has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def fake_data(
        Severity: Major
        Found in nikamap/utils.py - About 1 hr to fix

          Function uncertainty has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def uncertainty(self, value):
                  if value is not None:
                      if isinstance(value, NDUncertainty):
                          if getattr(value, "_parent_nddata", None) is not None:
                              value = value.__class__(value, copy=False)
          Severity: Minor
          Found in nikamap/contmap.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function normalize_uncertainty has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def normalize_uncertainty(self, factor=None, method="check_SNR", **kwargs):
                  """Normalize the uncertainty.value
          
                  Parameters
                  ----------
          Severity: Minor
          Found in nikamap/contmap.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function fits_contmap_reader has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def fits_contmap_reader(
              filename,
              unit=None,
              hdu_data="DATA",
              hdu_uncertainty="UNCERT",
          Severity: Minor
          Found in nikamap/contmap.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in nikamap/contmap.py - About 1 hr to fix

            Function from_fits_history has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def from_fits_history(cls, hdr, pixscale=None):  # pragma: no cover
                    """
                    Instantiate the beam from an AIPS header. AIPS holds the beam
                    in history. This method of initializing uses the last such
                    entry.
            Severity: Minor
            Found in nikamap/contmap.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function phot_sources has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def phot_sources(
            Severity: Major
            Found in nikamap/contmap.py - About 1 hr to fix

              Function fits_contmap_reader has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def fits_contmap_reader(
              Severity: Major
              Found in nikamap/contmap.py - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language