SleePyPhases 0.10.2__tar.gz → 0.10.3__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.3}/PKG-INFO +1 -1
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/Eval.py +17 -5
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases.egg-info/PKG-INFO +1 -1
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases.egg-info/SOURCES.txt +2 -1
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/setup.py +1 -1
- sleepyphases-0.10.3/tests/unit/test_softwareMetaValue.py +27 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/LICENSE +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/README.md +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/DataManipulation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/EventScorer.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/FeatureExtraction.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/LabelChannels.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/MultiScorer.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/Plot.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/Plugin.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/PreManipulation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/RecordFeatureExtraction.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/Reporter.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/SignalPreprocessing.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/SleePyPhases.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/SleepMetaData.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/__init__.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/config.yaml +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/create_wizard.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/BuildDataset.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/DataAnalysis.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/DataReport.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/EvalPlotExamples.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/EvalReport.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/ExportMetadataToMeticalDB.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/Extract.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/ExtractEvents.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/ExtractFeatures.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/ExtractRecordFeatures.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/GatherMetadata.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/LogCleanup.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/LogOverview.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/Predict.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/Setup.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/TestRun.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/ThresholdOptimisation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/Training.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/Validation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/VisualizeConfig.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases/phases/__init__.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases.egg-info/dependency_links.txt +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases.egg-info/entry_points.txt +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases.egg-info/requires.txt +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/SleePyPhases.egg-info/top_level.txt +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/pyproject.toml +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/setup.cfg +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/__init__.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/conftest.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/__init__.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_BuildDataset.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_BuildDatasetFolded.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_BuildDatasetMetadataSync.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_BuildDatasetSegments.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_DataManipulation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_Eval.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_EventScorer.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_Extract.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_LabelChannels.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_PreManipulation.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_RecordFeatureExtraction.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_RecordProcessor.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_Setup.py +0 -0
- {sleepyphases-0.10.2 → sleepyphases-0.10.3}/tests/unit/test_SignalPreprocessing.py +0 -0
|
@@ -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
|
|
|
@@ -62,4 +62,5 @@ 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_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.3"[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",
|
|
@@ -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.3}/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
|
|
File without changes
|