Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New logic for plot limits #48

Merged
merged 6 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cobrawap/pipeline/configs/config_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ NEO_FORMAT: 'nix'
USE_LINK_AS_STAGE_OUTPUT: True

# Plotting parameters
PLOT_TSTART: 0 # in s
PLOT_TSTOP: 10 # in s
PLOT_TSTART: 0 # float (in s) or 'None' -> T_START of the input signal is used
PLOT_TSTOP: 10 # float (in s) or 'None' -> T_STOP of the input signal is used
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and in the following, does T_START refer to t_start of the Neo object? In that case I would suggest

Suggested change
PLOT_TSTART: 0 # float (in s) or 'None' -> T_START of the input signal is used
PLOT_TSTOP: 10 # float (in s) or 'None' -> T_STOP of the input signal is used
PLOT_TSTART: 0 # float (in s) or 'None' -> t_start of the input signal is used
PLOT_TSTOP: 10 # float (in s) or 'None' -> t_stop of the input signal is used

Copy link
Contributor Author

@cosimolupo cosimolupo Mar 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they refer to the attributes of the neo object. I used the uppercase notation as in the config files they are introduced this way. Anyway, let's decide if switch to the lowercase version, and then I will fix them coherently.

PLOT_CHANNELS: 'None' # int or None. default 'None' -> randomly selected
# Note that when using the None option, the automatic creation of reports will fail
PLOT_FORMAT: 'png'
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ KWARGS: 'None'
# Plotting parameters
# These parameters are used to create an example plot to get a first view
# on the signals and ensure that the data was loaded and annotated correctly
PLOT_TSTART: 0 # in s
PLOT_TSTOP: 10 # in s
PLOT_TSTART: 0 # float (in s) or 'None' -> T_START of the input signal is used
PLOT_TSTOP: 10 # float (in s) or 'None' -> T_STOP of the input signal is used
PLOT_CHANNELS: 'None' # int, or list of int, or 'None' -> randomly chosen channel
PLOT_FORMAT: 'png' # file extension for storing the plot
6 changes: 3 additions & 3 deletions cobrawap/pipeline/stage01_data_entry/scripts/plot_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
import seaborn as sns
from utils.io_utils import load_neo, save_plot
from utils.neo_utils import time_slice
from utils.parse import parse_plot_channels, none_or_int
from utils.parse import parse_plot_channels, none_or_int, none_or_float

CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='?', type=Path, required=True,
help="path to input data in neo format")
CLI.add_argument("--output", nargs='?', type=Path, required=True,
help="path of output figure")
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=none_or_int, default=0,
help="list of channels to plot")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ NEO_FORMAT: 'nix'
USE_LINK_AS_STAGE_OUTPUT: True

# Plotting parameters
PLOT_TSTART: 0 # in s
PLOT_TSTOP: 10 # in s
PLOT_TSTART: 0 # float (in s) or 'None' -> T_START of the input signal is used
PLOT_TSTOP: 10 # float (in s) or 'None' -> T_STOP of the input signal is used
PLOT_CHANNELS: 'None' # int or None. default 'None' -> randomly selected
PLOT_FORMAT: 'png'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ NEO_FORMAT: 'nix'
USE_LINK_AS_STAGE_OUTPUT: True

# Plotting parameters
PLOT_TSTART: 0 # in s
PLOT_TSTOP: 10 # in s
PLOT_TSTART: 0 # float (in s) or 'None' -> T_START of the input signal is used
PLOT_TSTOP: 10 # float (in s) or 'None' -> T_STOP of the input signal is used
PLOT_CHANNELS: 'None' # int or None. default 'None' -> randomly selected
PLOT_FORMAT: 'png'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ NEO_FORMAT: 'nix'
USE_LINK_AS_STAGE_OUTPUT: True

# Plotting parameters
PLOT_TSTART: 0 # in s
PLOT_TSTOP: 10 # in s
PLOT_TSTART: 0 # float (in s) or 'None' -> T_START of the input signal is used
PLOT_TSTOP: 10 # float (in s) or 'None' -> T_STOP of the input signal is used
PLOT_CHANNELS: 'None' # int or None. default 'None' -> randomly selected
PLOT_FORMAT: 'png'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ STAGE_OUTPUT: 'channel-wise_measures.csv'
USE_LINK_AS_STAGE_OUTPUT: True

# Plotting parameters
PLOT_TSTART: 0 # in s
PLOT_TSTOP: 10 # in s
PLOT_TSTART: 0 # float (in s) or 'None' -> T_START of the input signal is used
PLOT_TSTOP: 10 # float (in s) or 'None' -> T_STOP of the input signal is used
PLOT_CHANNELS: 'None' # int or None. default 'None' -> randomly selected
PLOT_FORMAT: 'png'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ STAGE_OUTPUT: 'wave-wise_measures.csv'
USE_LINK_AS_STAGE_OUTPUT: True

# Plotting parameters
PLOT_TSTART: 0 # in s
PLOT_TSTOP: 10 # in s
PLOT_TSTART: 0 # float (in s) or 'None' -> T_START of the input signal is used
PLOT_TSTOP: 10 # float (in s) or 'None' -> T_STOP of the input signal is used
PLOT_CHANNELS: 'None' # int or None. default 'None' -> randomly selected
PLOT_FORMAT: 'png'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ OFFSET: 20
A: 'a'

# Plotting parameters
PLOT_TSTART: 0 # in s
PLOT_TSTOP: 10 # in s
PLOT_TSTART: 0 # float (in s) or 'None' -> T_START of the input signal is used
PLOT_TSTOP: 10 # float (in s) or 'None' -> T_STOP of the input signal is used
PLOT_CHANNELS: 'None' # int or None. default 'None' -> randomly selected
PLOT_FORMAT: 'png'