Skip to content

Instantly share code, notes, and snippets.

View rexissimus's full-sized avatar
💭
I may be slow to respond.

Tommy Ellqvist rexissimus

💭
I may be slow to respond.
  • Inify LAboratories AB
  • Sweden
View GitHub Profile
@rexissimus
rexissimus / bokeh-export.py
Created August 18, 2016 20:43
Export bokeh and numpy as script
import bokeh.plotting
import importlib
import vistrails
org_vistrails_vistrails_bokeh = vistrails.load_package('org.vistrails.vistrails.bokeh')
# MODULE 20 org.vistrails.vistrails.bokeh:plotting|circle
# FUNCTION x_list x_list
x_list = [3, 4, 5]
# FUNCTION y_list y_list
y_list = [4, 5, 6]
@rexissimus
rexissimus / vtk_example.py
Created August 10, 2016 14:51
Example of turning a vtk example into a script
import vtk
# MODULE 61 org.vistrails.vistrails.vtk:vtkCellArray
vtk_cell_array = vtk.vtkCellArray()
vtk_cell_array.vtkInstance = vtk_cell_array
vtk_cell_array.InsertNextCell(12)
vtk_cell_array.InsertCellPoint(0)
vtk_cell_array.InsertCellPoint(1)
vtk_cell_array.InsertCellPoint(2)
vtk_cell_array.InsertCellPoint(3)
@rexissimus
rexissimus / new_patching.py
Created July 27, 2016 14:19
New patching script
import vtk
import vistrails.core.scripting.api as api
org_vistrails_vistrails_url = api.Package('org.vistrails.vistrails.url')
import locale
import os
from vistrails.packages.vtk import tf_widget
# MODULE 381 org.vistrails.vistrails.vtk:vtkVolumeRayCastCompositeFunction
vtk_volume_ray_cast_composite_function = vtk.vtkVolumeRayCastCompositeFunction()
vtk_volume_ray_cast_composite_function.vtkInstance = vtk_volume_ray_cast_composite_function
@rexissimus
rexissimus / patches.py
Created July 20, 2016 14:40
New patch example
patches = {
'UpdateAlgorithm':
"""
is_aborted = [False]
if hasattr($self, '_callback') and $self._callback is not None:
cbId = None
def ProgressEvent(obj, event):
try:
$self._callback(obj.GetProgress())
except Exception, e:
@rexissimus
rexissimus / api_example2.py
Created July 13, 2016 14:53
API script example
import vistrails.core.api as API
org_vistrails_vistrails_url = API.load_package('org.vistrails.vistrails.url')
from vistrails.packages.vtk.vtk_wrapper import vvtk
import vtk
# MODULE 364 org.vistrails.vistrails.url:DownloadFile
# FUNCTION url url
url = 'http://www.vistrails.org/download/download.php?type=DATA&id=head.120.vtk'
# DEFAULT insecure insecure
insecure = False
@rexissimus
rexissimus / hybrid_script.py
Created July 6, 2016 14:58
hybrid scripting
import vistrails.core.api as API
from vistrails.core.modules.basic_modules import create_constant
from vistrails.core.modules.vistrails_module import ModuleConnector
org_vistrails_vistrails_url = API.load_package('org.vistrails.vistrails.url')
from vistrails.packages.vtk.vtk_wrapper import vvtk
import vtk
# MODULE 364 org.vistrails.vistrails.url:DownloadFile
# FUNCTION url url
url = 'http://www.vistrails.org/download/download.php?type=DATA&id=head.120.vtk'
@rexissimus
rexissimus / api_example.py
Created July 6, 2016 14:56
api scripting example
import vistrails.core.api as API
from vistrails.core.modules.basic_modules import create_constant
org_vistrails_vistrails_vtk = API.load_package('org.vistrails.vistrails.vtk')
org_vistrails_vistrails_vtk_2 = API.load_package('org.vistrails.vistrails.vtk')
import requests
org_vistrails_vistrails_vtk_3 = API.load_package('org.vistrails.vistrails.vtk')
org_vistrails_vistrails_vtk_4 = API.load_package('org.vistrails.vistrails.vtk')
import vtk
org_vistrails_vistrails_vtk_5 = API.load_package('org.vistrails.vistrails.vtk')
from vistrails.core.modules.vistrails_module import ModuleConnector
@rexissimus
rexissimus / combined_rendering.py
Created June 29, 2016 14:31
Terminator Combined Rendering as python script
# Prelude
from vistrails.packages.vtk.vtk_wrapper import vvtk
# Prelude
import requests
# Prelude
from vistrails.packages.vtk.vtk_wrapper import vvtk
# Prelude
Building Python 3 with PyQt5, QWebEngine, QScintilla, VTK on Windows 64bit
Install Visual C++ 2013 (I failed to get MingW working with PyQt5)
Install the vs2013 version of Qt5
Install Python 3.4 64bit
Get sip (4.17), PyQt5 (5.5.1), and QScintilla sources
Add path to qmake to PATH
Porting to Python 3
-------------------
2to3 transforms most py2 strings to py3 strings with unicode support
use bytes in module hasher
use encode=unicode in elementtree.serialize
New ordering logic
Porting to PytQt5
-----------------