# include "relphot.h"

void wcatalog (Catalog *catalog) {
  
  fits_modify (&catalog[0].header, "NRPHOT", "%t", 1, TRUE);

  save_catalog (catalog, VERBOSE);

  if (catalog[0].Naverage) {
    free (catalog[0].average); 
    catalog[0].Naverage = 0;
  }
  if (catalog[0].Nmeasure) {
    free (catalog[0].measure); 
    catalog[0].Nmeasure = 0;
  }
  if (catalog[0].Nmissing) {
    free (catalog[0].missing); 
    catalog[0].Nmissing = 0;
  }
  if (catalog[0].Nsecfilt) {
    free (catalog[0].secfilt); 
    catalog[0].Nsecfilt = 0;
  }
}
