Skip to content

substrate

Define all the object use to describe the substrate in which the structures are created.

Dielectric

define the dielectric property of a layer

Source code in passive_auto_design\substrate.py
18
19
20
21
22
23
24
25
26
class Dielectric:
    """
    define the dielectric property of a layer
    """

    def __init__(self, _epsilon, _tan_d=0.0, _roughness=0.0):
        self.epsilon = _epsilon
        self.tan_d = _tan_d
        self.roughness = _roughness

Layer

define a layer for a substrate

Source code in passive_auto_design\substrate.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class Layer:
    """
    define a layer for a substrate
    """

    def __init__(self, _name, _height, _metal, _dielectric):
        self.name = _name
        self.metal = _metal
        self.width = {"min": 1e-3, "max": 1e-3}
        self.gap = 1e-3
        self.dielectric = _dielectric
        self.height = _height

    def set_rules(self, _metal_w_min, _metal_w_max, _metal_gap_min):
        """
        Set the technological rules of the layer
        minimal and maximal width, and minimal gap
        """
        self.width = {"min": _metal_w_min, "max": _metal_w_max}
        self.gap = _metal_gap_min

set_rules(_metal_w_min, _metal_w_max, _metal_gap_min)

Set the technological rules of the layer minimal and maximal width, and minimal gap

Source code in passive_auto_design\substrate.py
42
43
44
45
46
47
48
def set_rules(self, _metal_w_min, _metal_w_max, _metal_gap_min):
    """
    Set the technological rules of the layer
    minimal and maximal width, and minimal gap
    """
    self.width = {"min": _metal_w_min, "max": _metal_w_max}
    self.gap = _metal_gap_min

Metal

define the metal property of a layer

Source code in passive_auto_design\substrate.py
 8
 9
10
11
12
13
14
15
class Metal:
    """
    define the metal property of a layer
    """

    def __init__(self, _rho, _roughness=0.0):
        self.rho = _rho
        self.roughness = _roughness

Substrate

contain all informations about a substrate

Source code in passive_auto_design\substrate.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
class Substrate:
    """
    contain all informations about a substrate
    """

    def __init__(self, _path=""):
        if _path != "":
            self.load(_path)
        else:
            self.sub = list()

    def add_layer(self, _layer):
        """
        add a layer on top of the last layer
        """
        self.sub.append(_layer)

    def get_index_of(self, _layer_name):
        """
        return the index of the first layer with the _layer_name name
        """
        index = -1
        for layer in self.sub:
            index = index + 1
            if layer.name == _layer_name:
                return index
        raise ValueError(f"No layer find with name: {_layer_name}")

    def dump(self, _path):
        """
        save the substrate as an yaml file
        """
        save_dir = _path.rsplit("/", 1)
        if len(save_dir) < 2:
            raise ValueError("incorrect path")
        if len(save_dir) == 2:
            os.makedirs(save_dir[0], exist_ok=True)
        with open(_path, "w+") as file:
            yaml.dump(self.sub, file)

    def load(self, _path):
        """
        load a yaml file to configure the substrate
        """
        with open(_path) as file:
            self.sub = yaml.full_load(file)

add_layer(_layer)

add a layer on top of the last layer

Source code in passive_auto_design\substrate.py
62
63
64
65
66
def add_layer(self, _layer):
    """
    add a layer on top of the last layer
    """
    self.sub.append(_layer)

dump(_path)

save the substrate as an yaml file

Source code in passive_auto_design\substrate.py
79
80
81
82
83
84
85
86
87
88
89
def dump(self, _path):
    """
    save the substrate as an yaml file
    """
    save_dir = _path.rsplit("/", 1)
    if len(save_dir) < 2:
        raise ValueError("incorrect path")
    if len(save_dir) == 2:
        os.makedirs(save_dir[0], exist_ok=True)
    with open(_path, "w+") as file:
        yaml.dump(self.sub, file)

get_index_of(_layer_name)

return the index of the first layer with the _layer_name name

Source code in passive_auto_design\substrate.py
68
69
70
71
72
73
74
75
76
77
def get_index_of(self, _layer_name):
    """
    return the index of the first layer with the _layer_name name
    """
    index = -1
    for layer in self.sub:
        index = index + 1
        if layer.name == _layer_name:
            return index
    raise ValueError(f"No layer find with name: {_layer_name}")

load(_path)

load a yaml file to configure the substrate

Source code in passive_auto_design\substrate.py
91
92
93
94
95
96
def load(self, _path):
    """
    load a yaml file to configure the substrate
    """
    with open(_path) as file:
        self.sub = yaml.full_load(file)