![]() ![]() isfile ( trialList ): # import conditions from that file self. trialList = # user has hopefully specified a filename elif isinstance ( trialList, str ) and os. autoLog = autoLog if trialList in ( None, ): # user wants an empty trialList # which corresponds to a list with a single empty entry self. origin - the contents of the script or builder experiment that created the handler """ self. extraInfo - the dictionary of extra info as given at beginning. finished - True/False for have we finished yet. thisTrial - a dictionary giving the parameters of the current trial. thisTrialN - which trial number *within* that repeat. thisRepN - which repeat you are currently on. ![]() nRemaining - the total number of trials remaining. nTotal - the total number of trials that will be run. thisIndex - the index of the current trial in the original conditions list. trialList - the original list of dicts, specifying the conditions. data - a dictionary (or more strictly, a `DataHandler` sub- class of a dictionary) of numpy arrays, one for each data type stored. ![]() If `OriginPath=-1` then nothing will be stored. If `originPath=None` is provided here then the TrialHandler will still store a copy of the script where it was created. The psydat file format will store a copy of the experiment if possible. seed: an integer If provided then this fixes the random number generator to use the same pattern of trials, by seeding its startpoint originPath: a string describing the location of the script / experiment file path. If not provided then these will be created as needed during calls to :func:`~` extraInfo: A dictionary This will be stored alongside the data and usually describes the experiment and subject ID, date etc. dataTypes: (optional) list of names for data storage. 'fullRandom' fully randomises the trials across repeats as well, which means you could potentially run all trials of one condition before any trial of another. 'random' will result in a shuffle of the conditions on each repeat, but all conditions occur once before the second repeat etc. This can be imported from an excel/csv file using :func:`~` nReps: number of repeats for all conditions method: *'random',* 'sequential', or 'fullRandom' 'sequential' obviously presents the conditions in the order they appear in the list. You can open it with:: from import fromFile dat = fromFile(path) Then you'll find that `dat` has the following attributes that """ def _init_ ( self, trialList, nReps, method = 'random', dataTypes = None, extraInfo = None, seed = None, originPath = None, name = '', autoLog = True ): """ :Parameters: trialList: a simple list (or flat array) of dictionaries specifying conditions. See demo_trialHandler.py The psydat file format is literally just a pickled copy of the TrialHandler object that saved it. Calls will raise a StopIteration error if trials have finished. next() will fetch the next trial object given to this handler, according to the method specified (random, sequential, fullRandom). Class TrialHandler ( _BaseTrialHandler ): """Class to handle trial sequencing and data storage. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |