# include "ppSim.h"

// XXX add bounds to the inputs?
bool ppSimMakeDark (pmReadout *readout, pmConfig *config) {

    psImage *signal = readout->image;
    psImage *variance = readout->weight;

    float darkRate = psMetadataLookupF32(NULL, config->arguments, "DARK.RATE"); // Dark rate
    float expTime = psMetadataLookupF32(NULL, config->arguments, "EXPTIME"); // Exposure time

    for (int y = 0; y < signal->numRows; y++) {
	for (int x = 0; x < signal->numCols; x++) {
			
	    // Dark current
	    float darkCurrent = darkRate * expTime; // Dark current accumulated
	    signal->data.F32[y][x] += darkCurrent;
	    variance->data.F32[y][x] += darkCurrent;
	}
    }
    return true;
}

