design
Task design containers.
- class axopy.design.Array(data=None, stack_axis=1)[source]
Trial array.
The array is not much more than a NumPy array with a
stack()
method for conveniently adding new data to the array. This is useful in cases where you iteratively collect new segments of data and want to concatenate them. For example, you could use anArray
to collect the samples from a data acquisition device as they come in.You usually don’t need to create an array manually – instead, use
Trial.add_array()
.- Parameters:
- data
The NumPy array holding the data.
- Type:
ndarray, optional
- class axopy.design.Block(index, *args, **kwargs)[source]
List of trials.
Experiments often consist of a set of blocks, each containing the same set of trials in randomized order. You usually shouldn’t need to create a block directly – use
Design.add_block()
instead.- Parameters:
index (int) – Index of the block in the design. This is required to pass along to each trial in the block, so that the trial knows which block it belongs to.
- add_trial(attrs=None)[source]
Add a trial to the block.
A
Trial
object is created and added to the block. You can optionally provide a dictionary of attribute name/value pairs to initialize the trial.
- shuffle(reset_index=True, seed=None)[source]
Shuffle the block’s trials in random order.
- Parameters:
reset_index (bool, optional) – Whether or not to set the
trial
attribute of each trial such that they remain in sequential order after shuffling. This is the default.seed (int, optional) – If provided, the random seed will be set to the specified value to ensure reproducible shuffling. Note that if you have multiple identical blocks and want to shuffle them differently, use a different seed value for each block.
- class axopy.design.Design(iterable=(), /)[source]
Top-level task design container.
The
Design
is a list ofBlock
objects, which themselves are lists ofTrial
objects.
- class axopy.design.Trial(attrs)[source]
Container of trial data.
There are two kinds of data typically needed during a trial: attributes and arrays. Attributes are scalar quantities or primitives like integers, floating point numbers, booleans, strings, etc. Arrays are NumPy arrays, useful for holding things like cursor trajectories.
There are two primary purposes for each of these two kinds of data. First, it’s useful to design a task with pre-determined values, such as the target location or the cursor trajectory to follow. The other purpose is to temporarily hold runtime data using the same interface, such as the final cursor position or the time-to-target.
You shouldn’t normally need to create a trial directly – instead, use
Block.add_trial()
.