class_docstr: Unit test class for general utilities. 
class_docstr_tok: ["Unit","test","class","for","general","utilities","."]
docstr: Test map_to_cube and map_to_bounds. 
docstr_tok: ["Test","map_to_cube","and","map_to_bounds","."]
code: def test_mapping_to_cube_and_bound(self):
      """Test map_to_cube and map_to_bounds."""
      self.report("map_to_cube and map_to_bounds")
      bounds = np.array([[1, 3], [2, 4], [5, 6]])
      x = np.array([1.7, 3.1, 5.5])
      X = np.array([[1.7, 3.1, 5.5], [2.1, 2.9, 5.0]])
      y = np.array([0.35, 0.55, 0.5])
      Y = np.array([[0.35, 0.55, 0.5], [0.55, 0.45, 0]])
      # Map to cube
      y_ = general_utils.map_to_cube(x, bounds)
      Y_ = general_utils.map_to_cube(X, bounds)
      # Map to Bounds
      x_ = general_utils.map_to_bounds(y, bounds)
      X_ = general_utils.map_to_bounds(Y, bounds)
      # Check if correct.
      assert np.linalg.norm(y - y_) < 1e-5
      assert np.linalg.norm(Y - Y_) < 1e-5
      assert np.linalg.norm(x - x_) < 1e-5
      assert np.linalg.norm(X - X_) < 1e-5
  
file_path: dragonfly/dragonfly/utils/unittest_general_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  import numpy
  from .None import general_utils
  from .base_test_class import BaseTestClass, execute_tests
label_desc: Use image node_id 4 for calling the GeneralUtilsTestCase obj's underlying member method code with example usage: obj.test_mapping_to_cube_and_bound() without return types