In some case BatchPreprocessing (v1.34) is subtracting the dark intended for the light from the flats, which is likely not what is expected.
In line 1453 [edit: of BatchPreprocessing-engine.js] we have:
IC.masterDarkPath = this.getMasterDarkFrame( binning, exptime );
IC.masterDarkEnabled = !IC.masterDarkPath.isEmpty();
For flats there is usually no adequate dark, in which case it takes whatever darks are present, usually the one prepared for the lights. This results in one of the messages at the beginning of the calibration of the flats (I guess nobody looks back so far in the log).
* Searching for a master dark frame with exposure time = 0.1s -- best match is a master dark frame of unknown exposure time.
* Searching for a master dark frame with exposure time = 0.1s -- best match is 421s
You get the former if the master dark was not done with BPP, in which case it has no exposure time, the later if the master dark as exposure time in its header.
Although it makes sense to use whatever dark is provided when calibrating lights, it is generally wrong to use the same ones for the flats. May be you can get away with this when using 'optimize', this is not correct in the general case.
The mechanism was probably intended to support flat darks, but it does not work if you do not provide them.
As a work around I added the line marked BITLI after 1458
if ( imageType == ImageType.FLAT )
{
IC.outputDirectory = File.existingDirectory( this.outputDirectory + "/calibrated/flat" );
IC.masterDarkEnabled = false; // BITLI - Do NOT subtract dark from flat, as they may be the dark intended for lights
}
A better solution would be for getMasterDarkFrame not to return any dark if: we are calibrating flats AND there is no matching dark within the tolerance AND (maybe) we are not using optimize AND we are also calibrating lights (the last condition to allow calibrating just flats with dark flats).
I suppose that because darks levels are usually very small compared to flat (and because the darks are scaled to a very small value or rejected if you use optimize) this had no obvious impact. However I had to calibrate very dark flats (no pun intended) and obtained different results from BPP and manual process, therefore my investigation.
-- bitli