funpack.parsing.process

The Process class, and functions for parsing processing steps.

This module defines the Process class which is used by the funpack.processing module to run FUNPACK processing steps.

exception funpack.parsing.process.NoSuchProcessError[source]

Bases: Exception

Exception raised by the Process class when an unknown process name is specified.

class funpack.parsing.process.Process(ptype, name, args, kwargs, procstr)[source]

Bases: object

Simple class which represents a single processing step. The run() method can be used to run the process on the data for one or more variables.

property args

Returns the positional arguments for this Process.

auxillaryVariables(broadcastIndex=None)[source]

Returns a list of “auxillary” variables for this process. Auxillary variables are variables which a process is not being applied to, but which is needed by the process. These variables are passed in as arguments to the process.

The names of any arguments which contain auxillary variables are specified via the auxvids argument to the processor decorator function.

property broadcastKwargs

Returns the keyword arguments for this Process which will broadcasted across all variable IDs that are passed to an invocation of run().

property filterMissing

Return True if this processing function expects that the list of variable IDs which it is given will not contain the IDs of variables which are not present in the data.

This property is set via a filterMissing argument passed to the processor decorator function. Its default value is True.

property kwargs

Returns the keyword arguments for this Process.

property name

Returns the name of this Process.

property processString

Returns the original string, from the processing table/ command-line, which defines this Process.

run(*args, broadcastIndex=None)[source]

Run the process on the data, passing it the given arguments, and any arguments that were passed to __init__().

Parameters:

broadcastIndex – Deprecated. If provided, and if any broadcast arguments were specified for this process, this index is used to retrieve one value each broadcast argument list - this value is then passed to the process function.

funpack.parsing.process.makeProcessParser()[source]

Generate a pyparsing parser which can be used to parse a single process call in the processing table.

funpack.parsing.process.parseProcesses(procs, ptype)[source]

Parses the given string containing one or more comma-separated process calls, as defined in the processing table. Returns a list of Process objects.

Parameters:
  • procs – String containing one or more comma-separated (pre-)processing steps.

  • ptype – either cleaner or processor

Returns:

A list of Process objects.