Analyze the results of the workflow. Dispatches each result file to the right analyzer by filename suffix (`SUFFIX_ANALYZERS`). To plot only one kind, pass an explicit glob: ``workflow_plot 'results_*.cluster.csv'``.
(composition: Composition, parser: WorkflowArgumentParser)
| 4145 | |
| 4146 | |
| 4147 | def workflow_plot(composition: Composition, parser: WorkflowArgumentParser) -> None: |
| 4148 | """Analyze the results of the workflow. |
| 4149 | |
| 4150 | Dispatches each result file to the right analyzer by filename suffix |
| 4151 | (`SUFFIX_ANALYZERS`). To plot only one kind, pass an explicit glob: |
| 4152 | ``workflow_plot 'results_*.cluster.csv'``. |
| 4153 | """ |
| 4154 | parser.add_argument( |
| 4155 | "files", |
| 4156 | nargs="*", |
| 4157 | default=[f"results_*{suffix}" for suffix, _ in SUFFIX_ANALYZERS], |
| 4158 | type=str, |
| 4159 | help="Glob pattern(s) of result files to plot.", |
| 4160 | ) |
| 4161 | args = parser.parse_args() |
| 4162 | for file in itertools.chain(*map(glob.iglob, args.files)): |
| 4163 | file_str = str(file) |
| 4164 | base_name = os.path.basename(file_str) |
| 4165 | for suffix, fn in SUFFIX_ANALYZERS: |
| 4166 | if base_name.endswith(suffix): |
| 4167 | fn(file_str) |
| 4168 | break |
| 4169 | else: |
| 4170 | raise UIError( |
| 4171 | f"Error: Filename '{file_str}' doesn't indicate which " |
| 4172 | "result-stream kind it belongs to. Expected one of these " |
| 4173 | f"suffixes: {', '.join(s for s, _ in SUFFIX_ANALYZERS)}." |
| 4174 | ) |
| 4175 | |
| 4176 | |
| 4177 | def extract_cluster_size(s: str) -> float: |