neuropsychology/NeuroKit.py

View on GitHub

Showing 90 of 176 total issues

File bio_ecg.py has 680 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""
Subsubmodule for ecg processing.
"""
import numpy as np
Severity: Major
Found in neurokit/bio/bio_ecg.py - About 1 day to fix

    Function ecg_EventRelated has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
    Open

    def ecg_EventRelated(epoch, event_length=1, window_post=0, features=["Heart_Rate", "Cardiac_Phase", "RR_Interval", "RSA", "HRV"]):
    """
    Extract event-related ECG changes.
     
    Parameters
    Severity: Minor
    Found in neurokit/bio/bio_ecg.py - About 1 day to fix

    File complexity.py has 524 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    import nolds
    import numpy as np
     
    # ==============================================================================
    Severity: Major
    Found in neurokit/signal/complexity.py - About 1 day to fix

      Function complexity has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

      def complexity(signal, sampling_rate=1000, shannon=True, sampen=True, multiscale=True, spectral=True, svd=True, correlation=True, higushi=True, petrosian=True, fisher=True, hurst=True, dfa=True, lyap_r=False, lyap_e=False, emb_dim=2, tolerance="default", k_max=8, bands=None, tau=1):
      """
      Computes several chaos/complexity indices of a signal (including entropy, fractal dimensions, Hurst and Lyapunov exponent etc.).
       
      Parameters
      Severity: Minor
      Found in neurokit/signal/complexity.py - About 6 hrs to fix

      Function compute_BMI has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

      def compute_BMI(height, weight, age, sex):
      """
      Returns the traditional BMI, the 'new' Body Mass Index and estimates the Body Fat Percentage (BFP; Deurenberg et al., 1991).
       
      Parameters
      Severity: Minor
      Found in neurokit/statistics/routines.py - About 6 hrs to fix

      Function eeg_complexity has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

      def eeg_complexity(eeg, sampling_rate, times=None, index=None, include="all", exclude=None, hemisphere="both", central=True, verbose=True, shannon=True, sampen=True, multiscale=True, spectral=True, svd=True, correlation=True, higushi=True, petrosian=True, fisher=True, hurst=True, dfa=True, lyap_r=False, lyap_e=False, names="Complexity"):
      """
      Compute complexity indices of epochs or raw object.
       
      DOCS INCOMPLETE :(
      Severity: Minor
      Found in neurokit/eeg/eeg_complexity.py - About 6 hrs to fix

      Function read_acqknowledge has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

      def read_acqknowledge(filename, path="", index="datetime", sampling_rate="max", resampling_method="pad", fill_interruptions=True, return_sampling_rate=True):
      """
      Read and Format a BIOPAC's AcqKnowledge file into a pandas' dataframe.
       
      Parameters
      Severity: Minor
      Found in neurokit/bio/bio_data.py - About 5 hrs to fix

      File bio_eda.py has 392 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      from __future__ import division
      import pandas as pd
      import numpy as np
      import biosppy
      Severity: Minor
      Found in neurokit/bio/bio_eda.py - About 5 hrs to fix

        Function ecg_hrv has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

        def ecg_hrv(rpeaks=None, rri=None, sampling_rate=1000, hrv_features=["time", "frequency", "nonlinear"]):
        """
        Computes the Heart-Rate Variability (HRV). Shamelessly stolen from the `hrv <https://github.com/rhenanbartels/hrv/blob/develop/hrv>`_ package by Rhenan Bartels. All credits go to him.
         
        Parameters
        Severity: Minor
        Found in neurokit/bio/bio_ecg.py - About 4 hrs to fix

        File routines.py has 355 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        from __future__ import division
        from .statistics import normal_range
        from .statistics import find_following_duplicates
        from .statistics import find_closest_in_list
        Severity: Minor
        Found in neurokit/statistics/routines.py - About 4 hrs to fix

          File bio_ecg_preprocessing.py has 345 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          """
          Subsubmodule for ecg processing.
          """
          import numpy as np
          Severity: Minor
          Found in neurokit/bio/bio_ecg_preprocessing.py - About 4 hrs to fix

            File eeg_microstates.py has 342 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """
            Microstates submodule.
            """
            from ..signal import complexity
            from ..miscellaneous import find_following_duplicates
            Severity: Minor
            Found in examples/UnderDev/eeg/eeg_microstates.py - About 4 hrs to fix

              Function eeg_select_electrodes has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

              def eeg_select_electrodes(eeg, include="all", exclude=None, hemisphere="both", central=True):
              """
              Returns electrodes/sensors names of selected region (according to a 10-20 EEG montage).
               
              Parameters
              Severity: Minor
              Found in neurokit/eeg/eeg_data.py - About 3 hrs to fix

              Function plot_eeg_erp has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

              def plot_eeg_erp(all_epochs, conditions=None, times=None, include="all", exclude=None, hemisphere="both", central=True, name=None, colors=None, gfp=False, ci=0.95, ci_alpha=0.333, invert_y=False, linewidth=1, linestyle="-", filter_hfreq=None):
              """
              DOCS INCOMPLETE :(
              """
              # Preserve original
              Severity: Minor
              Found in neurokit/eeg/eeg_erp.py - About 3 hrs to fix

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

              def eeg_erp(eeg, times=None, index=None, include="all", exclude=None, hemisphere="both", central=True, verbose=True, names="ERP", method="mean"):
              """
              DOCS INCOMPLETE :(
              """
              erp = {}
              Severity: Minor
              Found in neurokit/eeg/eeg_erp.py - About 3 hrs to fix

              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

              Function bio_process has 25 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def bio_process(ecg=None, rsp=None, eda=None, emg=None, add=None, sampling_rate=1000, age=None, sex=None, position=None, ecg_filter_type="FIR", ecg_filter_band="bandpass", ecg_filter_frequency=[3, 45], ecg_segmenter="hamilton", ecg_quality_model="default", ecg_hrv_features=["time", "frequency"], eda_alpha=8e-4, eda_gamma=1e-2, scr_method="makowski", scr_treshold=0.1, emg_names=None, emg_envelope_freqs=[10, 400], emg_envelope_lfreq=4, emg_activation_treshold="default", emg_activation_n_above=0.25, emg_activation_n_below=1):
              Severity: Major
              Found in neurokit/bio/bio_meta.py - About 3 hrs to fix

                File eeg_data.py has 290 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """
                Loading data and events submodule.
                """
                from ..signal import find_events
                 
                 
                Severity: Minor
                Found in neurokit/eeg/eeg_data.py - About 2 hrs to fix

                  Function plot_events_in_signal has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def plot_events_in_signal(signal, events_onsets, color="red", marker=None):
                  """
                  Plot events in signal.
                   
                  Parameters
                  Severity: Minor
                  Found in neurokit/signal/events.py - About 2 hrs to fix

                  Function plot_polarbar has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def plot_polarbar(scores, labels=None, labels_size=15, colors="default", distribution_means=None, distribution_sds=None, treshold=1.28, fig_size=(15, 15)):
                  """
                  Polar bar chart.
                   
                  Parameters
                  Severity: Minor
                  Found in neurokit/statistics/plot.py - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language