def write_skycatalog(self, filename, show_flux=False, show_id=False):
        """ Write out the all_radec catalog for this image to a file.
        """
        f = open(filename,'w')
        f.write("#Sky positions for cumulative reference catalog. Initial catalog from: "+self.name+'\n')
        header1 = "#RA        Dec"
        header2 = "#(deg)     (deg)"
        if show_flux:
            header1 += "        Flux"
            header2 += "       (counts)"
        if show_id:
            header1 += "        ID        Origin"
            header2 += ""
        header1 += "\n"
        header2 += "\n"

        f.write(header1)
        f.write(header2)

        show_details = show_flux or show_id
        flux_end_char = ''
        if show_details and show_flux:
            if show_id:
                flux_end_char = '\t'

        for i in range(self.all_radec[0].shape[0]):
            src_line = "{:.7f}  {:.7f}" \
                .format(self.all_radec[0][i], self.all_radec[1][i])
            if show_details:
                #src_line += " #"
                if show_flux:
                    #src_line += " flux: {:.5g}{:s}" \
                        #.format(self.xy_catalog[2][i], flux_end_char)
                    src_line += "  {:.5g}".format(self.xy_catalog[2][i])
                if show_id:
                    #src_line += " ID: {:d}\torigin: '{:s}'" \
                        #.format(self.xy_catalog[3][i], self.xy_catalog[-1][i])
                    src_line += "  {:d}  {:s}".format(self.xy_catalog[3][i],
                                                      self.xy_catalog[-1][i])
            f.write(src_line + '\n')
        f.close()