tomopy/tomopy

View on GitHub

Showing 176 of 354 total issues

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

def detector_drift_adjust_aps_1id(imgstacks,
                                  slit_cnr_ref,
                                  medfilt2_kernel_size=3,
                                  medfilt_kernel_size=3,
                                  ncore=None,
Severity: Minor
Found in source/tomopy/prep/alignment.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

File benchmark.py has 257 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# #########################################################################
# Copyright (c) 2015, UChicago Argonne, LLC. All rights reserved.         #
Severity: Minor
Found in source/tomopy/misc/benchmark.py - About 2 hrs to fix

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

    def stripes_mask3d(weights,
                       threshold=0.6,
                       min_stripe_length=20,
                       min_stripe_depth=10,
                       min_stripe_width=5,
    Severity: Minor
    Found in source/tomopy/prep/stripe.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 main has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(arg):
    
        import multiprocessing as mp
        default_ncores = mp.cpu_count()
        default_type = "partial"
    Severity: Minor
    Found in benchmarking/rec.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

    File phantom.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    
    """TomoPy script to reconstruct a built-in phantom."""
    
    
    Severity: Minor
    Found in benchmarking/phantom.py - About 2 hrs to fix

      Function c_vector3 has 16 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def c_vector3(tomo1, tomo2, tomo3, center1, center2, center3, recon1,
      Severity: Major
      Found in source/tomopy/util/extern/recon.py - About 2 hrs to fix

        Function align_seq has 13 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def align_seq(
        Severity: Major
        Found in source/tomopy/prep/alignment.py - About 1 hr to fix

          Function vector3 has 13 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def vector3(tomo1, tomo2, tomo3, theta1, theta2, theta3, center1=None, center2=None, center3=None, num_iter=1, axis1=0, axis2=1, axis3=2):
          Severity: Major
          Found in source/tomopy/recon/vector.py - About 1 hr to fix

            Function align_joint has 13 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def align_joint(
            Severity: Major
            Found in source/tomopy/prep/alignment.py - About 1 hr to fix

              Function run has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def run(phantom, algorithm, args, get_recon=False):
                  """Run reconstruction benchmarks for phantoms.
              
                  Parameters
                  ----------
              Severity: Minor
              Found in benchmarking/phantom.py - About 1 hr to fix

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

                def normalize_nf(
                    tomo,
                    flats,
                    dark,
                    flat_loc,
                Severity: Minor
                Found in source/tomopy/prep/normalize.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 align_joint has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                def align_joint(
                        prj, ang, fdir='./', iters=10, pad=(0, 0),
                        blur=True, center=None, algorithm='sirt',
                        upsample_factor=10, rin=0.5, rout=0.8,
                        save=False, debug=True):
                Severity: Minor
                Found in source/tomopy/prep/alignment.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 remove_ring has 12 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def remove_ring(
                Severity: Major
                Found in source/tomopy/misc/corr.py - About 1 hr to fix

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

                  def c_vector2(tomo1, tomo2, center1, center2, recon1, recon2, recon3,
                  Severity: Major
                  Found in source/tomopy/util/extern/recon.py - About 1 hr to fix

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

                    def write_center(
                            tomo, theta, dpath='tmp/center', cen_range=None, ind=None,
                            mask=False, ratio=1., sinogram_order=False, algorithm='gridrec', filter_name='parzen'):
                        """
                        Save images reconstructed with a range of rotation centers.
                    Severity: Minor
                    Found in source/tomopy/recon/rotation.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_recon has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _init_recon(shape, init_recon, val=1e-6, sharedmem=True, empty=False):
                        if init_recon is None:
                            if sharedmem:
                                recon = dtype.empty_shared_array(shape)
                                recon[:] = val
                    Severity: Minor
                    Found in source/tomopy/recon/algorithm.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 find_slits_corners_aps_1id has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def find_slits_corners_aps_1id(img,
                                                   method='quadrant+',
                                                   medfilt2_kernel_size=3,
                                                   medfilt_kernel_size=23,
                                                   ):
                    Severity: Minor
                    Found in source/tomopy/prep/alignment.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 c_stripesmask3d has 11 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def c_stripesmask3d(
                    Severity: Major
                    Found in source/tomopy/util/extern/prep.py - About 1 hr to fix

                      Function project3 has 11 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def project3(
                      Severity: Major
                      Found in source/tomopy/sim/project.py - About 1 hr to fix

                        Function ufo_dfi has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        def ufo_dfi(tomo, center, recon, theta, **kwargs):
                            """
                            Reconstruct object using UFO's Direct Fourier pipeline
                            """
                            import gi
                        Severity: Minor
                        Found in source/tomopy/recon/wrappers.py - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language