# Python API

## <mark style="color:purple;">catch22\_all</mark>

Extract the *catch22* feature set from an input time series.

### **Syntax**

<pre class="language-python"><code class="lang-python"><strong>pycatch22.catch22_all(data, catch24=False, short_names=False)
</strong></code></pre>

### Parameters

| Parameter     | Type                                                                                    | Description                                                                                              |
| ------------- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `data`        | [array-like](https://numpy.org/doc/stable/user/basics.creation.html#array-like-objects) | Input time-series data.                                                                                  |
| `catch24`     | [bool](https://docs.python.org/3/library/stdtypes.html#boolean-values)                  | If True, include the two catch24 features (mean and standard deviation) in the output. Default is False. |
| `short_names` | [bool](https://docs.python.org/3/library/stdtypes.html#boolean-values)                  | If True, also include the short names of the features in the output. Default is False.                   |

***

### Return Value

The function returns a [dictionary](https://docs.python.org/3/library/stdtypes.html#dict) with the following keys:

| Key             | Type                                                         | Description                                          |
| --------------- | ------------------------------------------------------------ | ---------------------------------------------------- |
| `'names'`       | [list](https://docs.python.org/3/library/stdtypes.html#list) | List of feature names.                               |
| `'values'`      | [list](https://docs.python.org/3/library/stdtypes.html#list) | List of corresponding feature values.                |
| `'short_names'` | [list](https://docs.python.org/3/library/stdtypes.html#list) | List of short feature names (if `short_names=True`). |

***

### Example Usage

```python
import numpy as np
import pycatch22 as catch22

data = np.random.rand(100)
features = catch22_all(data)
print(features['names'])
# Output: ['DN_HistogramMode_5', 'DN_HistogramMode_10', 'CO_f1ecac', ..., 'SP_Summaries_welch_rect_centroid', 'FC_LocalSimple_mean3_stderr']
print(features['values'])
# Output: [0.23, 0.18, 1.52, ..., 0.04, 0.67]

features_with_catch24 = catch22_all(data, catch24=True)
print(features_with_catch24['names'][-2:])
# Output: ['DN_Mean', 'DN_Spread_Std']

features_with_short_names = catch22_all(data, short_names=True)
print(features_with_short_names['short_names'])
# Output: ['mode_5', 'mode_10', 'acf_timescale', ..., 'low_freq_power', 'forecast_error']

```

***

***

## Individual Feature Methods

The `catch22` module provides direct access to the individual feature extraction methods implemented in C. These methods can be called directly using `pycatch22.{name}`, where `{name}` is the name of the feature method (as given by the **long** name in the [table of features](/catch22/information-about-catch22/feature-descriptions/feature-overview-table.md)).&#x20;

### Syntax

```python
pycatch22.DN_Mean(data)
```

### Parameters

| Parameter | Type                                                                                                                             | Description             |
| --------- | -------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
| `data`    | ([list](https://docs.python.org/3/library/stdtypes.html#list) or [tuple](https://docs.python.org/3/library/stdtypes.html#tuple)) | Input time-series data. |

### Return Values

| Value     | Type                                                                                                                             | Description                                                                        |
| --------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `feature` | ([Int](https://docs.python.org/3/library/functions.html#int) or [Float](https://docs.python.org/3/library/functions.html#float)) | Individual feature value. Either integer or float depending on the feature method. |

### Example Usage

```python
import numpy as np
from pycatch22 import DN_Mean

data = list(np.random.randn(100))
individual_feature = DN_Mean(data)
print(individual_feature)
# Output: -0.11125506527054776
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://time-series-features.gitbook.io/catch22/information-about-catch22/api-reference/python-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
