Skip to content

Commit bf30300

Browse files
committed
updated README and entry points
1 parent 7f19fe8 commit bf30300

File tree

7 files changed

+45
-35
lines changed

7 files changed

+45
-35
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ Before launching the interface, ensure that the Arduino board is connected to th
6868

6969
To launch the interface, run the following command in the terminal:
7070
``` bash
71-
python -m PhysioKit2.main --config <path of config file>
71+
physiokit --config <path of config file>
7272
see example below
73-
python -m PhysioKit2.main --config configs/avr_default/sw_config.json
73+
physiokit --config configs/avr_default/sw_config.json
7474
```
7575

7676
This shall open user interface, basic functioning of which is shown in this demo. Please note that if secondary screen is connected, the interface uses it to adjust its resolution, however it may have to be moved to the secondary screen if it got launched on the primary.

setup.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
long_description = (this_directory / "README.md").read_text()
77

88
setup(name='PhysioKit2',
9-
version='1.7.2',
9+
version='1.7.3',
1010
description="PhysioKit: An Open-Source, Low-Cost Physiological Computing Toolkit for Single- and Multi-User Studies",
1111
long_description=long_description,
1212
long_description_content_type='text/markdown',
@@ -29,7 +29,7 @@
2929
'setuptools'
3030
],
3131
packages=find_namespace_packages(where="src"),
32-
package_dir={"": "src"},
32+
package_dir={"": "src", 'analyze':"src/PhysioKit2/analysis_helper"},
3333
include_package_data=True,
3434
package_data={
3535
"PhysioKit2": ["*.txt"],
@@ -42,5 +42,11 @@
4242
"PhysioKit2.configs.arm_due": ["*.json"],
4343
"PhysioKit2.configs.avr_default": ["*.json"],
4444
},
45-
exclude_package_data={"PhysioKit2": [".gitattributes"]}
45+
exclude_package_data={"PhysioKit2": [".gitattributes"]},
46+
entry_points={
47+
'console_scripts': [
48+
'physiokit = PhysioKit2.main:main',
49+
'physiokit_analyze = PhysioKit2.analysis_helper.process_signals:main',
50+
]
51+
}
4652
)

src/PhysioKit2/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ Before launching the interface, ensure that the Arduino board is connected to th
7070
To launch the interface, run the following command in the terminal:
7171

7272
``` bash
73-
python -m PhysioKit2.main --config <path of config file>
73+
physiokit --config <path of config file>
7474
see example below
75-
python -m PhysioKit2.main --config configs/avr_default/sw_config.json
75+
physiokit --config configs/avr_default/sw_config.json
7676
```
7777

7878
This shall open user interface. Please note that if secondary screen is connected, the interface uses it to adjust its resolution, however it may have to be moved to the secondary screen if it got launched on the primary.

src/PhysioKit2/analysis_helper/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Sample data and corresponding exp_config.json file is provided to illustrate how
66
### Step-2: Batch processing to compute metrics from PPG and EDA signals:
77

88
``` bash
9-
python -m PhysioKit2.analysis_helper.process_signals --config analysis_helper/exp_config.json --datapath analysis_helper sample_data --opt 0
9+
physiokit_analyze --config exp_config.json --datapath sample_data --opt 0
1010
```
1111

1212
### Step-3: Saving and exporting data-tables
@@ -16,5 +16,5 @@ Following command is to illustrate the use when a specific window size and step
1616
Please specify the appropriate path for "analysis_dict_nk.npy" - as it would have been saved after executing the "Step-1".
1717

1818
``` bash
19-
python -m PhysioKit2.analysis_helper.process_signals --config analysis_helper/exp_config.json --datadict analysis/W120_S5__OptPPG/analysis_dict_nk.npy --opt 1
19+
physiokit_analyze --config exp_config.json --datadict analysis/W120_S5__OptPPG/analysis_dict_nk.npy --opt 1
2020
```

src/PhysioKit2/analysis_helper/process_signals.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23
from copy import deepcopy
34
import numpy as np
45
from scipy import signal
@@ -405,7 +406,7 @@ def process_data(self):
405406
self.analysis_dict_nk[pid][cond] = {}
406407

407408
fn = os.path.join(self.datapath, pid, val["path"])
408-
_, _, ppg1, ppg2, _, _ = load_csv_data_all(fn)
409+
_, _, ppg1, ppg2, _ = load_csv_data_all(fn)
409410

410411
print("Processing: ", pid, cond)
411412
# PPG1
@@ -629,8 +630,17 @@ def make_data_tables(self):
629630

630631

631632

632-
def main(args_parser):
633+
def main(argv=sys.argv):
633634

635+
parser = argparse.ArgumentParser()
636+
parser.add_argument('--config', type=str, dest='config', help='Config file for experiment')
637+
parser.add_argument('--opt', type=str, dest='opt', help='0 - process signals/ 1 - make data tables', default="0")
638+
parser.add_argument('--datapath', type=str, dest='datapath', help='Root directory for data', default="data")
639+
parser.add_argument('--savepath', type=str, dest='savepath', help='Destination directory for saving analysis outcome', default="analysis")
640+
parser.add_argument('--datadict', type=str, dest='datadict', help='Filepath for data dictionary', default="")
641+
parser.add_argument('REMAIN', nargs='*')
642+
args_parser = parser.parse_args()
643+
634644
Process_Signals_obj = Process_Signals(args_parser.config, args_parser.datapath, args_parser.savepath, args_parser.datadict)
635645

636646
if Process_Signals_obj.status:
@@ -644,15 +654,5 @@ def main(args_parser):
644654

645655

646656
if __name__ == "__main__":
647-
648-
parser = argparse.ArgumentParser()
649-
parser.add_argument('--config', type=str, dest='config', help='Config file for experiment')
650-
parser.add_argument('--opt', type=str, dest='opt', help='0 - process signals/ 1 - make data tables', default="0")
651-
parser.add_argument('--datapath', type=str, dest='datapath', help='Root directory for data', default="data")
652-
parser.add_argument('--savepath', type=str, dest='savepath', help='Destination directory for saving analysis outcome', default="analysis")
653-
parser.add_argument('--datadict', type=str, dest='datadict', help='Filepath for data dictionary', default="")
654-
parser.add_argument('REMAIN', nargs='*')
655-
args_parser = parser.parse_args()
656-
657-
main(args_parser=args_parser)
657+
main()
658658

13.7 KB
Loading

src/PhysioKit2/main.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23
os.environ["PYSIDE_DESIGNER_PLUGINS"] = '.'
34
os.environ["QT_LOGGING_RULES"]='*.debug=false;qt.pysideplugin=false'
45
import argparse
@@ -920,18 +921,7 @@ def _draw_frame(self, framedata):
920921

921922

922923

923-
def main(app, args_parser):
924-
if config.OS_NAME == 'Darwin':
925-
app.setStyle('Fusion')
926-
927-
widget = physManager(args_parser)
928-
widget.show()
929-
ret = app.exec()
930-
931-
# sys.exit(ret)
932-
return
933-
934-
if __name__ == '__main__':
924+
def main(argv=sys.argv):
935925

936926
# Create the application instance.
937927
app = QApplication([])
@@ -946,7 +936,21 @@ def main(app, args_parser):
946936
parser.add_argument('--width', default=width, dest="width", type=int)
947937
parser.add_argument('--height', default=height, dest="height", type=int)
948938

939+
# args = parser.parse_args(argv[1:])
940+
949941
parser.add_argument('REMAIN', nargs='*')
950942
args_parser = parser.parse_args()
951943

952-
main(app, args_parser)
944+
945+
if config.OS_NAME == 'Darwin':
946+
app.setStyle('Fusion')
947+
948+
widget = physManager(args_parser)
949+
widget.show()
950+
ret = app.exec()
951+
952+
# sys.exit(ret)
953+
return
954+
955+
if __name__ == '__main__':
956+
main()

0 commit comments

Comments
 (0)