Skip to content

mnns.units

Characteristic units for a nanowire network.

Classes:

Name Description
NWNUnits

Class for characteristic units for a nanowire network. Acts similar to a

Functions:

Name Description
get_units

Deprecated. Use mnns.NWNUnits

NWNUnits

NWNUnits(new_units: dict[str, float] = None)

Class for characteristic units for a nanowire network. Acts similar to a dictionary with key-value pairs to access units.

The default units for the nanowire network are:

units = mnns.NWNUnits()
print(units)
      v0: 1.0     V, Voltage
     Ron: 10.0    Ω, ON Junction resistance
      l0: 7.0     μm, Wire length
      D0: 50.0    nm, Wire diameter
      w0: 10.0    nm, Junction length (2x Wire coating thickness)
    rho0: 22.6    nΩm, Wire resistivity
     mu0: 0.01    μm^2 s^-1 V^-1, Ion mobility
Roff_Ron: 160     Off-On Resistance ratio
      i0: 0.1     A, Current
      t0: 10000.0 μs, Time

Parameters:

Name Type Description Default
new_units NWNUnits or dict

Dictionary of any custom units to use. Only base units can be altered.

None

Attributes:

Name Type Description
units dict

Dictionary of characteristic units.

Source code in mnns/units.py
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
def __init__(self, new_units: dict[str, float] = None):
    if isinstance(new_units, NWNUnits):
        # Copy from previous NWNUnits instance
        self.units = new_units.units.copy()
        self.update_derived_units()

    else:
        # Set default and derived units
        self.units = self.default_units.copy()
        self.update_derived_units()

        # Update units and derived units for any new units
        if new_units is not None:
            for key, value in new_units.items():
                self[key] = value

get_units

get_units(
    new_units: dict[str, float] = None,
) -> dict[str, float]

Deprecated. Use mnns.NWNUnits instead.

Returns the characteristic units for a nanowire network.

Parameters:

Name Type Description Default
new_units dict

Dictionary of any custom units to use. Only base units can be altered.

None

Returns:

Name Type Description
units dict

Dictionary of characteristic units.

Source code in mnns/units.py
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
def get_units(new_units: dict[str, float] = None) -> dict[str, float]:
    """
    Deprecated. Use [`mnns.NWNUnits`](units.md#mnns.units.NWNUnits)
    instead.

    Returns the characteristic units for a nanowire network.

    Parameters
    ----------
    new_units : dict, optional
        Dictionary of any custom units to use. Only base units can be altered.

    Returns
    -------
    units : dict
        Dictionary of characteristic units.

    """
    if new_units is None:
        new_units = dict()

    # Base units
    units = {  # Unit, Description
        "v0": 1.0,  # V, Voltage
        "Ron": 10.0,  # Ω, ON junction resistance
        "l0": 7.0,  # μm, Wire length
        "D0": 50.0,  # nm, Wire diameter
        "w0": 10.0,  # nm, Junction length (2x Wire coating thickness)
        "rho0": 22.6,  # nΩm, Wire resistivity
        "mu0": 1e-2,  # μm^2 s^-1 V^-1, Ion mobility
        "Roff_Ron": 160,  # none, Off-On Resistance ratio
    }

    # Add any custom units
    units.update(new_units)

    # Derived units
    units["i0"] = units["v0"] / units["Ron"]  # A, Current
    units["t0"] = units["w0"] ** 2 / (units["mu0"] * units["v0"])  # μs, Time

    return units