The centroid function has been commented and its operation changed so that it deals with four cases
Now masking results in 0 for hot pixels if dark image is subtracted and dark mean if dark image is not subtracted