fix a sorting issue in the map between template ids and array index in the population file
This fixes a bug whereby the slices produced to map provided template ids into the HDF file storing population model coefficients won't work if the ids don't happen to be from ordered templates.