# `EvaluationAttribute`

digraph inheritance6a4f922adc { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "EvaluationAttribute" [URL="#taurus.core.evaluation.EvaluationAttribute",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="A :class:`TaurusAttribute` that can be used to perform mathematical"]; "TaurusAttribute" -> "EvaluationAttribute" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Logger" [URL="taurus-Logger.html#taurus.Logger",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="The taurus logger class. All taurus pertinent classes should inherit"]; "TaurusAttribute" [URL="taurus.core.taurusattribute-TaurusAttribute.html#taurus.core.taurusattribute.TaurusAttribute",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top"]; "TaurusModel" -> "TaurusAttribute" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusModel" [URL="taurus.core.taurusmodel-TaurusModel.html#taurus.core.taurusmodel.TaurusModel",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top"]; "Logger" -> "TaurusModel" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

class EvaluationAttribute(name='', parent=None, **kwargs)

  A `TaurusAttribute` that can be used to perform mathematical operations involving other arbitrary Taurus attributes. The mathematical operation is described in the attribute name itself. An Evaluation Attribute will keep references to any other attributes being referenced and it will update its own value whenever any of the referenced attributes change.

  See also

  `taurus.core.evaluation`

  Warning

  In most cases this class should not be instantiated directly. Instead it should be done via the `EvaluationFactory.getAttribute()`

  Import from `taurus.core.evaluation` as:

      from taurus.core.evaluation import EvaluationAttribute

  addListener(listener)

    Add a TaurusListener object in the listeners list. If it is the first listener, it triggers the subscription to the referenced attributes. If the listener is already registered nothing happens.

  applyTransformation()
  decode(attr_value)
  encode(value)
  eventReceived(evt_src, evt_type, evt_value)
  getDisplayValue(cache=True)
  static getId(obj, idFormat='_V%i_')
    returns an id string for the given object which has the following
      two properties:

        - It is unique for this object during all its life

        - It is a string that can be used as a variable or method name

    Parameters:

      - obj (object) – the python object whose id is requested

      - idFormat (str) – a format string containing a “%i” which, when expanded must be a valid variable name (i.e. it must match [a-zA- Z_][a-zA-Z0-9_]*). The default is _V%i_

  isBoolean()
  isUsingEvents()
  poll()
  preProcessTransformation(trstring)

    parses the transformation string and creates the necessary symbols for the evaluator. It also connects any referenced attributes so that the transformation gets re-evaluated if they change.

    Parameters:

      trstring (str) – a string to be pre-processed

    Returns:

      a tuple containing the processed string and a boolean indicating if the preprocessing was successful. if ok==True, the string is ready to be evaluated

    Return type:

      tuple<str,bool>

  read(cache=True)

    returns the value of the attribute.

    Parameters:

      cache (bool) – If True (default), the last calculated value will be returned. If False, the referenced values will be re- read and the transformation string will be re-evaluated

    Returns:

      attribute value

  removeListener(listener)

    Remove a TaurusListener from the listeners list. If polling enabled and it is the last element then stop the polling timer. If the listener is not registered nothing happens.

  write(value, with_read=True)