RandomVariable

class photonforge.monte_carlo.RandomVariable(name, parent=None, *, value=None, stdev=None, values=None, value_range=None)
Parameters:
  • name – Name of the random variable.

  • parent – Parent object to the variable. Instance of photonforge.Component, photonforge.Model, or photonforge.Technology.

  • value – Mean variable value (normal distribution).

  • stdev – Standard deviation for the value (normal distribution).

  • values – Sequence of values (discrete set of values).

  • value_range – Lower and upper value bounds (uniform distribution).

Note

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

Methods

set_by_cdf(cdf)

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

size()

Size of this variable, if countable.

Attributes

name

Random variable name.

parent

Random variable parent.

properties

Object properties.

type

Random variable type (read only).

value

Current random variable value (read only).

value_spec

Value specification for this variable, interpreted based on the variable type (read only).

name

Random variable name.

parent

Random variable parent.

properties

Object properties.

Type:

Properties

set_by_cdf(cdf)

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

Parameters:

cdf – CDF value.

Returns:

New variable value.

size()

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.

type

Random variable type (read only).

value

Current random variable value (read only).

value_spec

Value specification for this variable, interpreted based on the variable type (read only).