@@ -106,14 +106,16 @@ def __init__(self, grid=None, edges=None, origin=None, delta=None,
106106 # file formats are guess from extension == lower case key
107107 self ._exporters = {
108108 'DX' : self ._export_dx ,
109- 'PICKLE' : self ._export_python ,
109+ 'PKL' : self ._export_python ,
110+ 'PICKLE' : self ._export_python , # compatibility
110111 'PYTHON' : self ._export_python , # compatibility
111112 }
112113 self ._loaders = {
113114 'CCP4' : self ._load_cpp4 ,
114115 'DX' : self ._load_dx ,
115116 'PLT' : self ._load_plt ,
116- 'PICKLE' : self ._load_python ,
117+ 'PKL' : self ._export_python ,
118+ 'PICKLE' : self ._load_python , # compatibility
117119 'PYTHON' : self ._load_python , # compatibility
118120 }
119121
@@ -454,9 +456,6 @@ def _export_python(self, filename, **kwargs):
454456 The object is dumped as a dictionary with grid and edges: This
455457 is sufficient to recreate the grid object with __init__().
456458 """
457- root , ext = os .path .splitext (filename )
458- filename = root + ".pickle"
459-
460459 data = dict (grid = self .grid , edges = self .edges , metadata = self .metadata )
461460 with open (filename , 'wb' ) as f :
462461 cPickle .dump (data , f , cPickle .HIGHEST_PROTOCOL )
@@ -603,8 +602,10 @@ def interpolatedF(*coordinates):
603602 def __eq__ (self , other ):
604603 if not isinstance (other , Grid ):
605604 return False
606- return numpy .all (other .grid == self .grid ) and numpy .all (
607- other .origin == self .origin ) and other .edges == self .edges
605+ return numpy .all (other .grid == self .grid ) and \
606+ numpy .all (other .origin == self .origin ) and \
607+ numpy .all (numpy .all (other_edge == self_edge ) for other_edge , self_edge in
608+ zip (other .edges , self .edges ))
608609
609610 def __ne__ (self , other ):
610611 return not self .__eq__ (other )
0 commit comments