AHF_Subjects

AHF_Subjects manages individual mice, including registering new mice. Subjects can be managed manually through the subjects menu, Ctrl+C > A, handled by AHF_Subjects_mice.subjectSettings

AHF_Subjects.AHF_Subjects module

class AHF_Subjects.AHF_Subjects(taskP, settingsDictP)

Bases: AHF_Base.AHF_Base

Base class for experimental subjects. Defines subject attributes. Subjects must be unique for ID attribute Subclasses may wish to define an inner class that describes an object for a single experimental subject.

abstract add(IDnum, dataDict)

Adds a new subject to the pool of subjects, initializing subject fields with data from a dictionary returns True if subject was added, false if subject with IDnum already exists in subject pool

abstract check(IDnum)

returns 1 if IDnum is already in subjects, 0 if IDnum is not in subjects but is elgible to be added, returns -1 if IDnum is not elgible to be added

abstract generator()

Generator function that generates dictionaries of settings for all of the subjects in turn

abstract get(IDnum)

returns results/settings dictionary for individual in group of subjects based on a ID tag.

abstract get_all()
abstract remove(IDnum)

Removes a subject from the pool of subjects, based on IDnumber. Returns true if subject with given OD was found and removed, returns false if no subject with IDnum was found in pool of subjects

abstract setup()

results tuple defines dictionaries for subjects that our favorite objects will write results to for making daily tallies of results HeadFixer writes number of headfixes and un-fixes to its dictionary rewarder writes number and kind of rewards given to its dictionary TagReader writes number of chamber entrances to its dictionary Stimulator writes results of whatever it does during a head-fix session

abstract show(IDNum=0)

Prints out attributes for subject with given IDNum. If IDNum is 0, prints attributes for all subjects in pool. The attributes will be defined by subclass, results provided by stimulator, etc. Returns true if IDNum was found in pool, else False

abstract subjectSettings()

changes the subject specific parameters that are(usually) independent from basic hardware settings e.g. headfix time, headfix tightness, reward size, add or remove a subject to a cage, stimulation specifications, task settings

abstract userEdit()

Allows user interaction to add and remove subjects, maybe print out and edit individual configuration

AHF_Subjects.AHF_Subjects_mice module

class AHF_Subjects_mice.AHF_Subjects_mice(taskP, settingsDictP)

Bases: AHF_Subjects.AHF_Subjects

class for the mice, as experimental subjects. Contains a dictionary where key id IDtag, and value is a dictionary of configuration information for corresponding mouse. {mouseid1:{HeadFixer:{}, Stimulator: {}, Rewarder: {}}, mouseid2:…} Dictionaries from Stimulator, HeadFixer, Rewarder are configured with the config_user_subject_get methods in their respective classes.

static about()

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

add(IDnum, dataDict={}, default=True)

Adds a new subject to the pool of subjects, initializing subject fields with data from a dictionary returns True if subject was added, false if subjet with IDnum already exists in subject pool

check(IDnum)

returns 1 if IDnum is already in subjects, 0 if IDnum is not in subjects but is elgible to be added, returns -1 if IDnum is not elgible to be added

check_miceDict(starterDict={})
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.

create_fillable_json()
depth(d, level=0)
freshMiceDefault = False
generator()

A Generator function that generates a(tagID, dictionary) tuple for each of the mice in turn. Sample function call: for mouse in myMice.generator():

get(IDnum)

returns a reference to the dictionary for the mouse with given IDtag. if the mouse tag is not found, makes a new dictionary if fresh mice can be added, else returns an empty dicitonary if fresh mice are to be ignored

get_all()
hardwareTest()

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

headFixTimeDefault = 40
inChamberTimeLimitDefault = 300
individualSettings(starterDict={})
jsonNameDefault = 'subjects'
loadConfigsDefault = 'provide_json'
newDay()
propHeadFixDefault = 1
remove(IDnum)

Removes a subject from the pool of subjects, based on IDnumber. Returns true if subject with given OD was found and removed, returns false if no subject with IDnum was found in pool of subjects

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()

results tuple defines dictionaries for subjects that our favorite objects will write results to for making daily tallies of results HeadFixer writes number of headfixes and un-fixes to its dictionary rewarder writes number and kind of rewards given to its dictionary TagReader writes number of chamber entrances to its dictionary Stimulator writes results of whatever it does during a head-fix session

show(IDnum=0)

Prints out attributes for subject with given IDNum. If IDNum is 0, prints attributes for all subjects in pool. The attributes will be defined by subclass, results provided by stimulator, etc. Returns true if IDNum was found in pool, else False

skeddadleTimeDefault = 2
subjectSettings()

Allows user to add mice to file, maybe use TagReader, give initial values to paramaters

userEdit()

Allows user interaction to add and remove subjects, print out and edit individual configuration