Skip to content

Commit 46672eb

Browse files
author
Sherwood Richers
committed
dont allow angles to be a string and just expect the precomputed angles as input to avoid error. Ensure that functions returning values do in fact return something to avoid result being None.
1 parent 05f1b49 commit 46672eb

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

spinflip/angle_multiprocess_tools.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def angle_at_point(args):
4040

4141
#check if there is resonance
4242
if SP.resonant_theta(phi=0) == None:
43-
return
43+
return 0
4444
else: #compute quantity
4545
if args["method"] == 'solid angle':
4646
return SP.solidAngle(separate_ranges=args["separate_ranges"], **args["kwargs"])
@@ -131,15 +131,12 @@ def multiprocess_angles(self,
131131

132132
#plot processed angles
133133
def solid_angles_plot(self,
134-
angles = 'compute', #output of last function
134+
angles, #output of last function
135135
vmin = None,
136136
vmax = None,
137137
savefig = False
138138
):
139139

140-
if angles == 'compute':
141-
angles = self.multiprocess_angles()
142-
143140
#prepare plot axes
144141
xdim = 1E-5*self.Gr.merger_grid['x(cm)'][self.xy_limits[0,0]:self.xy_limits[0,1]+1,
145142
self.xy_limits[1,0]:self.xy_limits[1,1]+1,
@@ -184,10 +181,7 @@ def solid_angles_plot(self,
184181
if type(savefig) == str:
185182
f.savefig(savefig + '.png', dpi=300, bbox_inches = 'tight')
186183

187-
if angles == 'compute':
188-
return f,ax,angles
189-
else:
190-
return f,ax
184+
return f,ax
191185

192186

193187
def main(args):
@@ -228,7 +222,7 @@ def main(args):
228222
angles = Angles_obj.multiprocess_angles(h5_filename)
229223

230224
#plot angles
231-
Angles_obj.solid_angles_plot(angles = angles,
225+
Angles_obj.solid_angles_plot(angles,
232226
vmin = vmin,
233227
vmax = vmax,
234228
savefig = savefig,

0 commit comments

Comments
 (0)