script to process raw theory data