tomopy/tomopy

View on GitHub

Showing 162 of 321 total issues

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

def main(args):

    print("using tomopy: {}".format(tomopy.__file__))

    global image_quality
Severity: Minor
Found in benchmarking/phantom.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 trim_sinogram has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def trim_sinogram(data, center, x, y, diameter):
    """
    Provide sinogram corresponding to a circular region of interest
    by trimming the complete sinogram of a compact object.

Severity: Minor
Found in source/tomopy/misc/morph.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 normalize_nf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def normalize_nf(tomo, flats, dark, flat_loc,
                 cutoff=None, ncore=None, out=None):
    """
    Normalize raw 3D projection data with flats taken more than once during
    tomography. Normalization for each projection is done with the mean of the
Severity: Minor
Found in source/tomopy/prep/normalize.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 remove_ring has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def remove_ring(rec,
                center_x=None,
                center_y=None,
                thresh=300.0,
                thresh_max=300.0,
Severity: Minor
Found in source/tomopy/misc/corr.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 _run_accel_algorithm has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _run_accel_algorithm(idx, _func, tomo, center, recon, *_args, **_kwargs):
Severity: Major
Found in source/tomopy/recon/algorithm.py - About 50 mins to fix

    Function remove_all_stripe has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def remove_all_stripe(tomo, snr=3, la_size=61, sm_size=21, dim=1,
    Severity: Major
    Found in source/tomopy/prep/stripe.py - About 50 mins to fix

      Function remove_large_stripe has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def remove_large_stripe(tomo, snr=3, size=51, drop_ratio=0.1, norm=True,
      Severity: Major
      Found in source/tomopy/prep/stripe.py - About 50 mins to fix

        Function normalize_nf has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def normalize_nf(tomo, flats, dark, flat_loc,
        Severity: Major
        Found in source/tomopy/prep/normalize.py - About 50 mins to fix

          Function remove_stripe_based_interpolation has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def remove_stripe_based_interpolation(tomo, snr=3, size=31, drop_ratio=0.1,
          Severity: Major
          Found in source/tomopy/prep/stripe.py - About 50 mins to fix

            Function c_project3 has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def c_project3(objx, objy, objz, center, tomo, theta, axis):
            Severity: Major
            Found in source/tomopy/util/extern/recon.py - About 50 mins to fix

              Function _search_fine has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def _search_fine(sino, srad, step, init_cen, ratio, drop, ncore=None):
              Severity: Major
              Found in source/tomopy/recon/rotation.py - About 50 mins to fix

                Function remove_stripe_fw has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def remove_stripe_fw(
                Severity: Major
                Found in source/tomopy/prep/stripe.py - About 50 mins to fix

                  Function _retrieve_phase has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def _retrieve_phase(tomo, phase_filter, px, py, prj, pad):
                  Severity: Minor
                  Found in source/tomopy/prep/phase.py - About 45 mins to fix

                    Function remove_outlier1d has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def remove_outlier1d(arr, dif, size=3, axis=0, ncore=None, out=None):
                    Severity: Minor
                    Found in source/tomopy/misc/corr.py - About 45 mins to fix

                      Function find_center_vo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def find_center_vo(tomo, ind=None, smin=-50, smax=50, srad=6, step=0.25,
                                         ratio=0.5, drop=20, ncore=None):
                          """
                          Find rotation axis location using Nghia Vo's method. :cite:`Vo:14`.
                      
                      
                      Severity: Minor
                      Found in source/tomopy/recon/rotation.py - About 45 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def __init__(self, ncompare, nslice, nrows, ncols, solution=None, dtype=float):
                      Severity: Minor
                      Found in source/tomopy/misc/benchmark.py - About 45 mins to fix

                        Function c_vector has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def c_vector(tomo, center, recon1, recon2, theta, **kwargs):
                        Severity: Minor
                        Found in source/tomopy/util/extern/recon.py - About 45 mins to fix

                          Function median_filter_cuda has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def median_filter_cuda(arr, size=3, axis=0):
                              """
                              Apply median filter to 3D array along 0 axis with GPU support.
                              The winAllow is for A6000, Tian X support 3 to 8
                          
                          
                          Severity: Minor
                          Found in source/tomopy/misc/corr.py - About 45 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 get_ncore_nchunk has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def get_ncore_nchunk(axis_size, ncore=None, nchunk=None):
                              # limit chunk size to size of array along axis
                              if nchunk and nchunk > axis_size:
                                  nchunk = axis_size
                              # default ncore to max and limit number of cores to max number
                          Severity: Minor
                          Found in source/tomopy/util/mproc.py - About 45 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 distortion_correction_proj has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def distortion_correction_proj(tomo, xcenter, ycenter, list_fact,
                          Severity: Minor
                          Found in source/tomopy/prep/alignment.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language