Python scripts#

User can happen their own processing using a python widget to the workflow as presented in this video

The python widget defines a serie of inputs and outputs. inputs are variables provided when the widget is triggered. outputs must be defined in the python widgte in order to provide inputs to the next widget.

Today this widget can have the following inputs:

  • in_data, `in_datas: correspond to the data object in tomwer (also aka scan). Warning: if several ‘data’ are provided then ‘in_data’ will be set to None and in_datas will collect all the in_data provided

  • in_volume, in_volumes: correspond to the volume object in tomwer. Handling of in_volumes vs in_volume is the same as in_data and in_datas

  • in_future_object, in_future_objects: correspond to future objects in tomwer

  • in_configuration, in_configurations: correspond to configuration objects in tomwer (python dict expected)

  • in_cluster_config, in_cluster_config: python dictionary corresponding to a cluster configuration

  • in_serie, in_series: correspond to serie object in tomwer (serie of scan or volume)

existing outputs are:

  • out_data

  • out_volume

  • out_future_tomo_obj

  • out_object

  • out_configuration

  • out_cluster_config

  • out_serie

Here are a few example of such a scripts:

Warning

GUI freeze

The python script will be executed in the main Qt thread. As a consequence during it execution the GUI will not be responsive. So if your processing is heavy you might experience some gui freezing.

If the python script is triggered before the processing is finishing then Orange will fail to process anything. As a consequence the GUI will freeze … for ever. For advance processing one workaround could be to add a timer widget before.