tomopy/tomopy

View on GitHub

Showing 354 of 354 total issues

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                    coeff, _ = curve_fit(gauss1d, tmpx, tmpy,
                                         p0=[tmpy[0], tmpx[0], 5.0],
                                         maxfev=int(1e6),
    Severity: Major
    Found in source/tomopy/prep/alignment.py and 1 other location - About 1 hr to fix
    source/tomopy/prep/alignment.py on lines 673..675

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 41.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                    coeff, _ = curve_fit(gauss1d, tmpx, tmpy,
                                         p0=[tmpy[0], tmpx[0], 5.0],
                                         maxfev=int(1e6),
    Severity: Major
    Found in source/tomopy/prep/alignment.py and 1 other location - About 1 hr to fix
    source/tomopy/prep/alignment.py on lines 689..691

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 41.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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 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 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 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 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 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 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 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 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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            ltest_im[16:, :, :32 ] = ltest_im[:16, :, :32][:,:,::-1]
                    Severity: Major
                    Found in test/test_tomopy/test_misc/test_morph.py and 1 other location - About 1 hr to fix
                    test/test_tomopy/test_misc/test_morph.py on lines 75..75

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 39.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            rtest_im[16:, :, -32:] = rtest_im[:16, :, -32:][:,:,::-1]
                    Severity: Major
                    Found in test/test_tomopy/test_misc/test_morph.py and 1 other location - About 1 hr to fix
                    test/test_tomopy/test_misc/test_morph.py on lines 72..72

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 39.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                    def init_shared(
                    Severity: Major
                    Found in source/tomopy/util/mproc.py - About 1 hr to fix

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

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

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

                        def c_sample(
                        Severity: Major
                        Found in source/tomopy/util/extern/misc.py - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language