# {py:mod}`haniwers.v0.threshold`

```{py:module} haniwers.v0.threshold
```

```{autodoc2-docstring} haniwers.v0.threshold
:allowtitles:
```

## Module Contents

### Classes

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

* - {py:obj}`Count <haniwers.v0.threshold.Count>`
  - ```{autodoc2-docstring} haniwers.v0.threshold.Count
    :summary:
    ```
````

### Functions

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

* - {py:obj}`get_count <haniwers.v0.threshold.get_count>`
  - ```{autodoc2-docstring} haniwers.v0.threshold.get_count
    :summary:
    ```
* - {py:obj}`write_count <haniwers.v0.threshold.write_count>`
  - ```{autodoc2-docstring} haniwers.v0.threshold.write_count
    :summary:
    ```
* - {py:obj}`get_data <haniwers.v0.threshold.get_data>`
  - ```{autodoc2-docstring} haniwers.v0.threshold.get_data
    :summary:
    ```
* - {py:obj}`scan_threshold_by_channel <haniwers.v0.threshold.scan_threshold_by_channel>`
  - ```{autodoc2-docstring} haniwers.v0.threshold.scan_threshold_by_channel
    :summary:
    ```
* - {py:obj}`scan_thresholds_in_serial <haniwers.v0.threshold.scan_thresholds_in_serial>`
  - ```{autodoc2-docstring} haniwers.v0.threshold.scan_thresholds_in_serial
    :summary:
    ```
* - {py:obj}`scan_thresholds_in_parallel <haniwers.v0.threshold.scan_thresholds_in_parallel>`
  - ```{autodoc2-docstring} haniwers.v0.threshold.scan_thresholds_in_parallel
    :summary:
    ```
* - {py:obj}`erfc_function <haniwers.v0.threshold.erfc_function>`
  - ```{autodoc2-docstring} haniwers.v0.threshold.erfc_function
    :summary:
    ```
* - {py:obj}`fit_threshold_by_channel <haniwers.v0.threshold.fit_threshold_by_channel>`
  - ```{autodoc2-docstring} haniwers.v0.threshold.fit_threshold_by_channel
    :summary:
    ```
* - {py:obj}`fit_thresholds <haniwers.v0.threshold.fit_thresholds>`
  - ```{autodoc2-docstring} haniwers.v0.threshold.fit_thresholds
    :summary:
    ```
````

### API

`````{py:class} Count(/, **data: typing.Any)
:canonical: haniwers.v0.threshold.Count

Bases: {py:obj}`pydantic.BaseModel`

```{autodoc2-docstring} haniwers.v0.threshold.Count
```

```{rubric} Initialization
```

```{autodoc2-docstring} haniwers.v0.threshold.Count.__init__
```

````{py:attribute} timestamp
:canonical: haniwers.v0.threshold.Count.timestamp
:type: datetime.datetime
:value: >
   'now(...)'

```{autodoc2-docstring} haniwers.v0.threshold.Count.timestamp
```

````

````{py:attribute} duration
:canonical: haniwers.v0.threshold.Count.duration
:type: int
:value: >
   0

```{autodoc2-docstring} haniwers.v0.threshold.Count.duration
```

````

````{py:attribute} ch
:canonical: haniwers.v0.threshold.Count.ch
:type: int
:value: >
   0

```{autodoc2-docstring} haniwers.v0.threshold.Count.ch
```

````

````{py:attribute} vth
:canonical: haniwers.v0.threshold.Count.vth
:type: int
:value: >
   0

```{autodoc2-docstring} haniwers.v0.threshold.Count.vth
```

````

````{py:attribute} counts
:canonical: haniwers.v0.threshold.Count.counts
:type: int
:value: >
   0

```{autodoc2-docstring} haniwers.v0.threshold.Count.counts
```

````

````{py:attribute} hit_top
:canonical: haniwers.v0.threshold.Count.hit_top
:type: int
:value: >
   0

```{autodoc2-docstring} haniwers.v0.threshold.Count.hit_top
```

````

````{py:attribute} hit_mid
:canonical: haniwers.v0.threshold.Count.hit_mid
:type: int
:value: >
   0

```{autodoc2-docstring} haniwers.v0.threshold.Count.hit_mid
```

````

````{py:attribute} hit_btm
:canonical: haniwers.v0.threshold.Count.hit_btm
:type: int
:value: >
   0

```{autodoc2-docstring} haniwers.v0.threshold.Count.hit_btm
```

````

````{py:attribute} tmp
:canonical: haniwers.v0.threshold.Count.tmp
:type: float
:value: >
   0

```{autodoc2-docstring} haniwers.v0.threshold.Count.tmp
```

````

````{py:attribute} atm
:canonical: haniwers.v0.threshold.Count.atm
:type: float
:value: >
   0

```{autodoc2-docstring} haniwers.v0.threshold.Count.atm
```

````

````{py:attribute} hmd
:canonical: haniwers.v0.threshold.Count.hmd
:type: float
:value: >
   0

```{autodoc2-docstring} haniwers.v0.threshold.Count.hmd
```

````

````{py:method} to_list_string() -> list[str]
:canonical: haniwers.v0.threshold.Count.to_list_string

```{autodoc2-docstring} haniwers.v0.threshold.Count.to_list_string
```

````

`````

````{py:function} get_count(data: pandas.DataFrame) -> haniwers.v0.threshold.Count
:canonical: haniwers.v0.threshold.get_count

```{autodoc2-docstring} haniwers.v0.threshold.get_count
```
````

````{py:function} write_count(count: haniwers.v0.threshold.Count, fname: pathlib.Path) -> None
:canonical: haniwers.v0.threshold.write_count

```{autodoc2-docstring} haniwers.v0.threshold.write_count
```
````

````{py:function} get_data(daq: haniwers.v0.config.Daq, duration: int, ch: int, vth: int) -> haniwers.v0.threshold.Count
:canonical: haniwers.v0.threshold.get_data

```{autodoc2-docstring} haniwers.v0.threshold.get_data
```
````

````{py:function} scan_threshold_by_channel(daq: haniwers.v0.config.Daq, duration: int, ch: int, vth: int) -> haniwers.v0.threshold.Count
:canonical: haniwers.v0.threshold.scan_threshold_by_channel

```{autodoc2-docstring} haniwers.v0.threshold.scan_threshold_by_channel
```
````

````{py:function} scan_thresholds_in_serial(daq: haniwers.v0.config.Daq, duration: int, ch: int, thresholds: list[int]) -> list[haniwers.v0.threshold.Count]
:canonical: haniwers.v0.threshold.scan_thresholds_in_serial

```{autodoc2-docstring} haniwers.v0.threshold.scan_thresholds_in_serial
```
````

````{py:function} scan_thresholds_in_parallel(daq: haniwers.v0.config.Daq, duration: int, thresholds: list[int]) -> haniwers.v0.threshold.Count
:canonical: haniwers.v0.threshold.scan_thresholds_in_parallel

```{autodoc2-docstring} haniwers.v0.threshold.scan_thresholds_in_parallel
```
````

````{py:function} erfc_function(x, a, b, c, d)
:canonical: haniwers.v0.threshold.erfc_function

```{autodoc2-docstring} haniwers.v0.threshold.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.v0.threshold.fit_threshold_by_channel

```{autodoc2-docstring} haniwers.v0.threshold.fit_threshold_by_channel
```
````

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

```{autodoc2-docstring} haniwers.v0.threshold.fit_thresholds
```
````
