Skip to content

time

Frequency

Bases: PhysicalDimension

Frequency class inherited from Physical Dimension.

Source code in passive_auto_design\units\time.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class Frequency(PhysicalDimension):
    """
    Frequency class inherited from Physical Dimension.
    """

    unit = "Hz"

    def __init__(self, value, scale="lin", **data):
        super().__init__(value=value, scale=scale, **data)

    def to_time(self):
        """
        Convert the frequency to equivalent period.
        """
        if self.scale == "lin":
            return Time(value=1 / self.value, scale=self.scale)
        return Time(value=-self.value, scale=self.scale)

    def to_wavelength(self, eps_r: float = 1):
        """
        Convert the frequency to the equivalent wavelength.
        eps_r : relative permittivity of the medium used.
        """
        f_lin = self.lin()
        return PhysicalDimension(
            value=sqrt(eps_r) * c0 / f_lin.value, scale="lin", unit="m"
        )

    def fractionnal_bandwidth(self):
        """
        Return the fractionnal BandWidth in percent.
        """
        f_min = min(self.lin().value)
        f_max = max(self.lin().value)
        return 100 * abs(f_max - f_min) / sqrt(f_max * f_min)

fractionnal_bandwidth()

Return the fractionnal BandWidth in percent.

Source code in passive_auto_design\units\time.py
34
35
36
37
38
39
40
def fractionnal_bandwidth(self):
    """
    Return the fractionnal BandWidth in percent.
    """
    f_min = min(self.lin().value)
    f_max = max(self.lin().value)
    return 100 * abs(f_max - f_min) / sqrt(f_max * f_min)

to_time()

Convert the frequency to equivalent period.

Source code in passive_auto_design\units\time.py
16
17
18
19
20
21
22
def to_time(self):
    """
    Convert the frequency to equivalent period.
    """
    if self.scale == "lin":
        return Time(value=1 / self.value, scale=self.scale)
    return Time(value=-self.value, scale=self.scale)

to_wavelength(eps_r=1)

Convert the frequency to the equivalent wavelength. eps_r : relative permittivity of the medium used.

Source code in passive_auto_design\units\time.py
24
25
26
27
28
29
30
31
32
def to_wavelength(self, eps_r: float = 1):
    """
    Convert the frequency to the equivalent wavelength.
    eps_r : relative permittivity of the medium used.
    """
    f_lin = self.lin()
    return PhysicalDimension(
        value=sqrt(eps_r) * c0 / f_lin.value, scale="lin", unit="m"
    )

Time

Bases: PhysicalDimension

Time class inherited from Physical Dimension.

Source code in passive_auto_design\units\time.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class Time(PhysicalDimension):
    """
    Time class inherited from Physical Dimension.
    """

    unit = "s"

    def __init__(self, value, scale="lin", **data):
        super().__init__(value=value, scale=scale, **data)

    def to_freq(self):
        """
        Convert the period to equivalent frequency.
        """
        if self.scale == "lin":
            return Frequency(value=1 / self.value, scale=self.scale)
        return Frequency(value=-self.value, scale=self.scale)

to_freq()

Convert the period to equivalent frequency.

Source code in passive_auto_design\units\time.py
53
54
55
56
57
58
59
def to_freq(self):
    """
    Convert the period to equivalent frequency.
    """
    if self.scale == "lin":
        return Frequency(value=1 / self.value, scale=self.scale)
    return Frequency(value=-self.value, scale=self.scale)