new experiments in forecast.py, solve infrared_perimeters.py problem, and reading...
[JPSSData.git] / saveload.py
blob974e828e054550b9d2be36d2a8dfffe113c71ad8
1 # a simple utility to save to file and load back
2 import pickle
4 def save(obj,file):
5 """
6 :param obj: object to be saved
7 :param file: file name
8 """
9 with open(file,'w') as f:
10 pickle.dump(obj,f,protocol=-1)
12 def load(file):
13 """
14 :param file: file name
15 :return: the object read
16 """
17 with open(file) as f:
18 return pickle.load(f)