From 1ae0f5cb23fe2f39a28e2ac9d0d2b610ffffb2ea Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins <jrollins@finestructure.net> Date: Mon, 11 Mar 2019 11:40:08 -0700 Subject: [PATCH] Remove displacement plotting, and ifo argument, from plot_noise This is ultimately to remove assumptions about what is being plotted from the plotting function. --- README.md | 2 +- gwinc/__main__.py | 6 +----- gwinc/plot.py | 11 ----------- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ef9ab041..f983a18f 100644 --- a/README.md +++ b/README.md @@ -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: ``` diff --git a/gwinc/__main__.py b/gwinc/__main__.py index 80a029a4..0005c5a7 100644 --- a/gwinc/__main__.py +++ b/gwinc/__main__.py @@ -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() diff --git a/gwinc/plot.py b/gwinc/plot.py index 576d1344..16f6da5e 100644 --- a/gwinc/plot.py +++ b/gwinc/plot.py @@ -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 -- GitLab