extensive modification of selectPsfCat_and_validation