@@ -174,22 +174,29 @@ def read(self, method='standard', direction='central'):
174
174
assert self .method in ['standard' , 'frederiksen' ]
175
175
assert self .direction in ['central' , 'forward' , 'backward' ]
176
176
177
+ def load (fname ):
178
+ f = pickle .load (open (fname ))
179
+ if not hasattr (f , 'shape' ):
180
+ # output from InfraRed
181
+ return f [0 ]
182
+ return f
183
+
177
184
n = 3 * len (self .indices )
178
185
H = np .empty ((n , n ))
179
186
r = 0
180
187
if direction != 'central' :
181
- feq = pickle . load (open ( self .name + '.eq.pckl' ) )
188
+ feq = load (self .name + '.eq.pckl' )
182
189
for a in self .indices :
183
190
for i in 'xyz' :
184
191
name = '%s.%d%s' % (self .name , a , i )
185
- fminus = pickle . load (open ( name + '-.pckl' ) )
186
- fplus = pickle . load (open ( name + '+.pckl' ) )
192
+ fminus = load (name + '-.pckl' )
193
+ fplus = load (name + '+.pckl' )
187
194
if self .method == 'frederiksen' :
188
195
fminus [a ] -= fminus .sum (0 )
189
196
fplus [a ] -= fplus .sum (0 )
190
197
if self .nfree == 4 :
191
- fminusminus = pickle . load (open ( name + '--.pckl' ) )
192
- fplusplus = pickle . load (open ( name + '++.pckl' ) )
198
+ fminusminus = load (name + '--.pckl' )
199
+ fplusplus = load (name + '++.pckl' )
193
200
if self .method == 'frederiksen' :
194
201
fminusminus [a ] -= fminusminus .sum (0 )
195
202
fplusplus [a ] -= fplusplus .sum (0 )
0 commit comments