Utilities
data2rad(data, k=360)
Convert data measured on a circular scale to corresponding angular directions.
\[ \alpha = \frac{2\pi \times \mathrm{data}}{k} \]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
ndarray or float
|
Data measured on a circular scale. |
required |
k
|
float or int
|
Number of intervals in the full cycle. Default is 360. |
360
|
Returns:
Name | Type | Description |
---|---|---|
angle |
ndarray or float
|
Angular directions in radian. |
Source code in pycircstat2/utils.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
time2float(x, sep=':')
Convert an array of strings in time (hh:mm) to an array of floats.
Source code in pycircstat2/utils.py
39 40 41 42 43 44 45 46 47 48 |
|
angular_distance(a, b)
Angular distance between two angles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a
|
Union[ndarray, list, float]
|
angle(s). |
required |
b
|
float
|
target angle. |
required |
Returns:
Name | Type | Description |
---|---|---|
e |
ndarray
|
angular distance |
Reference
P642, Section 27.2, Zar, 2010
Source code in pycircstat2/utils.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
is_within_circular_range(value, lb, ub)
Check if a value lies within the circular range [lb, ub].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
float
|
The value to check. |
required |
lb
|
float
|
The lower bound of the range. |
required |
ub
|
float
|
The upper bound of the range. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the value is within the circular range, False otherwise. |
Source code in pycircstat2/utils.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|