added grain fitting scripts