def vignettingFromSpotAverage(
        images, bgImages=None, averageSpot=True, thresh=None):
    '''
    [images] --> list of images containing
                 small bright spots generated by the same 
                 device images at different positions within image plane
            depending on the calibrated waveband the device can be 
            a LCD display or PV 1-cell mini module

    This method is referred as 'Method B' in
    ---
    K.Bedrich, M.Bokalic et al.:
    ELECTROLUMINESCENCE IMAGING OF PV DEVICES:
    ADVANCED FLAT FIELD CALIBRATION,2017
    ---

    Args:
        averageSpot(bool): True: take only the average intensity of each spot
        thresh(float): marks the minimum spot value 
                       (estimated with Otsus method otherwise)

    Returns:
        * array to be post processed
        * image mask containing valid positions
    '''

    fitimg, mask = None, None
    mx = 0
    for c, img in enumerate(images):
        print('%s/%s' % (c + 1, len(images)))

        if c == 0:
            avgBg = getBackground2(bgImages, img)
        img = imread(img, dtype=float)
        img -= avgBg
        # init:
        if fitimg is None:
            fitimg = np.zeros_like(img)
            mask = np.zeros_like(img, dtype=bool)
        # find spot:
        if thresh is None:
            t = threshold_otsu(img)
        else:
            t = thresh

        # take brightest spot
        spots, n = label(minimum_filter(img > t, 3),
                         background=0, return_num=True)
        spot_sizes = [(spots == i).sum() for i in range(1, n + 1)]

        try:
            spot = (spots == np.argmax(spot_sizes) + 1)
        except ValueError:
            print("couldn't find spot in image")
            continue

        if averageSpot:
            spot = np.rint(center_of_mass(spot)).astype(int)
            mx2 = img[spot].max()
        else:
            mx2 = img[spot].mean()
        fitimg[spot] = img[spot]
        mask[spot] = 1

        if mx2 > mx:
            mx = mx2

    # scale [0...1]:
    fitimg /= mx

    return fitimg, mask