added protocol=2 to pickle dump in calc-coherence function
changed to protocol=2 on pickle dump