Skip to content

Commit 2500ea9

Browse files
authored
Merge pull request #77 from Pennycook/dendrogram-names
Fix broken dendrogram names
2 parents a3e7be4 + ff83d44 commit 2500ea9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

bin/codebasin

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def main():
234234

235235
for name in args.platforms:
236236
if name not in analysis_toml["platform"].keys():
237-
raise RuntimeError(
237+
raise KeyError(
238238
f"Platform {name} requested on the command line "
239239
+ "does not exist in the configuration file.",
240240
)
@@ -291,11 +291,17 @@ def main():
291291

292292
# Print clustering report
293293
if report_enabled("clustering"):
294-
if config_file is None:
295-
platform_names = [p[0] for p in args.platforms]
296-
output_prefix = "-".join(platform_names)
297-
else:
294+
# Legacy behavior: guess prefix from YAML filename
295+
if config_file is not None:
298296
output_prefix = os.path.realpath(guess_project_name(config_file))
297+
298+
# Modern behavior: append platforms to TOML filename
299+
else:
300+
basename = os.path.basename(args.analysis_file)
301+
filename = os.path.splitext(basename)[0]
302+
platform_names = [p for p in codebase["platforms"]]
303+
output_prefix = "-".join([filename] + platform_names)
304+
299305
clustering_output_name = output_prefix + "-dendrogram.png"
300306
clustering = report.clustering(clustering_output_name, setmap)
301307
if clustering is not None:

0 commit comments

Comments
 (0)