ported calculation of magnitude
ported calculation of dst image
ported calculation of map