Copied in python dispersion check script, need to port.