IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18815


Ignore:
Timestamp:
Jul 30, 2008, 6:05:07 PM (18 years ago)
Author:
eugene
Message:

add a Threaded version (still missing functions for dark and shutter)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080719/ppMerge/src/ppMergeLoop_Threaded.c

    r18759 r18815  
    3636
    3737    // General combination parameters
    38     int rows = psMetadataLookupS32(NULL, arguments, "ROWS"); // Number of rows to read per chunk
    3938    int iter = psMetadataLookupS32(NULL, arguments, "ITER"); // Number of rejection iterations
    4039    float rej = psMetadataLookupF32(NULL, arguments, "REJ"); // Rejection level
     
    175174                fileGroup->read = false;
    176175                fileGroup->busy = false;
     176                fileGroup->lastScan = 0;
     177                fileGroup->firstScan = 0;
    177178                fileGroups->data[i] = fileGroup;
    178179            }
    179180
     181            // call the init functions
     182            switch (type) {
     183              case PPMERGE_TYPE_BIAS:
     184              case PPMERGE_TYPE_FLAT:
     185              case PPMERGE_TYPE_FRINGE:
     186                psAssert (fileGroups->n > 0, "no valid file groups defined");
     187                ppMergeFileGroup *fileGroup = fileGroups->data[0];
     188                if (!pmReadoutCombinePrepare(outRO, fileGroup->readouts, combination)) {
     189                    goto ERROR;
     190                }
     191                break;
     192
     193              default:
     194                fprintf (stderr, "not yet ready");
     195                goto ERROR;
     196            }
     197
    180198            // Read input data by chunks
     199            psTimerStart ("ppMergeLoop");
    181200            for (int numChunk = 0; true; numChunk++) {
    182                
     201
     202                bool status = false;
    183203                ppMergeFileGroup *fileGroup = ppMergeReadChunk (&status, fileGroups, config, numChunk);
    184204                if (!status) goto ERROR;
     
    194214                        psArrayAdd (job->args, 1, outRO);
    195215                        psArrayAdd (job->args, 1, fileGroup);
    196                         psArrayAdd (job->args, 1, psScalarAlloc(shutterRef, PS_TYPE_F32))
     216                        psArrayAdd (job->args, 1, psScalarAlloc(shutterRef, PS_TYPE_F32));
    197217                        psArrayAdd (job->args, 1, shutters->data[cellNum]);
    198218                        psArrayAdd (job->args, 1, psScalarAlloc(iter, PS_TYPE_S32));
     
    272292                }
    273293            }
     294            psFree(fileGroups);
    274295
    275296            // Get list of cells for concepts averaging
    276297            psList *inCells = psListAlloc(NULL); // List of cells
    277298            for (int i = 0; i < numFiles; i++) {
    278                 pmReadout *readout = readouts->data[i]; // Readout of interest
    279                 psListAdd(inCells, PS_LIST_TAIL, readout->parent);
     299                pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i);
     300                pmCell *inCell = pmFPAviewThisCell(view, input->fpa); // Input cell
     301                psListAdd(inCells, PS_LIST_TAIL, inCell);
    280302            }
    281303            if (!pmConceptsAverageCells(outCell, inCells, NULL, NULL, true)) {
     
    286308            }
    287309            psFree(inCells);
    288 
    289             psFree(fileGroups);
     310            fprintf (stdout, "done ppMergeLoop for cell : %f\n", psTimerMark ("ppMergeLoop"));
    290311
    291312            // Plug supplementary images into their own FPAs
Note: See TracChangeset for help on using the changeset viewer.