q-optimize/c3

View on GitHub

Showing 160 of 330 total issues

File chip.py has 1062 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Component class and subclasses for the components making up the quantum device."""
import copy
import warnings

import numpy as np
Severity: Major
Found in c3/libraries/chip.py - About 2 days to fix

    File devices.py has 988 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import os
    import tempfile
    import hjson
    from typing import Callable, Dict, Any, List
    import tensorflow as tf
    Severity: Major
    Found in c3/generator/devices.py - About 2 days to fix

      File propagation.py has 744 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      "A library for propagators and closely related functions"
      import numpy as np
      import tensorflow as tf
      from typing import Dict
      from c3.model import Model
      Severity: Major
      Found in c3/libraries/propagation.py - About 1 day to fix

        File fidelities.py has 715 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """Library of fidelity functions."""
        
        import numpy as np
        import tensorflow as tf
        from typing import List, Dict
        Severity: Major
        Found in c3/libraries/fidelities.py - About 1 day to fix

          File model.py has 631 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """The model class, containing information on the system and its modelling."""
          import warnings
          import numpy as np
          import hjson
          import itertools
          Severity: Major
          Found in c3/model.py - About 1 day to fix

            File experiment.py has 621 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """
            Experiment class that models and simulates the whole experiment.
            
            It combines the information about the model of the quantum device, the control stack
            and the operations that can be done on the device.
            Severity: Major
            Found in c3/experiment.py - About 1 day to fix

              File algorithms.py has 561 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              """
              Collection of (optimization) algorithms. All entries share a common signature with
              optional arguments.
              """
              
              
              Severity: Major
              Found in c3/libraries/algorithms.py - About 1 day to fix

                File envelopes.py has 494 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """
                Library of envelope functions.
                
                All functions assume the input of a time vector and return complex amplitudes.
                """
                Severity: Minor
                Found in c3/libraries/envelopes.py - About 7 hrs to fix

                  File qt_utils.py has 471 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  """Useful functions to get basis vectors and matrices of the right size."""
                  import itertools
                  import numpy as np
                  from typing import List
                  from scipy.linalg import block_diag as scipy_block_diag
                  Severity: Minor
                  Found in c3/utils/qt_utils.py - About 7 hrs to fix

                    File c3_backend.py has 468 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import uuid
                    import time
                    import numpy as np
                    import logging
                    import warnings
                    Severity: Minor
                    Found in c3/qiskit/c3_backend.py - About 7 hrs to fix

                      File parametermap.py has 426 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      """ParameterMap class"""
                      
                      from typing import List, Dict, Tuple
                      import hjson
                      import copy
                      Severity: Minor
                      Found in c3/parametermap.py - About 6 hrs to fix

                        File tf_utils.py has 420 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        """Various utility functions to speed up tensorflow coding."""
                        
                        import numpy as np
                        import tensorflow as tf
                        from tensorflow.python.client import device_lib
                        Severity: Minor
                        Found in c3/utils/tf_utils.py - About 6 hrs to fix

                          Function cmaes has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def cmaes(x_init, fun=None, fun_grad=None, grad_lookup=None, options={}):
                              """
                              Wrapper for the pycma implementation of CMA-Es. See also:
                          
                              http://cma.gforge.inria.fr/apidocs-pycma/
                          Severity: Minor
                          Found in c3/libraries/algorithms.py - About 5 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

                          File modellearning.py has 385 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          """Object that deals with the model learning."""
                          
                          import os
                          import time
                          import pickle
                          Severity: Minor
                          Found in c3/optimizers/modellearning.py - About 5 hrs to fix

                            Function leakage_RB has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def leakage_RB(
                                propagators,
                                min_length: int = 5,
                                max_length: int = 500,
                                num_lengths: int = 20,
                            Severity: Minor
                            Found in c3/libraries/fidelities.py - About 4 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 process has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def process(
                                    self, instr: Instruction, chan: str, signal: List[Dict[str, Any]]
                                ) -> dict:
                                    # TODO check somewhere that there is only 1 carrier per instruction
                                    ts = self.create_ts(instr.t_start, instr.t_end, centered=True)
                            Severity: Minor
                            Found in c3/generator/devices.py - About 4 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

                            File optimizer.py has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            """Optimizer object, where the optimal control is done."""
                            
                            import os
                            import time
                            from typing import Callable, Union, List, Dict, Optional, Any
                            Severity: Minor
                            Found in c3/optimizers/optimizer.py - About 4 hrs to fix

                              Quantity has 33 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Quantity:
                                  """
                                  Represents any physical quantity used in the model or the pulse
                                  specification. For arithmetic operations just the numeric value is used. The
                                  value itself is stored in an optimizer friendly way as a float between -1
                              Severity: Minor
                              Found in c3/c3objs.py - About 4 hrs to fix

                                File c3objs.py has 332 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                """Basic custom objects."""
                                
                                import hjson
                                from typing import List
                                import numpy as np
                                Severity: Minor
                                Found in c3/c3objs.py - About 4 hrs to fix

                                  File gates.py has 331 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import hjson
                                  import numpy as np
                                  import tensorflow as tf
                                  from c3.c3objs import C3obj, Quantity, hjson_encode
                                  from c3.signal.pulse import Envelope, Carrier
                                  Severity: Minor
                                  Found in c3/signal/gates.py - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language