adding script to calculate the phase of the worm body