Skip to content

Commit

Permalink
Merge pull request #316 from EIT-ALIVE/update_docs
Browse files Browse the repository at this point in the history
Update documentation
  • Loading branch information
psomhorst authored Oct 21, 2024
2 parents 1f98f6d + 309c447 commit c8147aa
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 13 deletions.
12 changes: 12 additions & 0 deletions docs/api/mixins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Mixins

::: eitprocessing.datahandling.mixins.equality.Equivalence
::: eitprocessing.datahandling.mixins.slicing.SelectByIndex
::: eitprocessing.datahandling.mixins.slicing.SelectByTime
options:
members:
- select_by_time
- t

::: eitprocessing.datahandling.mixins.slicing.TimeIndexer

25 changes: 19 additions & 6 deletions eitprocessing/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,24 @@ class Category(Node):
subsub(...)category, `category.has_subcategory("<name>")` can be used. The keyword `in` can be used as a shorthand.
Example:
```
>>> "tea" in category # is the same as:
True
>>> category.has_subcategory("tea")
True
```
To select a subcategory, category["<name>"] can be used. You can select multiple categories at once. This will
To select a subcategory, `category["<name>"]` can be used. You can select multiple categories at once. This will
create a new tree with a temporary root, containing only the selected categories.
Example:
```
>>> foobar = categories["foo", "bar"]
>>> print(foobar) # Category('/temporary root')
>>> print(foobar.children) # (Category('/temporary root/foo'), Category('/temporary root/bar'))
>>> print(foobar)
Category('/temporary root')
>>> print(foobar.children)
(Category('/temporary root/foo'), Category('/temporary root/bar'))
```
Categories can be hand-crafted, created from a dictionary or a YAML string. See [`anytree.DictionaryImporter`
documentation](https://anytree.readthedocs.io/en/latest/importer/dictimporter.html) for more info on the dictionary
Expand All @@ -61,10 +69,15 @@ class Category(Node):
algorithms.
Example:
```
>>> categories = get_default_categories()
>>> print(categories) # Category('/category')
>>> print("pressure" in categories) # True
>>> categories["pressure"] # Category('/category/physical measurements/pressure')
>>> print(categories)
Category('/category')
>>> print("pressure" in categories)
True
>>> categories["pressure"]
Category('/category/physical measurement/pressure')
```
"""

readonly = True
Expand Down
2 changes: 1 addition & 1 deletion eitprocessing/config/categories-compact.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
root:
- physical measurements:
- physical measurement:
- gas content:
- partial pressure:
- partial pressure of carbon dioxide
Expand Down
8 changes: 6 additions & 2 deletions eitprocessing/datahandling/loading/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ def load_eit_data(
Example:
```
sequence = load_data(["path/to/file1", "path/to/file2"], vendor="sentec", label="initial_measurement")
pixel_impedance = sequence.eit_data["raw"].pixel_impedance
>>> sequence = load_eit_data(
... ["path/to/file1", "path/to/file2"],
... vendor="sentec",
... label="initial_measurement"
... )
>>> pixel_impedance = sequence.eit_data["raw"].pixel_impedance
```
"""
from eitprocessing.datahandling.loading import draeger, sentec, timpel # not in top level to avoid circular import
Expand Down
2 changes: 1 addition & 1 deletion eitprocessing/datahandling/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def select_by_time(
) -> Self:
"""Return a sliced version of the Sequence.
See SelectByTime.select_by_time().
See `SelectByTime.select_by_time()`.
"""
if not label:
label = f"copy_of_<{self.label}>"
Expand Down
9 changes: 8 additions & 1 deletion eitprocessing/features/breath_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@ class BreathDetection:
implemented as the minimum time between peaks and between valleys.
Examples:
```
>>> bd = BreathDetection(minimum_duration=0.5)
>>> breaths = bd.find_breaths(sequency=seq, continuousdata_label="global_impedance_(raw)")
>>> breaths = bd.find_breaths(
... sequency=seq,
... continuousdata_label="global_impedance_(raw)"
... )
```
```
>>> global_impedance = seq.continuous_data["global_impedance_(raw)"]
>>> breaths = bd.find_breaths(continuous_data=global_impedance)
```
Args:
minimum_duration: minimum expected duration of breaths, defaults to 2/3 of a second
Expand Down
4 changes: 3 additions & 1 deletion eitprocessing/features/pixel_breath.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ class PixelBreath:
of inspiration and expiration. These points are then used to find the start/end of pixel
inspiration/expiration in pixel impedance data.
Examples:
Example:
```
>>> pi = PixelBreath()
>>> eit_data = sequence.eit_data['raw']
>>> continuous_data = sequence.continuous_data['global_impedance_(raw)']
>>> pixel_breaths = pi.find_pixel_breaths(eit_data, continuous_data, sequence)
```
Args:
breath_detection_kwargs (dict): A dictionary of keyword arguments for breath detection.
Expand Down
4 changes: 3 additions & 1 deletion eitprocessing/parameters/eeli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ def compute_parameter(self, continuous_data: ContinuousData) -> np.ndarray:
"""Compute the EELI for each breath in the impedance data.
Example:
```
>>> global_impedance = sequence.continuous_data["global_impedance_(raw)"]
>>> eeli_values = EELI().compute_parameter(global_impedance)
>>> eeli_data = EELI().compute_parameter(global_impedance)
```
Args:
continuous_data: a ContinuousData object containing impedance data.
Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ nav:
- api/features.md
- api/parameters.md
- api/categories.md
- api/mixins.md
- About:
- Contributing: contributing_doc.md
- Code of Conduct: code_of_conduct_doc.md
Expand Down Expand Up @@ -82,6 +83,7 @@ markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
pygments_lang_class: true
default_lang: "py"
- pymdownx.extra
- pymdownx.tabbed:
alternate_style: true
Expand Down

0 comments on commit c8147aa

Please sign in to comment.