AHF_Stimulus

AHF_Stimulus.AHF_Stimulus module

class AHF_Stimulus.AHF_Stimulus(taskP, settingsDictP)

Bases: AHF_Base.AHF_Base

Generic “Stimulus” for use in Stimulators. Interacts with the mouse in some defined method based on the type of stimulus. Examples include a vibration motor, laser pulse in a specific brain region, or nothing.

abstract length()

Return length of stimulus (e.g. pulse duration)

abstract period()

Return period of stimulus (1/frequency for motor/laser)

abstract stimulate()
abstract trialEnd()

Code to be run at end of trial. E.g. moving laser to zero position

abstract trialPrep(tag)

Prepares stimulus for trial: e.g. aligns laser, preps vib. motor, etc

AHF_Stimulus.AHF_Stimulus_Laser module

This Stimulator is subclassed from Rewards. It captures a reference image for each mouse and includes a user interface to select targets on reference images. The Stimulator directs and pulses a laser to selected targets for optogenetic stimulation/inhibition.

class AHF_Stimulus_Laser.AHF_Stimulus_Laser(taskP, settingsDictP)

Bases: AHF_Stimulus.AHF_Stimulus

Stimulates a specified region of the mouse’s brain with a laser, controlled via a stepper motor stage. Requires a camera - if using, cannot record video of the trial with overhead camera (used for aligning)

static about()

Returns a brief message describing your sub-class, used when asking user to pick a sub-class of this class

accuracyTest()

For the given coefficient matrix, moves the laser to the center, then takes an image. Then, moves to 100 random points, and then back to center, taking another image. These images can then be compared to determine the long-term accuracy of the stepper motors.

align(tag, resultsDict={}, settingsDict={})

Aligns laser with reference image and assigned targets. Returns True if aligned successfully, False otherwise.

static config_user_get(starterDict={})

static method that querries user for settings, with default responses from starterDict, and returns starterDict with settings as edited by the user.

editReference()
feed_byte(byte)
get_arrow_dir(key)
get_dir(steps)
get_ref_im()
get_state()
h5updater()
hardwareTest()

Tests functionality, gives user a chance to change settings. :Returns: bool – True if any settings have changed

image_registration()
length()

Return length of stimulus (e.g. pulse duration)

loadH5()
make_cross()
matcher()
move(x, y, phase, delay, topleft, mp)
move_to(new_pos, topleft=True, join=False)
on_press(key)
period()

Return period of stimulus (1/frequency for motor/laser)

pulse(duration, duty_cycle=0)
select_targets()
setdown()

oppposite of setup. Releases any hardware resouces. can be run before editing settings so GPIO pins can be reused, for example. This strategy should be used in hardwareTest method.

setup()

does hardware initialization with(possibly updated) info in self.settingsDict Run by __init__, or can be run separately after editing the settingsDict

Returns

code

bool whether setup completed without errors

stimulate()
trialEnd()

Code to be run at end of trial. E.g. moving laser to zero position

trialPrep(tag)

Prepares stimulus for trial: e.g. aligns laser, preps vib. motor, etc

unlock()
update_cross(q)
update_mot(mot_q, phase_queue, delay, topleft)

AHF_Stimulus.AHF_Stimulus_None module

class AHF_Stimulus_None.AHF_Stimulus_None(taskP, settingsDictP)

Bases: AHF_Stimulus.AHF_Stimulus

Does nothing.

static about()

Returns a brief message describing your sub-class, used when asking user to pick a sub-class of this class

static config_user_get(starterDict={})

static method that querries user for settings, with default responses from starterDict, and returns starterDict with settings as edited by the user.

hardwareTest()

Tests functionality, gives user a chance to change settings. :Returns: bool – True if any settings have changed

length()

Return length of stimulus (e.g. pulse duration)

period()

Return period of stimulus (1/frequency for motor/laser)

setdown()

oppposite of setup. Releases any hardware resouces. can be run before editing settings so GPIO pins can be reused, for example. This strategy should be used in hardwareTest method.

setup()

does hardware initialization with(possibly updated) info in self.settingsDict Run by __init__, or can be run separately after editing the settingsDict

Returns

code

bool whether setup completed without errors

stimulate()
trialEnd()

Code to be run at end of trial. E.g. moving laser to zero position

trialPrep(tag)

Prepares stimulus for trial: e.g. aligns laser, preps vib. motor, etc

AHF_Stimulus.AHF_Stimulus_VibMotor module

class AHF_Stimulus_VibMotor.AHF_Stimulus_VibMotor(taskP, settingsDictP)

Bases: AHF_Stimulus.AHF_Stimulus

Vibrates a motor placed on the exterior of the chamber.

static about()

Returns a brief message describing your sub-class, used when asking user to pick a sub-class of this class

static config_user_get(starterDict={})

static method that querries user for settings, with default responses from starterDict, and returns starterDict with settings as edited by the user.

hardwareTest()

Tests functionality, gives user a chance to change settings. :Returns: bool – True if any settings have changed

length()

Return length of stimulus (e.g. pulse duration)

motorDuty_def = 0.8
motorFreq_def = 300
motorPin_def = 27
period()

Return period of stimulus (1/frequency for motor/laser)

pulseTime_def = 0.2
setdown()

oppposite of setup. Releases any hardware resouces. can be run before editing settings so GPIO pins can be reused, for example. This strategy should be used in hardwareTest method.

setup()

does hardware initialization with(possibly updated) info in self.settingsDict Run by __init__, or can be run separately after editing the settingsDict

Returns

code

bool whether setup completed without errors

stimulate()
trialEnd()

Code to be run at end of trial. E.g. moving laser to zero position

trialPrep(tag)

Prepares stimulus for trial: e.g. aligns laser, preps vib. motor, etc