Extract EMLF Results via Jupyter
-
How do we extract EMLF results via Jupyter? I'd specifically like to know if there is a way to generate images of slice viewers via the API. I can see how to extract the data cache from an analysis, but I cannot seem to access results contained within the data cache, and I cannot find any documentation that supports how to do this.
For context, I am running custom parameter sweeps via Jupyter. Every time we begin a new EMLF simulation with new settings, it deletes the results from the previous simulation. Automating the data extraction process is thereby very important for programmatic analysis downstream.
-
To learn how to do this using the Python API, the most straightforward approach is to run the simulation, set up the analysis pipeline, and select, e.g., the slice field viewer and run the "To Python (selected)". This will generate the script and open it in the "Scripter" window.
You can then edit and copy this code to a cell in your notebook.
Many of the Jupyter notebook tutorials under Help -> Examples will run a simulation and extract results. Consider browsing through these to find examples most similar to your needs.
-
Thanks @bryn, I had not seen the s4l.renderer package, it was somewhat hidden in the API browser.
One question; is it possible to rotate a view with the API? I've been using renderer.SetViewDirection(Vec3(0, 0, -1)) to get a topdown view of my model, but I'd like to flip the view 90 degrees to the left before rendering an image.This is what I'm after:
This is what I'm getting:
-
Good question. The rotation of the camera around the view direction is not so easy to specify in the API.
I can suggest the following workaround, in your target image the 'right' direction is negative
Y
cam = XRenderer.CameraSettings() # create a camera cam.Distance = 100 # instead, you could zoom to the bounding box, as shown in the Jupyter notebook examples cam.SetViewDirection(Vec3(0,0,-1), Vec3(0,-1,0)) # specify view direction and 'right' direction XRenderer.RestoreCamera(cam) # tell the GUI to use these camera settings
-
Good question. The rotation of the camera around the view direction is not so easy to specify in the API.
I can suggest the following workaround, in your target image the 'right' direction is negative
Y
cam = XRenderer.CameraSettings() # create a camera cam.Distance = 100 # instead, you could zoom to the bounding box, as shown in the Jupyter notebook examples cam.SetViewDirection(Vec3(0,0,-1), Vec3(0,-1,0)) # specify view direction and 'right' direction XRenderer.RestoreCamera(cam) # tell the GUI to use these camera settings