neuropsychology/NeuroKit.py

View on GitHub

Showing 90 of 176 total issues

Function plot_polarbar has 8 arguments (exceeds 4 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)):
Severity: Major
Found in neurokit/statistics/plot.py - About 1 hr to fix

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

    def emg_process(emg, sampling_rate=1000, emg_names=None, envelope_freqs=[10, 400], envelope_lfreq=4, activation_treshold="default", activation_n_above=0.25, activation_n_below=1):
    Severity: Major
    Found in neurokit/bio/bio_emg.py - About 1 hr to fix

      Function find_closest_in_list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def find_closest_in_list(number, array, direction="both", strictly=False):
          """
          Find the closest number in the array from x.
      
          Parameters
      Severity: Minor
      Found in neurokit/statistics/statistics.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

      Function ecg_wave_detector has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def ecg_wave_detector(ecg, rpeaks):
          """
          Returns the localization of the P, Q, T waves. This function needs massive help!
      
          Parameters
      Severity: Minor
      Found in neurokit/bio/bio_ecg_preprocessing.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

      Function eeg_to_all_evokeds has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def eeg_to_all_evokeds(all_epochs, conditions=None):
          """
          Convert all_epochs to all_evokeds.
      
          DOCS INCOMPLETE :(
      Severity: Minor
      Found in neurokit/eeg/eeg_data.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

      Function ecg_preprocess has 7 arguments (exceeds 4 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"):
      Severity: Major
      Found in neurokit/bio/bio_ecg_preprocessing.py - About 50 mins 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

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

          def read_acqknowledge(filename, path="", index="datetime", sampling_rate="max", resampling_method="pad", fill_interruptions=True, return_sampling_rate=True):
          Severity: Major
          Found in neurokit/bio/bio_data.py - About 50 mins to fix

            Function eda_process has 7 arguments (exceeds 4 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):
            Severity: Major
            Found in neurokit/bio/bio_eda.py - About 50 mins to fix

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

              def eeg_gfp_peaks(data, gflp_method='GFPL1', smoothing=False, smoothing_window=100, peak_method="wavelet", normalize=False):
              Severity: Minor
              Found in examples/UnderDev/eeg/eeg_microstates.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if key in complexity_features[epoch_index].keys():
                                        complexity_features[epoch_index][key].append(feature)
                                    else:
                                        complexity_features[epoch_index][key] = [feature]
                
                
                Severity: Major
                Found in neurokit/eeg/eeg_complexity.py - About 45 mins to fix

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

                  def complexity_entropy_shannon(signal):
                      """
                      Computes the shannon entropy. Copied from the `pyEntropy <https://github.com/nikdon/pyEntropy>`_ repo by tjugo.
                  
                      Parameters
                  Severity: Minor
                  Found in neurokit/signal/complexity.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 eeg_to_df has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def eeg_to_df(eeg, index=None, include="all", exclude=None, hemisphere="both", central=True):
                  Severity: Minor
                  Found in neurokit/eeg/eeg_data.py - About 45 mins to fix

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

                        def __init__(self, signal=[0, 100], treshold=0.50, burn=5, stop_n_inversions=False, prior_signal=[], prior_response=[]):
                    Severity: Minor
                    Found in neurokit/statistics/routines.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if isinstance(hrv[key], float):  # Avoid storing series or dataframes
                                              ECG_Response["ECG_HRV_" + key + "_Baseline"] = hrv[key]
                      
                                      # Compute differences between features and baseline
                                      keys = [key for key in ECG_Response.keys() if '_Baseline' in key]  # Find keys
                      Severity: Major
                      Found in neurokit/bio/bio_ecg.py - About 45 mins to fix

                        Function ecg_process has a Cognitive Complexity of 8 (exceeds 5 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):
                            """
                            Automated processing of ECG and RSP signals.
                        
                            Parameters
                        Severity: Minor
                        Found in neurokit/bio/bio_ecg.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 eeg_add_channel has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def eeg_add_channel(raw, channel, sync_index_eeg=0, sync_index_channel=0, channel_type=None, channel_name=None):
                        Severity: Minor
                        Found in neurokit/eeg/eeg_data.py - About 45 mins to fix

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

                          def ecg_signal_quality(cardiac_cycles, sampling_rate, rpeaks=None, quality_model="default"):
                              """
                              Attempt to find the recording lead and the overall and individual quality of heartbeats signal. Although used as a routine, this feature is experimental.
                          
                              Parameters
                          Severity: Minor
                          Found in neurokit/bio/bio_ecg.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 save_nk_object has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def save_nk_object(obj, filename="file", path="", extension="nk", compress=False, compatibility=-1):
                          Severity: Minor
                          Found in neurokit/miscellaneous/data.py - About 45 mins to fix

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

                            def find_following_duplicates(array):
                                """
                                Find the duplicates that are following themselves.
                            
                                Parameters
                            Severity: Minor
                            Found in neurokit/statistics/statistics.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

                            Severity
                            Category
                            Status
                            Source
                            Language