cellpack.autopack.upy.simularium package

Submodules

cellpack.autopack.upy.simularium.plots module

class cellpack.autopack.upy.simularium.plots.PlotData[source]

Bases: object

add_histogram(title, xaxis_title, traces)[source]
add_scatter(title, xaxis_title, yaxis_title, xtrace, ytraces)[source]

cellpack.autopack.upy.simularium.simularium_helper module

class cellpack.autopack.upy.simularium.simularium_helper.Instance(name, instance_id, unique_id, radius, viz_type, mesh=None)[source]

Bases: object

increment_static(time_point)[source]
move(time_point, position=None, rotation=None, sub_points=None)[source]
set_static(is_static, position=None, rotation=None, sub_points=None)[source]
class cellpack.autopack.upy.simularium.simularium_helper.simulariumHelper(master=None, vi=None)[source]

Bases: Helper

The Simularium helper abstract class

This is the Simularium helper Object. The helper give access to the basic function need for create and edit a host 3d object and scene.

Box(*args, **kw)[source]
Cube(*args, **kw)[source]
Cylinders(*args, **kw)[source]
DATABASE = 'https://raw.githubusercontent.com/mesoscope/cellPACK_data/master/cellPACK_database_1.1.0'
DEBUG = 0
DecomposeMesh(poly, edit=True, copy=True, tri=True, transform=True)[source]
EMPTY = 'Simularium.Geom'
FromVec(points, pos=True)[source]
Geom(*args, **kw)[source]
GetAbsPosUntilRoot(obj)[source]
INSTANCE = 'Simularium.Geom'
IndexedPolygons(*args, **kw)[source]
Labels(*args, **kw)[source]
ObjectsSelection(listeObjects, typeSel='new')[source]

Modify the current object selection.

@type listeObjects: list @param listeObjects: list of object to joins @type typeSel: string @param listeObjects: type of modification: new,add,…

POLYGON = 'Simularium.IndexedPolygons'
Points(name, **kw)[source]
Polylines(*args, **kw)[source]
SPHERE = 'Simularium.Spheres'
SPLINE = 'kNurbsCurve'
Spheres(*args, **kw)[source]
TextureFaceCoordintesToVertexCoordinates(v, f, t, ti)[source]
ToVec(v, pos=True)[source]

Return a python xyz array from a host xyz array/vector

  • overwrited by children class for each host

@type v: host vector array @param v: host vector array @rtype: array @return: the converted vector array

VERBOSE = 0
addCameraToScene()[source]

Add a camera object to the scene

  • overwrited by children class for each host

>>> sc = helper.getCurrentScene()
>>> center=[0.,-12.,40.]
>>> cam = helper.addCameraToScene("cam1","persp",30.,center,sc)

@type name: string @param name: name of the camera @type Type: cameraType @param Type: perspective, orthogonale etc… @type focal: float @param focal: the focal of the camera @type center: list @param center: the position of the camera @type scene: host scene @param scene: the scene #we add a **kw for futur arguments

addLampToScene()[source]

Add a light to the scene

  • overwrited by children class for each host

>>> sc = helper.getCurrentScene()
>>> center=[0.,-12.,40.]
>>> color = [1.,1.,1.]
>>> light = helper.addLampToScene("light1","Sun",color,20.,1.0,1.0,True,center,sc)

@type name: string @param name: name of the instance @type Type: light hostType/int etc.. @param Type: the light type : spot,sun,omni,etc.. @type rgb: list of int 0-255 @param rgb: color of the light in rgb @type dist: float @param dist: light distance of attenuation @type energy: float @param energy: intensity of the light @type soft: bool @param soft: soft light @type shadow: boolean @param shadow: does the light produce shadow @type scene: host scene @param scene: the scene #we add a **kw for futur arguments

addMaterial(name, color)[source]

Add a material in the current document

  • overwrited by children class for each host

@type name: string @param name: the material name @type color: array @param color: the material color (r,g,b)

@rtype: hostMaterial @return: the new material

add_compartment_to_scene(compartment)[source]
add_grid_data_to_scene(incoming_name, positions, values, radius=0.5)[source]
add_instance(name, ingredient, instance_id, radius, position=None, rotation=None, sub_points=None, mesh=None)[source]
add_new_instance_and_update_time(name, ingredient, instance_id, position=None, rotation=None, sub_points=None)[source]
add_object_to_scene(doc, ingredient, instance_id, position=None, rotation=None, control_points=None)[source]
assignMaterial(object, mat, texture=False)[source]

Assign the provided material to the object

  • overwrited by children class for each host

@type object: hostApp object @param object: the object @type matname: string @param matname: the material name @type texture: Boolean @param texture: is the material use a textue @type kw: dictionary @param kw: additional keywords options

box(name, center=[0.0, 0.0, 0.0], size=[1.0, 1.0, 1.0], cornerPoints=None, **kw)[source]

Create a hostobject of type cube.

  • overwrited by children class for each host

@type name: string @param name: name of the box @type center: array @param center: the center of the box @type size: array @param size: the size in x y z direction @type cornerPoints: array list @param cornerPoints: the upper-left and bottom right corner point coordinates @type visible: booelan @param visible: visibility of the cube after creation (deprecated) @type kw: dictionary @param kw: additional keywords options

@rtype: hostObject,hostMesh @return: the created box object and mesh

changeColor(obj, colors, perVertex=False, proxyObject=False, doc=None, pb=False)[source]

Apply the given set of color to the given object, if the object is a mesh this function handle the color per vertex.

  • overwrited by children class for each host

@type obj: string or hostObject @param obj: the object to be colored @type colors: list @param colors: the list of colors to apply [[r,g,b],[r,g,b],…] @type perVertex: Boolean @param perVertex: is it color per Vertex @type proxyObject: Boolean @param proxyObject: special keyword for Cinema4D which doesnt support vertex color @type doc: Scene @param doc: the current working documents @type pb: Boolean @param pb: use the progress bar @type facesSelection: liste @param facesSelection: only assign color to the given face selecion @type faceMaterial: Boolean @param faceMaterial: assign color per Face

changeColorO(object, colors)[source]
changeObjColorMat(obj, color)[source]

Change the diffuse color of the object material.

  • overwrited by children class for each host

@type obj: string or hostObject @param obj: the object forwhich we want to change e material color @type color: list @param color: the new color to apply [r,g,b]

clear()[source]
concatObjectMatrix()[source]

Apply a matrix to an hostObject

  • overwrited by children class for each host

@type object: hostObject @param object: the object who receive the transformation @type hostmatrice: list/Matrix @param hostmatrice: transformation matrix in host format @type matrice: list/Matrix @param matrice: transformation matrix in epmv/numpy format

createTexturedMaterial(filename)[source]
cylinder(name, radius=1.0, length=1.0, res=0, pos=[0.0, 0.0, 0.0], parent=None, **kw)[source]
decomposeColladaGeom(g, col)[source]
deleteInstance(instance)[source]
deleteObject(obj)[source]
static format_rgb_color(color)[source]
getAllMaterials()[source]

Get all the maerials of the current scene.

  • overwrited by children class for each host

@rtype: list @return: the list of all materials available

getChilds(obj)[source]
getColladaMaterial(geom, col)[source]
getCornerPointCube(cube)[source]

Return the corner Point of the Given Cube/Box

@type obj: string @param obj: name of the box

@rtype: array 2x3 @return: the upper-left and bottom right corner point coordinates

getCurrentScene()[source]

Return the current/active working document or scene.

  • overwrited by children class for each host

>>> sc = helper.getCurrentScene()
>>> print (sc)
None #in maya there is no scene concept
<bpy_strct, Scene("Scene")  #blender 2.6
[Scene "Scene"]             #blender 2.49b
<c4d.documents.BaseDocument object at 0x246c01a0>  #Cinema4D

@rtype: scene @return: the active scene

getCurrentSelection()[source]

Return the current/active selected object in the document or scene Simularium support only one object at a time. @rtype: liste @return: the list of selected object

getFace(face)[source]

Convert the face edge in python format

  • overwrited by children class for each host

@type hostface: hostFace @param hostface: the face to convert to python @type kw: dictionary @param kw: dictionary of arg options.

  • r=True : Cinema4D reverse face order

@rtype: list @return: the face in python format [i,j,k]

getMaterial(mat)[source]

Get the maerial of the given name.

  • overwrited by children class for each host

@type name: string @param name: the name of the desired material

@rtype: hostMaterial @return: the new material

getMaterialName(mat)[source]
getMaterialObject(o)[source]
getMesh(m, **kw)[source]

Get the mesh of given name

  • overwrited by children class for each host

@type name: string @param name: the name of the deired mesh

@rtype: hostMesh @return: the mesh

getMeshEdges(poly)[source]

Get the edges of the given polygon object data

  • overwrited by children class for each host

@type poly: hostObject @param poly: the object from which we want the edges @type selected: Boolean @param selected: return only the selected edges or not @type kw: dictionary @param kw: dictionary of arg options

@rtype: list @return: all or selected edges of the given object

getMeshFaces(poly)[source]

Get the faces of the given polygon object data

  • overwrited by children class for each host

@type poly: hostObject @param poly: the object from which we want the faces @type selected: Boolean @param selected: return only the selected faces or not @type kw: dictionary @param kw: dictionary of arg options

@rtype: list @return: all or selected faces of the given object

getMeshNormales(poly)[source]

Get the normals of the given polygon object data

  • overwrited by children class for each host

@type poly: hostObject @param poly: the object from which we want the normals @type selected: Boolean @param selected: return only the selected normals or not @type kw: dictionary @param kw: dictionary of arg options

@rtype: list of array xyz @return: coordinate for all or for selected normals of the given object

getMeshVertices(poly, transform=False)[source]

Get the vertices of the given polygon object data

  • overwrited by children class for each host

@type poly: hostObject @param poly: the object from which we want the vertices @type selected: Boolean @param selected: return only the selected vertices or not @type kw: dictionary @param kw: dictionary of arg options

@rtype: list of array xyz @return: coordinate for all or for selected vertices of the given object

getName(o)[source]

Return the name of an host object. Redundant with getObjecName

  • overwrited by children class for each host

>>> obj = helper.Sphere("mySphere")
>>> name = helper.getObjectName(obj)
>>> print (name)
mySphere

@type object: hostObject @param object: an host object @rtype: string @return: the name of the host object

getNormals(f, v, n, ni)[source]
getObject(name)[source]

Retrieve an object from his name.

  • overwrited by children class for each host

>>> oname = "mysphere"
>>> object= helper.getObject(oname)
>>> print oname,object#the result depnds on the host
mysphere <c4d.BaseObject object at 0x1e4fc4b0> # Cinema4D
mysphere    # Maya

@type name: string @param name: request name of an host object

@rtype: hostObject @return: the object with the requested name or None

getTransformation(geom)[source]
getTranslation(name)[source]

Return the current position (translation) of the given object in absolute or local world

  • overwrited by children class for each host

@type name: hostObject @param name: the object name @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host

@rtype: 3d vector/list @return: the position

getType(object)[source]
getVisibility(obj, editor=True, render=False, active=False)[source]

return the editor/renedring/active visibility state of the given object

  • overwrited by children class for each host

@type obj: hostObject @param obj: the object @type editor: boolean @param editor: request editor visibility @type render: boolean @param render: request rendering visibility @type active: boolean @param active: request active states ie C4D

@rtype: bool/array of bool @return: the current visibility state of the object

get_display_data(ingredient)[source]
host = 'simularium'
increment_static_objects()[source]
increment_time()[source]
init_scene_with_objects(objects, grid_point_positions=None, grid_point_compartment_ids=None, show_sphere_trees=False, grid_pt_radius=0.5)[source]
instancePolygon(name, matrices=None, mesh=None, parent=None, **kw)[source]
instancesCylinder(name, points, faces, radii, mesh, colors, scene, parent=None)[source]
instancesSphere(name, centers, radii, meshsphere, colors, scene, parent=None)[source]
isIndexedPolyon(obj)[source]
static is_fiber(ingr_type)[source]
move_object(name, position=None, rotation=None, sub_points=None)[source]
newEmpty(name, location=None, parentCenter=None, display=1, visible=0, **kw)[source]

Create a new Null/Empty Object

  • overwrited by children class for each host

>>> empty = helper.newEmpty("null1",location=[10.0,0.0,0.0])
>>> empty_child = helper.newEmpty("null2",location=[15.0,0.0,0.0],parent = empty)

@type name: string @param name: name of the empty @type location: list @param location: position of the null object @type parentCenter: list @param parentCenter: position of the parent object DEPRECATED

@type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host

-“parent”

@rtype: hostObject @return: the null object

nodeToGeom(node, i, col, nodexml, parentxml=None, parent=None, dicgeoms=None, uniq=False)[source]
oneColladaGeom(g, col)[source]
oneCylinder(name, head, tail, instance=None, parent=None)[source]
static open_in_simularium(aws_url)[source]
pathDeform(*args, **kw)[source]

Should create a modifierfor the given object using the given path/curve/spline TO DO.

  • overwrited by children class for each host

@type args: list @param args: list of arguments options @type kw: dictionary @param kw: dictionary of arguments options

pb = False
place_object(name, position=None, rotation=None, sub_points=None)[source]
plane(name, center=[0.0, 0.0, 0.0], size=[1.0, 1.0], cornerPoints=None, visible=1, **kw)[source]

Create a hostobject of type cube.

  • overwrited by children class for each host

@type name: string @param name: name of the plane @type center: array @param center: the center of the plane @type size: array @param size: the size in x y z direction @type cornerPoints: array list @param cornerPoints: the upper-left and bottom right corner point coordinates @type visible: booelan @param visible: visibility of the plane after creation (deprecated) @type kw: dictionary @param kw: list of additional arguments : “material”, subdivision”, axis”

@rtype: hostObject,hostMesh @return: the created plane object and data

post_and_open_file(file_name, open_results_in_browser=True)[source]
progressBar(progress=None, label=None)[source]

update the progress bar status by progress value and label string @type progress: Int/Float @param progress: the new progress @type label: string @param label: the new message to put in the progress status

raycast(**kw)[source]
raycast_test(obj, start, end, length, **kw)[source]
reParent(obj, parent)[source]

Change the object parent using the specified parent objects

  • overwrited by children class for each host

@type objs: hostObject @param objs: the object or liste of objects to be reparented @type parent: hostObject @param parent: the new parent object

static remove_nans(positions, values)[source]
resetProgressBar()[source]

reset the Progress Bar, using value

rotateObj(obj, rot)[source]

Global Rotation : Rotate the object This method take a 3d array [rotation_X,rotatio_Y,rotation_Z]

  • overwrited by children class for each host

@type object: hostObject @param object: the object @type rotation: liste/array - matrice @param rotation: the new object rotation @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host

scaleObj(obj, sc)[source]

Global Scale : scale the object by the vector scale

  • overwrited by children class for each host

@type object: hostObject @param object: the object @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host

setInstance()[source]
setObjectMatrix(object, matrice, **kw)[source]

Set a matrix to an hostObject

  • overwrited by children class for each host

@type object: hostObject @param object: the object who receive the transformation @type hostmatrice: list/Matrix @param hostmatrice: transformation matrix in host format @type matrice: list/Matrix @param matrice: transformation matrix in epmv/numpy format @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host

setRigidBody(*args, **kw)[source]

Set the curren objec as a rigid body

@type doc: document/scene @param doc: the desired scene @type kw: dictionary @param kw: dictionary of arg options

setTranslation(name, pos=[0.0, 0.0, 0.0])[source]

Return the current position (translation) of the given object in absolute or local world

  • overwrited by children class for each host

@type name: hostObject @param name: the object name @type pos: list<float> @param pos: the new position @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host

setViewer(vi)[source]
set_object_static(name, position, rotation)[source]
static sort_values(positions, values)[source]
sphere(name, radius=1.0, res=0, parent=None, color=None, mat=None, pos=None)[source]
spline(name, points, close=0, type=1, scene=None, parent=None)[source]

This will return a hostApp spline/curve object according the given list of point.

  • overwrited by children class for each host

@type name: string @param name: name for the object @type points: liste/array vector @param points: list of position coordinate of the curve point @type close: bool/int @param close: is the curve is closed @type type: int/string @param type: ususally describe type of curve, ie : bezier, linear, cubic, etc… @type scene: hostApp scene @param scene: the current scene @type parent: hostObject @param parent: the parent for the curve @type kw: dictionary @param kw: additional keywords options

@rtype: hostObject,hostMesh @return: the created spline object and data

static store_metadata(file_name, url, db=None)[source]
static store_result_file(file_path, storage=None)[source]
toggleDisplay(obj, display, **kw)[source]

Toggle on/off the display/visibility/rendermode of an hostObject in the host viewport.

  • overwrited by children class for each host

>>> helper.toggleDisplay("polygone1",True)
>>> obj = helper.getObject("polygone1")
>>> helper.toggleDisplay(obj,False)

@type object: hostObject @param object: the object @type display: boolean @param display: if the object is displayed

transformNode(node, i, col, parentxmlnode, parent=None)[source]
translateObj(obj, position, use_parent=True)[source]

Global Translation : Move the object to the vector position

  • overwrited by children class for each host

@type object: hostObject @param object: the object @type position: liste/array @param position: the new object position px,py,pz @type use_parent: boolean @param use_parent: if the parent position is used @type absolue: Boolean @param absolue: absolute or local transformation @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host

update()[source]

Update the host viewport, ui or gl draw This function can’t be call in a thread.

  • overwrited by children class for each host

updateAppli(*args, **kw)[source]
updateBox(box, center=[0.0, 0.0, 0.0], size=[1.0, 1.0, 1.0], cornerPoints=None)[source]

Update the given box.

  • overwrited by children class for each host

@type box: string @param box: name of the box @type center: array @param center: the new center of the box @type size: array @param size: the new size in x y z direction @type cornerPoints: array list @param cornerPoints: the new upper-left and bottom right corner point coordinates @type visible: booelan @param visible: visibility of the cube after creation (deprecated) @type kw: dictionary @param kw: additional keywords options

updateMasterInstance(master, newMesh, **kw)[source]

Update the reference of the passed instance by adding/removing-hiding objects

  • overwrited by children class for each host

>>> sph = helper.Sphere("sph1")
>>> instance_sph = helper.newInstance("isph1",sph,location = [10.0,0.0,0.0])

@type instance: string/hostObj @param instance: name of the instance @type objects: list hostObject/string @param objects: the list of object to remove/add to the instance reference @type add: bool @param add: if True add the objec else remove @type hide: bool @param hide: hide instead of remove @type kw: dictionary @param kw: you can add your own keyword, but it should be interpreted by all host

updateMesh(obj, vertices=None, faces=None, smooth=False)[source]
updatePathDeform(*args, **kw)[source]

Should update the modifierfor the given object using the given path/curve/spline

TO DO.

  • overwrited by children class for each host

@type args: list @param args: list of arguments options @type kw: dictionary @param kw: dictionary of arguments options

updatePoly(polygon, faces=None, vertices=None)[source]
updateTubeMesh(mesh, cradius=1.0, quality=0, **kw)[source]
update_instance_positions_and_rotations(objects)[source]
update_spline(name, new_points)[source]

This will update the spline points coordinates

  • overwrited by children class for each host

@type name: string @param name: name for the spline to update @type coords: liste/array vector @param coords: list of new position coordinate to apply to the curve point

viewer = None
write(listObj, **kw)[source]
writeToFile(file_name, bb, recipe_name, version)[source]

Write to simularium file

Module contents

Copyright (C) <2010> Autin L. TSRI

This file git_upy/dejavuTk/__init__.py is part of upy.

upy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

upy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with upy. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.