SessionQuota#
- class alfred3.quota.SessionQuota(nslots: int, exp, respect_version: bool = True, inclusive: bool = False, name: str = 'quota', abort_page=None)[source]#
Bases:
object
A quota for experiment sessions.
The quota allows you to enforce an upper limit on the number of participants in your experiment.
- Parameters
nslots (int) – Maximum number of slots.
exp (alfred3.ExperimentSession) – Experiment session.
respect_version (bool) –
inclusive (bool) –
If False (default), the quota will only assign a slot, if there are no pending sessions for that slot. It will not assign a slot, if a session in that slot is finished, or if there is an ongoing session in that slot that has not yet timed out. You will end up with exactly as many participants, as specified in nslots.
If True, the quota will assign a slot, if there is no finished session in that slot. That means, there may be two ongoing sessions for the same slot, and both might end up to finish.
While inclusive=*False* may lead to participants being turned away before the experiment is really complete, inclusive=True may lead to more data being collected than necessary.
Defaults to False.
name (str) – An identifier for the quota. If you give this a custom value, you can use multiple quotas in the same experiment. Defaults to ‘quota’.
abort_page (alfred3.Page) – You can reference a custom page to be displayed to new participants, if the quota is full.
New in version 2.2.0.
Examples
A simple example on how to use the quota:
import alfred3 as al exp = al.Experiment() @exp.setup def setup(exp): quota = al.SessionQuota(10, exp) quota.count() exp += al.Page(title = "Hello, World!", name="hello_world")
Methods
Counts the experiment session associated with the quota.
Returns the next open slot.
Attributes
Indicates, whether all slots in the quota are finished.
True, if the randomizer has allocated all available slots.
Number of finished slots.
Number of open slots.
Number of slots in which a session is still ongoing.