tomopy/tomopy

View on GitHub

Showing 354 of 354 total issues

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

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

        def test_sirt(self):
            result = recon(self.prj, self.ang, algorithm='sirt', num_iter=4)
            assert_allclose(result, read_file('sirt.npy'), rtol=1e-2)
    Severity: Major
    Found in test/test_tomopy/test_recon/test_algorithm.py and 1 other location - About 1 hr to fix
    test/test_tomopy/test_recon/test_algorithm.py on lines 170..172

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

    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

        sc = np.array([p['a'], p['b'], p['c']], dtype=_dt).reshape(_shape)
    Severity: Major
    Found in source/tomopy/misc/phantom.py and 1 other location - About 1 hr to fix
    source/tomopy/misc/phantom.py on lines 414..414

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

    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

        def test_mlem(self):
            result = recon(self.prj, self.ang, algorithm='mlem', num_iter=4)
            assert_allclose(result, read_file('mlem.npy'), rtol=1e-2)
    Severity: Major
    Found in test/test_tomopy/test_recon/test_algorithm.py and 1 other location - About 1 hr to fix
    test/test_tomopy/test_recon/test_algorithm.py on lines 266..268

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

    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

        M0 = np.array([p['x0'], p['y0'], p['z0']], dtype=_dt).reshape(_shape)
    Severity: Major
    Found in source/tomopy/misc/phantom.py and 1 other location - About 1 hr to fix
    source/tomopy/misc/phantom.py on lines 415..415

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

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

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

              npad = ((0, 0), (pad[1], pad[1]), (pad[0], pad[0]))
          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 166..166

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

          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

              npad = ((0, 0), (pad[1], pad[1]), (pad[0], pad[0]))
          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 293..293

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

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

                  Severity
                  Category
                  Status
                  Source
                  Language