from math import log, sqrt, pow, exp, erf
import matplotlib.pyplot as plt
import numpy as np
import openpyxl


pi = 3.14159265


mode = 'N'


def validate(v1, v2, cell_name):
    print(f"v1 = {v1} ({cell_name}: {v2})")
    if v1 is None or v2 is None:
        print(f"  Validation error for [{cell_name}]: None value is not acceptable: v1 ({v1}), v2 ({v2})")
    elif type(v1) == 'str' and type(v2) == 'str':
        if v1 != v2:
            print(f"  Validation error for [{cell_name}]: v1 ({v1}) != v2 ({v2})")
    elif type(v1) == 'int' and type(v2) == 'int':
        if v1 != v2:
            print(f"  Validation error for [{cell_name}]: v1 ({v1}) != v2 ({v2})")
    else:
        try:
            if v1 == 0.0 or v2 == 0.0:
                eps = 1.0e-4
            else:
                eps = max([abs(v1), abs(v2)]) * 1.0e-4
            if abs(v1 - v2) > eps:
                print(f"  Validation error for [{cell_name}]: Difference between v1 ({v1}) and v2 ({v2}) ({diff}) is larger than eps ({eps})")
        except:
            print(f"  Validation error for [{cell_name}]: Type mismatch between v1 ({v1} type={type(v1)}) and v2 ({v2} type={type(v1)})")

    print("  Validation OK")

    return


def plot_N():
