Function to convert an array of PHA channels into PI channels. This conversion takes into account the momentary principal gain values of the current CCD readout node.
By using the GAIN as stored in the second extension of ADUConv, the PHA channels will be scaled to PI channels. The range of the PI channels will be such that they are roughly corresponding to energies in eV.
Therefore the basic formula is