tomopy/tomopy

View on GitHub
source/tomopy/util/extern/recon.py

Summary

Maintainability
F
3 wks
Test Coverage

File recon.py has 462 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

# #########################################################################
# Copyright (c) 2015-2019, UChicago Argonne, LLC. All rights reserved.    #
Severity: Minor
Found in source/tomopy/util/extern/recon.py - About 7 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 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 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 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 c_tv has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

              Function c_fbp has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

                Function c_bart has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

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

                  Function c_ospml_quad has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

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

                    Function c_sirt has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

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

                      Function c_osem has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

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

                        Function c_project2 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def c_project2(objx, objy, center, tomo, theta):
                        Severity: Minor
                        Found in source/tomopy/util/extern/recon.py - About 35 mins to fix

                          Function c_grad has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

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

                            Function c_ospml_hybrid has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

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

                              Function c_tikh has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

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

                                Function c_art has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

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

                                  Function c_pml_quad has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

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

                                    Function c_mlem has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

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

                                      Function c_pml_hybrid has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

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

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

                                        def c_sirt(tomo, center, recon, theta, **kwargs):
                                        
                                            if kwargs['accelerated']:
                                                return c_accel_sirt(tomo, center, recon, theta, **kwargs)
                                        
                                        
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 1 other location - About 2 days to fix
                                        source/tomopy/util/extern/recon.py on lines 261..290

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

                                        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 c_mlem(tomo, center, recon, theta, **kwargs):
                                        
                                            if kwargs['accelerated']:
                                                return c_accel_mlem(tomo, center, recon, theta, **kwargs)
                                        
                                        
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 1 other location - About 2 days to fix
                                        source/tomopy/util/extern/recon.py on lines 426..455

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

                                        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 c_pml_quad(tomo, center, recon, theta, **kwargs):
                                            if len(tomo.shape) == 2:
                                                # no y-axis (only one slice)
                                                dy = 1
                                                dt, dx = tomo.shape
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 1 other location - About 2 days to fix
                                        source/tomopy/util/extern/recon.py on lines 369..394

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

                                        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 c_pml_hybrid(tomo, center, recon, theta, **kwargs):
                                            if len(tomo.shape) == 2:
                                                # no y-axis (only one slice)
                                                dy = 1
                                                dt, dx = tomo.shape
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 1 other location - About 2 days to fix
                                        source/tomopy/util/extern/recon.py on lines 398..423

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

                                        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 c_ospml_quad(tomo, center, recon, theta, **kwargs):
                                            if len(tomo.shape) == 2:
                                                # no y-axis (only one slice)
                                                dy = 1
                                                dt, dx = tomo.shape
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 1 other location - About 1 day to fix
                                        source/tomopy/util/extern/recon.py on lines 318..340

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

                                        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 c_ospml_hybrid(tomo, center, recon, theta, **kwargs):
                                            if len(tomo.shape) == 2:
                                                # no y-axis (only one slice)
                                                dy = 1
                                                dt, dx = tomo.shape
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 1 other location - About 1 day to fix
                                        source/tomopy/util/extern/recon.py on lines 344..366

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                        def c_bart(tomo, center, recon, theta, **kwargs):
                                            if len(tomo.shape) == 2:
                                                # no y-axis (only one slice)
                                                dy = 1
                                                dt, dx = tomo.shape
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 2 other locations - About 1 day to fix
                                        source/tomopy/util/extern/recon.py on lines 294..315
                                        source/tomopy/util/extern/recon.py on lines 503..524

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                        def c_tikh(tomo, center, recon, theta, **kwargs):
                                            if len(tomo.shape) == 2:
                                                # no y-axis (only one slice)
                                                dy = 1
                                                dt, dx = tomo.shape
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 2 other locations - About 1 day to fix
                                        source/tomopy/util/extern/recon.py on lines 214..235
                                        source/tomopy/util/extern/recon.py on lines 294..315

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                        def c_osem(tomo, center, recon, theta, **kwargs):
                                            if len(tomo.shape) == 2:
                                                # no y-axis (only one slice)
                                                dy = 1
                                                dt, dx = tomo.shape
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 2 other locations - About 1 day to fix
                                        source/tomopy/util/extern/recon.py on lines 214..235
                                        source/tomopy/util/extern/recon.py on lines 503..524

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                        def c_fbp(tomo, center, recon, theta, **kwargs):
                                            if len(tomo.shape) == 2:
                                                # no y-axis (only one slice)
                                                dy = 1
                                                dt, dx = tomo.shape
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 2 other locations - About 1 day to fix
                                        source/tomopy/util/extern/recon.py on lines 457..477
                                        source/tomopy/util/extern/recon.py on lines 480..500

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                        def c_grad(tomo, center, recon, theta, **kwargs):
                                            if len(tomo.shape) == 2:
                                                # no y-axis (only one slice)
                                                dy = 1
                                                dt, dx = tomo.shape
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 2 other locations - About 1 day to fix
                                        source/tomopy/util/extern/recon.py on lines 238..258
                                        source/tomopy/util/extern/recon.py on lines 457..477

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                        def c_tv(tomo, center, recon, theta, **kwargs):
                                            if len(tomo.shape) == 2:
                                                # no y-axis (only one slice)
                                                dy = 1
                                                dt, dx = tomo.shape
                                        Severity: Major
                                        Found in source/tomopy/util/extern/recon.py and 2 other locations - About 1 day to fix
                                        source/tomopy/util/extern/recon.py on lines 238..258
                                        source/tomopy/util/extern/recon.py on lines 480..500

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

                                        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

                                        There are no issues that match your filters.

                                        Category
                                        Status