diff --git a/cmeutils/tests/test_visualize.py b/cmeutils/tests/test_visualize.py index 6e30ff2..5d30474 100644 --- a/cmeutils/tests/test_visualize.py +++ b/cmeutils/tests/test_visualize.py @@ -134,8 +134,12 @@ def test_box_radius(self, p3ht_fresnel): assert p3ht_fresnel.box_radius == 0.1 def test_default_height(self, p3ht_fresnel): - assert p3ht_fresnel.height == np.linalg.norm( - p3ht_fresnel.box_length[:3] * p3ht_fresnel.view_axis + assert ( + p3ht_fresnel.height + == np.linalg.norm( + p3ht_fresnel.box_length[:3] * p3ht_fresnel.view_axis + ) + * p3ht_fresnel._height_factor ) def test_reset_height(self, p3ht_fresnel): diff --git a/cmeutils/visualize.py b/cmeutils/visualize.py index 946b8d9..d348b05 100644 --- a/cmeutils/visualize.py +++ b/cmeutils/visualize.py @@ -75,6 +75,7 @@ def __init__( self.gsd_file = gsd_file with gsd.hoomd.open(gsd_file) as traj: self._n_frames = len(traj) + self._height_factor = 1.25 self._unwrap_positions = unwrap_positions self._snapshot = None self._view_axis = np.asarray(view_axis) @@ -89,7 +90,6 @@ def __init__( self._specular = specular self._specular_trans = specular_trans self._metal = metal - # self._view_axis = np.asarray(view_axis) self._up = np.asarray(up) self._show_box = show_box self._box_radius = box_radius @@ -321,7 +321,8 @@ def box_length(self): def _default_height(self): """Set the height based on box dimensions and view axis""" - return np.linalg.norm(self.view_axis * self.box_length[:3]) + height = np.linalg.norm(self.view_axis * self.box_length[:3]) + return height * self._height_factor def reset_height(self): """Reset the height of the camera to the default."""