code: def dmag(self,band):
          
          if self.mags is None:
              raise ValueError('dmag is not defined because primary mags are not defined for this population.')
          return self.stars['{}_mag'.format(band)] - self.mags[band]
docs: Magnitude difference between primary star and BG stars