File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -763,6 +763,42 @@ def check_metadata(sim_src, relion_src):
763763 )
764764
765765
766+ def test_pixel_size (caplog ):
767+ """
768+ Check pixel size is instantiated properly and warnings occur if pixel
769+ size is overridden.
770+ """
771+ vol_px_sz = 10.0
772+ L = 8
773+ data = np .ones (L ** 3 ).reshape (L , L , L )
774+ vol = Volume (data , pixel_size = vol_px_sz )
775+
776+ # Ensure vol pixel size
777+ assert vol .pixel_size == vol_px_sz
778+
779+ # Generate Simulation and check pixel_size is inhereted from vol
780+ sim = Simulation (vols = vol )
781+ assert sim .pixel_size == vol_px_sz
782+
783+ # Generate Simulation with provided pixel_size and check
784+ # that vol.pixel_size is overridden.
785+ caplog .clear ()
786+ caplog .set_level (logging .WARN )
787+
788+ sim_px_sz = 5.0
789+ msg = (
790+ f"Overriding volume pixel size, { vol_px_sz } , with "
791+ f"user provided pixel size of { sim_px_sz } angstrom."
792+ )
793+
794+ assert msg not in caplog .text
795+
796+ sim = Simulation (vols = vol , pixel_size = sim_px_sz )
797+
798+ assert msg in caplog .text
799+ assert sim .pixel_size == sim_px_sz
800+
801+
766802def test_mismatched_pixel_size ():
767803 """
768804 Confirm raises error when explicit Simulation and CTFFilter pixel sizes mismatch.
You can’t perform that action at this time.
0 commit comments