This paper aims to connect the theory of relativistic cosmology number counts with the astronomical data, practice, and theory behind the galaxy luminosity function (LF). We treat galaxies as the building blocks of the Universe, but ignore most aspects of their internal structures by considering them as point sources. However, we do consider general morphological types in order to use data from galaxy redshift surveys, where some kind of morphological classification is adopted. We start with a general relativistic treatment for a general spacetime, and then link the derived expressions with the LF definition adopted in observational cosmology. Then equations for differential number counts, the related relativistic density per source, and observed and total relativistic energy densities of the universe, and other related quantities are written in terms of the luminosity and selection functions. As an example of how these theoretical/observational relationships can be used, we apply them to test the LF parameters determined from the CNOC2 galaxy redshift survey, for consistency with the Einstein-de Sitter (EdS) cosmology, which they assume, for intermediate redshifts. We conclude that there is a general consistency for the tests we carried out, namely both the observed relativistic mass-energy density, and the observed relativistic mass-energy density per source, which is equivalent to differential number counts, in an EdS Universe. In addition, we find clear evidence of a large amount of hidden mass, as has been obvious from many earlier investigations. At the same time, we find that the CNOC2 LF give differential galaxy counts somewhat above the EdS predictions, indicating that this survey observes more galaxies at 0.1 < z < 0.4 than the models predictions.