pyworkflow.protocol.params module

class pyworkflow.protocol.params.BooleanParam(**args)[source]

Bases: pyworkflow.protocol.params.Param

class pyworkflow.protocol.params.Conditional(error, allowsNull=False)[source]

Bases: pyworkflow.protocol.params.Validator

Simple validation based on a condition. If the value doesn’t meet the condition, the error will be returned.

class pyworkflow.protocol.params.DigFreqParam(**args)[source]

Bases: pyworkflow.protocol.params.FloatParam

Digital frequency param.

class pyworkflow.protocol.params.ElementGroup(form=None, **args)[source]

Bases: pyworkflow.protocol.params.FormElement

Class to group some params in the form. Such as: Labeled group or params in the same line.

addHidden(paramName, ParamClass, **kwargs)[source]

Add a hidden parameter to be used in conditions.

addLine(lineName, **kwargs)[source]
addParam(paramName, ParamClass, **kwargs)[source]

Add a new param to the group

iterParams()[source]

Return key and param for every child param.

class pyworkflow.protocol.params.EnumParam(**args)[source]

Bases: pyworkflow.protocol.params.IntParam

Select from a list of values, separated by comma

DISPLAY_COMBO = 1
DISPLAY_HLIST = 2
DISPLAY_LIST = 0
class pyworkflow.protocol.params.FileParam(**args)[source]

Bases: pyworkflow.protocol.params.PathParam

Filename path

class pyworkflow.protocol.params.FloatParam(**args)[source]

Bases: pyworkflow.protocol.params.Param

class pyworkflow.protocol.params.FolderParam(**args)[source]

Bases: pyworkflow.protocol.params.PathParam

Folder path

class pyworkflow.protocol.params.Form(protocol)[source]

Bases: object

Store all sections and parameters

addGeneralSection()[source]
addGroup(*args, **kwargs)[source]
addHidden(*args, **kwargs)[source]
addLine(*args, **kwargs)[source]
addParallelSection(threads=1, mpi=8, condition='', hours=72, jobsize=0)[source]
addParam(*args, **kwargs)[source]

Add a new param to last section

addSection(label='', **kwargs)[source]

Add a new section

evalParamCondition(paramName)[source]

Evaluate if a condition is True for a give param with the values of a particular Protocol

getClass()[source]
getParam(paramName)[source]

Retrieve a param given a the param name None is returned if not found

getSection(label)[source]

get section by label from _sectionList

hasParam(paramName)[source]
iterAllParams()[source]

Iter all parameters, including ElementGroups.

iterParams()[source]

Iter parameters disregarding the ElementGroups.

iterPointerParams()[source]
iterSections()[source]
registerParam(paramName, param)[source]

Register a given param in the form.

validateParams(protocol)[source]

Check that all validations of the params in the form are met for the protocol param values. It will return a list with errors, just in the same way of the Protocol.validate function

class pyworkflow.protocol.params.FormElement(**args)[source]

Bases: pyworkflow.object.OrderedObject

Base for any element on the form

ATTRIBUTES = ['label', 'expertLevel', 'condition', 'important', 'help', 'default', 'paramClass']
config(**kwargs)[source]

Configure the object and set attributes coming in the keyword-arguments, the same as in the __init__

getHelp()[source]
getLabel()[source]
hasCondition()[source]
isExpert()[source]
isImportant()[source]
setExpert()[source]
setImportant(value)[source]
class pyworkflow.protocol.params.Format(valueType, error='Value have not a correct format', allowsNull=False)[source]

Bases: pyworkflow.protocol.params.Conditional

Check if the format is right.

class pyworkflow.protocol.params.GE(thresold, error='Value should be greater or equal than the thresold')[source]

Bases: pyworkflow.protocol.params.Conditional

class pyworkflow.protocol.params.GT(threshold, error='Value should be greater than the threshold')[source]

Bases: pyworkflow.protocol.params.Conditional

class pyworkflow.protocol.params.Group(form=None, **args)[source]

Bases: pyworkflow.protocol.params.ElementGroup

Group some parameters with a labeled frame.

class pyworkflow.protocol.params.HiddenBooleanParam(**args)[source]

Bases: pyworkflow.protocol.params.BooleanParam

class pyworkflow.protocol.params.IntParam(**args)[source]

Bases: pyworkflow.protocol.params.Param

class pyworkflow.protocol.params.LE(threshold, error='Value should be less or equal than the threshold')[source]

Bases: pyworkflow.protocol.params.Conditional

class pyworkflow.protocol.params.LT(threshold, error='Value should be less than the threshold')[source]

Bases: pyworkflow.protocol.params.Conditional

class pyworkflow.protocol.params.LabelParam(**args)[source]

Bases: pyworkflow.protocol.params.StringParam

Just the same as StringParam, but to be rendered as a label and can not be directly edited by the user in the Protocol Form.

class pyworkflow.protocol.params.Line(form=None, **args)[source]

Bases: pyworkflow.protocol.params.ElementGroup

Group to put some parameters in the same line.

class pyworkflow.protocol.params.MultiPointerParam(**args)[source]

Bases: pyworkflow.protocol.params.PointerParam

This type of Param will serve to select objects with DIFFERENT types from the database to be input for some protocol.

class pyworkflow.protocol.params.NonEmptyBoolCondition(error='Boolean param needs to be set.')[source]

Bases: pyworkflow.protocol.params.Conditional

class pyworkflow.protocol.params.NonEmptyCondition(error='Value cannot be empty')[source]

Bases: pyworkflow.protocol.params.Conditional

class pyworkflow.protocol.params.NumericListParam(**args)[source]

Bases: pyworkflow.protocol.params.StringParam

This class will serve to have list representations as strings. Possible notation are: 1000 10 1 1 -> to define a list with 4 values [1000, 10, 1, 1], or 10x2 5x3 -> to define a list with 5 values [10, 10, 5, 5, 5] If you ask for more elements than in the list, the last one is repeated

class pyworkflow.protocol.params.NumericListValidator(error='Incorrect format for numeric list param. ')[source]

Bases: pyworkflow.protocol.params.Conditional

Validator for ListParam. See ListParam.

class pyworkflow.protocol.params.NumericRangeParam(**args)[source]

Bases: pyworkflow.protocol.params.StringParam

This class will serve to specify range of numbers with a string representation. Possible notation are:

“1,5-8,10” -> [1,5,6,7,8,10] “2,6,9-11” -> [2,6,9,10,11] “2 5, 6-8” -> [2,5,6,7,8]
class pyworkflow.protocol.params.Param(**args)[source]

Bases: pyworkflow.protocol.params.FormElement

Definition of a protocol parameter

addValidator(validator)[source]

Validators should be callables that receive a value and return a list of errors if so. If everything is ok, the result should be an empty list.

getDefault()[source]
setDefault(newDefault)[source]
validate(value)[source]
class pyworkflow.protocol.params.PathParam(**args)[source]

Bases: pyworkflow.protocol.params.StringParam

Param for path strings

class pyworkflow.protocol.params.PointerParam(paramClass=<class 'pyworkflow.object.Pointer'>, **args)[source]

Bases: pyworkflow.protocol.params.Param

This type of Param will serve to select existing objects in the database that will be input for some protocol.

setPointerClass(newPointerClass)[source]
class pyworkflow.protocol.params.ProtocolClassParam(**args)[source]

Bases: pyworkflow.protocol.params.StringParam

class pyworkflow.protocol.params.Range(minValue, maxValue, error='Value is outside range')[source]

Bases: pyworkflow.protocol.params.Conditional

class pyworkflow.protocol.params.RegexParam(**args)[source]

Bases: pyworkflow.protocol.params.StringParam

Regex based string param

class pyworkflow.protocol.params.RelationParam(**args)[source]

Bases: pyworkflow.protocol.params.Param

This type of Param is very similar to PointerParam, since it will hold a pointer to another object. But, in the PointerParam, we search for objects of some Class (maybe with some conditions). Here, we search for objects related to a given attribute of a protocol by a given relation.

getAttributeName()[source]
getDirection()[source]
getName()[source]
class pyworkflow.protocol.params.Section(form, **args)[source]

Bases: pyworkflow.protocol.params.ElementGroup

Definition of a section to hold other params

addGroup(groupName, **kwargs)[source]
getQuestion()[source]

Return the question param

getQuestionName()[source]

Return the name of the question param.

hasQuestion()[source]

Return True if a question param was set

class pyworkflow.protocol.params.StringParam(**args)[source]

Bases: pyworkflow.protocol.params.Param

Param with underlying String value

class pyworkflow.protocol.params.TextParam(**args)[source]

Bases: pyworkflow.protocol.params.StringParam

Long string params

class pyworkflow.protocol.params.TupleParam(**args)[source]

Bases: pyworkflow.protocol.params.Param

This class will condense a tuple of several other params of the same type and related concenpt. For example: min and max, low and high.

class pyworkflow.protocol.params.Validator[source]

Bases: object