Staircase paradigms
*******************

class psynet.trial.staircase.GeometricStaircaseChain(*args, **kwargs)

   Bases: "ChainNetwork"

   creation_time

      the time at which the Network was created.

   details

      a generic column for storing structured JSON data

   failed

      boolean indicating whether the Network has failed which prompts
      Dallinger to ignore it unless specified otherwise. Objects are
      usually failed to indicate something has gone wrong.

   failed_reason

      an optional reason the object was failed. If the object is
      failed as part of a cascading failure triggered from another
      object, the chain of objects will be captured in this field.

   full

      Whether the network is currently full

   id

      a unique number for every entry. 1, 2, 3 and so on...

   max_size

      How big the network can get, this number is used by the full()
      method to decide whether the network is full

   property1

      a generic column that can be used to store experiment-specific
      details in String form.

   property2

      a generic column that can be used to store experiment-specific
      details in String form.

   property3

      a generic column that can be used to store experiment-specific
      details in String form.

   property4

      a generic column that can be used to store experiment-specific
      details in String form.

   property5

      a generic column that can be used to store experiment-specific
      details in String form.

   role

      The role of the network. By default dallinger initializes all
      networks as either "practice" or "experiment"

   time_of_death

      the time at which failing occurred

   type

      A String giving the name of the class. Defaults to "network".
      This allows subclassing.

   vars

class psynet.trial.staircase.GeometricStaircaseNode(*args, **kwargs)

   Bases: "ChainNode"

   k

      The number of consecutive correct responses required to increase
      the difficulty. Defaults to 2, which corresponds to a
      2-up-1-down procedure.

      Type:
         int

   parameter

      The parameter that determines the difficulty of the task.

      Type:
         object

   reversal

      Whether the present node constitutes a 'reversal'. A reversal is
      a node where the difficulty changes direction. More formally, a
      node is a reversal if its parameter value was originally reached
      from one direction (e.g. ascending), but the parameter value of
      the next node changed in the opposite direction (e.g.
      descending). Reversals are often used for score estimation.

      Type:
         bool

   n_prev_correct

      The number of consecutive correct responses that have already
      occurred at the same difficulty level in the immediate preceding
      nodes, not including the present node.

      Type:
         int

   n_prev_reversals

      The number of reversals that have occurred before (but not
      including) the present node.

      Type:
         int

   last_difficulty_change

      The direction of the last difficulty change, potentially
      including any difficulty change that produced the current node.
      Can be either "increase" or "decrease".

      Type:
         str

   creation_time

      the time at which the Network was created.

   details

      a generic column for storing structured JSON data

   failed

      boolean indicating whether the Network has failed which prompts
      Dallinger to ignore it unless specified otherwise. Objects are
      usually failed to indicate something has gone wrong.

   failed_reason

      an optional reason the object was failed. If the object is
      failed as part of a cascading failure triggered from another
      object, the chain of objects will be captured in this field.

   id

      a unique number for every entry. 1, 2, 3 and so on...

   make_next_definition(experiment, participant)

      Creates the definition for the next node in the chain.

      Parameters:
         * **experiment** -- An instantiation of
           "psynet.experiment.Experiment", corresponding to the
           current experiment.

         * **participant** -- The participant who initiated the
           creation of the node (if relevant).

      Returns:
         * *dict* -- The definition for the next node in the chain.

   network

      the network the node is in

   network_id

      the id of the network that this node is a part of

   participant

      the participant the node is associated with

   participant_id

      the id of the participant whose node this is

   property1

      a generic column that can be used to store experiment-specific
      details in String form.

   property2

      a generic column that can be used to store experiment-specific
      details in String form.

   property3

      a generic column that can be used to store experiment-specific
      details in String form.

   property4

      a generic column that can be used to store experiment-specific
      details in String form.

   property5

      a generic column that can be used to store experiment-specific
      details in String form.

   time_of_death

      the time at which failing occurred

   type

      A String giving the name of the class. Defaults to "node". This
      allows subclassing.

   vars

class psynet.trial.staircase.GeometricStaircaseTrial(*args, **kwargs)

   Bases: "ChainTrial"

   complete

      Whether the trial has been completed (i.e. received a response
      from the participant). It is set once all of "show_trial()"'s
      pages have ended, before "show_feedback()", and also when a
      barrier's release ends the trial's page in "waiting_logic"
      before it is answered, in which case the trial is failed with
      "failed_reason="interrupted_by_release"", not finalized, and
      gets no "show_feedback()". The user should not typically change
      this directly.

   creation_time

      the time at which the Network was created.

   failed

      boolean indicating whether the Network has failed which prompts
      Dallinger to ignore it unless specified otherwise. Objects are
      usually failed to indicate something has gone wrong.

   failed_reason

      an optional reason the object was failed. If the object is
      failed as part of a cascading failure triggered from another
      object, the chain of objects will be captured in this field.

   group_round

      The "SyncGroupRound" this trial was played in, shared with the
      trials of the other members in the round, or "None" for
      ungrouped trials. Its "var" holds the group's results for the
      round, and "group_round.trials" the partners' trials.

   id

      a unique number for every entry. 1, 2, 3 and so on...

   make_definition(experiment, participant)

      Creates and returns a definition for the trial, which will be
      later stored in the "definition" attribute. This can be an
      arbitrary object as long as it is serialisable to JSON.

      Parameters:
         * **experiment** -- An instantiation of
           "psynet.experiment.Experiment", corresponding to the
           current experiment.

         * **participant** -- An instantiation of
           "psynet.participant.Participant", corresponding to the
           current participant.

   position

      Zero-based creation position among all trials from this trial
      maker for the participant, or, for trials made by "Trial.cue()",
      among the participant's trials in the same module.

   sync_group_id

      The group of the trial maker's (or, for cued trials, the trial
      class's) "sync_group_type" that the participant was in when the
      trial was created, kept after the group ends.

   sync_group_outcome

      when the trial maker prepares the group's next trials,
      ""stayed"" is written on the complete trials of the members
      still in the group. "None" while nothing has happened yet, and
      for ungrouped trials.

      Type:
         How the group's round ended for this player, for a trial in a
         group's round ("group_round"), one of "SyncGroupOutcome". It
         is written during the trial's pages, that is, before
         "complete" is set

      Type:
         ""stayed"" once a "GroupBarrier" in those pages, such as in
         "show_trial()", releases the group with the player in it,
         after which it doesn't change. Before that, why the player
         left the group, one of the reasons of "remove_participant()",
         such as ""late"", ""waited_too_long"", ""left_experiment"" or
         ""group_dissolved"" or ""removed_by_experimenter"". Leaving
         after a release, for example by being late at a later
         barrier, shows in "sync_group_removal_reason()" and in the
         "left" of the next barrier's "on_release" instead. Barriers
         and departures after the trial's pages, such as in
         "show_feedback()" or between rounds, write nothing. The
         exception is a trial maker's round that no barrier in the
         trial's pages released

   sync_group_role

      The participant's role in "sync_group_id", if a Regrouper gave
      one.

   sync_group_round

      Which round of "sync_group_id" this trial belongs to, counted
      from 0. A member who joined the group late shares the group's
      numbers. In a trial maker, a leader told to wait gives the group
      no trials, so the followers wait too and no number is used up.
      It equals the "number" of "group_round".

   sync_group_round_id

      ID of "group_round".

   time_of_death

      the time at which failing occurred

   type

   vars

class psynet.trial.staircase.GeometricStaircaseTrialMaker(*, id_, trial_class, node_class, network_class=None, start_nodes, max_nodes_per_chain, max_reversals_per_chain=None, block_order='random', chain_order='random', interleave_chains=False, balance_across_chains=None, min_passing_score=None, max_passing_score=None, expected_trials_per_participant=None, max_trials_per_participant=None, target_n_participants=None, n_participants_completion='experiment', recruit_mode=None, assets=None, choose_participant_group=None, sync_group_type=None, sync_group_max_wait_time=<class 'psynet.utils.NoArgumentProvided'>, sync_group_max_wait_action='fail', sync_group_late_after=None, sync_group_late_action=None, sync_group_also_leave=None, sync_group_waiting_message=None, sync_group_newcomer_max_wait=None)

   Bases: "ChainTrialMaker"

   Runs within-participant geometric staircases, one chain per
   staircase.

   Takes the arguments of "ChainTrialMaker", except "chain_type",
   which is always ""within"". Unlike that class, "interleave_chains"
   defaults to "False", so each participant finishes one staircase
   before starting the next; "chain_order" (default ""random"")
   chooses the order of the staircases. See
   "demos/experiments/staircase_pitch_discrimination".

   performance_check(experiment, participant, participant_trials)

      Should return a dict: {"score": float, "passed": bool}
