Merge branch 'develop' into documentation

This commit is contained in:
fjosw 2023-06-02 14:46:45 +00:00
commit b67b5495e2
2 changed files with 21 additions and 19 deletions

View file

@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
## [2.8.2] - 2023-06-02
### Fixed
- Another bug appearing in an edge case of `_compute_drho` fixed.
## [2.8.1] - 2023-06-01
### Fixed
- `input.pandas` can now deal with columns that only have `None` entries.

View file

@ -286,28 +286,26 @@ def _make_pattern(version, name, noffset, wf, wf2, b2b, quarks):
def _find_correlator(file_name, version, pattern, b2b, silent=False):
T = 0
file = open(file_name, "r")
with open(file_name, "r") as my_file:
content = my_file.read()
match = re.search(pattern, content)
if match:
if version == "0.0":
start_read = content.count('\n', 0, match.start()) + 1
T = content.count('\n', start_read)
else:
start_read = content.count('\n', 0, match.start()) + 5 + b2b
end_match = re.search(r'\n\s*\n', content[match.start():])
T = content[match.start():].count('\n', 0, end_match.start()) - 4 - b2b
if not T > 0:
raise ValueError("Correlator with pattern\n" + pattern + "\nis empty!")
if not silent:
print(T, 'entries, starting to read in line', start_read)
content = file.read()
match = re.search(pattern, content)
if match:
if version == "0.0":
start_read = content.count('\n', 0, match.start()) + 1
T = content.count('\n', start_read)
else:
start_read = content.count('\n', 0, match.start()) + 5 + b2b
end_match = re.search(r'\n\s*\n', content[match.start():])
T = content[match.start():].count('\n', 0, end_match.start()) - 4 - b2b
if not T > 0:
raise ValueError("Correlator with pattern\n" + pattern + "\nis empty!")
if not silent:
print(T, 'entries, starting to read in line', start_read)
raise ValueError('Correlator with pattern\n' + pattern + '\nnot found.')
else:
file.close()
raise ValueError('Correlator with pattern\n' + pattern + '\nnot found.')
file.close()
return start_read, T