Impr/fix refactor sfcf read (#164)

* refactor read_sfcf

* adding tests for find_corr and read_compact_file

* add necessary broken data for tests

* fixed appended mode reading

* factored out sort_names and find_files

* now also using sort_files in sfcf.py

* edited tests to fit with new structure

* added find_files function

* shifted helpfunctions to bottom of file

* removed some debug lines

* linting

* Fixed requested changes, added silent mode

* added Exception if correlator is not found by read_append_rep

* use tmp_path fixture

* linting silent keyword

* try to fix testing for a_bb

* tests: Exception testing in test_find_corr made more explicit.

---------

Co-authored-by: Fabian Joswig <fabian.joswig@ed.ac.uk>
This commit is contained in:
Justus Kuhlmann 2023-03-15 18:46:12 +01:00 committed by GitHub
parent 991199a680
commit 41fec09816
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 880 additions and 315 deletions

View file

@ -1,4 +1,3 @@
import os
import numpy as np
import pyerrors as pe
import pytest
@ -136,7 +135,7 @@ def test_read_ms5_xsf():
def test_find_files():
path = './tests//data/openqcd_test/'
path = './tests/data/openqcd_test/'
prefix = "ms5_xsf_T24L16"
qc = 'dd'
@ -166,10 +165,3 @@ def test_find_files():
with pytest.raises(Exception):
pe.input.openQCD._find_files(path, fpre, "ms5_xsf_" + qc, "dat")
def test_sort_names():
my_list = ['sfqcd_r1_id5', 'sfqcd_r10_id5', 'sfqcd_r7_id5', 'sfqcd_r2_id5', 'sfqcd_r2_id9', 'sfqcd_r10_id4']
presorted_list = ['sfqcd_r1_id5', 'sfqcd_r2_id5', 'sfqcd_r2_id9', 'sfqcd_r7_id5', 'sfqcd_r10_id4', 'sfqcd_r10_id5']
sorted_list = pe.input.openQCD._sort_names(my_list)
assert (all([sorted_list[i] == presorted_list[i] for i in range(len(sorted_list))]))