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
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
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
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
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
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.
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.
"""
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.
"""
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
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
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
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
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/
- Read upRead up
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
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,
- Read upRead up
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)
- Read upRead up
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
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
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
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