tisane.AtMost¶

class tisane.AtMost(value)

An upper bound of a number of instances

Used to represent when the number of instances of a data variable has a ceiling. Should be given to the `number_of_instances` parameter of `Unit.nominal()`, `Unit.numeric()`, or `Unit.ordinal()`.

Parameters

value (int or AbstractVariable) – The value of the upper bound. If an `tisane.variable.AbstractVariable`, then the cardinality of value is used as the upper bound.

Examples

A study using MTurkers allowed the MTurkers to participate in the study at most 20 times.

```>>> import tisane as ts
>>> mturker = ts.Unit(name="mturker_id")
>>> response = mturker.ordinal(name="response", number_of_instances=AtMost(20))
```

Methods

 `per`([cardinality, number_of_instances]) Express a per relationship on a given AtMost
 get_value is_equal_to_one is_greater_than_one
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

`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
```