__getstate__ and __setstate__ implemented to control serialization of Measurement