This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from matplotlib.colors import LinearSegmentedColormap as LSC | |
from matplotlib.cm import register_cmap | |
def neut_cmap(s=0.5, n=256, name='NCcmap'): | |
"""Usage : neut_cmap(s=0.5, n=256) | |
Output a color-map that is neutral (gray) in the middle, | |
use reddish/warm colors at the upper end, | |
and use blueish/cool colors at the lower end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from matplotlib.colors import LinearSegmentedColormap as LSC | |
from matplotlib.cm import register_cmap | |
def modulo_cmap(cmap, name=None): | |
colors = np.roll(cmap(np.arange(cmap.N)), cmap.N // 2, axis=0) | |
if name is None: | |
name = map.name + "_mod" | |
return LSC.from_list(name, colors, cmap.N) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import sympy as sp | |
from sympy.physics import units as u | |
import matplotlib.pyplot as plt | |
from sympy.core.symbol import Symbol | |
Q = sp.Rational | |
sqrt = sp.sqrt | |
pi = sp.pi |