tomopy/tomopy

View on GitHub

Showing 354 of 354 total issues

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

                cnr_y_guess = q.row_func(
                    np.gradient(
                        medfilt(
                            np.std(
                                q.img,
Severity: Minor
Found in source/tomopy/prep/alignment.py and 1 other location - About 55 mins to fix
source/tomopy/prep/alignment.py on lines 660..664

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

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

def main(args):

    print("using tomopy: {}".format(tomopy.__file__))

    global image_quality
Severity: Minor
Found in benchmarking/phantom.py - About 55 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 3 locations. Consider refactoring.
Open

def remove_stripe_based_sorting(tomo,
                                size=None,
                                dim=1,
                                ncore=None,
                                nchunk=None):
Severity: Major
Found in source/tomopy/prep/stripe.py and 2 other locations - About 55 mins to fix
source/tomopy/prep/stripe.py on lines 182..211
source/tomopy/prep/stripe.py on lines 524..559

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

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

    _sx = ndimage.sobel(_img, axis=0, mode='reflect') - \
        ndimage.sobel(_rec, axis=0, mode='reflect')
Severity: Minor
Found in source/tomopy/misc/benchmark.py and 1 other location - About 55 mins to fix
source/tomopy/misc/benchmark.py on lines 259..260

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

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 remove_stripe_ti(tomo, nblock=0, alpha=1.5, ncore=None, nchunk=None):
    """
    Remove horizontal stripes from sinogram using Titarenko's
    approach :cite:`Miqueles:14`.

Severity: Major
Found in source/tomopy/prep/stripe.py and 2 other locations - About 55 mins to fix
source/tomopy/prep/stripe.py on lines 367..401
source/tomopy/prep/stripe.py on lines 524..559

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

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

    smax = np.int16(np.clip(smax + cen_fliplr, 0, ncol - 1) - cen_fliplr)
Severity: Minor
Found in source/tomopy/recon/rotation.py and 1 other location - About 55 mins to fix
source/tomopy/recon/rotation.py on lines 311..311

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

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 fft2(x, s=None, axes=(-2,-1), overwrite_input=False, extra_info=None):
        return mkl_fft.fft2(x, shape=s, axes=axes, overwrite_x=overwrite_input)
Severity: Minor
Found in source/tomopy/util/misc.py and 1 other location - About 55 mins to fix
source/tomopy/util/misc.py on lines 135..136

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

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 remove_large_stripe has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def remove_large_stripe(tomo,
Severity: Major
Found in source/tomopy/prep/stripe.py - About 50 mins to fix

    Function _run_accel_algorithm has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _run_accel_algorithm(idx, _func, tomo, center, recon, *_args, **_kwargs):
    Severity: Major
    Found in source/tomopy/recon/algorithm.py - About 50 mins to fix

      Function remove_stripe_based_interpolation has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def remove_stripe_based_interpolation(tomo,
      Severity: Major
      Found in source/tomopy/prep/stripe.py - About 50 mins to fix

        Function remove_all_stripe has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def remove_all_stripe(tomo,
        Severity: Major
        Found in source/tomopy/prep/stripe.py - About 50 mins to fix

          Function inpainter_morph has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def inpainter_morph(
          Severity: Major
          Found in source/tomopy/misc/corr.py - About 50 mins to fix

            Function _search_fine has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _search_fine(sino, srad, step, init_cen, ratio, drop, ncore=None):
            Severity: Major
            Found in source/tomopy/recon/rotation.py - About 50 mins to fix

              Function stripes_mask3d has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def stripes_mask3d(weights,
              Severity: Major
              Found in source/tomopy/prep/stripe.py - About 50 mins 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 normalize has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def normalize(
                  Severity: Major
                  Found in source/tomopy/prep/normalize.py - About 50 mins to fix

                    Function remove_stripe_fw has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def remove_stripe_fw(tomo,
                    Severity: Major
                    Found in source/tomopy/prep/stripe.py - About 50 mins to fix

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

                          if not sinogram_order:
                              # rotate to radiograph order
                              tomo = np.swapaxes(tomo, 0, 1)  # doesn't copy data
                              # copy data to sharedmem
                              tomo = dtype.as_sharedmem(tomo, copy=True)
                      Severity: Major
                      Found in source/tomopy/sim/project.py and 2 other locations - About 50 mins to fix
                      source/tomopy/sim/project.py on lines 331..335
                      source/tomopy/sim/project.py on lines 464..468

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

                      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

                                  y_higher = min(arr.shape[2], y_idx + (size // 2) + 1)
                      Severity: Minor
                      Found in source/tomopy/misc/corr.py and 1 other location - About 50 mins to fix
                      source/tomopy/misc/corr.py on lines 332..332

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

                      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

                                  x_higher = min(arr.shape[1], x_idx + (size // 2) + 1)
                      Severity: Minor
                      Found in source/tomopy/misc/corr.py and 1 other location - About 50 mins to fix
                      source/tomopy/misc/corr.py on lines 334..334

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

                      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