tomopy/tomopy

View on GitHub

Showing 354 of 354 total issues

Function remove_outlier has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def remove_outlier(arr, dif, size=3, axis=0, ncore=None, out=None):
Severity: Minor
Found in source/tomopy/misc/corr.py - About 45 mins to fix

    Function pad has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def pad(arr, axis, npad=None, mode='constant', ncore=None, **kwargs):
    Severity: Minor
    Found in source/tomopy/misc/morph.py - About 45 mins to fix

      Function _retrieve_phase has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _retrieve_phase(tomo, phase_filter, px, py, prj, pad):
      Severity: Minor
      Found in source/tomopy/prep/phase.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if not isinstance(kwargs[key], np.float32):
                                kwargs[key] = np.array(value, dtype='float32')
        
                # Set kwarg defaults.
                for kw in allowed_kwargs[algorithm]:
        Severity: Major
        Found in source/tomopy/recon/algorithm.py - About 45 mins to fix

          Function remove_stripe_based_filtering has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def remove_stripe_based_filtering(tomo,
          Severity: Minor
          Found in source/tomopy/prep/stripe.py - About 45 mins to fix

            Function _rs_filter has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _rs_filter(sinogram, window, listsign, size, dim, pad):
            Severity: Minor
            Found in source/tomopy/prep/stripe.py - About 45 mins to fix

              Function median_filter_cuda has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def median_filter_cuda(arr, size=3, axis=0):
                  """
                  Apply median filter to 3D array along 0 axis with GPU support.
                  The winAllow is for A6000, Tian X support 3 to 8
              
              
              Severity: Minor
              Found in source/tomopy/misc/corr.py - About 45 mins 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_stripe_fw has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def _remove_stripe_fw(tomo, level, wname, sigma, pad):
                  dx, dy, dz = tomo.shape
                  nx = dx
                  if pad:
                      nx = dx + dx // 8
              Severity: Minor
              Found in source/tomopy/prep/stripe.py - About 45 mins 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

                                    rec[0].shape[0] - obj[0].shape[0],
              Severity: Minor
              Found in benchmarking/phantom.py and 1 other location - About 45 mins to fix
              benchmarking/phantom.py on lines 135..135

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

              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

                                    rec[0].shape[1] - obj[0].shape[1])
              Severity: Minor
              Found in benchmarking/phantom.py and 1 other location - About 45 mins to fix
              benchmarking/phantom.py on lines 134..134

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

              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 find_ctest_token has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def find_ctest_token():
                  """
                  Add authentification token if it exists
                  """
                  token_string = os.environ.get("CTEST_TOKEN")
              Severity: Minor
              Found in benchmarking/__init__.py - About 45 mins 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 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def build_name_append(item, separate=True, prefix="[", suffix="]", check=True, reset=False):
              Severity: Minor
              Found in benchmarking/__init__.py - About 45 mins to fix

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

                    list_metric = distribute_jobs(np.float32(list_shift),
                                                  _calculate_metric, axis=0,
                                                  args=(sino, flip_sino, comp_sino, mask),
                Severity: Minor
                Found in source/tomopy/recon/rotation.py and 1 other location - About 40 mins to fix
                source/tomopy/recon/rotation.py on lines 350..352

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

                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

                    list_metric = distribute_jobs(np.float32(list_shift),
                                                  _calculate_metric, axis=0,
                                                  args=(sino, flip_sino, comp_sino, mask),
                Severity: Minor
                Found in source/tomopy/recon/rotation.py and 1 other location - About 40 mins to fix
                source/tomopy/recon/rotation.py on lines 321..323

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

                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 ifft(x, n=None, axis=-1, overwrite_input=False, extra_info=None):
                        return mkl_fft.ifft(x, n=n, axis=axis, overwrite_x=overwrite_input)
                Severity: Minor
                Found in source/tomopy/util/misc.py and 1 other location - About 40 mins to fix
                source/tomopy/util/misc.py on lines 123..124

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

                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

                    if tomo.shape[1] != len(theta):
                        msg = 'There must be one angle for every projection.'
                        raise ValueError(msg)
                Severity: Minor
                Found in source/tomopy/recon/algorithm.py and 1 other location - About 40 mins to fix
                source/tomopy/recon/algorithm.py on lines 318..320

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

                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

                    if tomo.shape[0] != len(center_arr):
                        msg = 'There must be one center for every slice.'
                        raise ValueError(msg)
                Severity: Minor
                Found in source/tomopy/recon/algorithm.py and 1 other location - About 40 mins to fix
                source/tomopy/recon/algorithm.py on lines 265..267

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

                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 get_nproc():
                    """ Get the number of processes """
                    try:
                        from mpi4py import MPI
                        comm_w = MPI.COMM_WORLD
                Severity: Minor
                Found in source/tomopy/util/mproc.py and 1 other location - About 40 mins to fix
                source/tomopy/util/mproc.py on lines 84..91

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

                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 fft(x, n=None, axis=-1, overwrite_input=False, extra_info=None):
                        return mkl_fft.fft(x, n=n, axis=axis, overwrite_x=overwrite_input)
                Severity: Minor
                Found in source/tomopy/util/misc.py and 1 other location - About 40 mins to fix
                source/tomopy/util/misc.py on lines 127..128

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

                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 get_rank():
                    """ Get the rank of the process """
                    try:
                        from mpi4py import MPI
                        comm_w = MPI.COMM_WORLD
                Severity: Minor
                Found in source/tomopy/util/mproc.py and 1 other location - About 40 mins to fix
                source/tomopy/util/mproc.py on lines 94..101

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

                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

                Severity
                Category
                Status
                Source
                Language