Home | Trees | Indices | Help |
|
---|
|
object --+ | PypeApp
Pype Application Class.
Toplevel class for all pype programs -- one instance of this class is instantiated when the pype control gui is loaded. More than one of these per system is a fatal error.
The PypeApp class has methods & instance variables for just about everything a user would want to do.
Instance Methods | |||
a new object with type S, a subtype of T |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
Properties | |
Inherited from |
Method Details |
|
Initialize a PypeApp instance, with side effects:
Don't initialize more than one instance of this class. If you do an exception will be raised. An alternative (for later consideration) would be to allow multiple instances which share an underlying framebuffer & dacq hardware; however, this would really require some sort of underlying locking method to prevent collision.
|
Queue an action to happen about inms from now. Call with no args to clear the actio queue. Action will be dispatched from the idlefn() on or after the specified deadline. |
Write message to console window. Console is running log window
|
Write message to info window. Info is the window that gets cleared at the start of each trial.
|
Setting running state flags. Use this instead of tweaking internal vars in the app object! |
|
Save the result of current trial. This should be called at the end of each trial to update the history stack.
|
Get the nth to last saved trial result code. NB get_result(1) is result from last trial, not get_result(0) |
(Re)load task from file. Load a task, if no task is specified, try to reload current task.
|
Set function to call when unbound key is pressed in the udy canvas window. Function should take three arguments, e.g., def hookfn(data, key, ev):.... Where data is whatever you want the function to have and key is the string containing the key pressed and ev is the full event, in case you want (x,y) etc. The hook function should return 1 or 0 to indicate if the keypress was actually consumed. This function returns the old hookfn and hookdata values so they can be saved and restored. |
|
|
|
|
|
|
Get number of trials since run start. Number of trials is sum of C, E and M types (corrects, errors and maxrt_exceeded, typically). Doesn't count UI or USERABORT trials.
|
Set start run function/hook. The task_module.main() function must call this function to bind the startup function for the task. The main function can optionall also bind an update function that gets called after each trial. The update function can be used to update task-specific plots etc. The startfn must be a function that takes at least one argument, namely the PypeApp struction that acts as a handle for everything else (aka 'app'). Additional parameters can be included by using a lambda expression, for example: >>> t = Task(...) >>> app.set_startfn(lambda app, mytask=t: mystart(app, mytask)) The return value from the start function is ignored. The updatefn is similar. It should be a function takes at least two parameters, first is 'app', second either None or a tuple. None for a pre-run initialization stage and a tuple with the info provided to record_write(), i.e.:
>>> resultcode, rt, params, taskinfo = info
You can do whatever you want, but if you are overriding the built-in RT histogram stuff (in which case it might be useful to know that app.rtdata contains a list of all the RTs for the current run) the updater shoudl return False. If it returns True, the built-in histogram will get updated IN ADDITION to whatever you did.. validatefn (new 10/4/2013) is called before the run actually starts to give task chance to validate parameters, cache stimuli etc. Should return 'True' if pype should continue on and start task, 'False' to abort run. |
|
|
|
Tell pype where the monkey's supposed to be looking. This is crucial for the F8 key -- when you hit F8 telling pype to rezero the eyeposition, it assumes that the monkey is looking at this location (in pixels) when you strike the key.
|
Adjust X & Y offsets to set DC-offsets for eye position.
|
Idle function -- call when there's nothing to do to update GUI. The idle function -- this function should be call periodically by everything. Whenever the program's looping or busy waiting for something (bar to go up/down, timer to expire etc), the app should just call idlefn(). The optional ms arg will run the idle function for the indicated amount of time -- this is not accurate; it just uses the tk after() command, so it's X11 limited and only approximate. This function is also responsible for monitoring the GUI's keyboard queue and handling key events. Right now only some basics are implemented -- give a drop of juice, open/close solenoid, run/stop etc.. more can be implemented and eventually there should be a way to set user/app specific keybindings just like the user buttons. NB anywhere this is called you MUST catch the UserAbort exception!!! |
|
|
|
|
Give reward. Deliver a squirt of juice based on current dropsize and dropvar settings.
|
Count touch bar transitions. Reset (ie, barchanges(reset=1)) once the bar's been grabbed and then monitor with barchanges() to see if the count increases. Count incremewnts each time there's a state change (0->1 or 1->0). Sampled at DACQ frequency (~1khz), so as to avoid loosing signals during CPU intensive graphics.
|
Enable/disable exceptions (aka interrupts) when the touch bar is touched. If this is enabled, then the das_server will generate a SIGUSR1 interupt each time the bar changes state. This gets caught by an internal function and converted into a python exception: BarTransition. Don't even think about calling this outside a try/except wrapper to catch the BarTransition exception, or you will have serious problems! |
Enable/disable exceptions (aka interrupts) for joypad input If this is enabled, then the das_server will generate a SIGUSR1 interupt each time a joypad button, other than #1, is pressed. When you call with enable=1, it will check to make sure no buttons are currently pressed -- if there are, it will return None and you need to try again.. Don't even think about calling this outside a try/except wrapper to catch the JoyTransition exception, or you will have serious problems!
|
Set an interupt/exception alarm to go off. An Alarm exception will be generated when the timer expires. Exception will be raised from idlefn() at next available opportunity, so you must periodicall call idlfn() once you set the alarm. NB This requires app.allow_ints to be true in order to work! NB only one alarm is allowed at a time.
|
Enable or disable interupts from comedi_server. If queue'ing is enabled, then interupts are cued to be handled the next time idlefn() is called instead of raised. By default, when pype is started, interupts are set to queue!
|
Query the nth joystick button (starting with #0, aka B1). Joystick labels are labeled starting with B1, while indexing in pype starts at 0. So to query the button labeled "1", you need to do joybut(0). To make life easier -- this will also accept keys 1,2,3.. as standins for B1,B2 so you can run without a joystick/keypad.
|
|
|
Call to initiate pype shutdown. Completely close and cleanup application -- shutdown the DACQ interface and framebuffer and restore the X11 bell etc. |
|
|
Start recording data. Clear the per-trial recording buffer and reset the per-trial timer. This should be called at the start of every trial, always at the same point in the trial. All per-trial timestamps (encodes and datastreams) will be timestamped relative to this call (which will be t=0). |
Stop recording data. End of trial clean up. |
Enable or disable plexon (or other auxilliary recording system) state. This basically triggers the external recording system (plexon, TDT, etc) to start recording by changing the polarity on digitial output line 2. In the case of the plexon, a 250ms ITI imposed as well to make sure the plexon can keep up and there are no drop outs. This is known problem with the plexon -- if you strobe the gating signal faster than 250ms it can loose the strobe. |
Start/stop recording eye position data. Begin recording eye trace data now. Or, stop recording eye data now. Be sure to call this before you save data with record_write() below! This idea is that you may not want to record eye position data until the fixation spot is acquired or the touchbar touched etc, so this provides fine grained control over storage of the eye pos data stream. You can start saving spike data first with record_start() and later start saving eye traces (although not vice versa).
|
|
Query current set of spike times for this trial. This is gets the spike data out from the ad/ad server in mid-trial. You can use this to do on-line statistics or generate dynamic stimuli etc. It should not be considered final data -- this is only an approximation, particularly if you're still recording data when you call this.
|
Find saccades in mid-trial. Retreives the eye trace data using get_eyetrace_now() and then calls pypedata.find_saccades with the specified parameters. See documentation on pypedata.find_saccades() for algorithm/parameter details.
|
Query current eye trace - note: was get_eyepos_now(). This function extracts the current state of the x/y eye position buffers from the dacq_server NOW. Like get_spikes() you can use this in mid-trial or at the end of the trial to adapt the task based on his eye movements. This should NOT be considered the final data, particularly if you're still in record mode when you call this function
|
|
|
Write the current record to the specified datafile. Call this at the end of each trial in your task to do post-processing and flush all the recorded data to disk.
|
Insert note into current datafile. Try not to use this -- it's really obsolete and hard to parse! |
Let pype know run (not trial) is over. Call this function at the end of each run (ie, datafile) to let pype know it's ok to clean up and reset things for the next run. This really should be called "run_done". |
Idle the framebuffer (put up test pattern display). Not really for users -- this is really only used by the candy module to clear the screen when candy exits. Note: test pattern is scaled to fill entire screeen |
Set time range for useful portion of the eye trace. If these are set, then when the eye trace is plotted, the time range is restricted to this time frame to speed up plotting. Typically this is used to prevent looking at all the time while the animal's trying to acquire the fixspot, which isn't very interesting and may slow things down. |
Helper function for creating new fixation window in std way. Actual window size will be scaled up automatically from the base radius (subject_param:win_size) using subject_param:win_scale and eccentricity of the fixation window (relative to montior ctr).
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Nov 17 00:22:04 2018 | http://epydoc.sourceforge.net |