First steps
Here we'll show a series of examples of what the Treble Software Development Kit (SDK) can be used for. The examples are based on Jupyter Notebooks but it is by no means necessary to use the SDK within a Notebook style environment. It is, however, a convenient way to do initial scripting, especially while getting a feeling for the SDK.
The initial notebooks are self-standing but can be viewed as a step-by-step guide to run your first simulation.
Note: Please download the notebook package from the link above to get up to date notebooks with demos and examples.
Working with Projects
At the top of the organizational hierarchy for each organization are the projects. The projects own simulations, models and Geometries. The data belonging to a project is all linked to the project in the cloud.
Projects belong to your organization so users belonging to the same organization can collaborate on a project.
Each project has a unique ID and a unique name. The instance of the TSDK
class has a few functions to work with projects.
create_project(name)
- Create a project with a certain name (id will be generated).get_project(id)
- Load a project with a certain id.get_project_by_name(name)
- Load a project with a certain name.get_or_create_project(name)
- Create a project if no project exists with that name, otherwise load the last updated project with that name.get_last_updated_project()
- Load the project you were using last timelist_projects()
- List all projects in your organizationlist_my_projects()
- List all projects created by you as a userdelete_project(id)
- Delete the project with this id
We will load or create new project with the name Tutorial
project_name = "Tutorial"
p = tsdk.get_or_create_project(name=project_name, description="Project used in Documentation Tutorial")
A good way to get an overview of your projects, and to associate ids with project names and creation dates. It's a good idea to plot the list of projects as a table. The id can then be used to load a certain project.
projects = tsdk.list_projects()
dd.as_table(projects)