Contrast transfer functions help quantify neural network out-of-distribution generalization in HRTEM