You are reading in to what the article says. It doesn’t say or imply magic, it says it was a algorithm, a math formula that predicted the cycle of the planets.
Re-read the article or read it for the first time.
The hat’s were just headgear. They didn’t really do anything. The only kind of power they could have derived from the hats was the power of suggestion.