-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Template.py: make filter warnings conditional and allow for no ctf_pa…
…rams (#98) * Make filter warning template.py conditional * allow default for ctf_params * add test for logging * use proper call to assertEqual * this is why we test logging * no space after but a comma * restructure based on Marten's comments, only warn if overriding a set frequency * Update src/pytom_tm/template.py Co-authored-by: Marten <[email protected]> --------- Co-authored-by: Marten <[email protected]>
- Loading branch information
Showing
2 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import unittest | ||
import numpy as np | ||
from pytom_tm.template import generate_template_from_map | ||
|
||
class TestLogging(unittest.TestCase): | ||
def test_lowpass_resolution(self): | ||
template = np.zeros((13, 13, 13), dtype=np.float32) | ||
|
||
# Test too low filter resolution | ||
with self.assertLogs(level='WARNING') as cm: | ||
_ = generate_template_from_map(template, 1., 1., filter_to_resolution=1.5) | ||
self.assertEqual(len(cm.output), 1) | ||
self.assertIn('Filter resolution', cm.output[0]) | ||
self.assertIn('too low', cm.output[0]) | ||
|
||
# Test working filter resolution | ||
with self.assertNoLogs(level='WARNING'): | ||
_ = generate_template_from_map(template, 1., 1., filter_to_resolution=2.5) | ||
|