factorize the dark and flat correction in two methods

the idea is to compute the dark and flat correction in only one place.
It will be easier and consistant for all integration methods. Idealy
the preparation of all common parameters of the equivalent method should
be identical and shared into one uniq method

I put some remarks with the usual ???.
I add a bunch of new line, it is easier for me to read like this.

It seems to me that there is some inconsistency when using or not the mask.
no need to check for filename before callinf save1D.

this check is redundent with the internal code of save1D.
check for the filename also in save2D.

this way no need to check everywhere in the code.
use a method instead of a function for dark/flat corrections