Author Topic: Access violation on master-dark optimization  (Read 2135 times)

Offline Julien

  • Newcomer
  • Posts: 19
Access violation on master-dark optimization
« on: 2018 October 28 13:57:35 »
Hi,

When I try to calibrate my flats I get this in the console :

Code: [Select]
Hi



ImageCalibration: Global context

Loading master calibration frames:
Loading calibration frame image:
D:/Users/julien/Images Astro/CCD/Calibration files/2018/MasterBias_bin11_-30C_2018-02-09.xisf
Loading image: w=3326 h=2504 n=1 Gray Float32
3231 FITS keyword(s) extracted.
Loading calibration frame image:
D:/Users/julien/Images Astro/CCD/Calibration files/2018/MasterDarkFlat_bin11_-30C_11.2s_2018-02-05_uncalibrate.xisf
Loading image: w=3326 h=2504 n=1 Gray Float32

Applying bias correction: master dark frame ...

Dark frame optimization thresholds:
Td0 = 0.00000000 (0 px = 0.000%)
** Warning: The dark frame optimization threshold is probably too high (channel 0).
** Warning: The dark frame optimization pixel set is too small - disabling dark frame optimization (channel 0).
*** PCL Win32 System Exception: At address 00007FFF8EE9A388 with exception code C0000005 :
Access violation: invalid memory read operation at address 0000000000000008
<* failed *>

And the Image Calibration instance source code :

Code: [Select]
var P = new ImageCalibration;
P.targetFrames = [ // enabled, path
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010121.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010122.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010123.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010124.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010125.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010126.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010127.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010128.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010129.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010130.fit"], // row 10
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010131.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010132.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010133.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010134.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010135.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010136.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010137.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010138.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010139.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010140.fit"], // row 20
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010141.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010142.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010143.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010144.fit"],
   [true, "C:/Users/julien/Desktop/Flats_2018-01-28/Ha/Ha 3nmFlatField_1x1_11.200secs_-30.00C_00010145.fit"]
];
P.inputHints = "";
P.outputHints = "";
P.pedestal = 0;
P.pedestalMode = ImageCalibration.prototype.Keyword;
P.pedestalKeyword = "";
P.overscanEnabled = false;
P.overscanImageX0 = 0;
P.overscanImageY0 = 0;
P.overscanImageX1 = 0;
P.overscanImageY1 = 0;
P.overscanRegions = [ // enabled, sourceX0, sourceY0, sourceX1, sourceY1, targetX0, targetY0, targetX1, targetY1
   [false, 0, 0, 0, 0, 0, 0, 0, 0],
   [false, 0, 0, 0, 0, 0, 0, 0, 0],
   [false, 0, 0, 0, 0, 0, 0, 0, 0],
   [false, 0, 0, 0, 0, 0, 0, 0, 0]
];
P.masterBiasEnabled = true;
P.masterBiasPath = "D:/Users/julien/Images Astro/CCD/Calibration files/2018/MasterBias_bin11_-30C_2018-02-09.xisf";
P.masterDarkEnabled = true;
P.masterDarkPath = "D:/Users/julien/Images Astro/CCD/Calibration files/2018/MasterDarkFlat_bin11_-30C_11.2s_2018-02-05_uncalibrate.xisf";
P.masterFlatEnabled = false;
P.masterFlatPath = "";
P.calibrateBias = false;
P.calibrateDark = true;
P.calibrateFlat = false;
P.optimizeDarks = true;
P.darkOptimizationThreshold = 0.00000;
P.darkOptimizationLow = 3.0000;
P.darkOptimizationWindow = 1024;
P.darkCFADetectionMode = ImageCalibration.prototype.DetectCFA;
P.evaluateNoise = true;
P.noiseEvaluationAlgorithm = ImageCalibration.prototype.NoiseEvaluation_MRS;
P.outputDirectory = "C:/Users/julien/Desktop/tmp";
P.outputExtension = ".fit";
P.outputPrefix = "cal_";
P.outputPostfix = "";
P.outputSampleFormat = ImageCalibration.prototype.f32;
P.outputPedestal = 0;
P.overwriteExistingFiles = true;
P.onError = ImageCalibration.prototype.Continue;
P.noGUIMessages = false;
/*
 * Read-only properties
 *
P.outputData = [ // outputFilePath, darkScalingFactorRK, darkScalingFactorG, darkScalingFactorB, noiseEstimateRK, noiseEstimateG, noiseEstimateB, noiseFractionRK, noiseFractionG, noiseFractionB, noiseAlgorithmRK, noiseAlgorithmG, noiseAlgorithmB
];
 */


With the same parameters, but without "Optimize" I don't have the error.

Regards

Julien
Julien
------------------------------------------------
www.elendil.software

Offline Julien

  • Newcomer
  • Posts: 19
Re: Access violation on master-dark optimization
« Reply #1 on: 2018 October 30 00:26:26 »
Hi,

I've some more tests. If I enable the Optimize option but disable Calibrate option I don't have the error. So maybe there is something wrong with my Master Bias ?
Julien
------------------------------------------------
www.elendil.software

Offline bulrichl

  • PixInsight Guru
  • ****
  • Posts: 524
Re: Access violation on master-dark optimization
« Reply #2 on: 2018 October 30 03:27:08 »
Hi Julien,

from the provided information, I understand that you want to calibrate flat frames captured with narrow band filters. You are using a MasterFlatDark and a MasterBias. I presume that the MasterFlatDark contains the bias, in other words: it is not precalibrated.

In PI's ImageCalibration Process you can choose a combination of settings that is not meaningful and therefore will lead to wrong results, so you'll have to be careful:

When using a MasterFlatDark (i.e. a MasterDark taken at the same exposure time and same temperature as the flat frames) you don't want to apply dark frame optimization. You don't want to calibrate the MasterFlatDark either, therefore you don't need a MasterBias for the calibration of the flat frames at all. In your case, the only reasonable setting for the calibration of the flat frames is:

Reset the ImageCalibration process,
add the flat frames,
select the output directory,
uncheck the 'Master Bias' section,
check the 'Master Dark' section, select the MasterFlatDark, uncheck both 'Calibrate' and 'Optimize' options,
uncheck the 'Master Flat' section.

I don't know why the access violation arised during the calibration process, that should not happen.

Bernd

Offline Julien

  • Newcomer
  • Posts: 19
Re: Access violation on master-dark optimization
« Reply #3 on: 2018 October 31 14:44:09 »
from the provided information, I understand that you want to calibrate flat frames captured with narrow band filters. You are using a MasterFlatDark and a MasterBias. I presume that the MasterFlatDark contains the bias, in other words: it is not precalibrated.

Exactly.

When using a MasterFlatDark (i.e. a MasterDark taken at the same exposure time and same temperature as the flat frames) you don't want to apply dark frame optimization.

OK, that makes sense.

You don't want to calibrate the MasterFlatDark either, therefore you don't need a MasterBias for the calibration of the flat frames at all.

I don't understand why don't need thé MasterBias. Shouldn't my Flats be calibrated ?
Julien
------------------------------------------------
www.elendil.software

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: Access violation on master-dark optimization
« Reply #4 on: 2018 October 31 15:32:34 »
You don't want to calibrate the MasterFlatDark either, therefore you don't need a MasterBias for the calibration of the flat frames at all.

I don't understand why don't need thé MasterBias. Shouldn't my Flats be calibrated ?

All you need to calibrate the flats is a matching (same duration, temperature) master dark.  The master dark includes the bias offset and dark current.  A master bias is only needed if you're doing dark scaling/optimisation.

Offline bulrichl

  • PixInsight Guru
  • ****
  • Posts: 524
Re: Access violation on master-dark optimization
« Reply #5 on: 2018 October 31 16:08:18 »
I don't understand why don't need thé MasterBias. Shouldn't my Flats be calibrated ?

Hi Julien,

Rick answered your question already.

Yes, of course the flat frames have to be calibrated, actually my post was about the calibration of the flat frames - they are calibrated with the MasterFlatDark.

Calibration of flat frames is only a special case of calibration of light frames. There are two cases:

1) If the MasterFlatDark has to be scaled (because exposure time or/and camera temperature of flat frames and flat dark frames are different), the calculation for the calibrated flat frames is:
Code: [Select]
(FF - MB) - k * (MFD - MB)
FF: Flat frame, MB: MasterBias, MFD: MasterFlatDark, k: dark frame scaling factor (calculated in the ImageCalibration process)

2) If you don't need to use dark frame optimization (because exposure time and camera temperature are the same for flat frames and flat dark frames), k = 1. In this case the calculation for the calibrated flat frames is simplified to:
Code: [Select]
FF - MFDand you will not need a MasterBias.

Bernd

Offline Julien

  • Newcomer
  • Posts: 19
Re: Access violation on master-dark optimization
« Reply #6 on: 2018 November 06 11:48:28 »
OK. Much clearer now.

Thanks
Julien
------------------------------------------------
www.elendil.software

Offline Julien

  • Newcomer
  • Posts: 19
Re: Access violation on master-dark optimization
« Reply #7 on: 2018 November 07 11:55:27 »
When using a MasterFlatDark (i.e. a MasterDark taken at the same exposure time and same temperature as the flat frames) you don't want to apply dark frame optimization.

There is something I don't understand.

I have understood that optimisation option should be enabled when the exposure time and/or the temperature are not the same. But when I look at my MasterBias or MasterDark I don't see any information in the header's data that is related to the temperature or exposure. So I don't understand how PixInsight can know there is a difference.

Regards

Julien
Julien
------------------------------------------------
www.elendil.software

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Access violation on master-dark optimization
« Reply #8 on: 2018 November 07 12:14:05 »
pi does not know or care about the temperature (or the exposure time). it simply scales the master dark until the noise in the calibrated frame is minimized.

by this method it can account for both exposure time and temperature differences simultaneously.

rob