q_fit script for fitting secondary map from primary map