IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 3, 2008, 9:50:19 AM (18 years ago)
Author:
Paul Price
Message:

Threading stacks. Following the same scheme as for ppMerge, but cleaned up some. Rejection stage still needs to be threaded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStack.h

    r19214 r19337  
    55#define PPSTACK_INSPECT_PIXELS "PPSTACK.PIXELS" // Name of rejected pixels metadata items
    66
     7#include <pslib.h>
    78#include <psmodules.h>
     9
     10// Mask values for inputs
     11typedef enum {
     12    PPSTACK_MASK_MATCH  = 0x01,         // PSF-matching failed
     13    PPSTACK_MASK_REJECT = 0x02,         // Rejection failed
     14    PPSTACK_MASK_BAD    = 0x04,         // Bad image (too many pixels rejected)
     15    PPSTACK_MASK_ALL    = 0xff          // All errors
     16} ppStackMask;
     17
     18// Thread for stacking chunks
     19//
     20// Each input file contributes a readout, into which is read a chunk from that file
     21typedef struct {
     22    psArray *readouts;                  // Input readouts to read and stack
     23    bool read;                          // Has the scan been read?
     24    bool busy;                          // Is the scan being processed?
     25    int firstScan;                      // First row of the chunk to be read for this group
     26    int lastScan;                       // Last row of the chunk to be read for this group
     27} ppStackThread;
     28
     29// Allocator
     30ppStackThread *ppStackThreadAlloc(psArray *readouts // Inputs readouts to read and stack
     31    );
     32
     33// Data for threads
     34typedef struct {
     35    psArray *threads;                   // Threads doing stacking
     36    int lastScan;                       // Last row that's been read
     37    psArray *imageFits;                 // FITS file pointers for images
     38    psArray *maskFits;                  // FITS file pointers for masks
     39    psArray *weightFits;                // FITS file pointers for weights
     40} ppStackThreadData;
     41
     42// Set up thread data
     43ppStackThreadData *ppStackThreadDataSetup(const psArray *cells, // Array of input cells
     44                                          const psArray *imageNames, // Names of images to read
     45                                          const psArray *maskNames, // Names of masks to read
     46                                          const psArray *weightNames, // Names of weight maps to read
     47                                          const pmConfig *config // Configuration
     48    );
     49
     50// Read chunk into the first available file thread
     51ppStackThread *ppStackThreadRead(bool *status, // Status of read
     52                                 ppStackThreadData *stack, // Stacks available for reading
     53                                 pmConfig *config, // Configuration
     54                                 int numChunk, // Chunk number (only for interest)
     55                                 int overlap // Overlap between subsequent scans
     56    );
     57
     58// Initialise the threads
     59void ppStackThreadInit(void);
    860
    961// Setup command-line arguments
     
    3183
    3284// Perform stacking on a readout
    33 bool ppStackReadoutInitial(const pmConfig *config,   // Configuration
    34                     pmReadout *outRO,   // Output readout
    35                     const psArray *readouts, // Input readouts
    36                     const psArray *regions, // Array with array of regions used in each PSF matching
    37                     const psArray *kernels // Array with array of kernels used in each PSF matching
     85//
     86// Returns an array of pixels to inspect for each input image
     87psArray *ppStackReadoutInitial(const pmConfig *config,   // Configuration
     88                               pmReadout *outRO,   // Output readout
     89                               const psArray *readouts, // Input readouts
     90                               const psArray *regions, // Array with array of regions used in each PSF match
     91                               const psArray *kernels // Array with array of kernels used in each PSF match
     92    );
     93
     94// Thread entry point for ppStackReadoutInitial
     95bool ppStackReadoutInitialThread(psThreadJob *job // Job to process
    3896    );
    3997
     
    43101                         const psArray *readouts, // Input readouts
    44102                         const psArray *rejected // Array with pixels rejected in each image
     103    );
     104
     105// Thread entry point for ppStackReadoutFinal
     106bool ppStackReadoutFinalThread(psThreadJob *job // Job to process
    45107    );
    46108
     
    62124
    63125/// Convolve image to match specified seeing
    64 bool ppStackMatch(pmReadout *readout, ///< Readout to be convolved; replaced with output
     126bool ppStackMatch(pmReadout *readout, // Readout to be convolved; replaced with output
    65127                  psArray **regions, // Array of regions used in each PSF matching, returned
    66128                  psArray **kernels, // Array of kernels used in each PSF matching, returned
    67                   const psArray *sources, ///< Array of sources
    68                   const pmPSF *psf,     ///< Target PSF
    69                   psRandom *rng,        ///< Random number generator
    70                   const pmConfig *config ///< Configuration
     129                  const psArray *sources, // Array of sources
     130                  const pmPSF *psf,     // Target PSF
     131                  psRandom *rng,        // Random number generator
     132                  const pmConfig *config // Configuration
    71133    );
    72134
     
    75137///
    76138/// Corrects the sources to have consistent magnitudes.  Returns the source lists.
    77 psArray *ppStackSourceListAdd(psArray *lists, ///< List to which to add, or NULL
    78                               psArray *sources, ///< Sources to add
    79                               const pmConfig *config ///< Configuration
     139psArray *ppStackSourceListAdd(psArray *lists, // List to which to add, or NULL
     140                              psArray *sources, // Sources to add
     141                              const pmConfig *config // Configuration
    80142    );
    81143
     
    83145///
    84146/// Corrects the sources to have consistent magnitudes where possible.  Returns the sources
    85 psArray *ppStackSourceListCombine(psArray *lists, ///< Source lists
    86                                   const pmConfig *config ///< Configuration
     147psArray *ppStackSourceListCombine(psArray *lists, // Source lists
     148                                  const pmConfig *config // Configuration
    87149    );
    88150
    89151/// Print sources into a ds9 regions file
    90 void ppStackSourcesPrint(const psArray *sources ///< Sources to print
     152void ppStackSourcesPrint(const psArray *sources // Sources to print
    91153    );
    92154
Note: See TracChangeset for help on using the changeset viewer.