From a58039b811178cad6dc7b6050e8476610bb26cf0 Mon Sep 17 00:00:00 2001 From: Christopher Wipf <wipf@ligo.mit.edu> Date: Mon, 13 Aug 2018 16:44:09 -0700 Subject: [PATCH] Improve backward compatibility with ancient matplotlib/numpy versions matplotlib: use hex color names instead of the cool xkcd ones When matplotlib >= 2.0 is ubiquitous, we can revert this. numpy: use np.flipud in place of np.flip np.flip only exists in numpy >= 1.12, and flipud is clearer anyway. --- gwinc/plot.py | 35 +++++++++++++++++++++++------------ gwinc/suspension.py | 2 +- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/gwinc/plot.py b/gwinc/plot.py index c694deb2..7be10159 100644 --- a/gwinc/plot.py +++ b/gwinc/plot.py @@ -19,42 +19,53 @@ PRIORITY_MAP = { STYLE_MAP = { 'Quantum Vacuum': dict( - color = 'xkcd:vibrant purple', + # color = 'xkcd:vibrant purple', + color = '#ad03de', ), 'Seismic': dict( - color = 'xkcd:brown', + # color = 'xkcd:brown', + color = '#653700', ), 'Newtonian Gravity': dict( - color = 'xkcd:green', + # color = 'xkcd:green', + color = '#15b01a', ), 'Suspension Thermal': dict( - color = 'xkcd:deep sky blue', + # color = 'xkcd:deep sky blue', + color = '#0d75f8', ), 'Coating Brownian': dict( - color = 'xkcd:fire engine red', + # color = 'xkcd:fire engine red', + color = '#fe0002', ), 'Coating Thermo-Optic': dict( - color = 'xkcd:bright sky blue', + # color = 'xkcd:bright sky blue', + color = '#02ccfe', ls = '--', ), 'ITM Thermo-Refractive': dict( - color = 'xkcd:dark sky blue', + # color = 'xkcd:dark sky blue', + color = '#448ee4', ls = '--', ), 'ITM Carrier Density': dict( - color = 'xkcd:grey', + # color = 'xkcd:grey', + color = '#929591', ls = '--', ), 'Substrate Brownian': dict( - color = 'xkcd:pumpkin orange', + # color = 'xkcd:pumpkin orange', + color = '#fb7d07', ls = '--', ), 'Substrate Thermo-Elastic': dict( - color = 'xkcd:golden', + # color = 'xkcd:golden', + color = '#f5bf03', ls = '--', ), 'Excess Gas': dict( - color = 'xkcd:baby shit brown', + # color = 'xkcd:baby shit brown', + color = '#ad900d', ls = '--', ), } @@ -111,7 +122,7 @@ def plot_noise( ax.loglog(f, sqrt(noise), **stylekw) plot_dict(noises) - ax.loglog(f, sqrt(noises['Total']), color='xkcd:black', alpha=0.6, label='Total', lw=4) + ax.loglog(f, sqrt(noises['Total']), color='#000000', alpha=0.6, label='Total', lw=4) ax.grid( True, diff --git a/gwinc/suspension.py b/gwinc/suspension.py index 8ea03600..2106f66f 100644 --- a/gwinc/suspension.py +++ b/gwinc/suspension.py @@ -206,7 +206,7 @@ def suspQuad(f, ifo, material='Silica'): phi_b[n] = bladeMat.Phi # loss angle # weight support by lower stages - Mg = g * np.flip(np.cumsum(np.flip(mass, 0)), 0) + Mg = g * np.flipud(np.cumsum(np.flipud(mass))) # Correction for the pendulum restoring force kh0 = Mg / length # N/m, horiz. spring constant, stage n -- GitLab