import sys from pathlib import Path sys.path.append(str(Path.cwd().parents[0])) from project_utils.project_paths import project_paths configfile: 'config.yaml' globals().update(config) wildcard_constraints: plot_name = '\w+', flag = '\d?|_temp-test', variant = '\|minimatrigger|\d?' def all_figures(w): variant = '|minimatrigger' return [project_paths.figures / f'dataset_comparison.pdf', project_paths.figures / f'method_comparison{variant}.pdf'] rule all: input: all_figures def local_data(w, variant=''): df_file = f'wavefronts_channel-wise{variant}_measures.csv' return project_paths.dataframes / df_file def alt_local_data(w): return local_data(w, variant=w.variant) rule plot_dataset_comparison: input: local_data = local_data, global_data = project_paths.dataframes \ / 'wavefronts_wave-wise_measures.csv', local_trend_data = project_paths.dataframes \ / 'wavefronts_channel-wise_trend_measures.csv', global_trend_data = project_paths.dataframes \ / 'wavefronts_wave-wise_trend_measures.csv', local_subsampled_data = project_paths.dataframes \ / 'wavefronts_channel-wise|macrodim11_measures.csv', script = 'scripts/plot_dataset_comparison.py', utils = 'scripts/plotting_utils.py', output: project_paths.figures / 'dataset_comparison.pdf' shell: """ python {input.script} --local_data {input.local_data:q} \ --global_data {input.global_data:q} \ --local_trend_data {input.local_trend_data:q} \ --global_trend_data {input.global_trend_data:q} \ --local_subsampled_data {input.local_subsampled_data:q} \ --output {output:q} """ def signal_path(w, variant=''): profile = 'LENS_M2_t1' return project_paths.pipeline_output / f'{profile}{variant}' \ / 'stage04_wave_detection' / 'waves.nix' def alt_signal_path(w): return signal_path(w, variant=w.variant) rule plot_method_comparison: input: local_data = local_data, global_data = project_paths.dataframes \ / 'wavefronts_wave-wise_measures.csv', alt_local_data = alt_local_data, alt_global_data = project_paths.dataframes \ / 'wavefronts_wave-wise{variant}_measures.csv', signal = signal_path, alt_signal = alt_signal_path, script = 'scripts/plot_method_comparison.py', utils = 'scripts/plotting_utils.py', output: project_paths.figures / 'method_comparison{variant}.pdf' shell: """ python {input.script} --local_data {input.local_data:q} \ --global_data {input.global_data:q} \ --alt_local_data {input.alt_local_data:q} \ --alt_global_data {input.alt_global_data:q} \ --signal {input.signal:q} \ --alt_signal {input.alt_signal:q} \ --output {output:q} """