import math


def mag2size(mag, max_mag):
	"""
	Calculates size of a dot from star's magnitude
	"""
	size = (max_mag - mag) / max_mag
	size = int(math.log(size * 6))
	if size <= 0:
		size = 1
	return size