Doe it makes any problems when I switch it totally off?
You can't actually turn it off, but if you set the margin to -7 it will only count pixels near black level as under exposed, and you could increase the % to 100. I think this would be pretty close to disabling it, but as I mentioned earlier, the current logic ramps in before the thresh % is reached.
Edit: Actually, you should be able to turn it of by setting Thresh % to 0.
Note that the "Meter low thresh" and "Meter low limit" discussed below also have an influence, and will eventually cancel out over exposure protection.
My understanding of your algorithms is: You try to get the box in the middle to a neutral value.
Or an ev shift if you've specified one.
If there is no Over or Underexposure every think is OK. If you have Overexposure than this has a higher priority or? But what is when you have Underexposure at the same time?
Over, under and the box each have a "weight" that controls the contribution to the final exposure. For over and under, the weight is based on square of the fraction of the threshold %.
This means that if values are much less than the threshold, the has a very small contribution, and if it's larger it has a very big contribution. The slope of these quadratics are modified so that over-exposure has more weight for a given fraction. (The /120 and /150 in the code mentioned earlier)
The box also has a quadratic behavior: As the average value is pushed past the limits defined by Meter high thresh Ev and Meter low thresh Ev, the weight is increased based on the fraction of corresponding "limit ev" reached.
The base weight for the box is 100, and all the weights are limited to 200.
The actual change in exposure is based on the combined weights, limited by Max Ev Change. So if both over and under are maxed out, they will cancel out. If over exposure is high, but meter has been pushed far below "Meter low limit", they will balance out.
The reason behind all of this is to vary the exposure smoothly between the different limits, with emphasis on keeping the meter area at a "reasonable" exposure.
Note that this is all a work in progress, and was mainly written to test the C code and provide an example of using the new fatures. I'm open to bug reports and improvements!
The exposure code is quite modular. You should be able replace exp:calc_ev_change with pretty much any logic you want as long as sets self.ev_change at the end (you also need to do something with the code at the top which ensures self.ev_target is set on the first iteration)
I would prefer when the time laps goes darker to the night.
This is currently something my script does not do well, since it always tries to maintain the target exposure at a fixed value. Things only get darker once you hit the shutter and ISO limits.
My idea to handle is adding an option to make the target Ev vary proportional to the absolute brightness of the scene. So for example, your initial shot would be neutral, and every stop of actual brightness would change the target exposure by say 0.1 stop.