A blog of Python-related topics and code.

$k$-means clustering of exoplanet data

The website hosts a repository of data on over 5000 exoplanets discovered by various missions and techniques. For this post, I have extracted data on the mass and orbital period of 2951 exoplanets: exoplanet-data-160824.csv. The planetary masses are expressed relative to the mass of Jupiter (M) and the orbital period is in days.

The n-second rule

How long have you got before a piece of food dropped on the floor is unsafe to eat?

Nuclear binding energies #2

The semi-empirical mass formula parameters used in the previous post were taken from the text book of J. W. Rohlf (1994) [1]. Another, older set of parameters are presented in the compilation of A. H. Wapstra (1958)[2]. Below we compare each with the experimental data from the OECD-NEA (in the file mass.mas03).

Nuclear binding energies #1

The binding energy of a nucleus is the energy that would be required to split apart each of its constituent protons and neutrons (nucleons). This energy is due to the forces that hold the nucleus together, which may be thought of as a balance between the attractive strong nuclear force and the electromagnetic force (which is repulsive between the positively-charged protons). The binding energy manifests itself in a mass difference between the nucleus and the individual nucleons ($E=mc^2$) and the difference in binding energy between different nuclei is the energy released in the process of nuclear fusion and fission.

Binning a 2D array in NumPy

The standard way to bin a large array to a smaller one by averaging is to reshape it into a higher dimension and then take the means over the appropriate new axes. The following function does this, assuming that each dimension of the new shape is a factor of the corresponding dimension in the old one.