margin_y = margin_inches/fig_height_inches margin_bottom = margin_bottom_inches/fig_height_inches margin_top = margin_top_inches/fig_height_inches margin_left = margin_left_inches/fig_width_inches margin_right = margin_right_inches/fig_width_inches subplot_width = subplot_width_inches/fig_width_inches subplot_height = subplot_height_inches/fig_height_inches fig_aspect = fig_height_inches/fig_width_inches lvals = lvals[il1:il2+1] mvals = mvals[im1:im2+1] lvals_2d, mvals_2d = np.meshgrid(lvals, mvals, indexing='ij') lvals_2d_new, mvals_2d_new = xy_grid(lvals_2d, mvals_2d) # Get full power fullpower = np.abs(spec.vals[:, :, :, :, 0])**2 # Get indices associated with desired r-values if ir_vals is None: ir_vals = [] if desired_rvals == ['all']: ir_vals = np.arange(nr) else: for i in range(len(desired_rvals)): rval = desired_rvals[i] ir_vals.append(np.argmin(np.abs(rvals - rval))) # What is given is now what is desired
lvals = lvals[:il_max + 1] br_trace_all = br_trace_all[:, :il_max + 1] bt_trace_all = bt_trace_all[:, :il_max + 1] bp_trace_all = bp_trace_all[:, :il_max + 1] if separate: # Break up quantities into l-even/l-odd lvals_int = lvals.astype(int) il_even = np.where(lvals_int % 2 == 0)[0] il_odd = np.where(lvals_int % 2 == 1)[0] lvals_even = lvals[il_even] lvals_odd = lvals[il_odd] # Make grid of times and l-values times2, lvals2 = np.meshgrid(times_trace, lvals, indexing='ij') times2, lvals2 = xy_grid(times2, lvals2) # Loop over the desired radii and save plots for i in range(len(i_desiredrvals)): i_desiredrval = i_desiredrvals[i] rval_to_plot = rvals_to_plot[i] br_trace = br_trace_all[:, :, i_desiredrval, itype] bt_trace = bt_trace_all[:, :, i_desiredrval, itype] bp_trace = bp_trace_all[:, :, i_desiredrval, itype] # Make appropriate file name to save savename = dirname_stripped + '_time-lval_B_' + \ str(itype).zfill(2) + '-' + power_type + '_' + \ ('rval%0.3f_' %rval_to_plot) + str(iter1).zfill(8) + '_' +\ str(iter2).zfill(8) + tag + '.png'