vectorose 0.2.2__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vectorose-0.2.2 → vectorose-0.2.4}/PKG-INFO +8 -2
- {vectorose-0.2.2 → vectorose-0.2.4}/README.md +6 -0
- {vectorose-0.2.2 → vectorose-0.2.4}/pyproject.toml +2 -2
- {vectorose-0.2.2 → vectorose-0.2.4}/src/vectorose/io.py +2 -2
- {vectorose-0.2.2 → vectorose-0.2.4}/src/vectorose/polar_data.py +3 -3
- {vectorose-0.2.2 → vectorose-0.2.4}/src/vectorose/sphere_base.py +18 -8
- {vectorose-0.2.2 → vectorose-0.2.4}/src/vectorose/stats.py +5 -3
- {vectorose-0.2.2 → vectorose-0.2.4}/src/vectorose/tregenza_sphere.py +3 -1
- {vectorose-0.2.2 → vectorose-0.2.4}/LICENSE +0 -0
- {vectorose-0.2.2 → vectorose-0.2.4}/src/vectorose/__init__.py +0 -0
- {vectorose-0.2.2 → vectorose-0.2.4}/src/vectorose/mock_data.py +0 -0
- {vectorose-0.2.2 → vectorose-0.2.4}/src/vectorose/plotting.py +0 -0
- {vectorose-0.2.2 → vectorose-0.2.4}/src/vectorose/triangle_sphere.py +0 -0
- {vectorose-0.2.2 → vectorose-0.2.4}/src/vectorose/util.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: vectorose
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Plot polar and spherical histograms from orientation data.
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Benjamin Z. Rudski
|
|
@@ -17,7 +17,7 @@ Requires-Dist: imageio[ffmpeg,pyav] (>=2.27.0)
|
|
|
17
17
|
Requires-Dist: importlib-metadata (>=7.0.1)
|
|
18
18
|
Requires-Dist: ipywidgets (>=8.1.5,<9)
|
|
19
19
|
Requires-Dist: matplotlib (>=3.3.4)
|
|
20
|
-
Requires-Dist: numpy (>=1.19.5
|
|
20
|
+
Requires-Dist: numpy (>=1.19.5)
|
|
21
21
|
Requires-Dist: openpyxl (>=3.1.2,<4)
|
|
22
22
|
Requires-Dist: pandas (>=1.1.3)
|
|
23
23
|
Requires-Dist: pyvista[all,jupyter] (>=0.44.1,<1)
|
|
@@ -37,6 +37,12 @@ Description-Content-Type: text/markdown
|
|
|
37
37
|
Spherical and polar histogram plotting for non-unit vectorial and axial
|
|
38
38
|
data.
|
|
39
39
|
|
|
40
|
+
[](https://pypi.org/project/vectorose/)
|
|
41
|
+
[](https://codecov.io/github/bzrudski/vectorose)
|
|
42
|
+
[](https://vectorose.readthedocs.io/en/latest/)
|
|
43
|
+
[](https://github.com/bzrudski/vectorose/actions/workflows/ci-cd.yml)
|
|
44
|
+
[](https://github.com/bzrudski/vectorose/actions/workflows/ci-win.yml)
|
|
45
|
+
|
|
40
46
|
## Overview
|
|
41
47
|
|
|
42
48
|
Many fields of science rely on oriented data. In these contexts, scalar
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
Spherical and polar histogram plotting for non-unit vectorial and axial
|
|
6
6
|
data.
|
|
7
7
|
|
|
8
|
+
[](https://pypi.org/project/vectorose/)
|
|
9
|
+
[](https://codecov.io/github/bzrudski/vectorose)
|
|
10
|
+
[](https://vectorose.readthedocs.io/en/latest/)
|
|
11
|
+
[](https://github.com/bzrudski/vectorose/actions/workflows/ci-cd.yml)
|
|
12
|
+
[](https://github.com/bzrudski/vectorose/actions/workflows/ci-win.yml)
|
|
13
|
+
|
|
8
14
|
## Overview
|
|
9
15
|
|
|
10
16
|
Many fields of science rely on oriented data. In these contexts, scalar
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "vectorose"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.4"
|
|
4
4
|
description = "Plot polar and spherical histograms from orientation data."
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Benjamin Z. Rudski", email = "benjamin.rudski@mail.mcgill.ca"},
|
|
@@ -10,7 +10,7 @@ license = "MIT"
|
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.10"
|
|
12
12
|
dependencies = [
|
|
13
|
-
"numpy
|
|
13
|
+
"numpy>=1.19.5",
|
|
14
14
|
"matplotlib>=3.3.4",
|
|
15
15
|
"pandas>=1.1.3",
|
|
16
16
|
"openpyxl (>=3.1.2, <4)",
|
|
@@ -311,8 +311,8 @@ def import_vector_field(
|
|
|
311
311
|
-1, d
|
|
312
312
|
)
|
|
313
313
|
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
# Remove any rows containing NaN
|
|
315
|
+
vector_field = vector_field[~np.any(np.isnan(vector_field), axis=1)]
|
|
316
316
|
|
|
317
317
|
# Use Pandas in the other cases
|
|
318
318
|
else:
|
|
@@ -253,7 +253,9 @@ class PolarDiscretiser:
|
|
|
253
253
|
bins = self._theta_bins
|
|
254
254
|
|
|
255
255
|
# Count the vectors in each bin
|
|
256
|
-
counts = labelled_vectors.groupby(bin_assignment_column).apply(
|
|
256
|
+
counts = labelled_vectors.groupby(bin_assignment_column).apply(
|
|
257
|
+
len, include_groups=False
|
|
258
|
+
)
|
|
257
259
|
counts.name = "count"
|
|
258
260
|
|
|
259
261
|
# Normalise to get the frequencies
|
|
@@ -261,7 +263,6 @@ class PolarDiscretiser:
|
|
|
261
263
|
frequencies = counts / number_of_vectors
|
|
262
264
|
frequencies.name = "frequency"
|
|
263
265
|
|
|
264
|
-
|
|
265
266
|
# Combine everything to get a nice histogram
|
|
266
267
|
counts = counts.reindex(index=bins.index, fill_value=0)
|
|
267
268
|
frequencies = frequencies.reindex(index=bins.index, fill_value=0)
|
|
@@ -312,4 +313,3 @@ class PolarDiscretiser:
|
|
|
312
313
|
angle_name = util.AngleName.THETA
|
|
313
314
|
|
|
314
315
|
return self._construct_histogram(labelled_vectors, angle_name)
|
|
315
|
-
|
|
@@ -150,7 +150,9 @@ class SphereBase(abc.ABC):
|
|
|
150
150
|
|
|
151
151
|
return processed_vector_data
|
|
152
152
|
|
|
153
|
-
def _initial_vector_component_preparation(
|
|
153
|
+
def _initial_vector_component_preparation(
|
|
154
|
+
self, vectors: pd.DataFrame
|
|
155
|
+
) -> pd.DataFrame:
|
|
154
156
|
"""Prepare the vector components for histogram construction.
|
|
155
157
|
|
|
156
158
|
Override this method to include specific operations that should be
|
|
@@ -331,7 +333,9 @@ class SphereBase(abc.ABC):
|
|
|
331
333
|
grouping_columns = self.hist_group_cols
|
|
332
334
|
|
|
333
335
|
# Use groupby to perform the grouping
|
|
334
|
-
original_histogram = binned_data.groupby(grouping_columns).apply(
|
|
336
|
+
original_histogram = binned_data.groupby(grouping_columns).apply(
|
|
337
|
+
len, include_groups=False
|
|
338
|
+
)
|
|
335
339
|
|
|
336
340
|
# Modify the index to account for any missing bins.
|
|
337
341
|
multi_index = self._construct_histogram_index()
|
|
@@ -379,7 +383,9 @@ class SphereBase(abc.ABC):
|
|
|
379
383
|
"""
|
|
380
384
|
|
|
381
385
|
# Group based only on the magnitude bin
|
|
382
|
-
counts_by_shell = binned_data.groupby(self.magnitude_shell_cols).apply(
|
|
386
|
+
counts_by_shell = binned_data.groupby(self.magnitude_shell_cols).apply(
|
|
387
|
+
len, include_groups=False
|
|
388
|
+
)
|
|
383
389
|
|
|
384
390
|
# Construct the index (in case some bins are zero).
|
|
385
391
|
magnitude_index = self._construct_magnitude_index()
|
|
@@ -428,7 +434,9 @@ class SphereBase(abc.ABC):
|
|
|
428
434
|
"""
|
|
429
435
|
|
|
430
436
|
# Group based on only the orientation data
|
|
431
|
-
counts_by_orientation = binned_data.groupby(self.orientation_cols).apply(
|
|
437
|
+
counts_by_orientation = binned_data.groupby(self.orientation_cols).apply(
|
|
438
|
+
len, include_groups=False
|
|
439
|
+
)
|
|
432
440
|
|
|
433
441
|
# Construct the index (in case some orientations are zero).
|
|
434
442
|
orientation_index = self._construct_orientation_index()
|
|
@@ -507,8 +515,8 @@ class SphereBase(abc.ABC):
|
|
|
507
515
|
pandas.Series
|
|
508
516
|
The proportion of vectors in each magnitude shell relative to
|
|
509
517
|
all vectors having that orientation. The index used is the
|
|
510
|
-
|
|
511
|
-
|
|
518
|
+
same as that obtained in the bivariate case, having the
|
|
519
|
+
magnitude first, followed by the orientation parameters.
|
|
512
520
|
|
|
513
521
|
Warnings
|
|
514
522
|
--------
|
|
@@ -651,8 +659,10 @@ class SphereBase(abc.ABC):
|
|
|
651
659
|
|
|
652
660
|
@abc.abstractmethod
|
|
653
661
|
def convert_vectors_to_cartesian_array(
|
|
654
|
-
self,
|
|
655
|
-
|
|
662
|
+
self,
|
|
663
|
+
labelled_vectors: pd.DataFrame,
|
|
664
|
+
create_unit_vectors: bool = False,
|
|
665
|
+
include_spatial_locations: bool = False,
|
|
656
666
|
) -> np.ndarray:
|
|
657
667
|
"""Convert a set of labelled vectors into Cartesian coordinates.
|
|
658
668
|
|
|
@@ -143,7 +143,7 @@ def compute_orientation_matrix(
|
|
|
143
143
|
|
|
144
144
|
def compute_orientation_matrix_eigs(
|
|
145
145
|
vector_field: np.ndarray,
|
|
146
|
-
) ->
|
|
146
|
+
) -> NamedTuple:
|
|
147
147
|
"""Compute the eigenvectors and eigenvalues of the orientation matrix.
|
|
148
148
|
|
|
149
149
|
Compute the eigen-decomposition of the orientation matrix. This
|
|
@@ -159,8 +159,10 @@ def compute_orientation_matrix_eigs(
|
|
|
159
159
|
|
|
160
160
|
Returns
|
|
161
161
|
-------
|
|
162
|
-
numpy.
|
|
163
|
-
Eigenvectors
|
|
162
|
+
eigenvectors : numpy.ndarray
|
|
163
|
+
Eigenvectors of the orientation matrix.
|
|
164
|
+
eigenvalues : numpy.ndarray
|
|
165
|
+
Eigenvalues of the orientation matrix.
|
|
164
166
|
|
|
165
167
|
Notes
|
|
166
168
|
-----
|
|
@@ -334,7 +334,9 @@ class TregenzaSphere(SphereBase):
|
|
|
334
334
|
ring_weights = self._rings.loc[:, "weight"]
|
|
335
335
|
original_index = histogram.index
|
|
336
336
|
weighted_face_data = (
|
|
337
|
-
histogram.groupby("ring", group_keys=False).apply(
|
|
337
|
+
histogram.groupby("ring", group_keys=False).apply(
|
|
338
|
+
lambda x: x, include_groups=False
|
|
339
|
+
)
|
|
338
340
|
* ring_weights
|
|
339
341
|
)
|
|
340
342
|
weighted_face_data = weighted_face_data.reindex(original_index)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|