@@ -40,14 +40,15 @@ def _sorted_xyz_files(model_dir: Path) -> list[Path]:
4040 return sorted (model_dir .glob ("*.xyz" ), key = lambda path : int (path .stem ))
4141
4242
43- def _extract_metadata () -> tuple [ list [ str ] , list [str ]]:
43+ def _extract_metadata () -> dict [ str , list [str ]]:
4444 """
4545 Return structure identifiers and molecule labels from the first model output.
4646
4747 Returns
4848 -------
49- tuple[list[str], list[str]]
50- Ordered structure identifiers and molecule labels.
49+ dict[str, list[str]]
50+ Ordered structure identifiers and molecule labels keyed by ``"structures"``
51+ and ``"molecules"``.
5152 """
5253 for model_name in MODELS :
5354 model_dir = CALC_PATH / model_name
@@ -63,34 +64,11 @@ def _extract_metadata() -> tuple[list[str], list[str]]:
6364 atoms = read (xyz_file )
6465 structures .append (atoms .info .get ("structure" , xyz_file .stem ))
6566 molecules .append (atoms .info .get ("molecule" , "" ))
66- return structures , molecules
67- return [], []
67+ return { " structures" : structures , " molecules" : molecules }
68+ return { "structures" : [], "molecules" : []}
6869
6970
70- def get_structure_names () -> list [str ]:
71- """
72- Return ordered structure identifiers for Wiggle150.
73-
74- Returns
75- -------
76- list[str]
77- Structure identifiers sorted consistently with analysis outputs.
78- """
79- structures , _ = _extract_metadata ()
80- return structures
81-
82-
83- def get_molecule_labels () -> list [str ]:
84- """
85- Return molecule labels corresponding to Wiggle150 structures.
86-
87- Returns
88- -------
89- list[str]
90- Molecule identifiers aligned with the structure order.
91- """
92- _ , molecules = _extract_metadata ()
93- return molecules
71+ METADATA = _extract_metadata ()
9472
9573
9674@pytest .fixture
@@ -100,8 +78,8 @@ def get_molecule_labels() -> list[str]:
10078 x_label = "Predicted relative energy / kcal/mol" ,
10179 y_label = "Reference relative energy / kcal/mol" ,
10280 hoverdata = {
103- "Structure" : get_structure_names () ,
104- "Molecule" : get_molecule_labels () ,
81+ "Structure" : METADATA [ "structures" ] ,
82+ "Molecule" : METADATA [ "molecules" ] ,
10583 },
10684)
10785def relative_energies () -> dict [str , list [float ]]:
0 commit comments