Some scripts for processing mag data