> For the complete documentation index, see [llms.txt](https://particle-analytics-1.gitbook.io/iota-python-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://particle-analytics-1.gitbook.io/iota-python-api/iota/project.md).

# Project

`iota.session.Project()`

**Description** Iota project object.

**Methods**

* [`exists_scenario`](/iota-python-api/iota/project.md#exists_scenario)
* [`get_scenario`](/iota-python-api/iota/project.md#get_scenario)
* [`get_scenarios`](/iota-python-api/iota/project.md#get_scenarios)
* [`add_scenario`](/iota-python-api/iota/project.md#add_scenario)
* [`get_dataset`](/iota-python-api/iota/project.md#get_dataset)
* [`get_datasets`](/iota-python-api/iota/project.md#get_datasets)
* [`add_dataset`](/iota-python-api/iota/project.md#add_dataset)
* [`import_dataset`](/iota-python-api/iota/project.md#import_dataset)
* [`exists_graph`](/iota-python-api/iota/project.md#exists_graph)
* [`get_graph`](/iota-python-api/iota/project.md#get_graph)
* [`get_graphs`](/iota-python-api/iota/project.md#get_graphs)
* [`add_graph`](/iota-python-api/iota/project.md#add_graph)
* [`add_file`](/iota-python-api/iota/project.md#add_file)
* [`get_file`](/iota-python-api/iota/project.md#get_file)
* [`get_files`](/iota-python-api/iota/project.md#get_files)
* [`get_mesh`](/iota-python-api/iota/project.md#get_mesh)
* [`get_meshes`](/iota-python-api/iota/project.md#get_meshes)
* [`add_mesh`](/iota-python-api/iota/project.md#add_mesh)
* [`get_script`](/iota-python-api/iota/project.md#get_script)
* [`get_scripts`](/iota-python-api/iota/project.md#get_scripts)
* [`add_script`](/iota-python-api/iota/project.md#add_script)
* [`add_video`](/iota-python-api/iota/project.md#add_video)
* [`add_screenshot`](/iota-python-api/iota/project.md#add_screenshot)
* [`run_batch_processing`](/iota-python-api/iota/project.md#run_batch_processing)
* [`delete`](/iota-python-api/iota/project.md#delete)

&#x20;**Variables**

* `name` (str) project name
* `description` (str) project description
* `id` (int) project Id

## Methods

### [exists\_scenario(name)](/iota-python-api/iota/project.md#exists_scenario) <a href="#exists_scenario" id="exists_scenario"></a>

*Return a scenario belonging to a specified project, by name*

**Arguments**

* `name`: (str) scenario name

**Example**

```python
if project.exists_scenario('my_scenario'):
  print('scenario exist')
```

### [get\_scenario(name)](/iota-python-api/iota/project.md#get_scenario) <a href="#get_scenario" id="get_scenario"></a>

*Return a scenario belonging to a specified project, by name*

**Arguments**

* `name`: (str) scenario name

**Example**

```python
scenario = project.get_scenario(name='my_scenario')
```

### [get\_scenarios()](/iota-python-api/iota/project.md#get_scenarios) <a href="#get_scenarios" id="get_scenarios"></a>

*Return the list of scenarios in the project*

**Example**

```python
for scenario in project.get_scenarios():
  print('scenario: {}'.format(scenario.name))
```

### [add\_scenario(name,\[description\])](/iota-python-api/iota/project.md#add_scenario) <a href="#add_scenario" id="add_scenario"></a>

*Create and return a scenario, described by name and optional description and tags*

**Arguments**

* `name`: (str) scenario name
* `description`: (str) scenario description (default: None)

**Example**

```python
new_scenario = project.add_scenario(
  name = 'scenario 01',
  description = 'simulation mixing analysis with speeed = 30 RPM'
  )
```

### [get\_dataset(name,\[data\_format\])](/iota-python-api/iota/project.md#get_dataset) <a href="#get_dataset" id="get_dataset"></a>

*Return a dataset record specified by name*

**Arguments**

* `name`: (str) scenario name
* `data_format`: (str) data format of the dataset to be loaded. The project can have more than one dataset with the same name if data\_format is different. (default: **None**)

**Example**

```python
dataset = project.get_dataset(
  name = 'mixing_rpm_30',
  data_format = 'PADEM'
  )
```

### [get\_datasets()](/iota-python-api/iota/project.md#get_datasets) <a href="#get_datasets" id="get_datasets"></a>

*Return the list of dataset records in the project*

**Example**

```python
print('List of datasets in the project')
for dataset in project.get_datasets():
  print('dataset: {} (format: {})'.format(dataset.name,dataset.data_format))
```

### [add\_dataset(name, data\_format, file, \[description\], \[scenario\])](/iota-python-api/iota/project.md#add_dataset) <a href="#add_dataset" id="add_dataset"></a>

*Add a Iota Dataset file to the project* *data\_format must be one of **PADEM** or **PACG***

**Arguments**

* `name`: (str) dataset name
* `data_format`: (str) format of the dataset
* `file`: (str) dataset filepath
* `description`: (str) dataset description (default: **None**)
* `scenario`: (str) add dataset to a specific scenario (default: **None**)

**Example**

```python
project.add_dataset(
  name = 'mixing_rpm_32',
  data_format = 'PADEM',
  file = '/path/to/my/dataset/mixing_rpm_32.meta',
  description = 'mixing analysis with drum speed of 32 RPM'
  )
```

### [import\_dataset(file,\[name\],\[data\_format\],\[include\_graphs\],\[description\],\[scenario\])](/iota-python-api/iota/project.md#import_dataset) <a href="#import_dataset" id="import_dataset"></a>

*Import external Dataset to the project* *data\_format must be one of the accepted formats: \[**EDEM 2017**]*

**Arguments**

* `file`: (str) dataset filepath
* `name`: (str) dataset name. If not defined, used the basename of the filepath (Default: **None**)
* `data_format`: (str) format of the dataset
* `include_graphs`: (bool) import any graph available in the dataset to the project
* `description`: (str) dataset description (Default: **None**)
* `scenario`: (str) add dataset to a specific scenario (default: **None**)

**Example**

```python
project.import_dataset(
  file = '/path/to/my/edem/dataset/simulation.dem',
  name = 'mixing_rpm_34',
  data_format = 'EDEM 2017',
  include_graphs = True,
  description = 'mixing analysis with drum speed of 34 RPM'
  )
```

### [exists\_graph(name,\[tags\])](/iota-python-api/iota/project.md#exists_graph) <a href="#exists_graph" id="exists_graph"></a>

*Return True if graph exists, specified by name (and tags)*

**Arguments**

* `name`: (str) graph name
* `tags`: (dict) tags dictionary

**Example**

```python
exists_graph = project.exists_graph(
  name = 'Reaction Force',
  tags = {
    'dataset': 'mixing_rpm_34'
    }
  )
if exists_graph: 
  print('graph exist!')
```

### [get\_graph(name,\[tags\])](/iota-python-api/iota/project.md#get_graph) <a href="#get_graph" id="get_graph"></a>

*Return a graph, specified by name (and tags)*

**Arguments**

* `name`: (str) graph name
* `tags`: (dict) tags dictionary

**Example**

```python
graph = project.get_graph(
  name = 'Reaction Force',
  tags = {
    'dataset': 'mixing_rpm_34'
    }
  )
```

### [get\_graphs()](/iota-python-api/iota/project.md#get_graphs) <a href="#get_graphs" id="get_graphs"></a>

*Return the list of graphs in the project*

**Example**

```python
print('List of graphs:')
for graph in project.get_graphs():
  print('Graph: {}'.format(graph.name))
```

### [add\_graph(name,\[title\],\[xdata\],\[ydata\],\[legend\],\[xtitle\],\[ytitle\],\[csvfile\],\[overwrite\],\[description\],\[tags\],\[scenario\])](/iota-python-api/iota/project.md#add_graph) <a href="#add_graph" id="add_graph"></a>

*Add a new graph to the project. The graph can be defined in a **csv file** or by defining all the components (data, titles, etc)*

**Arguments**

* `name`: (str) graph name
* `title`: (str) graph title
* `filepath`: (str) optional file path for new graph file (Default: **None**)
* `xdata`: (iota.ArrayFloat) array of data representing the values of axis X
* `ydata`: (list\[iota.ArrayFloat]) list of arrays representing the data series
* `legend`: (list\[str]) list of names for the data series
* `xtitle`: (str) title of the axis X
* `ytitle`: (str) title of the axis Y
* `csvfile`: (str) csv file containing the graph data. If this is defined, none of the previous variables are considered
* `description`: (str) graph description
* `tags`: (dict) tags dictionary
* `overwrite`: (bool) overwrite graph file if already exists

**Example**

```python
x_values = iota.ArrayFloat([0,1,2,3,4,5,6])
average_force = iota.ArrayFloat(len(x_values),10.0)
graph = project.add_graph(
  name = 'Average Force',
  title = 'Average Force',
  xtitle = 'Step',
  xdata = x_values,
  ytitle = 'Force',
  legend = ['Force'],
  ydata = [average_force],
  tags = {
    'dataset': 'mixing_rpm_34'
    },
  overwrite = True
  )

graph2 = project.add_graph(
  name = 'Average Torque',
  csvfile = '/path/to/my/graph/torque.csv',
  tags = {
    'dataset': 'mixing_rpm_34'
    }
  )
```

### [get\_mesh()](/iota-python-api/iota/project.md#get_mesh) <a href="#get_mesh" id="get_mesh"></a>

*Return a mesh specified by a name*

**Arguments**

* `name`: (str) mesh name

**Example**

```python
mesh_record = project.get_mesh(
  name = 'mixing_drum_v02'
  )
```

### [get\_meshes()](/iota-python-api/iota/project.md#get_meshes) <a href="#get_meshes" id="get_meshes"></a>

*Return th elist of meshes in the project*

**Example**

```python
print('List of meshes:')
for mesh in project.get_meshes():
  print(' mesh: {}'.format(mesh.name))
```

### [add\_mesh(file, \[description\])](/iota-python-api/iota/project.md#add_mesh) <a href="#add_mesh" id="add_mesh"></a>

*Add a mesh by filepath to the project*

**Arguments**

* `file`: (str) mesh filepath
* `description`: (str) mesh description

**Example**

```python
project.add_mesh(
  file = '/path/to/my/mesh/mixing_drum_v2.stl',
  description = 'Mixing drum with inclinantion of 30 degrees'
  )
```

### [get\_file(name)](/iota-python-api/iota/project.md#get_file) <a href="#get_file" id="get_file"></a>

*Return a file, specified by name*

**Arguments**

* `name`: (str) file name

**Example**

```python
file = project.get_file(
  name = 'list of values test 2'
  )
```

### [get\_files()](/iota-python-api/iota/project.md#get_files) <a href="#get_files" id="get_files"></a>

*Return the list of files in the project*

**Example**

```python
print('List of files:')
for file in project.get_files():
  print(' file: {}'.format(file.name))
```

### [add\_file(name, filepath, \[description\])](/iota-python-api/iota/project.md#add_file) <a href="#add_file" id="add_file"></a>

*Create and return a file, describe by name, filepath and optional description*

**Arguments**

* `name`: (str) scenario name
* `filepath`: (str) file path
* `description`: (str) file description (Default: **None**)

**Example**

```python
project.add_file(
  name = 'my text file',
  filepath= '/path/to/my/file/text.txt',
  description='this file contains the summary of parameters used for the simulations'
  )
```

### [get\_script(name)](/iota-python-api/iota/project.md#get_script) <a href="#get_script" id="get_script"></a>

*Return a script spcified by a name*

**Arguments**

* `name`: (str) script name

**Example**

```python
script_file = project.get_script(
  name = 'calculate mixing index'
  )
```

### [get\_scripts()](/iota-python-api/iota/project.md#get_scripts) <a href="#get_scripts" id="get_scripts"></a>

*Return the list of scripts in the project*

**Example**

```python
print('List of scripts:')
for script in project.get_scripts():
  print(' script: {}'.format(script.name))
```

### [add\_script()](/iota-python-api/iota/project.md#add_script) <a href="#add_script" id="add_script"></a>

*Add a script (python file) to the project*

**Arguments**

* `name`: (str) script name
* `filepath`: (str) script file path
* `description`: (str) script description (Default: **None**)

**Example**

```python
project.add_script(
  name = 'calculate mixing index',
  filepath = '/path/to/my/scripts/calculate_mixing_index.py',
  description = 'This script calculate the Lacey mixing index using binning'
  )
```

### [add\_video(file,name,\[description\],\[tags\],\[thumbnail\])](/iota-python-api/iota/project.md#add_video) <a href="#add_video" id="add_video"></a>

*Add a video file to the project*

**Arguments**

* `file`: (str) video file path
* `name`: (str) video name
* `description`: (str) video description (Default: **None**)
* `tags`: (dict) tags dictionary (Default: **None**)
* `thumbnail`: (str) image file to be used as a thumbnail (Default: **None**)

**Example**

```python
project.add_video(
  file = '/path/to/my/videos/mixer_rpm_32_velocity_X.mp4',
  name = 'Mixer at 32 RPM',
  description = 'This video shows the velocity profile in X direction for the case with drum speed at 32 RPM',
  tags = {
    'dataset': 'mixer_rpm_32',
    'result': 'Velocity (X)'
    }
  )
```

### [add\_screenshot(file,name,\[description\],\[tags\])](/iota-python-api/iota/project.md#add_screenshot) <a href="#add_screenshot" id="add_screenshot"></a>

*Add image file to the project*

**Arguments**

* `file`: (str) screenshot file path
* `name`: (str) screenshot name
* `description`: (str) screenshot description (Default: **None**)
* `tags`: (dict) tags dictionary (Default: **None**)

**Example**

```python
project.add_video(
  file = '/path/to/my/images/mixer_rpm_32_velocity-Y_time3.42.png',
  name = 'Mixer at 32 RPM',
  description = 'Velocity profile in Y direction for the case with drum speed at 32 RPM. Time = 3.42s',
  tags = {
    'dataset': 'mixer_rpm_32',
    'result': 'Velocity (Y)',
    'timestep': '3.42'
    }
  )
```

### [delete()](/iota-python-api/iota/project.md#delete) <a href="#delete" id="delete"></a>

*Delete project from the database (and disk if applicable)*

**Example**

```python
name = project.name
project.delete()
if not session.exist_project(name):
  print('project removed')
```
