So I have a pretty simple question regarding the size of my data. I am trying to calculate the distance between all sets points (WGS84) in a dataset (56000).
https://www.rdocumentation.org/packages/geosphere/versions/1.5-10/topics/distm
According to the documentation: distm(x,y,fun="") if missing, y is the same as x
mydist<-distm(coordinates(mySpatialObject), fun="distHaversine")
This led me to an Error that y was missing. So I figured I could easily work around this.
distm(coordinates(WeedClim.plot),coordinates(WeedClim.plot), fun="distHaversine")
This leads to not just R:Studio, but my entire computer freezing. I had to to a hard reset twice now and do not want to go through this again, because this is my dissertation and I am afraid of breaking something else in the project XD.
Any ideas/solutions? Is there a better function that gives me a distance matrix from a set of coordinates?
THANKS!
Related
I'm working on constraining an IK program so that the normal vector in the end-effector frame is parallel to a known vector in the world-frame, when both are projected to the xy-plane. My initial thought was to use an AddAnglesBetweenVectorsConstraint, but that only allows me to specify the total angle between vectors, and no difference between the different axes. Is there currently a way in Drake to do this?
Edit: it turns out that this was not exactly the problem I needed to solve. In my answer below, I describe the real problem I was solving.
It seems that AddOrientationConstraint will do what you need? If not, then you could accomplish the same with adding two PositionConstraints; I do precisely that in the interactive IK example in the notes for this chapter: https://manipulation.csail.mit.edu/trajectories.html .
Turns out, you can do what I wanted to do using an AddAnglesBetweenVectorsConstraint, I just misdescribed my problem. Specifically, what I really wanted was to do was enforce that the y-axis in the end effector frame (where z-axis is the direction of the end-effector, and the x-axis is straight up in said frame) was perpdinicular both to the z-axis in the world frame and the known vector in the world-frame. This is exactly what AddAngleBetweenVectorsConstraint, and it worked very nicely.
I am trying to save polygon area when a new polygon has been created by the user. I found that there is a function for this purpose - ST_AREA, but when I check if it is calculating correct I find some discrepancies. Here is one example:
This is one polygon which area according to geojson.io is 31.85:
But when I run ST_AREA for the same polygon:
SELECT ST_Area(CONCAT(a.polygon, 'SRID=4326'))*10000 AS area FROM kt_polygons a where polygon_id = 180;
The result is 34.93261884737489. Something more, I am not quite sure why I multiply the result area by 10000.. I just do that because the result seems to be more realistic in that way.
I check some other polygons and the difference is not more than 5, but why this can happen? Any ideas what I do wrong?
I found a solution which helps for my case. When I get the result from ST_Area I multiply it by 9090,91. This coefficient maybe is propriate only for my problem, but you can find if there is dependency between the real areas and the one from ST_Area. If so, you can find your coefficient.
I am trying to clean up some eye tracking data in which people are told to focus on the middle of the screen. However, the data is somewhat noisy and I am trying to clean it up in a proper way.
I have created some code that emulates the kind of data that I have and the methods I am trying to use as well as what I am presenting below.
The data complete with noise looks as follows:
I have tried to use a simple formula to throw all samples further than some pixels from the centre away such as:
results[results$x <= xmid+threshold & results$x >= xmid-threshold,]
But that results in data in a square shape rather than a circle:
I have tried to think about what to do here and have made it as far as to define a circle that encompasses the area that I am interested in:
However, I can not see a straightforward way to only pick data within that area.The solutions I have tried have required several for loops and still not given me the result I was hoping for.
I hope that some of you can point me in the right direction here. Maybe the problem is even trivial to solve in some manner that I have not yet considered? Thanks for reading this far and here is the code if you think that you can help :)
To check whether point lies in circular region with radius threshold around center xmid, ymid, you can use expression (^ denotes 2-nd power, squaring)
(x-xmid)^2 + (y-ymid)^2 <= threshold^2
I need to filter the harmonics of an audio track using the libraries 'seewave' and 'tuneR' of R, but I do not know the functions of this language well.
So far I have done the following:
library('seewave')
library('tuneR')
track<-readMP3('empty_spaces.mp3')
t1<-cutw(track, from=0, to=10)
autoc(t1, f=4400)
and the result is the next screen:
at first I thought that the group of points on the bottom were the harmonics and the points isolated above belonged to noise, but I think I'm not interpreting it well. Could someone help me interpret this image? or tell me what function would help me get what I need?
Thank you
This is image of distribution of frequencies across time, so by this image it s hard to see, where noise and where useful signal. To solve your problem, you should use frequency filters , chebyhev or butterworth filters (look at filter function in signal package) and of course you must know what frequencies you want to delete.
I am trying to graph a lemniscate in polar coordinates on scilab. Which formula is
rho^2=a^2*cos(2*theta).
The thing is that calculating the square root of certain values will return an imaginary number as the value would be negative.
clear
close
clc
clf
a=3;
theta=[0:((1*%pi)/180):((359*%pi)/180)];
rr=(a*a)*cos(2*theta);
rho=sqrt(rr);
polarplot(theta,rho,2);
Anyways, the program breaks itself when the negative rr values are reached since the square root is not properly defined for them.
All I need is the code to ignore those points and plot the others.
I don't know if this is understandable, but I hope someone do and can help me with this.
Thanks in advance.
You may ignore (e.g. filter out) those points, but there is an even easier solution: use only the real part of your result vector for the plot with real
polarplot(theta,real(rho),2);
You may also assigh it to a new variable if want to use it later:
rhoreal=real(rho);