tisane.AtMost.per

method

AtMost.per(cardinality=None, number_of_instances=None)

Express a per relationship on a given AtMost

Even though cardinality and number_of_instances are both optional parameters, this method requires exactly one of them to be specified – you currently cannot specify both.

Parameters
  • cardinality (AbstractVariable, optional) – The AbstractVariable whose cardinality we want to use

  • number_of_instances (AbstractVariable, optional) – The AbstractVariable whose number of instances we want to use

Returns

An object representing a “_ per _” relationship.

Return type

tisane.variable.Per

See also

tisane.Exactly.per

create a per relationship with an exact multiplier

Examples

Suppose we have a within-subjects study where participants are subjected to two conditions and can memorize a list of numbers at most five times in both conditions, before being tested.

>>> import tisane as ts
>>> from tisane import AtMost
>>> participant = ts.Unit(name="participant")
>>> condition = participant.nominal(name="condition",
...                                 cardinality=2,
...                                 number_of_instances=2)
>>> memorization_session_time = participant.numeric(
...                    name="learning_session_time",
...                    number_of_instances=AtMost(5).per(
...                              number_of_instances=condition))
>>> import tisane as ts
>>> variable = ts.Unit(name="variable", cardinality=5)
>>> atmost_five_per_variable = ts.AtMost(5).per(cardinality=variable)
>>> atmost_five_per_variable.value # this should be 5 * (cardinality of variable = 5)
25