I'm trying to understand this application of thermodynamics to astronomical inferrence. As I understand it, the temperature of a diffuse gas cloud in distant space can be inferred from the relative intensities of the spectral lines (correct?) which indicates the distribution of the population of excited states. However, until I uncovered this suggestion, I had accepted temperature to be proportional to the average kinetic energy of the particles (including rotational and vibrational) by definition (through Boltzmann's constant). So, which is it? Which defines the temperature: kinetic energy or internal energy (or a combination of both)? And, if it is kinetic energy, then does a cloud of gas moving through space have a higher temperature than an identical cloud of gas that is stationary; is temperature frame dependent?