# Path: emva1288/process/routines.py
# SIGNIFICANT_DIGITS = 7
#     L = len(imgs)
#     X = np.asfarray(Xi)
#     Y = np.asfarray(Yi)
#     X = np.asfarray(Xi)
#     Y = np.asfarray(Yi)
#     W = 1
#     Q = q + 1
#         W = int(np.ceil(1. * q / (Qmax - 1)))
#         Q = int(np.floor(1. * q / W)) + 1
#     B = [ymin + (i * W) for i in range(Q + 1)]
#     N = np.ma.count(y)
# def load_image(fname):
# def get_int_imgs(imgs):
# def LinearB0(Xi, Yi):
#     def fp(v, x):
#     def e(v, x, y):
# def LinearB(Xi, Yi):
#     def fp(v, x):
#     def e(v, x, y):
# def GetImgShape(img):
# def FFT1288(img_, rotate=False, n=1):
# def GetFrecs(fft):
# def Histogram1288(img, Qmax):
# def cls_1288_info(cls):
# def _sections_first(dct):
# def obj_to_dict(obj):
# def dict_to_xml(d, root='results', filename=None):
#     def key_to_xml(d, r):
# def xml_to_dict(xml):
#     def element_to_dict(r):
# def round_significant(v, sig=SIGNIFICANT_DIGITS):
# def compare_xml(x1, x2, filename=None):
# def high_pass_filter(img, dim):


import logging
import numpy as np
from emva1288.process import routines
from scipy.ndimage import convolve
        # For the accumulated histogram substract the mean
        y = np.abs(y - int(np.mean(y)))

        h = routines.Histogram1288(y, self._histogram_Qmax)
        # Rescale the bins
        h['bins'] /= (self.spatial['L'] * data['multiplicator'])

        # Perform the cumulative summation
        h['values'] = np.cumsum(h['values'][::-1])[::-1]
        # we want it as percentage of pixels
        h['values'] = 100 * h['values'] / y.size

        return h

    @property
    def histogram_DSNU(self):
        """DSNU histogram.

        Uses the :func:`~emva1288.process.routines.Histogram1288` function
        to make the histogram.

        .. emva1288::
            :Section: defect_pixel
            :Short: DSNU histogram
        """

        # For dsnu, the image is just the dark image, upscaled to have
        # only integers
        y = self.spatial['sum_dark']


# Path: emva1288/process/routines.py
# SIGNIFICANT_DIGITS = 7
#     L = len(imgs)
#     X = np.asfarray(Xi)
#     Y = np.asfarray(Yi)
#     X = np.asfarray(Xi)
#     Y = np.asfarray(Yi)
#     W = 1
#     Q = q + 1
#         W = int(np.ceil(1. * q / (Qmax - 1)))
#         Q = int(np.floor(1. * q / W)) + 1
#     B = [ymin + (i * W) for i in range(Q + 1)]
#     N = np.ma.count(y)
# def load_image(fname):
# def get_int_imgs(imgs):
# def LinearB0(Xi, Yi):
#     def fp(v, x):
#     def e(v, x, y):
# def LinearB(Xi, Yi):
#     def fp(v, x):
#     def e(v, x, y):
# def GetImgShape(img):
# def FFT1288(img_, rotate=False, n=1):
# def GetFrecs(fft):
# def Histogram1288(img, Qmax):
# def cls_1288_info(cls):
# def _sections_first(dct):
# def obj_to_dict(obj):
# def dict_to_xml(d, root='results', filename=None):
#     def key_to_xml(d, r):
# def xml_to_dict(xml):
#     def element_to_dict(r):
# def round_significant(v, sig=SIGNIFICANT_DIGITS):
# def compare_xml(x1, x2, filename=None):
# def high_pass_filter(img, dim):


# Path: emva1288/process/results.py
import logging
import numpy as np
from emva1288.process import routines
from scipy.ndimage import convolve

        # For the accumulated histogram substract the mean
        y = np.abs(y - int(np.mean(y)))

        h = routines.Histogram1288(y, self._histogram_Qmax)
        # Rescale the bins
        h['bins'] /= (self.spatial['L'] * data['multiplicator'])

        # Perform the cumulative summation
        h['values'] = np.cumsum(h['values'][::-1])[::-1]
        # we want it as percentage of pixels
        h['values'] = 100 * h['values'] / y.size

        return h

    @property
    def histogram_DSNU(self):
        """DSNU histogram.

        Uses the :func:`~emva1288.process.routines.Histogram1288` function
        to make the histogram.

        .. emva1288::
            :Section: defect_pixel
            :Short: DSNU histogram
        """

        # For dsnu, the image is just the dark image, upscaled to have
        # only integers
        y = self.spatial['sum_dark']


        h = routines.Histogram1288(y, self._histogram_Qmax)