def _write_n_photons(self, group):

        if self.n_photons == {}:
            raise Exception("Photon numbers not set")

        if self.n_iter == 0:
            if 'initial' in self.n_photons and self.n_photons['initial'] is not None:
                raise Exception("[n_photons] initial should not be set since no initial interations are being computed")
        else:
            if 'initial' in self.n_photons and self.n_photons['initial'] is not None:
                group.attrs['n_initial_photons'] = self.n_photons['initial']
            else:
                raise Exception("[n_photons] initial should be set since the initial iterations are being computed")

        if self._monochromatic:
            if 'last_sources' in self.n_photons:
                group.attrs['n_last_photons_sources'] = self.n_photons['last_sources']
            else:
                raise Exception("[n_photons] imaging_sources needs to be set in monochromatic mode")
            if 'last_dust' in self.n_photons:
                group.attrs['n_last_photons_dust'] = self.n_photons['last_dust']
            else:
                raise Exception("[n_photons] imaging_dust needs to be set in monochromatic mode")
            if 'last' in self.n_photons:
                raise Exception("[n_photons] imaging should not be set in monochromatic mode")
        else:
            if 'last_sources' in self.n_photons:
                raise Exception("[n_photons] imaging_sources should not be set as the monochromatic option is not being used")
            if 'last_dust' in self.n_photons:
                raise Exception("[n_photons] imaging_dust should not be set as the monochromatic option is not being used")
            if 'last' in self.n_photons:
                group.attrs['n_last_photons'] = self.n_photons['last']
            else:
                raise Exception("[n_photons] imaging should bet set")

        if self.raytracing:
            if 'raytracing_sources' in self.n_photons:
                group.attrs['n_ray_photons_sources'] = self.n_photons['raytracing_sources']
            else:
                raise Exception("[n_photons] raytracing_sources needs to be set in raytracing mode")
            if 'raytracing_dust' in self.n_photons:
                group.attrs['n_ray_photons_dust'] = self.n_photons['raytracing_dust']
            else:
                raise Exception("[n_photons] raytracing_dust needs to be set in raytracing mode")
        else:
            if 'raytracing_sources' in self.n_photons:
                raise Exception("[n_photons] raytracing_sources should not be set as raytracing is not being used")
            if 'raytracing_dust' in self.n_photons:
                raise Exception("[n_photons] raytracing_dust should not be set as raytracing is not being used")

        group.attrs['n_stats'] = self.n_photons['stats']
dataset/ETHPy150Open hyperion-rt/hyperion/hyperion/conf/conf_files.py/RunConf._write_n_photons/original