scripts to compute fractions of types