aplowman / spatial-sites Goto Github PK
View Code? Open in Web Editor NEWA Python package to represent labelled, spatial coordinates.
License: Mozilla Public License 2.0
A Python package to represent labelled, spatial coordinates.
License: Mozilla Public License 2.0
Sites.sites
is too confusing.
s1 = Sites(coords=..., labels=...)
After instantiation, s1.coords[0] == s1.x
Currently, we can reassign the default coordinate attributes like: s1.x = 0
, after which s1.x
no longer refers to the same thing as s1.coords[0]
. So to avoid this, prevent reassignment of s1.x
and similar attributes.
For Sites
objects: s1
, s2
:
Add a vector
to all site coordinates (vector
must have correct shape):
s1 += vector
s1' = s1 + vector == vector + s1
s1.translate(vector)
Combining multiple Sites
objects to increase the number of coordinates (all Sites
objects must have the same labels defined):
s1 += s2
s1' = s1 + s2 != s2 + s1
s1' = Sites.concatenate([s1, s2, ...])
Subtract a vector
from all site coordinates (vector
must have correct shape):
s1 -= vector
s1' = s1 - vector != vector - s1
s1.translate(-vector)
Removing coordinates according to some condition(s):
s1.remove(species='Zr')
s1.remove(s1.x > 0.5)
Scaling coordinates by a scalar number
:
s1' = s1 * number == number * s1
s1 *= number
Transform coordinates according to a linear operator (matrix), mat
(what are the conditions on mat
with respect to the dimension
and basis
attributes?):
vector_direction == column
:
s1' = mat @ s1
vector_direction == row
:
s1' = s1 @ mat
s1 @= mat
__mul__
or __matmul__
? This became s1.tile(s2)
.Scaling coordinates by a scalar number
(number
must be non-zero):
s1' = s1 / number
s1 /= number
coords = s1.whose(label_name=label_value)
s1.whose(label_name=label_value)
is the same as s1.sites[:, s.label_name== label_value]
(if vector_direction == column
)coords_idx = s1.index(label_name=label_value)
coords = s1.where(s1.x <= 0.1)
==
) should check coordinates and labels are equivalent (or to within a small tolerance)<
, <=
, >
, >=
):
Sites
, just pass directly to the corresponding Numpy methodsSites
and a number or array, compare the self.coords
with the number/arrays1.centroid
s1.bounding_box
s1.add_labels(label_name_1=(..., ...), label_name_2=(..., ...), ...)
s1.remove_labels('label_name_1', 'label_name_2', ...)
s1' = s1.copy()
s1.rotate(origin, [rot_mat, quaternion])
s1.get_components(component_idx)
Each index into a Sites
object should return a SingleSite
object with similar attributes to the parent object.
Consider a sites object:
s1 = Sites(coords=..., labels=...)`
We should be able to make a new sites object that contains a subset of the sites in the original object by using an integer or boolean index array:
s2 = s1[[1, 7, 2]]
I don't think there is a need for multi-dimensional indexing in this manner.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.