# {py:mod}`haniwers.v1.threshold.fitter`

```{py:module} haniwers.v1.threshold.fitter
```

```{autodoc2-docstring} haniwers.v1.threshold.fitter
:allowtitles:
```

## Module Contents

### Classes

````{list-table}
:class: autosummary longtable
:align: left

* - {py:obj}`ThresholdFitResult <haniwers.v1.threshold.fitter.ThresholdFitResult>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.fitter.ThresholdFitResult
    :summary:
    ```
````

### Functions

````{list-table}
:class: autosummary longtable
:align: left

* - {py:obj}`erfc_function <haniwers.v1.threshold.fitter.erfc_function>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.fitter.erfc_function
    :summary:
    ```
* - {py:obj}`fit_threshold_by_channel <haniwers.v1.threshold.fitter.fit_threshold_by_channel>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.fitter.fit_threshold_by_channel
    :summary:
    ```
* - {py:obj}`fit_thresholds <haniwers.v1.threshold.fitter.fit_thresholds>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.fitter.fit_thresholds
    :summary:
    ```
* - {py:obj}`verify_fit_quality <haniwers.v1.threshold.fitter.verify_fit_quality>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.fitter.verify_fit_quality
    :summary:
    ```
* - {py:obj}`plot_fit_results <haniwers.v1.threshold.fitter.plot_fit_results>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.fitter.plot_fit_results
    :summary:
    ```
````

### API

`````{py:class} ThresholdFitResult
:canonical: haniwers.v1.threshold.fitter.ThresholdFitResult

Bases: {py:obj}`typing.NamedTuple`

```{autodoc2-docstring} haniwers.v1.threshold.fitter.ThresholdFitResult
```

````{py:attribute} ch
:canonical: haniwers.v1.threshold.fitter.ThresholdFitResult.ch
:type: int
:value: >
   None

```{autodoc2-docstring} haniwers.v1.threshold.fitter.ThresholdFitResult.ch
```

````

````{py:attribute} timestamp
:canonical: haniwers.v1.threshold.fitter.ThresholdFitResult.timestamp
:type: str
:value: >
   None

```{autodoc2-docstring} haniwers.v1.threshold.fitter.ThresholdFitResult.timestamp
```

````

````{py:attribute} mean
:canonical: haniwers.v1.threshold.fitter.ThresholdFitResult.mean
:type: float
:value: >
   None

```{autodoc2-docstring} haniwers.v1.threshold.fitter.ThresholdFitResult.mean
```

````

````{py:attribute} sigma
:canonical: haniwers.v1.threshold.fitter.ThresholdFitResult.sigma
:type: float
:value: >
   None

```{autodoc2-docstring} haniwers.v1.threshold.fitter.ThresholdFitResult.sigma
```

````

````{py:attribute} sigma_0
:canonical: haniwers.v1.threshold.fitter.ThresholdFitResult.sigma_0
:type: float
:value: >
   None

```{autodoc2-docstring} haniwers.v1.threshold.fitter.ThresholdFitResult.sigma_0
```

````

````{py:attribute} sigma_1
:canonical: haniwers.v1.threshold.fitter.ThresholdFitResult.sigma_1
:type: float
:value: >
   None

```{autodoc2-docstring} haniwers.v1.threshold.fitter.ThresholdFitResult.sigma_1
```

````

````{py:attribute} sigma_3
:canonical: haniwers.v1.threshold.fitter.ThresholdFitResult.sigma_3
:type: float
:value: >
   None

```{autodoc2-docstring} haniwers.v1.threshold.fitter.ThresholdFitResult.sigma_3
```

````

````{py:attribute} sigma_5
:canonical: haniwers.v1.threshold.fitter.ThresholdFitResult.sigma_5
:type: float
:value: >
   None

```{autodoc2-docstring} haniwers.v1.threshold.fitter.ThresholdFitResult.sigma_5
```

````

`````

````{py:function} erfc_function(x: numpy.ndarray, a: float, b: float, c: float, d: float) -> numpy.ndarray
:canonical: haniwers.v1.threshold.fitter.erfc_function

```{autodoc2-docstring} haniwers.v1.threshold.fitter.erfc_function
```
````

````{py:function} fit_threshold_by_channel(data: pandas.DataFrame, ch: int, func, params: list[float]) -> tuple[pandas.DataFrame, pandas.DataFrame, pandas.DataFrame]
:canonical: haniwers.v1.threshold.fitter.fit_threshold_by_channel

```{autodoc2-docstring} haniwers.v1.threshold.fitter.fit_threshold_by_channel
```
````

````{py:function} fit_thresholds(data: pandas.DataFrame, channels: list[int], params: list[float]) -> pandas.DataFrame
:canonical: haniwers.v1.threshold.fitter.fit_thresholds

```{autodoc2-docstring} haniwers.v1.threshold.fitter.fit_thresholds
```
````

````{py:function} verify_fit_quality(scan_data: pandas.DataFrame, fit_results: pandas.DataFrame, verbose: bool = True) -> dict
:canonical: haniwers.v1.threshold.fitter.verify_fit_quality

```{autodoc2-docstring} haniwers.v1.threshold.fitter.verify_fit_quality
```
````

````{py:function} plot_fit_results(scan_data: pandas.DataFrame, fit_results: pandas.DataFrame, output_dir: pathlib.Path = None, verbose: bool = False) -> dict
:canonical: haniwers.v1.threshold.fitter.plot_fit_results

```{autodoc2-docstring} haniwers.v1.threshold.fitter.plot_fit_results
```
````
