# source

Python API: `luxonis_ml.data.datasets.source`

## Classes

| Name | Description |
| --- | --- |
|
[`LuxonisComponent`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/datasets/source.md)
| Media component within a source. |
|
[`LuxonisSource`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/datasets/source.md)
| Source definition for a dataset. |

### class `LuxonisComponent`

```python
class LuxonisComponent(BaseModelExtraForbid)
```

Media component within a source.

Most commonly, this represents one image sensor.

> **Deprecated**
> Deprecated since version 0.10.0:LuxonisComponent is deprecated and will be removed in a future release.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `image_type` | `ImageType` | Image kind. Only used for image media. |
| `media_type` | `MediaType` | Media kind represented by the component. |
| `name` | `str` | Human-readable component name. |

### class `LuxonisSource`

```python
class LuxonisSource(BaseModelExtraForbid)
```

Source definition for a dataset.

A source describes which components or media streams are included. For example, an
[OAK-D](https://docs.luxonis.com/projects/hardware/en/latest/pages/BW1098OAK/) source can contain `rgb`, `left`, `right`, `depth`
components.

> **Deprecated**
> Deprecated since version 0.10.0:LuxonisSource is deprecated and will be removed in a future release.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `components` | `dict[str, LuxonisComponent]` | Components grouped in the source. |
| `main_component` | `str` | Component name used as the primary visualization target. |
| `name` | `str` | Human-readable source name. |

Methods

| Name | Description |
| --- | --- |
|
[`merge_with`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/datasets/source.md)
| Merge two sources together. |

#### method `merge_with`

```python
def merge_with(other: LuxonisSource) -> LuxonisSource
```

Merge two sources together.

`name` and `main_component` are taken from the first source. `components` are merged together, with the second source's components
taking precedence in case of name conflicts.

> **Example**
> ```pycon
>>> source1 = LuxonisSource(
...     name="source1",
...     components={
...         "rgb": LuxonisComponent(name="rgb"),
...     },
...     main_component="rgb",
... )
>>> source2 = LuxonisSource(
...     name="source2",
...     components={
...         "depth": LuxonisComponent(name="depth"),
...     },
...     main_component="depth",
... )
>>> merged_source = source1.merge_with(source2)
>>> merged_source.name
'source1'
>>> merged_source.main_component
'rgb'
>>> sorted(merged_source.components.keys())
['depth', 'rgb']
```

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `other` | `LuxonisSource` | Source to merge with. | required |

Returns

| Type | Description |
| --- | --- |
| `LuxonisSource` | New source containing components from both sources. |
