An example of analogy in popular science writing:
"There are stars and stars. While most of them glow quietly in the sky, there are a few that constantly change their luminosity from bright to dim, and from dim to bright in regularly spaced cycles. The giant bodies of these stars pulsate as regularly as the heart beats, and along with this pulsation goes a periodic change of their brightness. The larger the star, the longer is the period of its pulsation, just as it takes a long pendulum more time to complete its swing than a short one."
George Gamow (1961) One, Two, Three…Infinity. Facts and speculations of science, Revised Edition, Dover Publications, Inc., New York.
The comparison with pendulums seems a full analogy as there is an explicit mapping – size of star : period of pulsation :: length of pendulum : period of oscillation.
The other comparison seems to map as – bodies of variable stars: pulsate regularly :: heart : beats regularly. (The stars are actually much more regular than a human heart!)
Read examples of scientific analogies
Many examples of science analogies are listed in 'Creative comparisons: Making science familiar through language. An illustrative catalogue of figurative comparisons and analogies for science concepts'. Free Download.