Commit 4646fcb3 authored by Thomas Vincent's avatar Thomas Vincent

clean-up unused code

parent ce50d120
......@@ -33,97 +33,14 @@ __date__ = "05/01/2016"
import os
import shutil
import sys
import tempfile
import unittest
import numpy as np
from silx.utils.testutils import ParametricTestCase
from xsocs import config
from xsocs.test.utils import test_resources
from xsocs.process.fit import PeakFitter, FitResult, FitTypes, BackgroundTypes
from xsocs.io.FitH5 import FitH5
def _cmp_fit_h5_files(test_case, ref_h5, this_h5):
"""Compares two FitH5 files.
:param test_case:
:param ref_h5:
:param this_h5:
:return:
"""
ref_entries = ref_h5.entries()
this_entries = this_h5.entries()
test_case.assertEqual(ref_entries, this_entries)
for entry in ref_entries:
_cmp_fit_h5_processes(test_case, ref_h5, this_h5, entry)
def _cmp_fit_h5_processes(test_case, ref_h5, this_h5, entry):
"""Compares two FitH5 files
:param test_case:
:param ref_h5:
:param this_h5:
:param entry:
:return:
"""
ref_processes = ref_h5.processes(entry)
this_processes = this_h5.processes(entry)
test_case.assertEqual(ref_processes, this_processes)
for process in ref_processes:
_cmp_fit_h5_results(test_case,
ref_h5,
this_h5,
entry,
process)
def _cmp_fit_h5_results(test_case,
ref_h5,
this_h5,
entry,
process):
"""Compares two FitH5 files
:param test_case:
:param ref_h5:
:param this_h5:
:param entry:
:param process:
:return:
"""
ref_results = ref_h5.get_result_names(
entry, process)
this_results = this_h5.get_result_names(
entry, process)
test_case.assertEqual(ref_results, this_results)
if sys.platform == 'win32': # Relax tests on Windows
compare_arrays = np.allclose
else:
compare_arrays = np.array_equal
for result in ref_results:
ref_qx = ref_h5.get_axis_result(entry, process, result, 0)
this_qx = this_h5.get_axis_result(entry, process, result, 0)
test_case.assertTrue(compare_arrays(ref_qx, this_qx))
ref_qy = ref_h5.get_axis_result(entry, process, result, 1)
this_qy = this_h5.get_axis_result(entry, process, result, 1)
test_case.assertTrue(compare_arrays(ref_qy, this_qy))
ref_qz = ref_h5.get_axis_result(entry, process, result, 2)
this_qz = this_h5.get_axis_result(entry, process, result, 2)
test_case.assertTrue(compare_arrays(ref_qz, this_qz))
class TestPeakFitter(ParametricTestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment