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

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

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

## Module Contents

### Functions

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

* - {py:obj}`write_threshold <haniwers.v1.threshold.writer.write_threshold>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.writer.write_threshold
    :summary:
    ```
* - {py:obj}`write_threshold_with_retry <haniwers.v1.threshold.writer.write_threshold_with_retry>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.writer.write_threshold_with_retry
    :summary:
    ```
* - {py:obj}`write_threshold_to_csv <haniwers.v1.threshold.writer.write_threshold_to_csv>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.writer.write_threshold_to_csv
    :summary:
    ```
* - {py:obj}`apply_threshold <haniwers.v1.threshold.writer.apply_threshold>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.writer.apply_threshold
    :summary:
    ```
* - {py:obj}`apply_thresholds <haniwers.v1.threshold.writer.apply_thresholds>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.writer.apply_thresholds
    :summary:
    ```
````

### Data

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

* - {py:obj}`DEVICE_STABILIZATION_DELAY <haniwers.v1.threshold.writer.DEVICE_STABILIZATION_DELAY>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.writer.DEVICE_STABILIZATION_DELAY
    :summary:
    ```
* - {py:obj}`RETRY_INTERVAL <haniwers.v1.threshold.writer.RETRY_INTERVAL>`
  - ```{autodoc2-docstring} haniwers.v1.threshold.writer.RETRY_INTERVAL
    :summary:
    ```
````

### API

````{py:data} DEVICE_STABILIZATION_DELAY
:canonical: haniwers.v1.threshold.writer.DEVICE_STABILIZATION_DELAY
:value: >
   0.1

```{autodoc2-docstring} haniwers.v1.threshold.writer.DEVICE_STABILIZATION_DELAY
```

````

````{py:data} RETRY_INTERVAL
:canonical: haniwers.v1.threshold.writer.RETRY_INTERVAL
:value: >
   0.5

```{autodoc2-docstring} haniwers.v1.threshold.writer.RETRY_INTERVAL
```

````

````{py:function} write_threshold(device: haniwers.v1.daq.device.Device, ch: int, vth: int) -> bool
:canonical: haniwers.v1.threshold.writer.write_threshold

```{autodoc2-docstring} haniwers.v1.threshold.writer.write_threshold
```
````

````{py:function} write_threshold_with_retry(device: haniwers.v1.daq.device.Device, ch: int, vth: int, max_retry: int = 3) -> haniwers.v1.threshold.model.ThresholdWriteResult
:canonical: haniwers.v1.threshold.writer.write_threshold_with_retry

```{autodoc2-docstring} haniwers.v1.threshold.writer.write_threshold_with_retry
```
````

````{py:function} write_threshold_to_csv(csv_path: pathlib.Path, result: haniwers.v1.threshold.model.ThresholdWriteResult) -> None
:canonical: haniwers.v1.threshold.writer.write_threshold_to_csv

```{autodoc2-docstring} haniwers.v1.threshold.writer.write_threshold_to_csv
```
````

````{py:function} apply_threshold(device: haniwers.v1.daq.device.Device, sensor: haniwers.v1.config.model.SensorConfig, max_retry: int = 3, history_path: pathlib.Path | None = None) -> haniwers.v1.threshold.model.ThresholdWriteResult
:canonical: haniwers.v1.threshold.writer.apply_threshold

```{autodoc2-docstring} haniwers.v1.threshold.writer.apply_threshold
```
````

````{py:function} apply_thresholds(device: haniwers.v1.daq.device.Device, sensors: list[haniwers.v1.config.model.SensorConfig], max_retry: int = 3, history_path: pathlib.Path | None = None) -> list[haniwers.v1.threshold.model.ThresholdWriteResult]
:canonical: haniwers.v1.threshold.writer.apply_thresholds

```{autodoc2-docstring} haniwers.v1.threshold.writer.apply_thresholds
```
````
