alchemyst/Skogestad-Python

View on GitHub

Showing 98 of 668 total issues

File utils.py has 2314 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""
Created on Jan 27, 2012

@author: Carl Sandrock
Severity: Major
Found in robustcontrol/utils.py - About 6 days to fix

    File utilsplot.py has 1107 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    """
    Common features to plotting functions in this script
    
    Default parameters
    Severity: Major
    Found in robustcontrol/utilsplot.py - About 2 days to fix

      Function display_export_data has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
      Open

      def display_export_data(data, display_type, row_head, save=False, latex=False, width=None, sep='|'):
          """
          Create a table view of data. Data can also be exported for a csv file or
          LaTex tabular format. This function is ideal to display large amounts of
          data.
      Severity: Minor
      Found in robustcontrol/reporting.py - About 1 day 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_tf_coefficients has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
      Open

          def from_tf_coefficients(num, den, delays):
              """
              array-like: (numerator, denominator, delays)
              numerator, denominator, delays can either be in SISO form or MIMO form
              MIMO form e.g.:
      Severity: Minor
      Found in robustcontrol/InternalDelay.py - About 7 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 scaling has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

      def scaling(G_hat, e, u, input_type='symbolic', Gd_hat=None, d=None):
          """
          Receives symbolic matrix of plant and disturbance transfer functions
          as well as array of maximum deviations, scales plant variables according
          to eq () and ()
      Severity: Minor
      Found in robustcontrol/utils.py - About 7 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

      File InternalDelay.py has 424 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      """
      Created on Apr 19, 2019
      
      @author: Darren Roos (http://github.com/darren-roos/)
      Severity: Minor
      Found in robustcontrol/InternalDelay.py - About 6 hrs to fix

        Function rga_plot has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

        def rga_plot(G, w_start=-2, w_end=2, axlim=None, points=1000, fig=0,
                     plot_type='elements', input_label=None, output_label=None):
            """
            Plots the relative gain interaction between each output and input pairing
        
        
        Severity: Minor
        Found in robustcontrol/utilsplot.py - About 5 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 PEAK_MIMO has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

        def PEAK_MIMO(w_start, w_end, error_poles_direction, wr, deadtime_if=0):
            """
            This function is for multivariable system analysis of controllability.
            gives:
            minimum peak values on S and T with or without deadtime
        Severity: Minor
        Found in PEAK_MIMO.py - About 5 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

        File Chapter_05.py has 368 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from __future__ import division
        from __future__ import print_function
        
        import numpy as np
        import matplotlib.pyplot as plt
        Severity: Minor
        Found in robustcontrol/Chapter_05.py - About 4 hrs to fix

          Function multi_polylcm has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          def multi_polylcm(P):
              roots_list = [i.r.tolist() for i in P]
              roots_by_mult = []
              lcm_roots_by_mult = []
              for roots in roots_list:
          Severity: Minor
          Found in robustcontrol/utils.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 mimo_bode has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

          def mimo_bode(G, w_start=-2, w_end=2,
                        axlim=None, points=1000,
                        Kin=None, text=False, sv_all=False, legend_loc='best'):
              """
              Plots the max and min singular values of G and computes the crossover
          Severity: Minor
          Found in robustcontrol/utilsplot.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 tf_step has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

          def tf_step(G, t_end=10, initial_val=0, points=1000,
                      constraint=None, Y=None, method='numeric'):
              """
              Validate the step response data of a transfer function by considering dead
              time and constraints. A unit step response is generated.
          Severity: Minor
          Found in robustcontrol/utils.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 PEAK_MIMO has 92 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def PEAK_MIMO(w_start, w_end, error_poles_direction, wr, deadtime_if=0):
              """
              This function is for multivariable system analysis of controllability.
              gives:
              minimum peak values on S and T with or without deadtime
          Severity: Major
          Found in PEAK_MIMO.py - About 3 hrs to fix

            Function zeros has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

            def zeros(G=None, A=None, B=None, C=None, D=None):
                """
                Return the zeros of a multivariable transfer function system for with
                transfer functions or state-space. For transfer functions, Theorem 4.5
                (p139) is used. For state-space, the method from Equations 4.66 and 4.67
            Severity: Minor
            Found in robustcontrol/utils.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 step has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

            def step(G, t_end=100, initial_val=0, input_label=None,
                     output_label=None, points=1000):
                """
                This function is similar to the MatLab step function.
            
            
            Severity: Minor
            Found in robustcontrol/utilsplot.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 pole_zero_directions has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            def pole_zero_directions(G, vec, dir_type, display_type='a', e=1E-8, z_tol=1E-4, p_tol=1E-4):
                """
                Crude method to calculate the input and output direction of a pole or zero,
                from the SVD.
            
            
            Severity: Minor
            Found in robustcontrol/utils.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 num_denom has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            def num_denom(A, symbolic_expr=False):
            
                sym_den = 0
                sym_num = 0
                s = sympy.Symbol('s')
            Severity: Minor
            Found in robustcontrol/utils.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

            tf has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class tf(object):
                """
                Very basic transfer function object
            
                Construct with a numerator and denominator:
            Severity: Minor
            Found in robustcontrol/utils.py - About 2 hrs to fix

              mimotf has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class mimotf(object):
                  """ Represents MIMO transfer function matrix
              
                  This is a pretty basic wrapper around the numpy.matrix class which deals
                  with most of the heavy lifting.
              Severity: Minor
              Found in robustcontrol/utils.py - About 2 hrs to fix

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

                def Analyses_second_order(v, t, max_peeks):
                    """take vector of output (v) , time vector along with the outputs (t) and  time where the analyses stops (t_end)
                    scaled models are used in this analyses"""
                
                    # empty vectors for storing data
                Severity: Minor
                Found in Second_order.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

                Severity
                Category
                Status
                Source
                Language