Currently, pDOS data is stored in a dict mapping $(l,m)$-resolved DOS to the arrays of actual pDOS values, organised by spin. This is an easy-to-understand data structure, but it does mean that accessing array values is slightly cumbersome when you want to mask (i.e. restrict to a range of energies for plotting) values.
Current example with matplotlib:
lm = lmpdos.lm_dict
fig = plt.figure(figsize=(10, 5))
lenergy = -10
renergy = 0
energy_mask = np.ma.masked_inside(rel_fermi, lenergy, renergy).mask
x_energy = rel_fermi[energy_mask]
for key in ["2,-2","2,-1","2,0","2,1","2,2"]:
plt.plot(x_energy, lm[key][0][energy_mask], label=key, color=color_dict[key])
plt.plot(x_energy, -1 * lm[key][1][energy_mask], linestyle="--",color=color_dict[key])
In particular, lm[key][0][energy_mask] and having to reuse np.ma.masked* is repetitive.
Possible implementation:
- Define a mask function inside
pdos_processor
- Define a new class attribute to hold the masked data, leaving the original untouched
- Use this to form a getter/setter pair
Currently, pDOS data is stored in a dict mapping$(l,m)$ -resolved DOS to the arrays of actual pDOS values, organised by spin. This is an easy-to-understand data structure, but it does mean that accessing array values is slightly cumbersome when you want to mask (i.e. restrict to a range of energies for plotting) values.
Current example with matplotlib:
In particular,
lm[key][0][energy_mask]and having to reusenp.ma.masked*is repetitive.Possible implementation:
pdos_processor