Using my Nikon D5100, shooting RAW pictures and using Darktable to disable absolutely all contrast curves, white balancing, sharpening and even the debayering, I've measured the average value of the green pixels of each picutre in a test (by green pixels I mean the actual physical pixels behind the green filters of the bayer filter, the other pixels where ignored).
This test consisted of, using a constant light (in both intensity and spectrum) and varying the exposure time, find the variation of the average value of the green pixels in respect to the total amount of light in each exposure (as everything else was kept constant, the amount of light integrated in each exposure was directly proportional to the exposure time).
I've got the true exposure times from this site, which I checked to be exact in the millisecond range with a microphone recording the shutter sound.
Then, I made a graph of the normalized exposure times VS the normalized average green pixel values for those exposure times.
What I expected was to see a 45º straight line, with the values being directly proportional to the amount of light integrated in each exposure.
But instead I got a way different graph:
This here is quite obviously some particular response function of the CMOS sensor. I didn't find which function makes the best fit on this data yet, logs didn't work very well.
So, what is this response function and why is it like that?