lucasmiranda42/deepof

View on GitHub
deepof/post_hoc.py

Summary

Maintainability
F
5 days
Test Coverage

File post_hoc.py has 923 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# @author lucasmiranda42
# encoding: utf-8
# module deepof

"""Data structures and functions for analyzing supervised and unsupervised model results."""
Severity: Major
Found in deepof/post_hoc.py - About 2 days to fix

    Function align_deepof_kinematics_with_unsupervised_labels has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

    def align_deepof_kinematics_with_unsupervised_labels(
        deepof_project: coordinates,
        kin_derivative: int = 1,
        center: str = "Center",
        align: str = "Spine_1",
    Severity: Minor
    Found in deepof/post_hoc.py - About 6 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 recluster has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def recluster(
        coordinates: coordinates,
        embeddings: table_dict,
        soft_counts: table_dict = None,
        min_confidence: float = 0.75,
    Severity: Minor
    Found in deepof/post_hoc.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 compute_transition_matrix_per_condition has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def compute_transition_matrix_per_condition(
        embedding: table_dict,
        soft_counts: table_dict,
        breaks: table_dict,
        exp_conditions: dict,
    Severity: Minor
    Found in deepof/post_hoc.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 annotate_time_chunks has 14 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def annotate_time_chunks(
    Severity: Major
    Found in deepof/post_hoc.py - About 1 hr to fix

      Function select_time_bin has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def select_time_bin(
          embedding: table_dict = None,
          soft_counts: table_dict = None,
          breaks: table_dict = None,
          supervised_annotations: table_dict = None,
      Severity: Minor
      Found in deepof/post_hoc.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 condition_distance_binning has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def condition_distance_binning(
      Severity: Major
      Found in deepof/post_hoc.py - About 1 hr to fix

        Function enrichment_across_conditions has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def enrichment_across_conditions(
        Severity: Major
        Found in deepof/post_hoc.py - About 1 hr to fix

          Function align_deepof_kinematics_with_unsupervised_labels has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def align_deepof_kinematics_with_unsupervised_labels(
          Severity: Major
          Found in deepof/post_hoc.py - About 1 hr to fix

            Function recluster has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def recluster(
            Severity: Major
            Found in deepof/post_hoc.py - About 1 hr to fix

              Function compute_transition_matrix_per_condition has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def compute_transition_matrix_per_condition(
              Severity: Major
              Found in deepof/post_hoc.py - About 1 hr to fix

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

                def select_time_bin(
                Severity: Major
                Found in deepof/post_hoc.py - About 50 mins to fix

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

                  def separation_between_conditions(
                  Severity: Minor
                  Found in deepof/post_hoc.py - About 45 mins to fix

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

                    def _fit_hmm_range(concat_embeddings, states, min_states, max_states):
                        """Auxiliary function for fitting a range of HMMs with different number of states.
                    
                        Args:
                            concat_embeddings (np.ndarray): Concatenated embeddings across all animal experiments.
                    Severity: Minor
                    Found in deepof/post_hoc.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 explain_clusters has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def explain_clusters(
                    Severity: Minor
                    Found in deepof/post_hoc.py - About 35 mins to fix

                      Function train_supervised_cluster_detectors has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def train_supervised_cluster_detectors(
                      Severity: Minor
                      Found in deepof/post_hoc.py - About 35 mins to fix

                        Function annotate_time_chunks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def annotate_time_chunks(
                            deepof_project: coordinates,
                            soft_counts: table_dict,
                            breaks: table_dict,
                            supervised_annotations: table_dict = None,
                        Severity: Minor
                        Found in deepof/post_hoc.py - About 35 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 condition_distance_binning has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def condition_distance_binning(
                            embedding: table_dict,
                            soft_counts: table_dict,
                            breaks: table_dict,
                            exp_conditions: dict,
                        Severity: Minor
                        Found in deepof/post_hoc.py - About 35 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 separation_between_conditions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def separation_between_conditions(
                            cur_embedding: table_dict,
                            cur_soft_counts: table_dict,
                            cur_breaks: table_dict,
                            exp_conditions: dict,
                        Severity: Minor
                        Found in deepof/post_hoc.py - About 25 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

                        There are no issues that match your filters.

                        Category
                        Status