tomopy/tomopy

View on GitHub

Showing 176 of 354 total issues

Function main has 32 lines of code (exceeds 25 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 1 hr to fix

    Function c_inpainter has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function recon_accelerated has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def recon_accelerated(
      Severity: Major
      Found in source/tomopy/recon/acceleration.py - About 1 hr to fix

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

        def remove_outlier3d(arr, dif, size=3, ncore=None):
            """
            Selectively applies 3D median filter to a 3D array to remove outliers. Also
            called a dezinger.
        
        
        Severity: Minor
        Found in source/tomopy/misc/corr.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 write_center has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def write_center(
        Severity: Major
        Found in source/tomopy/recon/rotation.py - About 1 hr to fix

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

          def median_filter3d(arr, size=3, ncore=None):
              """
              Apply 3D median filter to a 3D array.
          
              .. versionadded:: 1.13
          Severity: Minor
          Found in source/tomopy/misc/corr.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 astra has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def astra(tomo, center, recon, theta, **kwargs):
              """
              Reconstruct object using the ASTRA toolbox
          
              Extra options
          Severity: Minor
          Found in source/tomopy/recon/wrappers.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 project2 has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

            Function run_pyctest has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def run_pyctest():
                '''
                Configure PyCTest and execute
                '''
                # run argparse, checkout source, copy over files
            Severity: Minor
            Found in pyctest_tomopy.py - About 1 hr to fix

              Function ufo_fbp has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

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

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

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

                  def astra_rec(tomo, center, recon, theta, vol_geom, niter, proj_type, gpu_index, opts):
                  Severity: Major
                  Found in source/tomopy/recon/wrappers.py - About 1 hr to fix

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

                    def find_center_vo(tomo, ind=None, smin=-50, smax=50, srad=6, step=0.25,
                    Severity: Major
                    Found in source/tomopy/recon/rotation.py - About 1 hr to fix

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

                      def lpmultigpu(lp, lpmethod, recon, tomo, num_iter, reg_par, gpu_list, lock, ids):
                      Severity: Major
                      Found in source/tomopy/recon/wrappers.py - About 1 hr to fix

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

                        def recon(tomo,
                        Severity: Major
                        Found in source/tomopy/recon/algorithm.py - About 1 hr to fix

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

                          def reconstruct(h5fname, sino, rot_center, args, blocked_views=None):
                          
                              # not setting this will cause issues on supercomputers
                              # allow user to override though
                              os.environ.setdefault("OMP_NUM_THREADS", "1")
                          Severity: Minor
                          Found in benchmarking/rec.py - About 1 hr to fix

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

                            def stripes_detect3d(tomo, size=10, radius=3, ncore=None):
                                """
                                Detect stripes in a 3D array. Usually applied to normalized projection
                                data. The algorithm is presented in the paper :cite:`Kazantsev:23`.
                            
                            
                            Severity: Minor
                            Found in source/tomopy/prep/stripe.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 output_images has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def output_images(rec, fpath, format="jpeg", scale=1, ncol=1):
                                """Save an image stack as a series of concatenated images.
                            
                                Each set of ncol images are concatenated horizontally and saved together
                                into files named {fpath}_0_{ncol}.{img_format},
                            Severity: Minor
                            Found in source/tomopy/misc/benchmark.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_seq has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def align_seq(
                                    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 build_name_append has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def build_name_append(item, separate=True, prefix="[", suffix="]", check=True, reset=False):
                                if reset:
                                    pyctest.BUILD_NAME = ""
                                # if not list, check if is None
                                if item is None or not item:
                            Severity: Minor
                            Found in benchmarking/__init__.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

                            Severity
                            Category
                            Status
                            Source
                            Language