Use stringIO instead of tempfile for test_gamma_rays()