diff --git a/espei/error_functions/zpf_error.py b/espei/error_functions/zpf_error.py index 422bd872..12e915eb 100644 --- a/espei/error_functions/zpf_error.py +++ b/espei/error_functions/zpf_error.py @@ -72,6 +72,8 @@ def _extract_pot_conds(all_conditions: Dict[v.StateVariable, np.ndarray], idx: i # Otherwise treat it as a scalar if len(cond_val) > 1: cond_val = cond_val[idx] + else: + cond_val = cond_val[0] # need to explictly extract scalar for NumPy type conversion pot_conds[getattr(v, cond_key)] = float(cond_val) return pot_conds diff --git a/espei/plot.py b/espei/plot.py index a00121d4..eba0ff3f 100644 --- a/espei/plot.py +++ b/espei/plot.py @@ -391,10 +391,8 @@ def plot_interaction(dbf, comps, phase_name, configuration, output, datasets=Non # TODO: Fix this to filter because we need to guarantee the plot points are disordered occ = data['solver']['sublattice_occupancies'] subl_idx = np.nonzero([isinstance(c, (list, tuple)) for c in occ[0]])[0] - if len(subl_idx) > 1: - subl_idx = int(subl_idx[0]) - else: - subl_idx = int(subl_idx) + # Always take the first matching sublattice index + subl_idx = int(subl_idx[0]) indep_var_data = [c[subl_idx][1] for c in occ] else: interactions = np.array([cond_dict[Symbol('YS')] for cond_dict in sample_condition_dicts])