#ifndef PPSTACK_OPTIONS_H
#define PPSTACK_OPTIONS_H

#include <pslib.h>
#include <psmodules.h>

/// Options for stacking process
typedef struct {
    // Setup
    psMetadata *stats;                  // Statistics for output
    FILE *statsFile;                    // File to which to write statistics
    psArray *imageNames, *maskNames, *varianceNames; // Filenames for the temporary convolved images
    int num;                            // Number of inputs
    // Prepare
    pmPSF *psf;                         // Target PSF
    float sumExposure;                  // Sum of exposure times
    psVector *inputMask;                // Mask for inputs
    psArray *sourceLists;               // Individual lists of sources for matching
    // Convolve
    psArray *cells;                     // Cells for convolved images --- a handle for reading again
    psArray *subKernels;                // Subtraction kernels --- required in the stacking
    psArray *subRegions;                // Subtraction regions --- required in the stacking
    int numCols, numRows;               // Size of image
    psVector *matchChi2;                // chi^2 for stamps from matching
    psVector *weightings;               // Combination weightings for images (1/noise^2)
    psArray *covariances;               // Covariance matrices
    // Combine initial
    pmReadout *outRO;                   // Output readout
    psArray *inspect;                   // Array of arrays of pixels to inspect
    // Rejection
    psArray *rejected;                  // Rejected pixels
} ppStackOptions;

/// Allocator
ppStackOptions *ppStackOptionsAlloc(void);


#endif
