IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38098


Ignore:
Timestamp:
Apr 8, 2015, 8:26:27 PM (11 years ago)
Author:
eugene
Message:

handle lensing and lensobj formats in PS1_SIM

Location:
branches/eam_branches/ipp-20150405/Ohana/src/libdvo/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150405/Ohana/src/libdvo/src/dvo_catalog_split.c

    r37807 r38098  
    992992    assert (catalog[0].Nlensing_disk >= catalog[0].Nlensing_off);
    993993
    994     // convert to external table format (note that the block above does not damage or free catalog.average)
    995     if (!LensingToFtable (&ftable, &catalog[0].lensing[first], Nrows, catalog[0].catformat)) {
    996       fprintf (stderr, "trouble converting format\n");
    997       goto failure;
    998     }
    999 
    1000     // write out Lensing table
    1001     if (!dvo_catalog_save_subcat (catalog[0].lensing_catalog, &ftable, start, Nrows, catalog[0].Nlensing_disk, Nlensing_disk_new)) {
    1002       fprintf (stderr, "trouble writing Lensing table\n");
    1003       goto failure;
    1004     }
    1005     gfits_free_header (&header);
    1006     gfits_free_table (&ftable);
     994    if (catalog[0].Nlensing) {
     995      // convert to external table format (note that the block above does not damage or free catalog.average)
     996      if (!LensingToFtable (&ftable, &catalog[0].lensing[first], Nrows, catalog[0].catformat)) {
     997        fprintf (stderr, "trouble converting format\n");
     998        goto failure;
     999      }
     1000
     1001      // write out Lensing table
     1002      if (!dvo_catalog_save_subcat (catalog[0].lensing_catalog, &ftable, start, Nrows, catalog[0].Nlensing_disk, Nlensing_disk_new)) {
     1003        fprintf (stderr, "trouble writing Lensing table\n");
     1004        goto failure;
     1005      }
     1006      gfits_free_header (&header);
     1007      gfits_free_table (&ftable);
     1008    }
    10071009  }
    10081010
     
    10191021    assert (catalog[0].Nlensobj_disk >= catalog[0].Nlensobj_off);
    10201022
    1021     // convert to external table format (note that the block above does not damage or free catalog.average)
    1022     if (!LensobjToFtable (&ftable, &catalog[0].lensobj[first], Nrows, catalog[0].catformat)) {
    1023       fprintf (stderr, "trouble converting format\n");
    1024       goto failure;
    1025     }
    1026 
    1027     // write out Lensobj table
    1028     if (!dvo_catalog_save_subcat (catalog[0].lensobj_catalog, &ftable, start, Nrows, catalog[0].Nlensobj_disk, Nlensobj_disk_new)) {
    1029       fprintf (stderr, "trouble writing Lensobj table\n");
    1030       goto failure;
    1031     }
    1032     gfits_free_header (&header);
    1033     gfits_free_table (&ftable);
     1023    if (catalog[0].Nlensobj) {
     1024      // convert to external table format (note that the block above does not damage or free catalog.average)
     1025      if (!LensobjToFtable (&ftable, &catalog[0].lensobj[first], Nrows, catalog[0].catformat)) {
     1026        fprintf (stderr, "trouble converting format\n");
     1027        goto failure;
     1028      }
     1029
     1030      // write out Lensobj table
     1031      if (!dvo_catalog_save_subcat (catalog[0].lensobj_catalog, &ftable, start, Nrows, catalog[0].Nlensobj_disk, Nlensobj_disk_new)) {
     1032        fprintf (stderr, "trouble writing Lensobj table\n");
     1033        goto failure;
     1034      }
     1035      gfits_free_header (&header);
     1036      gfits_free_table (&ftable);
     1037    }
    10341038  }
    10351039
     
    10461050    assert (catalog[0].Nstarpar_disk >= catalog[0].Nstarpar_off);
    10471051
    1048     // convert to external table format (note that the block above does not damage or free catalog.average)
    1049     if (!StarParToFtable (&ftable, &catalog[0].starpar[first], Nrows, catalog[0].catformat)) {
    1050       fprintf (stderr, "trouble converting format\n");
    1051       goto failure;
    1052     }
    1053 
    1054     // write out StarPar table
    1055     if (!dvo_catalog_save_subcat (catalog[0].starpar_catalog, &ftable, start, Nrows, catalog[0].Nstarpar_disk, Nstarpar_disk_new)) {
    1056       fprintf (stderr, "trouble writing StarPar table\n");
    1057       goto failure;
    1058     }
    1059     gfits_free_header (&header);
    1060     gfits_free_table (&ftable);
     1052    if (catalog[0].Nstarpar) {
     1053      // convert to external table format (note that the block above does not damage or free catalog.average)
     1054      if (!StarParToFtable (&ftable, &catalog[0].starpar[first], Nrows, catalog[0].catformat)) {
     1055        fprintf (stderr, "trouble converting format\n");
     1056        goto failure;
     1057      }
     1058
     1059      // write out StarPar table
     1060      if (!dvo_catalog_save_subcat (catalog[0].starpar_catalog, &ftable, start, Nrows, catalog[0].Nstarpar_disk, Nstarpar_disk_new)) {
     1061        fprintf (stderr, "trouble writing StarPar table\n");
     1062        goto failure;
     1063      }
     1064      gfits_free_header (&header);
     1065      gfits_free_table (&ftable);
     1066    }
    10611067  }
    10621068
  • branches/eam_branches/ipp-20150405/Ohana/src/libdvo/src/dvo_convert.c

    r38062 r38098  
    497497  SKIPPING_FORMAT ("DVO_LENSING_PS1_V4",          PS1_V4,          PS1_V4);
    498498  CONVERT_FORMAT  ("DVO_LENSING_PS1_V5",          PS1_V5,          PS1_V5_R2);
     499  SKIPPING_FORMAT ("DVO_LENSING_PS1_SIM",         PS1_SIM,         PS1_SIM);
    499500# undef CONVERT_FORMAT
     501# undef SKIPPING_FORMAT
    500502
    501503  fprintf (stderr, "table format unknown: %s\n", extname);
     
    556558  }
    557559
     560# define SKIPPING_FORMAT(NAME, FORMAT, TYPE)            \
     561  if (!strcmp (extname, NAME)) {                                        \
     562    fprintf (stderr, "ERROR: format %s not defined for lensobj, skipping\n", NAME); \
     563    *Nlensobj = 0; \
     564    return NULL; \
     565  }
     566
    558567# define CONVERT_FORMAT(NAME, FORMAT, TYPE)             \
    559568  if (!strcmp (extname, NAME)) {                                        \
     
    579588  }
    580589
    581 // CONVERT_FORMAT ("DVO_LENSOBJ_PS1_REF",         PS1_REF,         PS1_REF);
    582 // CONVERT_FORMAT ("DVO_LENSOBJ_ELIXIR",          ELIXIR,          Elixir);
    583 // CONVERT_FORMAT ("DVO_LENSOBJ_LONEOS",          LONEOS,          Loneos);
    584 // CONVERT_FORMAT ("DVO_LENSOBJ_PANSTARRS_DEV_0", PANSTARRS_DEV_0, Panstarrs_DEV_0);
    585 // CONVERT_FORMAT ("DVO_LENSOBJ_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
    586 // CONVERT_FORMAT ("DVO_LENSOBJ_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
    587 // CONVERT_FORMAT ("DVO_LENSOBJ_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    588 // CONVERT_FORMAT ("DVO_LENSOBJ_PS1_V1",          PS1_V1,          PS1_V1);
    589 // CONVERT_FORMAT ("DVO_LENSOBJ_PS1_V2",          PS1_V2,          PS1_V2);
    590 // CONVERT_FORMAT ("DVO_LENSOBJ_PS1_V3",          PS1_V3,          PS1_V3);
    591 // CONVERT_FORMAT ("DVO_LENSOBJ_PS1_V4",          PS1_V4,          PS1_V4);
    592   CONVERT_FORMAT ("DVO_LENSOBJ_PS1_V5",          PS1_V5,          PS1_V5);
     590  SKIPPING_FORMAT ("DVO_LENSOBJ_PS1_REF",         PS1_REF,         PS1_REF);
     591  SKIPPING_FORMAT ("DVO_LENSOBJ_ELIXIR",          ELIXIR,          Elixir);
     592  SKIPPING_FORMAT ("DVO_LENSOBJ_LONEOS",          LONEOS,          Loneos);
     593  SKIPPING_FORMAT ("DVO_LENSOBJ_PANSTARRS_DEV_0", PANSTARRS_DEV_0, Panstarrs_DEV_0);
     594  SKIPPING_FORMAT ("DVO_LENSOBJ_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
     595  SKIPPING_FORMAT ("DVO_LENSOBJ_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
     596  SKIPPING_FORMAT ("DVO_LENSOBJ_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
     597  SKIPPING_FORMAT ("DVO_LENSOBJ_PS1_V1",          PS1_V1,          PS1_V1);
     598  SKIPPING_FORMAT ("DVO_LENSOBJ_PS1_V2",          PS1_V2,          PS1_V2);
     599  SKIPPING_FORMAT ("DVO_LENSOBJ_PS1_V3",          PS1_V3,          PS1_V3);
     600  SKIPPING_FORMAT ("DVO_LENSOBJ_PS1_V4",          PS1_V4,          PS1_V4);
     601  CONVERT_FORMAT  ("DVO_LENSOBJ_PS1_V5",          PS1_V5,          PS1_V5);
     602  SKIPPING_FORMAT ("DVO_LENSOBJ_PS1_SIM",         PS1_SIM,         PS1_SIM);
    593603# undef CONVERT_FORMAT
     604# undef SKIPPING_FORMAT
    594605
    595606  fprintf (stderr, "table format unknown: %s\n", extname);
     
    650661  }
    651662
     663# define SKIPPING_FORMAT(NAME, FORMAT, TYPE)            \
     664  if (!strcmp (extname, NAME)) {                                        \
     665    fprintf (stderr, "ERROR: format %s not defined for starpar, skipping\n", NAME); \
     666    *Nstarpar = 0; \
     667    return NULL; \
     668  }
     669
    652670# define CONVERT_FORMAT(NAME, FORMAT, TYPE)             \
    653671  if (!strcmp (extname, NAME)) {                                        \
     
    673691  }
    674692
    675    CONVERT_FORMAT ("DVO_STARPAR_PS1_SIM",         PS1_SIM,         PS1_SIM);
    676 // CONVERT_FORMAT ("DVO_STARPAR_PS1_REF",         PS1_REF,         PS1_REF);
    677 // CONVERT_FORMAT ("DVO_STARPAR_ELIXIR",          ELIXIR,          Elixir);
    678 // CONVERT_FORMAT ("DVO_STARPAR_LONEOS",          LONEOS,          Loneos);
    679 // CONVERT_FORMAT ("DVO_STARPAR_PANSTARRS_DEV_0", PANSTARRS_DEV_0, Panstarrs_DEV_0);
    680 // CONVERT_FORMAT ("DVO_STARPAR_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
    681 // CONVERT_FORMAT ("DVO_STARPAR_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
    682 // CONVERT_FORMAT ("DVO_STARPAR_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    683 // CONVERT_FORMAT ("DVO_STARPAR_PS1_V1",          PS1_V1,          PS1_V1);
    684 // CONVERT_FORMAT ("DVO_STARPAR_PS1_V2",          PS1_V2,          PS1_V2);
    685 // CONVERT_FORMAT ("DVO_STARPAR_PS1_V3",          PS1_V3,          PS1_V3);
    686 // CONVERT_FORMAT ("DVO_STARPAR_PS1_V4",          PS1_V4,          PS1_V4);
    687   CONVERT_FORMAT ("DVO_STARPAR_PS1_V5",          PS1_V5,          PS1_V5);
    688 //  CONVERT_FORMAT ("DVO_STELLAR_PARAMS_PS1_V5",          PS1_V5,          PS1_V5);
    689   // XXX fix in libauto: STELLAR_PARAMS to STARPAR
     693  CONVERT_FORMAT  ("DVO_STARPAR_PS1_SIM",         PS1_SIM,         PS1_SIM);
     694  SKIPPING_FORMAT ("DVO_STARPAR_PS1_REF",         PS1_REF,         PS1_REF);
     695  SKIPPING_FORMAT ("DVO_STARPAR_ELIXIR",          ELIXIR,          Elixir);
     696  SKIPPING_FORMAT ("DVO_STARPAR_LONEOS",          LONEOS,          Loneos);
     697  SKIPPING_FORMAT ("DVO_STARPAR_PANSTARRS_DEV_0", PANSTARRS_DEV_0, Panstarrs_DEV_0);
     698  SKIPPING_FORMAT ("DVO_STARPAR_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
     699  SKIPPING_FORMAT ("DVO_STARPAR_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
     700  SKIPPING_FORMAT ("DVO_STARPAR_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
     701  SKIPPING_FORMAT ("DVO_STARPAR_PS1_V1",          PS1_V1,          PS1_V1);
     702  SKIPPING_FORMAT ("DVO_STARPAR_PS1_V2",          PS1_V2,          PS1_V2);
     703  SKIPPING_FORMAT ("DVO_STARPAR_PS1_V3",          PS1_V3,          PS1_V3);
     704  SKIPPING_FORMAT ("DVO_STARPAR_PS1_V4",          PS1_V4,          PS1_V4);
     705  CONVERT_FORMAT  ("DVO_STARPAR_PS1_V5",          PS1_V5,          PS1_V5);
    690706# undef CONVERT_FORMAT
     707# undef SKIPPING_FORMAT
    691708
    692709  fprintf (stderr, "table format unknown: %s\n", extname);
Note: See TracChangeset for help on using the changeset viewer.