I using python to generate some POVray rendering code for visualization of some computed data. I need pass a lot parameters from python to strings of POVray code. I would like to make the scrips cleaner. So I would like to use tuples and arrays directly as arguments for string formating. Something like this:
sign = -1
name = "temp1"
nu = 0.245
boxMin =(0.01,0.01,0.01) # tuple
boxMax =array([0.99,0.99,0.99]) # array
povfile.write( '''
isosurface {
function { %f*( %f - data3d_%s(x,y,z) ) }
contained_by { box { <%f,%f,%f>,<%f,%f,%f> } }
}''' %( sign, nu, name, *boxMin, *boxMax ) )
instead of this:
povfile.write( '''
isosurface {
function { %f*( %f - data3d_%s(x,y,z) ) }
contained_by { box { <%f,%f,%f>,<%f,%f,%f> } }
}''' %( sign, nu, name, boxMin[0],boxMin[1],boxMin[2], boxMax[0],boxMax[1],boxMax[2] ) )