Skip to content

Commit

Permalink
dont allow angles to be a string and just expect the precomputed angl…
Browse files Browse the repository at this point in the history
…es as input to avoid error. Ensure that functions returning values do in fact return something to avoid result being None.
  • Loading branch information
Sherwood Richers committed Aug 12, 2023
1 parent 05f1b49 commit 46672eb
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions spinflip/angle_multiprocess_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def angle_at_point(args):

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

#plot processed angles
def solid_angles_plot(self,
angles = 'compute', #output of last function
angles, #output of last function
vmin = None,
vmax = None,
savefig = False
):

if angles == 'compute':
angles = self.multiprocess_angles()

#prepare plot axes
xdim = 1E-5*self.Gr.merger_grid['x(cm)'][self.xy_limits[0,0]:self.xy_limits[0,1]+1,
self.xy_limits[1,0]:self.xy_limits[1,1]+1,
Expand Down Expand Up @@ -184,10 +181,7 @@ def solid_angles_plot(self,
if type(savefig) == str:
f.savefig(savefig + '.png', dpi=300, bbox_inches = 'tight')

if angles == 'compute':
return f,ax,angles
else:
return f,ax
return f,ax


def main(args):
Expand Down Expand Up @@ -228,7 +222,7 @@ def main(args):
angles = Angles_obj.multiprocess_angles(h5_filename)

#plot angles
Angles_obj.solid_angles_plot(angles = angles,
Angles_obj.solid_angles_plot(angles,
vmin = vmin,
vmax = vmax,
savefig = savefig,
Expand Down

0 comments on commit 46672eb

Please sign in to comment.