Skip to content
Snippets Groups Projects
Commit eb1ec872 authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

rads2rpm implemented

parent 549b3755
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -88,4 +88,8 @@ def std_rad(dir):
return np.sqrt(1 - (np.nanmean(np.sin(dir)) ** 2 + np.nanmean(np.cos(dir)) ** 2))
def rpm2rads(rpm):
return rpm * 2 * np.pi / 60
\ No newline at end of file
return rpm * 2 * np.pi / 60
def rads2rpm(rads):
return rads/ (2 * np.pi) * 60
\ No newline at end of file
......@@ -13,7 +13,8 @@ import unittest
import numpy as np
from wetb.utils.geometry import rad, deg, mean_deg, sind, cosd, std_deg, tand
from wetb.utils.geometry import rad, deg, mean_deg, sind, cosd, std_deg, tand,\
rpm2rads, rads2rpm
import os
......@@ -67,6 +68,10 @@ class TestGeometry(unittest.TestCase):
def test_std_deg_nan(self):
self.assertAlmostEqual(std_deg(np.array([0, 90, 180, 270, np.nan])), 57.296, 2)
def test_rpm2rads(self):
self.assertAlmostEqual(rpm2rads(1),.1047,4)
self.assertAlmostEqual(rads2rpm(rpm2rads(1)), 1)
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment