Skip to content

monte_carlo.RandomVariable

RandomVariable(
name,
parent=None,
*,
value=None,
stdev=None,
values=None,
value_range=None,
)

Args

  • name (str): Name of the random variable.
  • parent (Component | Model | Technology | None): Parent object to the variable. Instance of Component, Model, or Technology.
  • value (float | int | complex | None): Mean variable value (normal distribution).
  • stdev (float | int | None): Standard deviation for the value (normal distribution).
  • values (Sequence[float | int | complex] | None): Sequence of values (discrete set of values).
  • value_range (Sequence[float | int] | None): Lower and upper value bounds (uniform distribution).

Note

If a value if set with no standard deviation, the variable assumes the fixed value.

See Also

Cascaded MZI Filter

MethodDescription
set_by_cdfSet the value of this variable from a cumulative distribution function
sizeSize of this variable, if countable.

set_by_cdf(self, cdf)

Set the value of this variable from a cumulative distribution function (CDF) value in range 0 to 1.

Args

  • cdf (float): CDF value.

Returns

New variable value.

size(self)

Size of this variable, if countable.

Fixed-value variables have a size of 1, whereas the size of variables with a discrete value set are the number of options in the set. Variables with normal or uniform distributions nahe no size and will return None.

Returns

Variable size or None.

AttributeDescription
namestr: Random variable name.
parentComponent | Model | Technology | None: Random variable parent.
propertiesProperties: Object properties.
typestr: Random variable type (read only).
valueobject: Current random variable value (read only).
value_specdict[str, object]: Value specification for this variable, interpreted based on the variable type (read only).

str: Random variable name.

Component | Model | Technology | None: Random variable parent.

Properties: Object properties.

str: Random variable type (read only).

object: Current random variable value (read only).

dict[str, object]: Value specification for this variable, interpreted based on the variable type (read only).