JASMINE-Mission/jasmine-imagesim

View on GitHub

Showing 41 of 2,807 total issues

File extract_json.py has 527 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import numpy as np
import os
import json
import dataclasses
from typing import List
Severity: Major
Found in src/jis/photonsim/extract_json.py - About 1 day to fix

    File mkimage_nosub.py has 312 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python3.8
    # -*- coding: utf-8 -*-
    """Make an image.
    
    .. code-block:: bash
    Severity: Minor
    Found in bin/mkimage_nosub.py - About 3 hrs to fix

      Function calc_aperture has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      def calc_aperture(N,EPD,Robs,Tsp):
          """
          This function calculates the aperture pattern and its area.
      
          The aperture pattern consists of a circular aperture
      Severity: Minor
      Found in src/jis/photonsim/aperture.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 set_custom has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      def set_custom(theta,psfarr,psfcenter,psfscale,pixdim,spixdim):
          import sys
      
          # psf array
          fpsfarr = (psfarr.flatten()).astype(np.float32)
      Severity: Minor
      Found in src/jis/pixsim/simpix_stable.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 emurate_pixlight_custom has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def emurate_pixlight_custom(theta_instant,psfarr,pixdim,spixdim,subtilex,subtiley,Nsubtilex, Nsubtiley,psfcenter,psfscale):
          #------------------------------------------------------
          ## emurating cuda pixlight_custom.h
          testpsf=np.zeros(pixdim)
          allpsf=np.zeros(pixdim*spixdim)
      Severity: Minor
      Found in src/jis/pixsim/simpix_stable.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 calc_ace has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def calc_ace(rg, N, T, ace):
          """    
          The ACE is assumed to have a power spectral distribution (PSD) 
          which consists of a white noise spectrum in low frequencies,
          a power-law function in high frequencies (index=-2), 
      Severity: Minor
      Found in src/jis/photonsim/ace.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 save_outputs has 14 arguments (exceeds 5 allowed). Consider refactoring.
      Open

      def save_outputs(filenames, output_format, control_params, telescope, detector, wfe, psf, pixcube_global, tplate, uniform_flat_interpix, uniform_flat_intrapix, acex, acey, overwrite):
      Severity: Major
      Found in src/jis/binutils/save.py - About 1 hr to fix

        Function save_outputs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def save_outputs(filenames, output_format, control_params, telescope, detector, wfe, psf, pixcube_global, tplate, uniform_flat_interpix, uniform_flat_intrapix, acex, acey, overwrite):
            """Saving the outputs."""
            # interpix flat
            if control_params.effect.flat_interpix is True:
                pf.writeto(filenames['interpix'],
        Severity: Minor
        Found in src/jis/binutils/save.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 save_outputs has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def save_outputs(filenames, output_format, control_params, telescope, detector, wfe, psf, pixcube_global, tplate, uniform_flat_interpix, uniform_flat_intrapix, acex, acey, overwrite):
            """Saving the outputs."""
            # interpix flat
            if control_params.effect.flat_interpix is True:
                pf.writeto(filenames['interpix'],
        Severity: Minor
        Found in src/jis/binutils/save.py - About 1 hr to fix

          Function gentransit has 12 arguments (exceeds 5 allowed). Consider refactoring.
          Open

          def gentransit(t, t0=0.0, Porb=14.0, Rp=1.0, Mp=1.0, Rs=0.2, Ms=0.15,\
          Severity: Major
          Found in src/jis/pixsim/transitmodel.py - About 1 hr to fix

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

            def check_output_directory(filenames, dirname_output, overwrite):
                """Checking the output directory.
            
                Args:
                   filenames: filename to be checked
            Severity: Minor
            Found in src/jis/binutils/setfiles.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 calc_response has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def calc_response(control_params, telescope, detector):
                """
                This function calculates the electron rate (e-/s/m^2) detected by Jasmine
                based on the optics efficiency (EPdefined) and the quantum efficiency (QEdet).
                The target object is assumed to have an SED determined by the effective
            Severity: Minor
            Found in src/jis/photonsim/response.py - About 1 hr to fix

              Function calc_dummy_psf has 10 arguments (exceeds 5 allowed). Consider refactoring.
              Open

              def calc_dummy_psf(wfe, wN, WL, NP, Ntot, Stel, adata, M, aN, fN=520):
              Severity: Major
              Found in src/jis/photonsim/psf.py - About 1 hr to fix

                Function inject_transit has 10 arguments (exceeds 5 allowed). Consider refactoring.
                Open

                def inject_transit(p, t0, depth, ntime,\
                Severity: Major
                Found in src/jis/pixsim/transitmodel.py - About 1 hr to fix

                  Function emurate_pixlight_custom has 10 arguments (exceeds 5 allowed). Consider refactoring.
                  Open

                  def emurate_pixlight_custom(theta_instant,psfarr,pixdim,spixdim,subtilex,subtiley,Nsubtilex, Nsubtiley,psfcenter,psfscale):
                  Severity: Major
                  Found in src/jis/pixsim/simpix_stable.py - About 1 hr to fix

                    Function calc_psf has 10 arguments (exceeds 5 allowed). Consider refactoring.
                    Open

                    def calc_psf(wfe, wN, WL, NP, Ntot, Stel, adata, M, aN, fN=520):
                    Severity: Major
                    Found in src/jis/photonsim/psf.py - About 1 hr to fix

                      Function integrate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def integrate(pixar, jx, jy, texp, dt, det, raw=False, addnoise=True, digitize=True):
                          """
                          Summary:
                              This function integrates the pixar array
                              calculated by simpix with taking the sampling
                      Severity: Minor
                      Found in src/jis/pixsim/integrate.py - About 1 hr to fix

                        Function integrate has 9 arguments (exceeds 5 allowed). Consider refactoring.
                        Open

                        def integrate(pixar, jx, jy, texp, dt, det, raw=False, addnoise=True, digitize=True):
                        Severity: Major
                        Found in src/jis/pixsim/integrate.py - About 1 hr to fix

                          Function run_calc_psf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def run_calc_psf(control_params, telescope, detector, wfe):
                              """Making PSF.
                          
                              Args:
                                  control_params: control parameters
                          Severity: Minor
                          Found in src/jis/binutils/runphotonsim.py - About 55 mins 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 calc_psf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def calc_psf(wfe, wN, WL, NP, Ntot, Stel, adata, M, aN, fN=520):
                              """
                              This function calculates the psf in e-/sec/fp-cell
                              based on the wavefront error (wfe),
                              the spectral information (NP), and
                          Severity: Minor
                          Found in src/jis/photonsim/psf.py - About 55 mins 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

                          Severity
                          Category
                          Status
                          Source
                          Language