Sure, astronomers were taking a beating by being excommunicated or under house arrest, but in roughly the same time period some German clergymen marginalized by the Vatican were publishing a witch-hunter's manual filled with conclusions arrived at with the best logic and reasoning to be mustered at the time. (I'm referring, of course, to the Malleus Maleficarum, available in pdf format online.)
Galileo's house arrest was 1633. The Malleus Maleficarum was written in 1486. Not really the same period. And the Malleus Maleficarum was hardly a model of reason and logic: it was this book that argued that witches do exist (contrary to the earlier mainstream Catholic view) and that they are agents of Satan.
You're right, though, that rational thought and magical thought co-existed. It's important to remember, for example, that the witch hunts mostly happened in the sixteenth and seventeenth centuries, not in the Middle Ages or even the main period of the Renaissance. As a rule, when a new thought paradigm comes along, the old one is not displaced but remains. So the Renaissance, with all of its magic and occultism, did not displace the Aristotelian rationalism of the thirteenth and fourteenth centuries, which continued to exist alongside it. And when the Enlightenment, with its mechanistic and scientific rationalism, came along, the occultist thinking of the Renaissance also continued to exist, sometimes in the same people.