Skip to content
Snippets Groups Projects
Commit e56b55d9 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

speed up plotting by adding displacement axis at end

parent 7087f667
No related branches found
No related tags found
No related merge requests found
......@@ -74,8 +74,8 @@ STYLE_MAP = {
def plot_noise(
ifo,
noises,
ax = None,
displacement = True,
ax=None,
displacement=True,
):
f = noises['Freq']
......@@ -83,20 +83,6 @@ def plot_noise(
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
if displacement:
ax_d = ax.twinx()
ax_d.set_yscale('log')
def convert_ax_h_to_d(ax):
"""
Update second axis according with first axis.
"""
y1, y2 = ax.get_ylim()
ax_d.set_ylim(y1 * ifo.Infrastructure.Length, y2 * ifo.Infrastructure.Length)
ax_d.figure.canvas.draw()
ax.callbacks.connect("ylim_changed", convert_ax_h_to_d)
ax_d.set_ylabel(u"Displacement [m/\u221AHz]")
def plot_dict(noises):
#use sorted to force a consistent ordering
#The key lambda in sorted gets the (name, noise) pair and so nn[0] returns the name
......@@ -126,18 +112,25 @@ def plot_noise(
ax.grid(
True,
which = 'both',
lw = 0.5,
ls = '-',
alpha = 0.5,
which='both',
lw=0.5,
ls='-',
alpha=0.5,
)
ax.legend(
ncol=2,
fontsize = 'small',
fontsize='small',
)
ax.set_xlabel('Frequency [Hz]')
ax.set_ylabel(u"Strain [1/\u221AHz]")
ax.set_xlim([min(f), max(f)])
ax.set_ylim([3e-25, 1e-21])
if displacement:
ax_d = ax.twinx()
ax_d.set_yscale('log')
y1, y2 = ax.get_ylim()
ax_d.set_ylim(y1*ifo.Infrastructure.Length, y2*ifo.Infrastructure.Length)
ax_d.set_ylabel(u"Displacement [m/\u221AHz]")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment