Skip to content
Snippets Groups Projects
Commit a58039b8 authored by Christopher Wipf's avatar Christopher Wipf
Browse files

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.
parent 95bfb2a8
No related branches found
No related tags found
1 merge request!20Compatibility fixes for outdated matplotlib/numpy libraries
Pipeline #27983 passed
...@@ -19,42 +19,53 @@ PRIORITY_MAP = { ...@@ -19,42 +19,53 @@ PRIORITY_MAP = {
STYLE_MAP = { STYLE_MAP = {
'Quantum Vacuum': dict( 'Quantum Vacuum': dict(
color = 'xkcd:vibrant purple', # color = 'xkcd:vibrant purple',
color = '#ad03de',
), ),
'Seismic': dict( 'Seismic': dict(
color = 'xkcd:brown', # color = 'xkcd:brown',
color = '#653700',
), ),
'Newtonian Gravity': dict( 'Newtonian Gravity': dict(
color = 'xkcd:green', # color = 'xkcd:green',
color = '#15b01a',
), ),
'Suspension Thermal': dict( 'Suspension Thermal': dict(
color = 'xkcd:deep sky blue', # color = 'xkcd:deep sky blue',
color = '#0d75f8',
), ),
'Coating Brownian': dict( 'Coating Brownian': dict(
color = 'xkcd:fire engine red', # color = 'xkcd:fire engine red',
color = '#fe0002',
), ),
'Coating Thermo-Optic': dict( 'Coating Thermo-Optic': dict(
color = 'xkcd:bright sky blue', # color = 'xkcd:bright sky blue',
color = '#02ccfe',
ls = '--', ls = '--',
), ),
'ITM Thermo-Refractive': dict( 'ITM Thermo-Refractive': dict(
color = 'xkcd:dark sky blue', # color = 'xkcd:dark sky blue',
color = '#448ee4',
ls = '--', ls = '--',
), ),
'ITM Carrier Density': dict( 'ITM Carrier Density': dict(
color = 'xkcd:grey', # color = 'xkcd:grey',
color = '#929591',
ls = '--', ls = '--',
), ),
'Substrate Brownian': dict( 'Substrate Brownian': dict(
color = 'xkcd:pumpkin orange', # color = 'xkcd:pumpkin orange',
color = '#fb7d07',
ls = '--', ls = '--',
), ),
'Substrate Thermo-Elastic': dict( 'Substrate Thermo-Elastic': dict(
color = 'xkcd:golden', # color = 'xkcd:golden',
color = '#f5bf03',
ls = '--', ls = '--',
), ),
'Excess Gas': dict( 'Excess Gas': dict(
color = 'xkcd:baby shit brown', # color = 'xkcd:baby shit brown',
color = '#ad900d',
ls = '--', ls = '--',
), ),
} }
...@@ -111,7 +122,7 @@ def plot_noise( ...@@ -111,7 +122,7 @@ def plot_noise(
ax.loglog(f, sqrt(noise), **stylekw) ax.loglog(f, sqrt(noise), **stylekw)
plot_dict(noises) 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( ax.grid(
True, True,
......
...@@ -206,7 +206,7 @@ def suspQuad(f, ifo, material='Silica'): ...@@ -206,7 +206,7 @@ def suspQuad(f, ifo, material='Silica'):
phi_b[n] = bladeMat.Phi # loss angle phi_b[n] = bladeMat.Phi # loss angle
# weight support by lower stages # 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 # Correction for the pendulum restoring force
kh0 = Mg / length # N/m, horiz. spring constant, stage n kh0 = Mg / length # N/m, horiz. spring constant, stage n
......
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