neuropsychology/NeuroKit.py

View on GitHub
examples/UnderDev/eeg/eeg_time_frequency.py

Summary

Maintainability
D
1 day
Test Coverage

Function eeg_create_frequency_bands has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

def eeg_create_frequency_bands(bands="all", step=1):
    """
    Delta: 1-3Hz
    Theta: 4-7Hz
    Alpha1: 8-9Hz
Severity: Minor
Found in examples/UnderDev/eeg/eeg_time_frequency.py - About 3 hrs 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 eeg_power_per_epoch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def eeg_power_per_epoch(epochs, include="all", exclude=None, hemisphere="both", include_central=True, frequency_bands="all", time_start=0, time_end="max", fill_bads="NA", print_progression=True):
    """
    """


Severity: Minor
Found in examples/UnderDev/eeg/eeg_time_frequency.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 eeg_name_frequencies has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def eeg_name_frequencies(freqs):
    """
    Name frequencies according to standart classifications.

    Parameters
Severity: Minor
Found in examples/UnderDev/eeg/eeg_time_frequency.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 eeg_power_per_epoch has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

def eeg_power_per_epoch(epochs, include="all", exclude=None, hemisphere="both", include_central=True, frequency_bands="all", time_start=0, time_end="max", fill_bads="NA", print_progression=True):
Severity: Major
Found in examples/UnderDev/eeg/eeg_time_frequency.py - About 1 hr to fix

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

    def eeg_psd(raw, sensors_include="all", sensors_exclude=None, fmin=0.016, fmax=60, method="multitaper", proj=False):
    Severity: Major
    Found in examples/UnderDev/eeg/eeg_time_frequency.py - About 50 mins to fix

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

              if band == "Alpha1":
                  frequencies[band] = np.arange(8, 9+0.1, step)
      Severity: Major
      Found in examples/UnderDev/eeg/eeg_time_frequency.py and 8 other locations - About 45 mins to fix
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 216..217
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 218..219
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 222..223
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 224..225
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 226..227
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 228..229
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 230..231
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 232..233

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

              if band == "Gamma2":
                  frequencies[band] = np.arange(41, 50+0.1, step)
      Severity: Major
      Found in examples/UnderDev/eeg/eeg_time_frequency.py and 8 other locations - About 45 mins to fix
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 216..217
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 218..219
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 220..221
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 222..223
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 224..225
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 226..227
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 228..229
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 232..233

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

              if band == "Alpha2":
                  frequencies[band] = np.arange(10, 12+0.1, step)
      Severity: Major
      Found in examples/UnderDev/eeg/eeg_time_frequency.py and 8 other locations - About 45 mins to fix
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 216..217
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 218..219
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 220..221
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 224..225
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 226..227
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 228..229
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 230..231
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 232..233

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

              if band == "Beta1":
                  frequencies[band] = np.arange(13, 17+0.1, step)
      Severity: Major
      Found in examples/UnderDev/eeg/eeg_time_frequency.py and 8 other locations - About 45 mins to fix
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 216..217
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 218..219
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 220..221
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 222..223
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 226..227
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 228..229
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 230..231
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 232..233

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

              if band == "Delta":
                  frequencies[band] = np.arange(1, 3+0.1, step)
      Severity: Major
      Found in examples/UnderDev/eeg/eeg_time_frequency.py and 8 other locations - About 45 mins to fix
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 218..219
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 220..221
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 222..223
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 224..225
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 226..227
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 228..229
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 230..231
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 232..233

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

              if band == "Beta2":
                  frequencies[band] = np.arange(18, 30+0.1, step)
      Severity: Major
      Found in examples/UnderDev/eeg/eeg_time_frequency.py and 8 other locations - About 45 mins to fix
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 216..217
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 218..219
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 220..221
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 222..223
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 224..225
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 228..229
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 230..231
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 232..233

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

              if band == "Gamma1":
                  frequencies[band] = np.arange(31, 40+0.1, step)
      Severity: Major
      Found in examples/UnderDev/eeg/eeg_time_frequency.py and 8 other locations - About 45 mins to fix
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 216..217
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 218..219
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 220..221
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 222..223
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 224..225
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 226..227
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 230..231
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 232..233

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

              if band == "Theta":
                  frequencies[band] = np.arange(4, 7+0.1, step)
      Severity: Major
      Found in examples/UnderDev/eeg/eeg_time_frequency.py and 8 other locations - About 45 mins to fix
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 216..217
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 220..221
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 222..223
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 224..225
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 226..227
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 228..229
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 230..231
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 232..233

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

              if band == "Mu":
                  frequencies[band] = np.arange(8, 13+0.1, step)
      Severity: Major
      Found in examples/UnderDev/eeg/eeg_time_frequency.py and 8 other locations - About 45 mins to fix
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 216..217
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 218..219
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 220..221
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 222..223
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 224..225
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 226..227
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 228..229
      examples/UnderDev/eeg/eeg_time_frequency.py on lines 230..231

      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

      There are no issues that match your filters.

      Category
      Status