TwoPWS

class hive.implementation.two_phases_win_shift.TwoPWS(action, trigger)

Bases: AbstractSequenceTask

Protocol for 2 phases win-shift

In this protocol, we put an animal in 8-arms radial maze.

Phase 1:

Choose 4 randoms arms Open door one after another + give reward when detected

sleep 15s

Phase 2:

open all doors after visit, door closes give food in arm not selected in phase 1 stop the trial once all 4 arm not selected has been visited

Fail conditions and consequences on the next steps

  • Phase 1 : no fail

  • Phase 2 : no food in arm selected in phase 1 + stop the trial

Use in config file

Task:
  mode : 2PWS
  options:
    wait_time_btw_phase: 15 #s
  trigger :
    - name: Keyboard or Tracking
    - name: Timer

Devices used

Food_delivery devices named in F1, index from 1 to 8. Door_delivery devices names in D1, index from 1 to 8 A detection center zone named 0

Attributes Summary

phase

selected_arms

sequence

the sequence used in this Task

use_door_devices

doors are automatically used in this protocol

use_food_devices

Use F1, F2, F3 as food devices.

wait_time_btw_phase

Methods Summary

filter_event(event_type, event_data)

filter the incoming event.

get_para([para])

get supported parameters (para is None) or parameter value

give_food(visit_arm, result)

invoked when the animal visit the arm.

give_sequence(phase)

new_seq_control()

get the sequence control.

stop_task([success])

invoked when the task stop.

visit_arm(visit_arm)

process animal visiting event.

Attributes Documentation

phase
selected_arms
sequence
use_door_devices

doors are automatically used in this protocol

use_food_devices

Use F1, F2, F3 as food devices. F0 = center of the maze - when we can open/close door Needs to be added as virtual id in the config file.

wait_time_btw_phase

Methods Documentation

filter_event(event_type: str, event_data: str)

filter the incoming event.

event type

there are common used event types/groups in hive.

  1. detection DEVICE

    detection event from trigger like the keyboard or tracking

  2. battery level DEVICE,LEVEL

    device battery level callback event

Parameters
  • event_type – event type or group

  • event_data – event data

get_para(para: Optional[str] = None)

get supported parameters (para is None) or parameter value

give_food(visit_arm: int, result: SequenceStepResult)

invoked when the animal visit the arm.

This function purpose to send commands to food/door devices.

Parameters
  • visit_arm – where the animal visiting

  • result – the result of this visiting

give_sequence(phase)
new_seq_control() SequenceControl

get the sequence control.

stop_task(success=True)

invoked when the task stop.

visit_arm(visit_arm: int)

process animal visiting event.

Parameters

visit_arm (int) – where the animal visiting