updated arithmetic for magnitudes in mosaic.py