From 19bab7c49d438a1419360160bb5a3cd5de999c5d Mon Sep 17 00:00:00 2001 From: cosimolupo Date: Wed, 20 Mar 2024 15:34:12 +0100 Subject: [PATCH] Adding "None" as a permitted value in all plotting scripts --- .../pipeline/stage02_processing/scripts/logMUA_estimation.py | 4 ++-- .../stage02_processing/scripts/plot_processed_trace.py | 5 +++-- .../pipeline/stage04_wave_detection/scripts/time_slice.py | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cobrawap/pipeline/stage02_processing/scripts/logMUA_estimation.py b/cobrawap/pipeline/stage02_processing/scripts/logMUA_estimation.py index ba9e91fd..95254a2f 100644 --- a/cobrawap/pipeline/stage02_processing/scripts/logMUA_estimation.py +++ b/cobrawap/pipeline/stage02_processing/scripts/logMUA_estimation.py @@ -37,9 +37,9 @@ help="overlap parameter for Welch's algorithm [0-1]") CLI.add_argument("--fft_slice", nargs='?', type=none_or_float, default=None, help="time window length used for power spectrum estimate, in s") -CLI.add_argument("--plot_tstart", nargs='?', type=float, default=0, +CLI.add_argument("--plot_tstart", nargs='?', type=none_or_float, default=0, help="start time in seconds") -CLI.add_argument("--plot_tstop", nargs='?', type=float, default=10, +CLI.add_argument("--plot_tstop", nargs='?', type=none_or_float, default=10, help="stop time in seconds") CLI.add_argument("--plot_channels", nargs='+', type=none_or_int, default=None, help="list of channels to plot") diff --git a/cobrawap/pipeline/stage02_processing/scripts/plot_processed_trace.py b/cobrawap/pipeline/stage02_processing/scripts/plot_processed_trace.py index 26bcbc6d..8de32015 100644 --- a/cobrawap/pipeline/stage02_processing/scripts/plot_processed_trace.py +++ b/cobrawap/pipeline/stage02_processing/scripts/plot_processed_trace.py @@ -8,6 +8,7 @@ import os from utils.io_utils import load_neo, save_plot from utils.neo_utils import time_slice +from utils.parse import none_or_float CLI = argparse.ArgumentParser() CLI.add_argument("--original_data", nargs='?', type=str, required=True, @@ -19,9 +20,9 @@ CLI.add_argument("--img_name", nargs='?', type=str, default='processed_trace_channel0.png', help='example filename for channel 0') -CLI.add_argument("--t_start", nargs='?', type=float, default=0, +CLI.add_argument("--t_start", nargs='?', type=none_or_float, default=0, help="start time in seconds") -CLI.add_argument("--t_stop", nargs='?', type=float, default=10, +CLI.add_argument("--t_stop", nargs='?', type=none_or_float, default=10, help="stop time in seconds") CLI.add_argument("--channels", nargs='+', type=int, default=0, help="channel to plot") diff --git a/cobrawap/pipeline/stage04_wave_detection/scripts/time_slice.py b/cobrawap/pipeline/stage04_wave_detection/scripts/time_slice.py index af9143ae..49f565c1 100644 --- a/cobrawap/pipeline/stage04_wave_detection/scripts/time_slice.py +++ b/cobrawap/pipeline/stage04_wave_detection/scripts/time_slice.py @@ -6,15 +6,16 @@ import quantities as pq from utils.io_utils import load_neo, write_neo from utils.neo_utils import time_slice +from utils.parse import none_or_float CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='?', type=str, required=True, help="path to input data in neo format") CLI.add_argument("--output", nargs='?', type=str, required=True, help="path of output file") -CLI.add_argument("--t_start", nargs='?', type=float, default=0, +CLI.add_argument("--t_start", nargs='?', type=none_or_float, default=0, help="new starting time in s") -CLI.add_argument("--t_stop", nargs='?', type=float, default=10, +CLI.add_argument("--t_stop", nargs='?', type=none_or_float, default=10, help="new stopping time in s") if __name__ == '__main__':