IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 17, 2007, 6:29:18 PM (19 years ago)
Author:
Paul Price
Message:

Fixing bias, adding catalog and random stars.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSimCreate.c

    r12834 r12873  
    1313    PS_ASSERT_PTR_NON_NULL(config, NULL);
    1414
    15     psString formatName = psMetadataLookupStr(NULL, config->arguments, "FORMAT"); // Input format name
    16     config->formatName = psMemIncrRefCounter(formatName);
    17 
    18     psMetadata *formats = psMetadataLookupMetadata(NULL, config->camera, "FORMATS"); // The camera formats
    19     if (!formats) {
    20         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FORMATS in camera configuration.");
    21         return NULL;
    22     }
    23     psMetadata *format = psMetadataLookupMetadata(NULL, formats, formatName); // Format of interest
    24     if (!format) {
    25         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find format %s in camera FORMATS.", formatName);
    26         return NULL;
    27     }
    28     pmFPALevel phuLevel = pmFPAPHULevel(format); // Level at which PHU goes
    29 
    3015    pmFPA *fpa = pmFPAConstruct(config->camera); // FPA to contain the observation
    3116    if (!fpa) {
     
    3419    }
    3520
     21    pmFPAfile *file = pmFPAfileDefineOutput(config, fpa, OUTPUT_FILE);
     22    psFree(fpa);
     23    if (!file) {
     24        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to create output file from %s.  "
     25                "Did you forget to specify the format?", OUTPUT_FILE);
     26        return NULL;
     27    }
     28    if (file->type != PM_FPA_FILE_IMAGE) {
     29        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "%s type is not IMAGE", OUTPUT_FILE);
     30        psFree(file);
     31        return NULL;
     32    }
     33
     34    pmFPALevel phuLevel = pmFPAPHULevel(file->format); // Level at which PHU goes
     35
    3636    pmFPAview *view = pmFPAviewAlloc(0);// View for current level
    3737
    3838    if (phuLevel == PM_FPA_LEVEL_FPA) {
    39         if (!pmFPAAddSourceFromView(fpa, "Simulation", view, format)) {
     39        if (!pmFPAAddSourceFromView(fpa, "Simulation", view, file->format)) {
    4040            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    4141            psFree(fpa);
     
    4848    while ((chip = pmFPAviewNextChip(view, fpa, 1))) {
    4949        if (phuLevel == PM_FPA_LEVEL_CHIP) {
    50             if (!pmFPAAddSourceFromView(fpa, "Simulation", view, format)) {
     50            if (!pmFPAAddSourceFromView(fpa, "Simulation", view, file->format)) {
    5151                psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    5252                psFree(fpa);
     
    5959        while ((cell = pmFPAviewNextCell(view, fpa, 1))) {
    6060            if (phuLevel == PM_FPA_LEVEL_CELL) {
    61                 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, format)) {
     61                if (!pmFPAAddSourceFromView(fpa, "Simulation", view, file->format)) {
    6262                    psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    6363                    psFree(fpa);
     
    7070    psFree(view);
    7171
    72     pmFPAfile *file = pmFPAfileDefineOutput(config, fpa, OUTPUT_FILE);
    73     psFree(fpa);
    74     if (!file) {
    75         psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to create output file from %s", OUTPUT_FILE);
    76         return NULL;
    77     }
    78     if (file->type != PM_FPA_FILE_IMAGE) {
    79         psError(PS_ERR_BAD_PARAMETER_TYPE, true, "%s type is not IMAGE", OUTPUT_FILE);
    80         psFree(file);
    81         return NULL;
    82     }
    83 
    8472    return file;
    8573}
Note: See TracChangeset for help on using the changeset viewer.