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

Remove displacement plotting, and ifo argument, from plot_noise

This is ultimately to remove assumptions about what is being plotted from
the plotting function.
parent ef2ba4a9
No related branches found
No related tags found
1 merge request!41nb: generic noise budget support
......@@ -19,7 +19,7 @@ description is loaded, the noise budget can be calculated and plotted:
>>> ifo = gwinc.load_ifo('aLIGO')
>>> ifo = gwinc.precompIFO(freq, ifo)
>>> noises = gwinc.noise_calc(freq, ifo)
>>> gwinc.plot_noise(ifo, noises)
>>> gwinc.plot_noise(noises)
```
Or the `gwinc` convenience function can be used to handle it all:
```
......
......@@ -64,8 +64,6 @@ parser.add_argument('--title', '-t',
help="plot title")
parser.add_argument('--fom',
help="calculate inspiral range for resultant spectrum ('func[:param=val,param=val]')")
parser.add_argument('--no-displacement', '-nd', action='store_false', dest='displacement',
help="suppress displacement sensitivity axis")
group = parser.add_mutually_exclusive_group()
group.add_argument('--interactive', '-i', action='store_true',
help="interactive plot with interactive shell")
......@@ -214,7 +212,7 @@ You may interact with plot using "plt." methods, e.g.:
>>> plt.savefig("foo.pdf")
''')
ipshell.enable_pylab()
ipshell.run_code("plot_noise(ifo, noises)")
ipshell.run_code("plot_noise(noises)")
ipshell.run_code("plt.title('{}')".format(title))
ipshell()
......@@ -224,10 +222,8 @@ You may interact with plot using "plt." methods, e.g.:
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
plot_noise(
ifo,
noises,
ax=ax,
displacement=args.displacement,
)
ax.set_title(title)
fig.tight_layout()
......
......@@ -74,16 +74,12 @@ STYLE_MAP = {
def plot_noise(
ifo,
noises,
ax=None,
displacement=True,
):
"""Plot a GWINC noise budget from calculated noises
If an axis handle is provided it will be used for the plot.
`displacement` may be set to False to supress the right had
displacement axis.
Returns the figure handle used.
......@@ -141,11 +137,4 @@ def plot_noise(
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]")
return fig
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