Repository: ross-rotordynamics/ross (python)

Issue:
BearingElement.from_table does not support us units
I have added a file with us units (on the tests/data folder) and also a test for this case (see #354).

Pull request description:
Add us units support for bearing from table instantiation
Close #355 

Patch:
diff --git a/ross/utils.py b/ross/utils.py
index efa7dc77..10e4194a 100644
--- a/ross/utils.py
+++ b/ross/utils.py
@@ -117,7 +117,7 @@ def read_table_file(file, element, sheet_name=0, n=0, sheet_type="Model"):
                     if row[i].lower() == header_key_word:
                         header_index = index
                         header_found = True
-                if "inches" in row[i].lower() or "lbm" in row[i].lower():
+                if "inches" in row[i].lower() or "lbm" in row[i].lower() or 'lb' in row[i].lower():
                     convert_to_metric = True
                 if "rpm" in row[i].lower():
                     convert_to_rad_per_sec = True


Test patch:
diff --git a/ross/tests/test_bearing_seal_element.py b/ross/tests/test_bearing_seal_element.py
index 1c789a47..5242fa8d 100644
--- a/ross/tests/test_bearing_seal_element.py
+++ b/ross/tests/test_bearing_seal_element.py
@@ -213,7 +213,6 @@ def test_equality(bearing0, bearing1, bearing_constant):
     assert not bearing0 == 1
 
 
-@pytest.mark.skip("Waiting for implementation of units conversion for bearings.")
 def test_from_table():
     bearing_file = (
         os.path.dirname(os.path.realpath(__file__)) + "/data/bearing_seal_si.xls"
@@ -221,7 +220,7 @@ def test_from_table():
 
     bearing = BearingElement.from_table(0, bearing_file)
     assert bearing.n == 0
-    assert_allclose(bearing.w[2], 523.5987755985)
+    assert_allclose(bearing.frequency[2], 523.5987755985)
     assert_allclose(bearing.kxx.coefficient[2], 53565700)
 
     # bearing with us units
@@ -230,7 +229,7 @@ def test_from_table():
     )
     bearing = BearingElement.from_table(0, bearing_file)
     assert bearing.n == 0
-    assert_allclose(bearing.w[2], 523.5987755985)
+    assert_allclose(bearing.frequency[2], 523.5987755985)
     assert_allclose(bearing.kxx.coefficient[2], 53565700)