with open("BestFit.pkl", 'wb') as f: pkl.dump({'AMags': AMags, "EMags": EMags}, f)