<div dir="ltr"><div><div>Thanks Hanno<br></div>I got some idea.<br></div>How about the bin(grid)??????<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 18, 2013 at 8:21 PM, Hanno Klemm <span dir="ltr"><<a href="mailto:klemm@phys.ethz.ch" target="_blank">klemm@phys.ethz.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 18.10.2013 12:33, Pooja Gupta wrote:<br>
> I have generated random point around a object and then evaluate each<br>
> random point on certain criteria. But problem is that every time I am<br>
> getting new point. How i can resolve this problem so that my result<br>
> should be uniform. Is any way to evaluate the position of random<br>
> point.<br>
><br>
> for arang in range(1000): # generate 1000 random point around object<br>
>  arang = arang + 1<br>
>  x,y,z = 9.251, 24.410, 64.133 # coordinates of objects (i have 500<br>
> object coordinates)<br>
><br>
>  x1,y1,z1 =<br>
> (uniform(x-3.5,x+3.5),uniform(y-3.5,y+3.5),uniform(z-3.5,z+3.5))<br>
> #randompoint<br>
>  pacord = [x1,y1,z1] #random point coordinates<br>
>  dist_pap = euDist(uacoord, pacord) # check distance between object<br>
> and random points<br>
><br>
>  if (dist_pap > 2.5): # if the random point far from obect<br>
>  dist_pap1 = dist_pap<br>
> vecpw = euvector(uacoord, pacord) # generate vectors b/w objject and<br>
> random point<br>
><br>
> # angle between angle between object and random point<br>
> num1 = np.dot (vect1, vecpw)<br>
> denom1 = np.linalg.norm(vect1) * np.linalg.norm(vecpw)<br>
> ang1 = rad2deg(np.arccos(num1/denom1))<br>
><br>
> if 140 > ang1 >100: # check angle<br>
>  ang2= ang1<br>
> print pacord<br>
><br>
> Queries<br>
> every time i am getting new result (new positions of the random<br>
> point). How to fix it.<br>
> on above basis I want to score each random point and the two random<br>
> point should be 2.5 distance apart from each other. How I can avoid<br>
> overlapping of the random points.<br>
><br>
<br>
</div></div>I am not sure if i understand the question correctly but if you always<br>
want to get the same random number, every time you run the script, you<br>
can fix the random seed by using np.random.seed(). Regarding your second<br>
question, when I understand correctly, you somehow want to find two<br>
points that have a distance of 2.5. If you already have one of them, I<br>
would generate the second one using spherical coordinates and specifying<br>
the distance a priori. something like:<br>
<br>
def pt2(pt1, distance=2.5):<br>
     theta = np.random.rand()*np.pi<br>
     phi = np.random.rand()*2*np.pi<br>
     r = distance<br>
     x = r*np.sin(theta)*np.cos(phi)<br>
     y = r*np.sin(theta)*np.sin(phi)<br>
     z = r*np.cos(theta)<br>
     return pt1 + np.array((x,y,z))<br>
<br>
<br>
In [367]: pt1 = np.array([0,0,0])<br>
<br>
In [368]: pt2(pt1)<br>
Out[368]: a = array([-2.29954368, -0.57223342,  0.79664785])<br>
<br>
In [369]: np.linalg.norm(a)<br>
Out[369]: 2.5<br>
<br>
Hope this helps,<br>
Hanno<br>
<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">पूजा गुप्ता, पीएचडी <br>राष्ट्रीय कोशिका विज्ञान केंद्र<br><br>"जीवन को खुल कर मुस्कुराने दो, खोल दो बाहे अवसर आने दो ।<br>पग बढाओ हर पथ तुम्हारा है, पथ कंटक मंजिलो का इशारा है।।"<br>
<br></div>
</div>