Mayavi mlab moving object - python

I am a chemist, so programming isn't my daily work. However for one project, I am building a little programm on NMR product operators.
I have an vector with quiver, which always has its one point in [0,0,0] and just the head of the arrow is moveable, e.g. from the z to the y axis ([0,0,1] to [0,1,0]).
Right now I just can plot first the one vector and then the other. Is it possible to let the arrow rotate from one position to the other?

Related

Marking out points on surface directly above level curve in xy-plane

I have a 3D plot with a surface z = f(x,y) and a level curve g(x,y) = c. This last one lies in the xy-plane. I need to somehow mark out the points on the surface which lie directly above the level curve. I am trying to maximize f, but are restricted to the points directly above g(x,y)=c. Therefore, for illustrational purposes, it would be nice to make it clear for my readers which points we are evaluating. My current plot looks like this:
Current plot
My first idea was to somehow collect the points on g(x,y) = c, adding them to a list, and then again plot z = f(x,y) with these points as the argument. Is that overcomplicating things?
I know that Python has commands for projecting from surfaces to the xy-plane. What I am trying here is kinda the other way around. Does Python have a command for that?
Answers are highly appreciated.

Identifying rotation of accelerometer using xyz values in Python

I have time series data consisting of x y z values of accelerometer readings. I want to be able to detect that the device was moved/rotated using these values in Python.
Following is a plot of such data -
plot of xyz values of acclerometer data
Using RMS is going to help you know if movement happened, but since you lose the individual axes values it becomes impossible to distinguish what kind of movement it is.
Movement in each direction is relatively simple as that will show up as an acceleration on that axis. For rotation, assuming you are near the earth, you will have a constant acceleration equal to -9.8m/s^2 toward the earth. As your sensor is rotated the distribution of that acceleration onto the different axes will change. That should become more clear if you look at something like an average across a period of time for each axis.

In Plotly 3D Scatterplot, is there a way to freeze rotation of one axis?

I am making a 3-D Scatterplot with plotly in Python 3 and the Z-axis represents time. I would like to freeze that so that, when the using clicks around to rotate the plot, it spins on that axis, but that axis stays up and down. I'm not sure if it's possible, but that would be a great feature.
As it is, the oldest points are at the top (this is a genetic tree) and the newest are at the bottom. However, it's very easy to get this turned when clicking around the plot to rotate and then the time axis is going left-to-right or diagonal or something and it's a bit disorienting, especially for people who are not used to looking at complex visuals like this (i.e. my intended audience).
A first draft example: https://plot.ly/~seth127/6
Any help is greatly appreciated!
Thanks,
Seth

How to compare the orientation of a 3D vector against a plane in three dimensions

I am currently trying to plot a plane in three dimensional space but not sure how to do it for the problem I have.
Currently I have code that defines a 3D vector according to co-ordinates I have, this includes the ability to rotate, translate, and work out the angle between vectors.
The next step is to define a plane. I am not sure the best way to do this, however. The plane will be in a 100,100,100 box, be flat, and likely exist at a z height of around 30.
My issue comes because I need this plane to do a couple of things:
1: I need to be able to rotate it around the three axes.
2: I need to be able to measure the smallest angle between the plane and the vector I have defined where the vector intersects the plane.
I was initially playing around trying to fill a numpy array with 1s where the plane would be etc but I don't see this really working how I need it to.
Does anyone know of any other tool that I would be able to use in this situation? Many thanks.
First of all, you'll need the normal vector to the plane. From there and following this link it should be easy for you to figure it out :)
Basically you get arcsin of the scalar product of your vector and the normal vector of the plane divided by the product of the norms of both vectors.
PS: If the plane is paralel to the XY plane, then it's normal vector it's just (0,0,1).

Creating triangulated grid mesh using matplotlib

So I have been creating mesh's using software called BlueKenue for hydraulic models, which is great. In the document I am currently writing I would like to include an image of the mesh however the mesh's I have constructed are very long in the x-axis and short in the y direction. Unfortunately BlueKenue will not allow you to have different scale ranges on your axis (or if it does I have not been able to find a way), i.e. if you have increments of 5 on one axis you will have likewise on the other. I have included an image of the mesh I currently have to illustrate my problem. If I can construct this mesh in matplotlib I can then ensure my image is suitably clear.
My question is can I reproduce this mesh in Matplotlib in a relatively simple way? (I am fairly new to python). The mesh is a regular grid which has been triangulated.
Edit:
Mesh dimensions 29.76 x 2
x intervals = 0.16m (186 points along the x axis)
y intervals = 0.20m (10 points along the y axis)
Thanks

Categories

Resources