AcquisitionProtocol.py
Add custom shapes to the palette in the "Acquisition Protocol" window.
See class Sine for an example.
AddShape( shape )
shape is a class derived from AcquisitionProtocol.
Shape
. To make sure your shape is always available, define it in a .py file in QUB\PythonScripts.
class Shape:
name
string: e.g. "Ramp" -- identifies this class of shape in the file and on the palette
__init__( self, properties, defaults )
properties
a
Shape
tree, or None.
defaults
list of pairs: (name, value) -- one per parameter
Don't forget to call this from your subclass's constructor
renameProperties( self, properties, renames )
properties
a
Shape
tree, or None.
renames
dictionary {oldname : newname}
Call this in your constructor if older files may have outdated parameter names.
get( self, prop )
prop
the name of a parameter
Returns the value of a named parameter as a string.
set( self, prop, valstr )
Sets the parameter named prop to valstr and calls
setup
().
setup( self )
Called each time a parameter changes.
Override in your subclass to pre-compute stuff that would be too time-consuming in
evaluate
().
duration( self, rep_index )
Override in your subclass to tell how many seconds a given repetition will take (0 is the first rep).
count( self, t_start, sampling, rep_index )
Calculates the number of samples needed for a given rep, given a start time and sampling rate. Don't override.
evalute( self, t, rep_index )
Called by
generate()
to calculate each sample. You must override.
generate( self, first, last, t_start, sampling, rep_index )
Called by QUB to generate a range of samples, using your
evaluate
() method. Don't override.
generateInto( self, first, last, t_start, sampling, rep_index, node, i_start )
Called by QUB to generate a range of samples, using your
evaluate
() method. Don't override.