# 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 pytest
import numpy as np
from emva1288.process import routines



def test_highpass_filter():
    # instantiate a bayer filter and a wrong filter
    bayer_filter = np.tile([[0, 1], [1, 0]], (500, 500))
    wrong_filter = np.tile([[1, 1, 1, 0], [1, 0, 0, 1]], (500, 250))

    # Source images. imgc is for color image (image with a bayer filter)
    img = np.abs(np.random.random([1000, 1000]))
    imgc = np.ma.array(img, mask=bayer_filter)

    # Image wrong's purpose is to assert that a ValueError is raised
    img_wrong = np.ma.array(img, mask=wrong_filter)

    # Pass the highpass filter on the source images
    res = routines.high_pass_filter(img, 5)
    img_filt = res['img']/res['multiplicator']

# 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: tests/test_routines.py
import pytest
import numpy as np
from emva1288.process import routines




def test_highpass_filter():
    # instantiate a bayer filter and a wrong filter
    bayer_filter = np.tile([[0, 1], [1, 0]], (500, 500))
    wrong_filter = np.tile([[1, 1, 1, 0], [1, 0, 0, 1]], (500, 250))

    # Source images. imgc is for color image (image with a bayer filter)
    img = np.abs(np.random.random([1000, 1000]))
    imgc = np.ma.array(img, mask=bayer_filter)

    # Image wrong's purpose is to assert that a ValueError is raised
    img_wrong = np.ma.array(img, mask=wrong_filter)

    # Pass the highpass filter on the source images
    res = routines.high_pass_filter(img, 5)
    img_filt = res['img']/res['multiplicator']

    res = routines.high_pass_filter(imgc, 5)