ihavalyova/DiAtomic

View on GitHub
diatomic/spectrum.py

Summary

Maintainability
C
1 day
Test Coverage

File spectrum.py has 526 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import io
import numpy as np
from .wavenumbers import calculate_wavenumbers_list, calculate_wavenumbers_list_with_obs

from scipy.interpolate import CubicSpline
Severity: Major
Found in diatomic/spectrum.py - About 1 day to fix

    Spectrum has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Spectrum:
    
        def __init__(self, H, dmfs=None, spec_type='absorption'):
            """Calculate the spectral quantities
    
    
    Severity: Minor
    Found in diatomic/spectrum.py - About 3 hrs to fix

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

          def _compute_rot_factors(self, usymm, lsymm, uj, lj, uomega,
      Severity: Major
      Found in diatomic/spectrum.py - About 1 hr to fix

        Function _interpolate_dipole_moment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def _interpolate_dipole_moment(self, igrid, dmfs):
        
                # dipole_matrix = np.ones((self.H.nch, self.H.nch, igrid.shape[0]))
                dipole_matrix = np.zeros((self.H.nch, self.H.nch, igrid.shape[0]))
        
        
        Severity: Minor
        Found in diatomic/spectrum.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 _compute_honl_london_factors has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _compute_honl_london_factors(self, usymm, lsymm, uj, lj, uomega,
        Severity: Major
        Found in diatomic/spectrum.py - About 1 hr to fix

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

              def set_constraints(self, uenr_range=None, lenr_range=None, lsymm=None,
          Severity: Major
          Found in diatomic/spectrum.py - About 1 hr to fix

            Function calculate_partition_functions has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def calculate_partition_functions(self, Ia=0, Ib=0, T=296,
            Severity: Minor
            Found in diatomic/spectrum.py - About 35 mins to fix

              Function calculate_Einstein_coefficients has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def calculate_Einstein_coefficients(self, wavens, dmfs=None, ninter=1000,
              Severity: Minor
              Found in diatomic/spectrum.py - About 35 mins to fix

                Function _get_default_jrange has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _get_default_jrange(self, uterms, uj, lterms, lj):
                Severity: Minor
                Found in diatomic/spectrum.py - About 35 mins to fix

                  Function _calculate_wavenumber_with_observations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _calculate_wavenumber_with_observations(self, ulevels, llevels, wrange=None,
                                                                  apply_rules=False):
                  
                          # id v J E p s iso lambda omega
                          ulevels = ulevels[:, [0, -3, 2, 1, 3, -4, 4, -2, -1]]
                  Severity: Minor
                  Found in diatomic/spectrum.py - About 35 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 _compute_honl_london_factors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _compute_honl_london_factors(self, usymm, lsymm, uj, lj, uomega,
                                                       lomega, ulambda, llambda):
                  
                          # n' E' J' p' iso' st' v' l' o' n E J p iso st v l o freq
                          # print(usymm, lsymm, uj, uomega, lomega, ulambda, llambda)
                  Severity: Minor
                  Found in diatomic/spectrum.py - About 35 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 _compute_line_strength has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _compute_line_strength(self, out_wavens, dmfs, ninter=1000):
                  
                          ivec_inds = out_wavens[:, 0].astype(np.int)
                          fvec_inds = out_wavens[:, 8].astype(np.int)
                  
                  
                  Severity: Minor
                  Found in diatomic/spectrum.py - About 25 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

                  There are no issues that match your filters.

                  Category
                  Status