Skip to content

Commit

Permalink
Fix formatting problems
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFP committed Oct 11, 2021
1 parent 38a6ba7 commit 31d1398
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 8 additions & 6 deletions aptools/plotting/quick_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
from aptools.data_handling.reading import read_beam
from aptools.plotting.plot_types import scatter_histogram
from aptools.plotting.rc_params import rc_params
from aptools.plotting.utils import add_projection, create_vertical_colorbars, add_text
from aptools.helper_functions import get_only_statistically_relevant_slices, weighted_std
from aptools.plotting.utils import (
add_projection, create_vertical_colorbars, add_text)
from aptools.helper_functions import (
get_only_statistically_relevant_slices, weighted_std)


def phase_space_overview_from_file(
Expand Down Expand Up @@ -511,9 +513,9 @@ def lon_phase_space(
if beam_info:
# analyze beam
if type(bins) in [tuple, list]:
bins_x, bins_y = bins
bins_x = bins[0]
else:
bins_x = bins_y = bins
bins_x = bins
i_peak = bd.peak_current(z, q, n_slices=bins_x) * 1e-3 # kA
tau_fwhm = bd.fwhm_length(z, q, n_slices=bins_x) * 1e15/ct.c # fs
s_t = bd.rms_length(z, w=q) * 1e15/ct.c # fs
Expand Down Expand Up @@ -660,7 +662,7 @@ def phase_space_plot(
else:
n_cols = 1
width_ratios = None
figsize=(4, 4)
figsize = (4, 4)

with plt.rc_context(rc_params):
if fig is None:
Expand Down Expand Up @@ -729,7 +731,7 @@ def phase_space_plot(
if tight_layout:
try:
grid.tight_layout(fig)
except:
except Exception:
fig.tight_layout()

if show:
Expand Down
6 changes: 2 additions & 4 deletions aptools/plotting/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ def add_projection(

if orientation == 'horizontal':
ax_p.plot(x_pos, x_proj, c='k', lw=0.5, alpha=0.5)
ax_p.fill_between(x_pos, x_proj, facecolor='tab:gray',
alpha=0.3)
ax_p.fill_between(x_pos, x_proj, facecolor='tab:gray', alpha=0.3)
xlim = main_ax.get_xlim()
ax_p.set_xlim(xlim)
ylim = list(ax_p.get_ylim())
ylim[0] = 0
ax_p.set_ylim(ylim)
elif orientation == 'vertical':
ax_p.plot(x_proj, x_pos, c='k', lw=0.5, alpha=0.5)
ax_p.fill_betweenx(x_pos, x_proj, facecolor='tab:gray',
alpha=0.3)
ax_p.fill_betweenx(x_pos, x_proj, facecolor='tab:gray', alpha=0.3)
ylim = main_ax.get_ylim()
ax_p.set_ylim(ylim)
xlim = list(ax_p.get_xlim())
Expand Down

0 comments on commit 31d1398

Please sign in to comment.