def norm_chain(chain, axis=0):
    std = np.std(flatchain(chain), axis=axis)
    med = np.median(flatchain(chain), axis=axis)
    return ((chain - med) / std)
def norm_chain(chain, axis=0):
    std = np.std(flatchain(chain), axis=axis)
    med = np.median(flatchain(chain), axis=axis)
    return ((chain - med) / std)