Parameters - kwargs: Values for un-specified circuit components, ex: ``L=1e-9``. ' % ( label, label )) def _set_zeta ( self, ** kwargs ): ''' Sets the Qcircuit.zeta to the circuit eigenfrequencies (including the imaginary part due to losses). _no_value_components : try : kwargs except Exception : raise ValueError ( 'The value of %s should be specified with the keyword argument %s =. " "To be able to change it, you should re-build the circuit " "without specifying its value." ) else : raise ValueError ( ' %s is not the label of a circuit element' % key ) for label in self. components = ' " "has already been specified when building the circuit. _grounds = # Initialize a dictionary of components having a label, such that a component # with label 'L_1' can be obtained by ``ponents`` self. _network = _Network ( netlist ) # Converts the list of components into a network object # The Network object has methods to compute of the admittance between two nodes # or the tranfer function between two nodes and two others # We construct (enpty) lists of all the different type of # components that could be present in the circuit self. netlist = netlist # List of all components present in the circuit self. plotting_parameters_show = plotting_parameters_show self. plotting_parameters_normal_modes = plotting_parameters_normal_modes self. _plotting_normal_mode = False # Used to keep track of which imported plotting_settings to use # only set to true when show_normal_mode is called self. # After an initial estimation of the complex eigenfrequenceis using a diaglinalization # of the companion matrix, the frequencies are polishd to a tolerence # self.root_relative_tolerance using a gradient based root finder, with a maximum number of iterations self.root_max_iterations self. warn_discarded_mode = True # If this is set to True, the user will be notified when a mode is discarded. Q_min = 1 # Modes with have a quality factor below Q_min will not ignored self. Attributes: components (dict): Dictionary of components having a label, such that a component with label 'L_1' can be obtained by ``ponents`` Q_min (float): Modes with have a quality factor below Q_min will not ignored inductors (list): List of inductor objects present in the circuit resistors (list): List of inductor objects present in the circuit junctions (list): List of junction objects present in the circuit capacitors (list): List of capacitor objects present in the circuit netlist (list): List of all components present in the circuit ref_elt (J or L): list of junction or inductor component used as a reference for the calculation of zero-point fluctations, each index of the list corresponds to a different mode """ def _init_ ( self, netlist ): self. Parameters - s : string One of 'W', 'R', 'L', 'J', 'C', 'G', dicatates the type of component to create args, kwargs : Arguments needed for the component creation Returns - A component of type ``s`` ''' if s = 'W' : return W ( * arg, ** kwarg ) elif s = 'R' : return R ( * arg, ** kwarg ) elif s = 'L' : return L ( * arg, ** kwarg ) elif s = 'J' : return J ( * arg, ** kwarg ) elif s = 'C' : return C ( * arg, ** kwarg ) elif s = 'G' : return G ( * arg, ** kwarg ) class Qcircuit ( object ): """A class representing a quantum circuit. _name_, ( te - ts ) * 1000 )) return result return timed def string_to_component ( s, * arg, ** kwarg ): ''' Allows the creation of a Component object using a string. time () if PROFILING : print ( 'calling %r took %2.2f ms' % \ time () result = method ( * args, ** kw ) te = time. ''' def timed ( * args, ** kw ): ts = time. Only works the global variable PROFILING is set to True. plotting_settings import plotting_parameters_show, plotting_parameters_normal_modes except ImportError : # When running from source without pip installation from _constants import * from _utility import * from plotting_settings import plotting_parameters_show, plotting_parameters_normal_modes PROFILING = False def timeit ( method ): ''' Decorator which prints the time a function took to execute. Import sympy as sp from import lambdify import numpy as np from import Polynomial as npPoly from import Mul, Pow, Add from copy import deepcopy from numbers import Number from math import floor, factorial import os from subprocess import run import inspect import matplotlib.pyplot as plt import time from warnings import warn try : from.
0 Comments
Leave a Reply. |