neuropsychology/NeuroKit.py

View on GitHub

Showing 90 of 176 total issues

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

    def predict_next_value(self):
        if len(self.burn) > 0:
            value = np.random.choice(self.burn)
            self.burn.remove(value)
            self.next_value = value
Severity: Minor
Found in neurokit/statistics/routines.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 ecg_process has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

def ecg_process(ecg, rsp=None, sampling_rate=1000, filter_type="FIR", filter_band="bandpass", filter_frequency=[3, 45], segmenter="hamilton", quality_model="default", hrv_features=["time", "frequency"], age=None, sex=None, position=None):
Severity: Major
Found in neurokit/bio/bio_ecg.py - About 1 hr to fix

    Function eda_process has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def eda_process(eda, sampling_rate=1000, alpha=8e-4, gamma=1e-2, filter_type = "butter", scr_method="makowski", scr_treshold=0.1):
        """
        Automated processing of EDA signal using convex optimization (CVXEDA; Greco et al., 2015).
    
        Parameters
    Severity: Minor
    Found in neurokit/bio/bio_eda.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 rsp_EventRelated has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def rsp_EventRelated(epoch, event_length, window_post=4):
        """
        Extract event-related respiratory (RSP) changes.
    
        Parameters
    Severity: Minor
    Found in neurokit/bio/bio_rsp.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_add_channel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def eeg_add_channel(raw, channel, sync_index_eeg=0, sync_index_channel=0, channel_type=None, channel_name=None):
        """
        Add a channel to a mne's Raw m/eeg file. It will basically synchronize the channel to the eeg data following a particular index and add it.
    
        Parameters
    Severity: Minor
    Found in neurokit/eeg/eeg_data.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 create_epochs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_epochs(data, events_onsets, sampling_rate=1000, duration=1, onset=0, index=None):
        """
        Epoching a dataframe.
    
        Parameters
    Severity: Minor
    Found in neurokit/signal/epochs.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_microstates_plot has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def eeg_microstates_plot(method, path="", extension=".png", show_sensors_position=False, show_sensors_name=False, plot=True, save=True, dpi=150, contours=0, colorbar=False, separate=False):
    Severity: Major
    Found in examples/UnderDev/eeg/eeg_microstates.py - About 1 hr to fix

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

        def plot_eeg_erp_topo(all_epochs, colors=None):
            """
            Plot butterfly plot.
        
            DOCS INCOMPLETE :(
        Severity: Minor
        Found in neurokit/eeg/eeg_erp.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 cvxEDA has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def cvxEDA(eda, sampling_rate=1000, tau0=2., tau1=0.7, delta_knot=10., alpha=8e-4, gamma=1e-2, solver=None, verbose=False, options={'reltol':1e-9}):
        Severity: Major
        Found in neurokit/bio/bio_eda.py - About 1 hr to fix

          Function eeg_erp has 10 arguments (exceeds 4 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"):
          Severity: Major
          Found in neurokit/eeg/eeg_erp.py - About 1 hr to fix

            Function eeg_add_events has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def eeg_add_events(raw, events_channel, conditions=None, treshold="auto", cut="higher", time_index=None, number="all", after=0, before=None, min_duration=1):
            Severity: Major
            Found in neurokit/eeg/eeg_data.py - About 1 hr to fix

              Function feature_reduction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              def feature_reduction(data, method, n_features):
                  """
                  Feature reduction.
              
                  Parameters
              Severity: Minor
              Found in examples/UnderDev/eeg/feature_reduction.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 ecg_rsa has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def ecg_rsa(rpeaks, rsp, sampling_rate=1000):
                  """
                  Returns Respiratory Sinus Arrhythmia (RSA) features. Only the Peak-to-trough (P2T) algorithm is currently implemented (see details).
              
                  Parameters
              Severity: Minor
              Found in neurokit/bio/bio_ecg.py - About 1 hr to fix

                Function segmenter_pekkanen has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                def segmenter_pekkanen(ecg, sampling_rate, window_size=5.0, lfreq=5.0, hfreq=15.0):
                    """
                    ECG R peak detection based on `Kathirvel et al. (2001) <http://link.springer.com/article/10.1007/s13239-011-0065-3/fulltext.html>`_ with some tweaks (mainly robust estimation of the rectified signal cutoff threshold).
                
                    Parameters
                Severity: Minor
                Found in neurokit/bio/bio_ecg_preprocessing.py - About 1 hr to fix

                  Function ecg_preprocess has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def ecg_preprocess(ecg, sampling_rate=1000, filter_type="FIR", filter_band="bandpass", filter_frequency=[3, 45], filter_order=0.3, segmenter="hamilton"):
                      """
                      ECG signal preprocessing.
                  
                      Parameters
                  Severity: Minor
                  Found in neurokit/bio/bio_ecg_preprocessing.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 bio_process has a Cognitive Complexity of 10 (exceeds 5 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):
                      """
                      Automated processing of bio signals. Wrapper for other bio processing functions.
                  
                      Parameters
                  Severity: Minor
                  Found in neurokit/bio/bio_meta.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 find_events has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def find_events(events_channel, treshold="auto", cut="higher", time_index=None, number="all", after=0, before=None, min_duration=1):
                  Severity: Major
                  Found in neurokit/signal/events.py - About 1 hr to fix

                    Function eeg_microstates_clustering has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def eeg_microstates_clustering(data, n_microstates=4, clustering_method="kmeans", n_jobs=1, n_init=25, occurence_rejection_treshold=0.05, max_refitting=5, verbose=True):
                    Severity: Major
                    Found in examples/UnderDev/eeg/eeg_microstates.py - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language