Skip to content

Commit

Permalink
MAINT: Update calculate shadow function for adding metastable composi…
Browse files Browse the repository at this point in the history
…tion sets (#206)

Incorporates the changes to the Dataset/LightDataset API introduced in pycalphad/pycalphad#362.
  • Loading branch information
bocklund committed Aug 9, 2021
1 parent 8c2842e commit a37742a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions espei/shadow_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ def calculate_(species: Sequence[v.Species], phases: Sequence[str],
parameters={})
all_phase_data.append(phase_ds)

fp_offset = len(nonvacant_components) if fake_points else 0
running_total = [fp_offset] + list(np.cumsum([phase_ds['X'].shape[-2] for phase_ds in all_phase_data]))
islice_by_phase = {phase_name: slice(running_total[phase_idx], running_total[phase_idx+1], None)
for phase_idx, phase_name in enumerate(sorted(phases))}

if len(all_phase_data) > 1:
concatenated_coords = all_phase_data[0].coords

Expand All @@ -109,6 +114,7 @@ def calculate_(species: Sequence[v.Species], phases: Sequence[str],
final_ds = LightDataset(data_vars=concatenated_data_vars, coords=concatenated_coords)
else:
final_ds = all_phase_data[0]
final_ds.attrs['phase_indices'] = islice_by_phase
return final_ds


Expand Down

0 comments on commit a37742a

Please sign in to comment.