Skip to content

Commit

Permalink
update setup.py for v0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hanjinliu committed Aug 2, 2022
1 parent d30f390 commit 4b16382
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions cpp/coords.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
namespace py = pybind11;
using ssize_t = Py_ssize_t;

// NOTE: The definition of Vector3D and CoordinateSystem cannot be moved into another
// cpp file because they are templated.

// A 3-D vector (or coordinate) object.
// Implemented with simple operations.
template <typename T>
Expand Down Expand Up @@ -69,16 +72,19 @@ inline Vector3D<T> Vector3D<T>::operator/(T other) {
return Vector3D<T>(z / other, y / other, x / other);
}

// dot product of two vectors
template<typename T>
inline T Vector3D<T>::dot(Vector3D<T> other) {
return z * other.z + y * other.y + x * other.x;
}

// the square of length.
template<typename T>
T Vector3D<T>::length2() {
return z*z + y*y + x*x;
}

// return the cosine angle between two vectors.
template<typename T>
T Vector3D<T>::angle(Vector3D<T> other) {
T dot_prod = dot(other);
Expand All @@ -88,6 +94,7 @@ T Vector3D<T>::angle(Vector3D<T> other) {
return dot_prod / (a2 + b2 - 2 * ab);
}

// length of the vector.
template<typename T>
T Vector3D<T>::length() {
return std::sqrt(length2());
Expand All @@ -102,6 +109,7 @@ py::array_t<T> Vector3D<T>::asarray() {
return arr_;
}

// A CoordinateSystem defines a local Cartesian coordinate system.
template <typename T>
class CoordinateSystem {
public:
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@ def build_extensions(self):
**INFO,
license="BSD 3-Clause",
packages=find_packages(exclude=["tests", "tests.*"]),
package_data={"mtprops": ["**/*.pyi", "*.pyi", "**/*.png"]},
package_data={"mtprops": ["**/*.pyi", "*.pyi", "**/*.png", "**/*.yaml"]},
entry_points={"napari.manifest": "MTProps=mtprops:napari.yaml"},
include_package_data=True,
setup_requires=["pybind11>=2.9.2"],
cmdclass={"build_ext": build_ext},
py_modules=[],
install_requires=[
"impy-array>=2.1.1",
"impy-array>=2.1.2",
"acryo>=0.0.2",
"magicgui>=0.5.1",
"magic-class>=0.6.7",
"magic-class>=0.6.8",
"pyqtgraph>=0.12.4",
"mrcfile>=1.3.0",
"napari>=0.4.15",
Expand Down

0 comments on commit 4b16382

Please sign in to comment.