SleePyPhases 0.10.2__tar.gz → 0.10.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/PKG-INFO +2 -1
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/Eval.py +17 -5
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases.egg-info/PKG-INFO +2 -1
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases.egg-info/SOURCES.txt +3 -1
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases.egg-info/requires.txt +1 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/setup.py +2 -1
- sleepyphases-0.10.4/tests/unit/test_optionalConfig.py +35 -0
- sleepyphases-0.10.4/tests/unit/test_softwareMetaValue.py +27 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/LICENSE +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/README.md +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/DataManipulation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/EventScorer.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/FeatureExtraction.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/LabelChannels.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/MultiScorer.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/Plot.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/Plugin.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/PreManipulation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/RecordFeatureExtraction.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/Reporter.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/SignalPreprocessing.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/SleePyPhases.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/SleepMetaData.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/__init__.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/config.yaml +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/create_wizard.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/BuildDataset.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/DataAnalysis.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/DataReport.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/EvalPlotExamples.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/EvalReport.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/ExportMetadataToMeticalDB.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/Extract.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/ExtractEvents.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/ExtractFeatures.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/ExtractRecordFeatures.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/GatherMetadata.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/LogCleanup.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/LogOverview.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/Predict.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/Setup.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/TestRun.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/ThresholdOptimisation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/Training.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/Validation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/VisualizeConfig.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/__init__.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases.egg-info/dependency_links.txt +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases.egg-info/entry_points.txt +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases.egg-info/top_level.txt +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/pyproject.toml +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/setup.cfg +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/__init__.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/conftest.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/__init__.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_BuildDataset.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_BuildDatasetFolded.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_BuildDatasetMetadataSync.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_BuildDatasetSegments.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_DataManipulation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_Eval.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_EventScorer.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_Extract.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_LabelChannels.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_PreManipulation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_RecordFeatureExtraction.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_RecordProcessor.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_Setup.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.4}/tests/unit/test_SignalPreprocessing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SleePyPhases
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.4
|
|
4
4
|
Summary: A framwork for creating deep learning pipelines for sleep data
|
|
5
5
|
Home-page: https://gitlab.com/sleep-is-all-you-need/sleepyphases
|
|
6
6
|
Author: Franz Ehrlich
|
|
@@ -11,6 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.5
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
+
Requires-Dist: pyPhases>=1.6.3
|
|
14
15
|
Requires-Dist: SleepHarmonizer
|
|
15
16
|
Requires-Dist: pyPhasesML
|
|
16
17
|
Requires-Dist: phases
|
|
@@ -12,6 +12,22 @@ from SleePyPhases.EventScorer import EventScorer
|
|
|
12
12
|
from SleePyPhases.SleepMetaData import SleepMetaData
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
def softwareMetaValue(recordData, metricName):
|
|
16
|
+
"""Value of a PSG parameter as reported by the scoring software (record metadata).
|
|
17
|
+
|
|
18
|
+
Missing, None or falsy values are reported as 0 (NaN is passed through, as before). Values can be numpy scalars,
|
|
19
|
+
plain Python values or None (e.g. CFS), so `.item()`/`.tolist()` must not be called blindly.
|
|
20
|
+
"""
|
|
21
|
+
if metricName not in recordData:
|
|
22
|
+
return 0
|
|
23
|
+
value = recordData[metricName]
|
|
24
|
+
if value is None:
|
|
25
|
+
return 0
|
|
26
|
+
if hasattr(value, "item"):
|
|
27
|
+
value = value.item()
|
|
28
|
+
return value if bool(value) else 0
|
|
29
|
+
|
|
30
|
+
|
|
15
31
|
class Eval(Phase):
|
|
16
32
|
allowTraining: bool = False
|
|
17
33
|
exampleCount: int = 3
|
|
@@ -211,11 +227,7 @@ class Eval(Phase):
|
|
|
211
227
|
sleepDataPredicted.addSignal(predictionName, scorer.flattenPrediction(predictionSignal), frequency=predictionFrequency)
|
|
212
228
|
|
|
213
229
|
for metricName in sleepDataPredicted.metaDataMap.keys():
|
|
214
|
-
resultRow[f"{metricName}-software"] = (
|
|
215
|
-
recordData[metricName].item()
|
|
216
|
-
if metricName in recordData and bool(recordData[metricName].tolist())
|
|
217
|
-
else 0
|
|
218
|
-
)
|
|
230
|
+
resultRow[f"{metricName}-software"] = softwareMetaValue(recordData, metricName)
|
|
219
231
|
resultRow[f"{metricName}-truth"] = sleepDataTruth.getMetaData(metricName)
|
|
220
232
|
resultRow[f"{metricName}-prediction"] = sleepDataPredicted.getMetaData(metricName)
|
|
221
233
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SleePyPhases
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.4
|
|
4
4
|
Summary: A framwork for creating deep learning pipelines for sleep data
|
|
5
5
|
Home-page: https://gitlab.com/sleep-is-all-you-need/sleepyphases
|
|
6
6
|
Author: Franz Ehrlich
|
|
@@ -11,6 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.5
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
+
Requires-Dist: pyPhases>=1.6.3
|
|
14
15
|
Requires-Dist: SleepHarmonizer
|
|
15
16
|
Requires-Dist: pyPhasesML
|
|
16
17
|
Requires-Dist: phases
|
|
@@ -62,4 +62,6 @@ tests/unit/test_PreManipulation.py
|
|
|
62
62
|
tests/unit/test_RecordFeatureExtraction.py
|
|
63
63
|
tests/unit/test_RecordProcessor.py
|
|
64
64
|
tests/unit/test_Setup.py
|
|
65
|
-
tests/unit/test_SignalPreprocessing.py
|
|
65
|
+
tests/unit/test_SignalPreprocessing.py
|
|
66
|
+
tests/unit/test_optionalConfig.py
|
|
67
|
+
tests/unit/test_softwareMetaValue.py
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="SleePyPhases",
|
|
8
|
-
version="v0.10.
|
|
8
|
+
version="v0.10.4"[1:],
|
|
9
9
|
author="Franz Ehrlich",
|
|
10
10
|
author_email="fehrlichd@gmail.com",
|
|
11
11
|
description="A framwork for creating deep learning pipelines for sleep data",
|
|
@@ -21,6 +21,7 @@ setuptools.setup(
|
|
|
21
21
|
"Operating System :: OS Independent",
|
|
22
22
|
],
|
|
23
23
|
install_requires=[
|
|
24
|
+
"pyPhases>=1.6.3", # getConfig(name, None) = optional entry
|
|
24
25
|
"SleepHarmonizer",
|
|
25
26
|
"pyPhasesML",
|
|
26
27
|
"phases"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Regression: SleePyPhases uses getConfig(name, None) for optional entries (thresholdMetric, optimizeThresholdFor,
|
|
2
|
+
dataversion.seed, predict.channelMapping). This needs pyPhases >= 1.6.3; before, a None default raised
|
|
3
|
+
ConfigNotFoundException (crashed EvalReport -> ThresholdOptimisation for projects without optimizeThresholdFor)."""
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from SleePyPhases.phases.ThresholdOptimisation import ThresholdOptimisation
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.fixture
|
|
10
|
+
def project():
|
|
11
|
+
from pyPhases.test import TestCase # local import: unittest classes at module level get collected
|
|
12
|
+
|
|
13
|
+
return TestCase.project
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_none_default_is_optional(project):
|
|
17
|
+
project.config.pop("optimizeThresholdFor", None)
|
|
18
|
+
assert project.getConfig("optimizeThresholdFor", None) is None
|
|
19
|
+
assert project.getConfig("predict.notExistingEntry", None) is None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_threshold_without_metric_is_half(project):
|
|
23
|
+
phase = ThresholdOptimisation()
|
|
24
|
+
phase.project = project
|
|
25
|
+
registered = {}
|
|
26
|
+
phase.registerData = lambda name, value: registered.__setitem__(name, value)
|
|
27
|
+
missing = object()
|
|
28
|
+
old = project.config.get("thresholdMetric", missing)
|
|
29
|
+
project.config.pop("thresholdMetric", None)
|
|
30
|
+
try:
|
|
31
|
+
phase.generateData("threshold")
|
|
32
|
+
finally:
|
|
33
|
+
if old is not missing:
|
|
34
|
+
project.config["thresholdMetric"] = old
|
|
35
|
+
assert registered["threshold"] == 0.5
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pandas as pd
|
|
3
|
+
|
|
4
|
+
from SleePyPhases.phases.Eval import softwareMetaValue
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_numpy_value_from_metadata_row():
|
|
8
|
+
row = pd.DataFrame([{"recordId": "a", "tst": 400.0}]).iloc[0]
|
|
9
|
+
assert softwareMetaValue(row, "tst") == 400.0
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_none_value_does_not_crash():
|
|
13
|
+
# CFS metadata contains None for some PSG parameters (crashed in 0.10.2 with .tolist())
|
|
14
|
+
row = pd.DataFrame([{"recordId": "a", "ahi": None, "tst": 1.0}], dtype=object).iloc[0]
|
|
15
|
+
assert softwareMetaValue(row, "ahi") == 0
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_plain_python_values_and_missing():
|
|
19
|
+
assert softwareMetaValue({"tst": 5}, "tst") == 5
|
|
20
|
+
assert softwareMetaValue({"tst": 0}, "tst") == 0
|
|
21
|
+
assert softwareMetaValue({}, "tst") == 0
|
|
22
|
+
assert softwareMetaValue({"x": 1}, "tst") == 0
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_nan_passes_through_unchanged():
|
|
26
|
+
row = pd.DataFrame([{"tst": np.nan}]).iloc[0]
|
|
27
|
+
assert np.isnan(softwareMetaValue(row, "tst"))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sleepyphases-0.10.2 → sleepyphases-0.10.4}/SleePyPhases/phases/ExportMetadataToMeticalDB.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|