From 5f685eb7f73a7b62c976fd99c5e4c89738c5e5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?In=C3=A9s=20Chavarr=C3=ADa?= <72545702+ineschh@users.noreply.github.com> Date: Thu, 12 Nov 2020 15:53:34 +0100 Subject: [PATCH 1/6] add parser --- phys2denoise/cli/run.py | 196 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 phys2denoise/cli/run.py diff --git a/phys2denoise/cli/run.py b/phys2denoise/cli/run.py new file mode 100644 index 0000000..7f79b40 --- /dev/null +++ b/phys2denoise/cli/run.py @@ -0,0 +1,196 @@ +# -*- coding: utf-8 -*- +"""Parser for phys2denoise.""" + + +import argparse + +from phys2denoise import __version__ + + +def _get_parser(): + """ + Parse command line inputs for this function. + + Returns + ------- + parser.parse_args() : argparse dict + + Notes + ----- + # Argument parser follow template provided by RalphyZ. + # https://stackoverflow.com/a/43456577 + """ + parser = argparse.ArgumentParser() + optional = parser._action_groups.pop() + metric = parser._action_groups.pop() + required = parser.add_argument_group('Required Argument:') + required.add_argument('-in', '--input-file', + dest='filename', + type=str, + help='Path/name of the file containing physiological ' + 'data, with or without extension.', + required=True) + metric.add_argument('-crf', '--crf', + dest='metric_list', + action='append_const', + const='crf', + help='Cardiac response function. Needs the following ' + 'inputs:sr, os, tl, onset and tr.', + default=False) + metric.add_argument('-rpv', '--rpv', + dest='metric_list', + action='append_const', + const='rpv', + help='REspiratory pattern variability. Needs the following ' + 'inputs: bts and win.', + default=False) + metric.add_argument('-env', '--env', + dest='metric_list', + action='append_const', + const='env', + help='Respiratory pattern variability calculated across a sliding ' + 'window. Needs the following inputs: bts, sr, osr, win and lags.', + default=False) + metric.add_argument('-rv', '--rv', + dest='metric_list', + action='append_const', + const='rv', + help='Respiratory variance. Needs the following inputs: ' + 'bts, sr, osr, win and lags.', + default=False) + metric.add_argument('-rvt', '--rvt', + dest='metric_list', + action='append_const', + const='rvt', + help='Respiratory volume-per-time. Needs the following inputs: ' + 'bts, sr, osr, win and lags.', + default=False) + metric.add_argument('-rrf', '--rrf', + dest='metric_list', + action='append_const', + const='rrf', + help='Respiratory response function. Needs the following inputs: ' + 'sr, os, tl, onset and tr.', + default=False) + metric.add_argument('-rcard', '--retroicor-card', + dest='metric_list', + action='append_const', + const='r_card', + help='Computes regressors for cardiac signal. Needs the following ' + 'inputs: tr, nscans, slt and n_harm.', + default=False) + metric.add_argument('-rresp', '--retroicor-resp', + dest='metric_list', + action='append_const', + const='r_resp', + help='Computes regressors for respiratory signal. Needs the following ' + 'inputs: tr, nscans, slt and n_harm.', + default=False) + optional.add_argument('-outdir', '--output-dir', + dest='outdir', + type=str, + help='Folder where output should be placed. ' + 'Default is current folder.', + default='.') + optional.add_argument('-sr', '--sample-rate', + dest='sample_rate', + type=float, + help='Sampling rate of the physiological data in Hz.', + default=None) + optional.add_argument('-pk', '--peaks', + dest='peaks', + type=str, + help='Filename of the list with the indexed peaks\' positions' + ' of the physiological data.', + default=None) + optional.add_argument('-thr', '--throughts', + dest='throughts', + type=str, + help='Filename of the list with the indexed peaks\' positions' + ' of the physiological data.', + default=None) + optional.add_argument('-os', '--oversampling', + dest='oversampling', + type=int, + help='Temporal oversampling factor in seconds. ' + 'Default is 50.', + default=50) + optional.add_argument('-tl', '--time-length', + dest='time_length', + type=int, + help='RRF Kernel length in seconds.', + default=None) + optional.add_argument('-onset', '--onset', + dest='onset', + type=float, + help='Onset of the response in seconds. ' + 'Default is 0.', + default=0) + optional.add_argument('-tr', '--tr', + dest='tr', + type=float, + help='TR of sequence in seconds.', + default=None) + optional.add_argument('-bts', '--belt-ts', + dest='belt_ts', + type=str, + help='Filename of the 1D array containing the .' + 'respiratory belt time series.', + default=None) + optional.add_argument('-win', '--window', + dest='window', + type=int, + help='Size of the sliding window in seconds. ' + 'Default is 6 seconds.', + default=6) + optional.add_argument('-osr', '--out-samplerate', + dest='out_samplerate', + type=float, + help='Sampling rate for the output time series ' + 'in seconds. Corresponds to TR in fMRI data.', + default=None) + optional.add_argument('-lags', '--lags', + dest='lags', + nargs='*', + type=int, + action='append', + help='List of lags to apply to the rv estimate ' + 'in seconds.', + default=None) + optional.add_argument('-nscans', '--nscans', + dest='nscans', + type=int, + help='Number of scans. Default is 1.', + default=1) + optional.add_argument('-slt', '--slice-timings', + dest='slice_timings', + type=str, + help='Filename with the slice timings.', + default=None) + optional.add_argument('-nharm', '--number-harmonics', + dest='n_harm', + type=int, + help='Number of harmonics. ', + default=None) + optional.add_argument('-debug', '--debug', + dest='debug', + action='store_true', + help='Only print debugging info to log file. Default is False.', + default=False) + optional.add_argument('-quiet', '--quiet', + dest='quiet', + action='store_true', + help='Only print warnings to log file. Default is False.', + default=False) + optional.add_argument('-v', '--version', action='version', + version=('%(prog)s ' + __version__)) + + parser._action_groups.append(optional) + + return parser + + +if __name__ == '__main__': + raise RuntimeError('phys2denoise/cli/run.py should not be run directly;\n' + 'Please `pip install` phys2denoise and use the ' + '`phys2denoise` command') From 2fa576faf3afee16d97be66ed1ad987028a15238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?In=C3=A9s=20Chavarr=C3=ADa?= <72545702+ineschh@users.noreply.github.com> Date: Thu, 12 Nov 2020 19:09:48 +0100 Subject: [PATCH 2/6] Update phys2denoise/cli/run.py Co-authored-by: Stefano Moia --- phys2denoise/cli/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phys2denoise/cli/run.py b/phys2denoise/cli/run.py index 7f79b40..d3f3384 100644 --- a/phys2denoise/cli/run.py +++ b/phys2denoise/cli/run.py @@ -41,7 +41,7 @@ def _get_parser(): dest='metric_list', action='append_const', const='rpv', - help='REspiratory pattern variability. Needs the following ' + help='Respiratory pattern variability. Needs the following ' 'inputs: bts and win.', default=False) metric.add_argument('-env', '--env', From 6142d30787c63fc5d9a090ef6beb34cc6d93ab49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?In=C3=A9s=20Chavarr=C3=ADa?= <72545702+ineschh@users.noreply.github.com> Date: Thu, 12 Nov 2020 20:31:26 +0100 Subject: [PATCH 3/6] Update --- phys2denoise/cli/run.py | 245 +++++++++++++++++++--------------------- 1 file changed, 115 insertions(+), 130 deletions(-) diff --git a/phys2denoise/cli/run.py b/phys2denoise/cli/run.py index 7f79b40..bfee4ac 100644 --- a/phys2denoise/cli/run.py +++ b/phys2denoise/cli/run.py @@ -23,174 +23,159 @@ def _get_parser(): parser = argparse.ArgumentParser() optional = parser._action_groups.pop() metric = parser._action_groups.pop() - required = parser.add_argument_group('Required Argument:') - required.add_argument('-in', '--input-file', - dest='filename', + required = parser.add_argument_group("Required Argument:") + required.add_argument("-in", "--input-file", + dest="filename", type=str, - help='Path/name of the file containing physiological ' - 'data, with or without extension.', + help="Full path and name of the file containing " + "physiological data, with or without extension.", required=True) - metric.add_argument('-crf', '--crf', - dest='metric_list', - action='append_const', - const='crf', - help='Cardiac response function. Needs the following ' - 'inputs:sr, os, tl, onset and tr.', + metric.add_argument("-crf", "--cardiac-response-function", + dest="metrics", + action="append_const", + const="crf", + help="Cardiac response function. Needs the following " + "inputs:sample-rate, oversampling, time-length, " + "onset and tr.", default=False) - metric.add_argument('-rpv', '--rpv', - dest='metric_list', - action='append_const', - const='rpv', - help='REspiratory pattern variability. Needs the following ' - 'inputs: bts and win.', + metric.add_argument("-rpv", "--respiratory-pattern-variability", + dest="metrics", + action="append_const", + const="rpv", + help="Respiratory pattern variability. Needs the following " + "input: window.", default=False) - metric.add_argument('-env', '--env', - dest='metric_list', - action='append_const', - const='env', - help='Respiratory pattern variability calculated across a sliding ' - 'window. Needs the following inputs: bts, sr, osr, win and lags.', + metric.add_argument("-env", "--envelope", + dest="metrics", + action="append_const", + const="env", + help="Respiratory pattern variability calculated across a sliding " + "window. Needs the following inputs: sample-rate, window and lags.", default=False) - metric.add_argument('-rv', '--rv', - dest='metric_list', - action='append_const', - const='rv', - help='Respiratory variance. Needs the following inputs: ' - 'bts, sr, osr, win and lags.', + metric.add_argument("-rv", "--respiratory-variance", + dest="metrics", + action="append_const", + const="rv", + help="Respiratory variance. Needs the following inputs: " + "sample-rate, window and lags.", default=False) - metric.add_argument('-rvt', '--rvt', - dest='metric_list', - action='append_const', - const='rvt', - help='Respiratory volume-per-time. Needs the following inputs: ' - 'bts, sr, osr, win and lags.', + metric.add_argument("-rvt", "--respiratory-volume-per-time", + dest="metrics", + action="append_const", + const="rvt", + help="Respiratory volume-per-time. Needs the following inputs: " + "sample-rate, window and lags.", default=False) - metric.add_argument('-rrf', '--rrf', - dest='metric_list', - action='append_const', - const='rrf', - help='Respiratory response function. Needs the following inputs: ' - 'sr, os, tl, onset and tr.', + metric.add_argument("-rrf", "--respiratory-response-function", + dest="metrics", + action="append_const", + const="rrf", + help="Respiratory response function. Needs the following inputs: " + "sample-rate, oversampling, time-length, onset and tr.", default=False) - metric.add_argument('-rcard', '--retroicor-card', - dest='metric_list', - action='append_const', - const='r_card', - help='Computes regressors for cardiac signal. Needs the following ' - 'inputs: tr, nscans, slt and n_harm.', + metric.add_argument("-rcard", "--retroicor-card", + dest="metrics", + action="append_const", + const="r_card", + help="Computes regressors for cardiac signal. Needs the following " + "inputs: tr, nscans and n_harm.", default=False) - metric.add_argument('-rresp', '--retroicor-resp', - dest='metric_list', - action='append_const', - const='r_resp', - help='Computes regressors for respiratory signal. Needs the following ' - 'inputs: tr, nscans, slt and n_harm.', + metric.add_argument("-rresp", "--retroicor-resp", + dest="metrics", + action="append_const", + const="r_resp", + help="Computes regressors for respiratory signal. Needs the following " + "inputs: tr, nscans and n_harm.", default=False) - optional.add_argument('-outdir', '--output-dir', - dest='outdir', + optional.add_argument("-outdir", "--output-dir", + dest="outdir", type=str, - help='Folder where output should be placed. ' - 'Default is current folder.', - default='.') - optional.add_argument('-sr', '--sample-rate', - dest='sample_rate', + help="Folder where output should be placed. " + "Default is current folder.", + default=".") + optional.add_argument("-sr", "--sample-rate", + dest="sample_rate", type=float, - help='Sampling rate of the physiological data in Hz.', + help="Sampling rate of the physiological data in Hz.", default=None) - optional.add_argument('-pk', '--peaks', - dest='peaks', + optional.add_argument("-pk", "--peaks", + dest="peaks", type=str, - help='Filename of the list with the indexed peaks\' positions' - ' of the physiological data.', + help="Full path and filename of the list with the indexed peaks' " + "positions of the physiological data.", default=None) - optional.add_argument('-thr', '--throughts', - dest='throughts', + optional.add_argument("-tg", "--throughts", + dest="throughts", type=str, - help='Filename of the list with the indexed peaks\' positions' - ' of the physiological data.', + help="Full path and filename of the list with the indexed peaks' " + "positions of the physiological data.", default=None) - optional.add_argument('-os', '--oversampling', - dest='oversampling', + optional.add_argument("-os", "--oversampling", + dest="oversampling", type=int, - help='Temporal oversampling factor in seconds. ' - 'Default is 50.', + help="Temporal oversampling factor in seconds. " + "Default is 50.", default=50) - optional.add_argument('-tl', '--time-length', - dest='time_length', + optional.add_argument("-tl", "--time-length", + dest="time_length", type=int, - help='RRF Kernel length in seconds.', + help="RRF Kernel length in seconds.", default=None) - optional.add_argument('-onset', '--onset', - dest='onset', + optional.add_argument("-onset", "--onset", + dest="onset", type=float, - help='Onset of the response in seconds. ' - 'Default is 0.', + help="Onset of the response in seconds. " + "Default is 0.", default=0) - optional.add_argument('-tr', '--tr', - dest='tr', + optional.add_argument("-tr", "--tr", + dest="tr", type=float, - help='TR of sequence in seconds.', + help="TR of sequence in seconds.", default=None) - optional.add_argument('-bts', '--belt-ts', - dest='belt_ts', - type=str, - help='Filename of the 1D array containing the .' - 'respiratory belt time series.', - default=None) - optional.add_argument('-win', '--window', - dest='window', + optional.add_argument("-win", "--window", + dest="window", type=int, - help='Size of the sliding window in seconds. ' - 'Default is 6 seconds.', + help="Size of the sliding window in seconds. " + "Default is 6 seconds.", default=6) - optional.add_argument('-osr', '--out-samplerate', - dest='out_samplerate', - type=float, - help='Sampling rate for the output time series ' - 'in seconds. Corresponds to TR in fMRI data.', - default=None) - optional.add_argument('-lags', '--lags', - dest='lags', - nargs='*', + optional.add_argument("-lags", "--lags", + dest="lags", + nargs="*", type=int, - action='append', - help='List of lags to apply to the rv estimate ' - 'in seconds.', + action="append", + help="List of lags to apply to the RV estimate " + "in seconds.", default=None) - optional.add_argument('-nscans', '--nscans', - dest='nscans', + optional.add_argument("-nscans", "--number-scans", + dest="nscans", type=int, - help='Number of scans. Default is 1.', + help="Number of scans. Default is 1.", default=1) - optional.add_argument('-slt', '--slice-timings', - dest='slice_timings', - type=str, - help='Filename with the slice timings.', - default=None) - optional.add_argument('-nharm', '--number-harmonics', - dest='n_harm', + optional.add_argument("-nharm", "--number-harmonics", + dest="n_harm", type=int, - help='Number of harmonics. ', + help="Number of harmonics.", default=None) - optional.add_argument('-debug', '--debug', - dest='debug', - action='store_true', - help='Only print debugging info to log file. Default is False.', + optional.add_argument("-debug", "--debug", + dest="debug", + action="store_true", + help="Only print debugging info to log file. Default is False.", default=False) - optional.add_argument('-quiet', '--quiet', - dest='quiet', - action='store_true', - help='Only print warnings to log file. Default is False.', + optional.add_argument("-quiet", "--quiet", + dest="quiet", + action="store_true", + help="Only print warnings to log file. Default is False.", default=False) - optional.add_argument('-v', '--version', action='version', - version=('%(prog)s ' + __version__)) + optional.add_argument("-v", "--version", action="version", + version=("%(prog)s " + __version__)) parser._action_groups.append(optional) + parser._action_groups.append(metric) return parser -if __name__ == '__main__': - raise RuntimeError('phys2denoise/cli/run.py should not be run directly;\n' - 'Please `pip install` phys2denoise and use the ' - '`phys2denoise` command') +if __name__ == "__main__": + raise RuntimeError("phys2denoise/cli/run.py should not be run directly;\n" + "Please `pip install` phys2denoise and use the " + "`phys2denoise` command") From 4c265e3cca715104b9f155a0e58c6b9831d059fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?In=C3=A9s=20Chavarr=C3=ADa?= <72545702+ineschh@users.noreply.github.com> Date: Fri, 13 Nov 2020 10:10:53 +0100 Subject: [PATCH 4/6] More updates --- phys2denoise/cli/run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phys2denoise/cli/run.py b/phys2denoise/cli/run.py index bfee4ac..4a75ac7 100644 --- a/phys2denoise/cli/run.py +++ b/phys2denoise/cli/run.py @@ -113,13 +113,13 @@ def _get_parser(): optional.add_argument("-os", "--oversampling", dest="oversampling", type=int, - help="Temporal oversampling factor in seconds. " + help="Temporal oversampling factor. " "Default is 50.", default=50) optional.add_argument("-tl", "--time-length", dest="time_length", type=int, - help="RRF Kernel length in seconds.", + help="RRF or CRF Kernel length in seconds.", default=None) optional.add_argument("-onset", "--onset", dest="onset", From 8bd4b8f0fa1351cab026bf180b3bc6f8ed14a6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?In=C3=A9s=20Chavarr=C3=ADa?= <72545702+ineschh@users.noreply.github.com> Date: Fri, 13 Nov 2020 13:34:56 +0100 Subject: [PATCH 5/6] Suggested changes --- phys2denoise/cli/run.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/phys2denoise/cli/run.py b/phys2denoise/cli/run.py index 4a75ac7..09e0ae5 100644 --- a/phys2denoise/cli/run.py +++ b/phys2denoise/cli/run.py @@ -59,13 +59,15 @@ def _get_parser(): help="Respiratory variance. Needs the following inputs: " "sample-rate, window and lags.", default=False) + """ metric.add_argument("-rvt", "--respiratory-volume-per-time", dest="metrics", action="append_const", const="rvt", help="Respiratory volume-per-time. Needs the following inputs: " - "sample-rate, window and lags.", + "sample-rate, window, lags, peaks and troughs.", default=False) + """ metric.add_argument("-rrf", "--respiratory-response-function", dest="metrics", action="append_const", @@ -104,10 +106,10 @@ def _get_parser(): help="Full path and filename of the list with the indexed peaks' " "positions of the physiological data.", default=None) - optional.add_argument("-tg", "--throughts", - dest="throughts", + optional.add_argument("-tg", "--troughs", + dest="troughs", type=str, - help="Full path and filename of the list with the indexed peaks' " + help="Full path and filename of the list with the indexed troughs' " "positions of the physiological data.", default=None) optional.add_argument("-os", "--oversampling", From 1541149d95b7b7268af88b85604d274ceb738579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?In=C3=A9s=20Chavarr=C3=ADa?= <72545702+ineschh@users.noreply.github.com> Date: Thu, 26 Nov 2020 15:03:48 +0100 Subject: [PATCH 6/6] metric_args into dict --- phys2denoise/cli/run.py | 188 +++++++++++++++++++++++----------------- 1 file changed, 109 insertions(+), 79 deletions(-) diff --git a/phys2denoise/cli/run.py b/phys2denoise/cli/run.py index 09e0ae5..2776756 100644 --- a/phys2denoise/cli/run.py +++ b/phys2denoise/cli/run.py @@ -5,6 +5,24 @@ import argparse from phys2denoise import __version__ +from phys2denoise.metrics.cardiac import crf +from phys2denoise.metrics.chest_belt import rpv, rv, rvt, rrf, env + + +class MetricsArgDict(argparse.Action): + """ + Custom Argparse Action to create a dictionary with the metrics' arguments in parser's output. + + """ + def __call__(self, parser, namespace, values, option_strings): + if not hasattr(namespace, "metrics_arg"): + setattr(namespace, "metrics_arg", dict()) + Keys = ["sample_rate", "peaks", "throughs", "oversampling", "time_length", "onset", + "tr", "window", "lags", "nscans", "nharm"] + Vals = ["None", "None", "None", "50", "None", "0", "None", "6", "None", "1", "None"] + for k, v in zip(Keys, Vals): + getattr(namespace, "metrics_arg")[k] = v + getattr(namespace, "metrics_arg")[self.dest] = values def _get_parser(): @@ -17,13 +35,16 @@ def _get_parser(): Notes ----- + Default values must be updated in __call__ method from MetricsArgDict class. # Argument parser follow template provided by RalphyZ. # https://stackoverflow.com/a/43456577 """ + parser = argparse.ArgumentParser() optional = parser._action_groups.pop() - metric = parser._action_groups.pop() - required = parser.add_argument_group("Required Argument:") + required = parser.add_argument_group("Required Argument") + metric = parser.add_argument_group("Metrics") + metric_arg = parser.add_argument_group("Metrics Arguments") required.add_argument("-in", "--input-file", dest="filename", type=str, @@ -33,32 +54,32 @@ def _get_parser(): metric.add_argument("-crf", "--cardiac-response-function", dest="metrics", action="append_const", - const="crf", + const=crf, help="Cardiac response function. Needs the following " "inputs:sample-rate, oversampling, time-length, " "onset and tr.", - default=False) + default=[]) metric.add_argument("-rpv", "--respiratory-pattern-variability", dest="metrics", action="append_const", - const="rpv", + const=rpv, help="Respiratory pattern variability. Needs the following " "input: window.", - default=False) + default=[]) metric.add_argument("-env", "--envelope", dest="metrics", action="append_const", - const="env", + const=env, help="Respiratory pattern variability calculated across a sliding " "window. Needs the following inputs: sample-rate, window and lags.", - default=False) + default=[]) metric.add_argument("-rv", "--respiratory-variance", dest="metrics", action="append_const", - const="rv", + const=rv, help="Respiratory variance. Needs the following inputs: " "sample-rate, window and lags.", - default=False) + default=[]) """ metric.add_argument("-rvt", "--respiratory-volume-per-time", dest="metrics", @@ -66,98 +87,108 @@ def _get_parser(): const="rvt", help="Respiratory volume-per-time. Needs the following inputs: " "sample-rate, window, lags, peaks and troughs.", - default=False) + default=[]) """ metric.add_argument("-rrf", "--respiratory-response-function", dest="metrics", action="append_const", - const="rrf", + const=rrf, help="Respiratory response function. Needs the following inputs: " "sample-rate, oversampling, time-length, onset and tr.", - default=False) + default=[]) metric.add_argument("-rcard", "--retroicor-card", dest="metrics", action="append_const", const="r_card", help="Computes regressors for cardiac signal. Needs the following " "inputs: tr, nscans and n_harm.", - default=False) + default=[]) metric.add_argument("-rresp", "--retroicor-resp", dest="metrics", action="append_const", const="r_resp", help="Computes regressors for respiratory signal. Needs the following " "inputs: tr, nscans and n_harm.", - default=False) + default=[]) optional.add_argument("-outdir", "--output-dir", dest="outdir", type=str, help="Folder where output should be placed. " "Default is current folder.", default=".") - optional.add_argument("-sr", "--sample-rate", - dest="sample_rate", - type=float, - help="Sampling rate of the physiological data in Hz.", - default=None) - optional.add_argument("-pk", "--peaks", - dest="peaks", - type=str, - help="Full path and filename of the list with the indexed peaks' " - "positions of the physiological data.", - default=None) - optional.add_argument("-tg", "--troughs", - dest="troughs", - type=str, - help="Full path and filename of the list with the indexed troughs' " - "positions of the physiological data.", - default=None) - optional.add_argument("-os", "--oversampling", - dest="oversampling", - type=int, - help="Temporal oversampling factor. " - "Default is 50.", - default=50) - optional.add_argument("-tl", "--time-length", - dest="time_length", - type=int, - help="RRF or CRF Kernel length in seconds.", - default=None) - optional.add_argument("-onset", "--onset", - dest="onset", - type=float, - help="Onset of the response in seconds. " - "Default is 0.", - default=0) - optional.add_argument("-tr", "--tr", - dest="tr", - type=float, - help="TR of sequence in seconds.", - default=None) - optional.add_argument("-win", "--window", - dest="window", - type=int, - help="Size of the sliding window in seconds. " - "Default is 6 seconds.", - default=6) - optional.add_argument("-lags", "--lags", - dest="lags", - nargs="*", - type=int, - action="append", - help="List of lags to apply to the RV estimate " - "in seconds.", - default=None) - optional.add_argument("-nscans", "--number-scans", - dest="nscans", - type=int, - help="Number of scans. Default is 1.", - default=1) - optional.add_argument("-nharm", "--number-harmonics", - dest="n_harm", - type=int, - help="Number of harmonics.", - default=None) + metric_arg.add_argument("-sr", "--sample-rate", + dest="sample_rate", + type=float, + action=MetricsArgDict, + help="Sampling rate of the physiological data in Hz.", + default=argparse.SUPPRESS) + metric_arg.add_argument("-pk", "--peaks", + dest="peaks", + type=str, + action=MetricsArgDict, + help="Full path and filename of the list with the indexed peaks' " + "positions of the physiological data.", + default=argparse.SUPPRESS) + metric_arg.add_argument("-tg", "--troughs", + dest="troughs", + type=str, + action=MetricsArgDict, + help="Full path and filename of the list with the indexed troughs' " + "positions of the physiological data.", + default=argparse.SUPPRESS) + metric_arg.add_argument("-os", "--oversampling", + dest="oversampling", + type=int, + action=MetricsArgDict, + help="Temporal oversampling factor. " + "Default is 50.", + default=argparse.SUPPRESS) + metric_arg.add_argument("-tl", "--time-length", + dest="time_length", + type=int, + action=MetricsArgDict, + help="RRF or CRF Kernel length in seconds.", + default=argparse.SUPPRESS) + metric_arg.add_argument("-onset", "--onset", + dest="onset", + type=float, + action=MetricsArgDict, + help="Onset of the response in seconds. " + "Default is 0.", + default=argparse.SUPPRESS) + metric_arg.add_argument("-tr", "--tr", + dest="tr", + type=float, + action=MetricsArgDict, + help="TR of sequence in seconds.", + default=argparse.SUPPRESS) + metric_arg.add_argument("-win", "--window", + dest="window", + type=int, + action=MetricsArgDict, + help="Size of the sliding window in seconds. " + "Default is 6 seconds.", + default=argparse.SUPPRESS) + metric_arg.add_argument("-lags", "--lags", + dest="lags", + nargs="*", + type=int, + action=MetricsArgDict, + help="List of lags to apply to the RV estimate " + "in seconds.", + default=argparse.SUPPRESS) + metric_arg.add_argument("-nscans", "--number-scans", + dest="nscans", + type=int, + action=MetricsArgDict, + help="Number of scans. Default is 1.", + default=argparse.SUPPRESS) + metric_arg.add_argument("-nharm", "--number-harmonics", + dest="n_harm", + type=int, + action=MetricsArgDict, + help="Number of harmonics.", + default=argparse.SUPPRESS) optional.add_argument("-debug", "--debug", dest="debug", action="store_true", @@ -172,7 +203,6 @@ def _get_parser(): version=("%(prog)s " + __version__)) parser._action_groups.append(optional) - parser._action_groups.append(metric) return parser