Anyone has good understanding of how model base agents work in 2D array? --AIMA repository

2019-10-06 Thread krishna singh
Hi, I have started learning artificial intelligence and currently going through AIMA repository https://github.com/aimacode/aima-python but I am stucked at model base reflex agent implementation in the 2D environment. Does anyone have a good understanding of how model base agents work in 2D

Fitting cubic spline on 2D array

2018-05-30 Thread Priya Singh
Hello all, Can anyone tell me how can I get the functional form of the fitted cubic spline function on to my 2D array? For eg. when we fit the Gaussian on to an array so we have the functional form with the parameters best fitted to my data likewise how can we do for the cubic spline function

Re: np.searchSorted over 2D array

2015-12-10 Thread Oscar Benjamin
On 10 Dec 2015 14:46, "Heli" wrote: > > Thanks Peter, > > I will try to explain what I really need. > > I have a 3D numpy array of 100*100*100 (1M elements). Then I have another numpy array of for example 10*2*10 (200 elements). I want to know if in the bigger dataset of 100*100*100, there is anyw

Re: np.searchSorted over 2D array

2015-12-10 Thread Heli
Thanks Peter, I will try to explain what I really need. I have a 3D numpy array of 100*100*100 (1M elements). Then I have another numpy array of for example 10*2*10 (200 elements). I want to know if in the bigger dataset of 100*100*100, there is anywhere, where the second numpy array of 200

Re: np.searchSorted over 2D array

2015-12-09 Thread Peter Otten
Heli wrote: [Please don't open a new thread for the same problem] > I need to check whether two 2d numpy arrays have intersections and if so I > will need to have the cell indices of the intersection. > > By intersection, I exactly mean the intersection definition used in set > theory. > > I w

np.searchSorted over 2D array

2015-12-09 Thread Heli
Dear all, I need to check whether two 2d numpy arrays have intersections and if so I will need to have the cell indices of the intersection. By intersection, I exactly mean the intersection definition used in set theory. I will give an example of what I need to do: a=[[0,1,2],[3,4,5],[6,7,8]]

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-26 Thread Jean Dubois
Op dinsdag 25 maart 2014 20:15:27 UTC+1 schreef Joel Goldstick: > Jean, be aware there is also python tutor list you might like.  This is > sometimes a tough crowd here. Don't be discouraged. It can be a badge of > honor sometimes thanks for the suggestions, I already subscribed to the python tu

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-26 Thread Jean Dubois
Op dinsdag 25 maart 2014 20:58:10 UTC+1 schreef Dave Angel: > Jean Dubois Wrote in message: > > Op dinsdag 25 maart 2014 15:42:13 UTC+1 schreef Dave Angel: > > >> If your instructor wanted you to copy examples, he would have > >> given you one. > > please Dave leave that belittling tone behind,

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Dave Angel
Jean Dubois Wrote in message: > Op dinsdag 25 maart 2014 15:42:13 UTC+1 schreef Dave Angel: >> If your instructor wanted you to copy examples, he would have >> given you one. > please Dave leave that belittling tone behind, there's no instructor > whatsoever involved here. It wasn't my inten

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Joel Goldstick
Jean, be aware there is also python tutor list you might like. This is sometimes a tough crowd here. Don't be discouraged. It can be a badge of honor sometimes -- https://mail.python.org/mailman/listinfo/python-list

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Jean Dubois
Op dinsdag 25 maart 2014 15:42:13 UTC+1 schreef Dave Angel: > Jean Dubois Wrote in message: > > Op dinsdag 25 maart 2014 12:01:37 UTC+1 schreef Steven D'Aprano: > >> > >> py> values = [float(s) for s in data.split()] > >> py> print values > >> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] > >> py>

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Jean Dubois
s = [line.strip() for line in open("test.dat")] > >>> lines > ['1.0 2 3', '4 5 6.0', '7 8 9'] > As you can see lines is a list of three strings. > Let's break these strings into parts: > >>> cells = [line.split() for line in

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Mark H Harris
On 3/25/14 9:42 AM, Dave Angel wrote: All I need is a little python-example reading a file with e.g. three lines with three numbers per line and putting those numbers as floats in a 3x3-numpy_array, then selecting an element from that numpy_array using it's row and column-number. If your instr

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Peter Otten
trings. Let's break these strings into parts: >>> cells = [line.split() for line in lines] >>> cells [['1.0', '2', '3'], ['4', '5', '6.0'], ['7', '8', '9']] We now have a list of lists

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Steven D'Aprano
On Tue, 25 Mar 2014 06:47:23 -0700, Jean Dubois wrote: [...] > Thanks for answering my question but unfortunately now I'm totally > confused. > Above I see parts from different programs which I can't assemble > together to one working program (I really tried hard). Can I tell from > your comment I

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Dave Angel
Jean Dubois Wrote in message: > Op dinsdag 25 maart 2014 12:01:37 UTC+1 schreef Steven D'Aprano: >> >> py> values = [float(s) for s in data.split()] >> py> print values >> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] >> py> array_lines = np.array(values) >> py> array_lines = array_lines.reshape

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Jean Dubois
Op dinsdag 25 maart 2014 12:01:37 UTC+1 schreef Steven D'Aprano: > On Tue, 25 Mar 2014 03:26:26 -0700, Jean Dubois wrote: > > > I'm confused by the behaviour of the following python-script I wrote: > > > > #!/usr/bin/env python > > #I first made a data file 'test.dat' with the following content >

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Steven D'Aprano
On Tue, 25 Mar 2014 03:26:26 -0700, Jean Dubois wrote: > I'm confused by the behaviour of the following python-script I wrote: > > #!/usr/bin/env python > #I first made a data file 'test.dat' with the following content > #1.0 2 3 > #4 5 6.0 > #7 8 9 > import numpy as np > lines=[line.strip() for

[newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Jean Dubois
I'm confused by the behaviour of the following python-script I wrote: #!/usr/bin/env python #I first made a data file 'test.dat' with the following content #1.0 2 3 #4 5 6.0 #7 8 9 import numpy as np lines=[line.strip() for line in open('test.dat')] #convert lines-list to numpy-array array_lines=n

Re: calculate part of solid circle in 2D array

2013-11-25 Thread Robert Voigtländer
Great discussion started here  To answer some of the questions and to give more background: - The grid resolution is 1x1cm. The problem starts when the distance of the readings gets high. Then a 1° resolution doesn’t cover all cells anymore. And cells get counted double on short distance

Re: calculate part of solid circle in 2D array

2013-11-25 Thread Gregory Ewing
Gene Heskett wrote: Your 1 degree assumption is, generally speaking, an extremely coarse answer in terms of the accuracy needed, as we need accuracies a lot closer to an arc-second than to a whole degree in robotics. That may be true for some applications, but somehow I doubt that a sonar bea

Re: calculate part of solid circle in 2D array

2013-11-25 Thread Gene Heskett
ithin the arc for some > > statistical calculations for an occupancy map. > > So the target is a 2D array, not a picture. > > > > Robert > > If you go with one of the suggestions to use a graphics package to draw > the arc, you can then take the resulting bitmap image

Re: calculate part of solid circle in 2D array

2013-11-25 Thread Roy Smith
In article <1fc9a269-4847-4d29-a35e-5cf91731e...@googlegroups.com>, Robert Voigtländer wrote: > Thanks a lot for the links. > > I don't need it to be drawn. I need the fields within the arc for some > statistical calculations for an occupancy map. > So the target is

Re: calculate part of solid circle in 2D array

2013-11-25 Thread Robert Voigtländer
Thanks a lot for the links. I don't need it to be drawn. I need the fields within the arc for some statistical calculations for an occupancy map. So the target is a 2D array, not a picture. Robert -- https://mail.python.org/mailman/listinfo/python-list

Re: calculate part of solid circle in 2D array

2013-11-25 Thread Peter Otten
Robert Voigtländer wrote: > OK. Found a good one here: > http://www.daniweb.com/software-development/python/threads/321181/python- bresenham-circle-arc-algorithm > > Now only filling is needed. > Any help is welcome ... I think you shouldn't implement the algorithm directly. Rather look for a l

Re: calculate part of solid circle in 2D array

2013-11-25 Thread Robert Voigtländer
OK. Found a good one here: http://www.daniweb.com/software-development/python/threads/321181/python-bresenham-circle-arc-algorithm Now only filling is needed. Any help is welcome ... Thanks Robert Am Montag, 25. November 2013 08:26:19 UTC+1 schrieb Robert Voigtländer: > Hi, > > > > I wonder i

calculate part of solid circle in 2D array

2013-11-24 Thread Robert Voigtländer
Hi, I wonder if someone can help me with a function I need for programming my robot. I want to update an 2D occupancy grid based on sonar data. The sonar “view angle” is cone shaped. So I need to calculate all cells of a 30° slice of a filled circle. Something like this: http://www.intechopen.co

Re: quickly looping over a 2D array?

2009-07-27 Thread Robert Kern
On 2009-07-27 06:24, Martin wrote: Hi, I am new to python and I was wondering if there was a way to speed up the way I index 2D arrays when I need to check two arrays simultaneously? My current implementations is (using numpy) something like the following... for i in range(numrows): for j

Re: quickly looping over a 2D array?

2009-07-27 Thread Martin
On Jul 27, 4:12 pm, Peter Otten <__pete...@web.de> wrote: > Martin wrote: > > The statement works now, but it doesn't give the same results as my > > original logic, strangely!? > > > in my logic: > > > data = np.zeros((numrows, numcols), dtype = np.uint8, order ='C') > > > for i in range(numrows):

Re: quickly looping over a 2D array?

2009-07-27 Thread Peter Otten
Martin wrote: > The statement works now, but it doesn't give the same results as my > original logic, strangely!? > > in my logic: > > data = np.zeros((numrows, numcols), dtype = np.uint8, order ='C') > > for i in range(numrows): > for j in range(numcols): > if band3[i,j] == 255 or

Re: quickly looping over a 2D array?

2009-07-27 Thread Martin
On Jul 27, 2:17 pm, Peter Otten <__pete...@web.de> wrote: > Martin wrote: > > On Jul 27, 1:46 pm, Peter Otten <__pete...@web.de> wrote: > >> Martin wrote: > >> > On Jul 27, 12:42 pm, Peter Otten <__pete...@web.de> wrote: > >> >> Martin wrote: > >> >> > I am new to python and I was wondering if ther

Re: quickly looping over a 2D array?

2009-07-27 Thread Peter Otten
Martin wrote: > On Jul 27, 1:46 pm, Peter Otten <__pete...@web.de> wrote: >> Martin wrote: >> > On Jul 27, 12:42 pm, Peter Otten <__pete...@web.de> wrote: >> >> Martin wrote: >> >> > I am new to python and I was wondering if there was a way to speed >> >> > up the way I index 2D arrays when I need

Re: quickly looping over a 2D array?

2009-07-27 Thread Martin
On Jul 27, 1:46 pm, Peter Otten <__pete...@web.de> wrote: > Martin wrote: > > On Jul 27, 12:42 pm, Peter Otten <__pete...@web.de> wrote: > >> Martin wrote: > >> > I am new to python and I was wondering if there was a way to speed up > >> > the way I index 2D arrays when I need to check two arrays >

Re: quickly looping over a 2D array?

2009-07-27 Thread Peter Otten
Martin wrote: > On Jul 27, 12:42 pm, Peter Otten <__pete...@web.de> wrote: >> Martin wrote: >> > I am new to python and I was wondering if there was a way to speed up >> > the way I index 2D arrays when I need to check two arrays >> > simultaneously? My current implementations is (using numpy) som

Re: quickly looping over a 2D array?

2009-07-27 Thread Martin
On Jul 27, 12:42 pm, Peter Otten <__pete...@web.de> wrote: > Martin wrote: > > I am new to python and I was wondering if there was a way to speed up > > the way I index 2D arrays when I need to check two arrays > > simultaneously? My current implementations is (using numpy) something > > like the f

Re: quickly looping over a 2D array?

2009-07-27 Thread Peter Otten
Martin wrote: > I am new to python and I was wondering if there was a way to speed up > the way I index 2D arrays when I need to check two arrays > simultaneously? My current implementations is (using numpy) something > like the following... > > for i in range(numrows): > for j in range(numco

quickly looping over a 2D array?

2009-07-27 Thread Martin
Hi, I am new to python and I was wondering if there was a way to speed up the way I index 2D arrays when I need to check two arrays simultaneously? My current implementations is (using numpy) something like the following... for i in range(numrows): for j in range(numcols): if array_1

Re: Define a 2d Array?

2008-10-12 Thread Jillian Calderon
Thanks, everyone. All of your help solved at least my data storage problem! -- http://mail.python.org/mailman/listinfo/python-list

Re: Define a 2d Array?

2008-10-12 Thread thomas . p . krauss
On Oct 11, 9:19 pm, Jillian Calderon <[EMAIL PROTECTED]> wrote: > How do I define a 2d list? > > For instance, to define a 4 by 5 list, I wanted to do this: > n=4 > m=5 > world = [n][m] > However, it gives me an invalid syntax error saying the index is out > of range. Here are some examples of how

Re: Define a 2d Array?

2008-10-12 Thread skip
Eric> I think you can do Eric> mylist = [[]] or somesuch... That won't do what you want. You've defined a list with a single element (another list). You might have been thinking of something like this: >>> N = 4 >>> M = 5 >>> mylist = [[0.0] * M] * N While to the casual g

Re: Define a 2d Array?

2008-10-12 Thread John Machin
On Oct 12, 1:30 pm, [EMAIL PROTECTED] wrote: >     Jill> How do I define a 2d list? > > If you are looking to do numeric work with such multidimensional lists you > should consider the builtin array object or the numpy package: > >    http://docs.python.org/dev/library/array.html#module-array The

Re: Define a 2d Array?

2008-10-12 Thread [EMAIL PROTECTED]
On Oct 11, 9:30 pm, [EMAIL PROTECTED] wrote: >     Jill> How do I define a 2d list? > > Python doesn't truly have 2d lists in the way you might think of 2d arrays > in C or Fortran.  It has 1d lists which can contain any Python object, > including other lists.  If you wanted to create a 4x5 list yo

Re: Define a 2d Array?

2008-10-11 Thread skip
Jill> How do I define a 2d list? Python doesn't truly have 2d lists in the way you might think of 2d arrays in C or Fortran. It has 1d lists which can contain any Python object, including other lists. If you wanted to create a 4x5 list you'd do something like this: N = 4 M = 5

Define a 2d Array?

2008-10-11 Thread Jillian Calderon
Hi. How do I define a 2d list? For instance, to define a 4 by 5 list, I wanted to do this: n=4 m=5 world = [n][m] However, it gives me an invalid syntax error saying the index is out of range. I know this is a real newbie question, but if you could help me out, I'd really appreciate it! Thanks,

Re: Writing 2d array in an ascci file

2006-09-28 Thread Jeremy Sanders
[EMAIL PROTECTED] wrote: > I want to write an 2d array in an ascii file using numpy. There's the - > tofile / fromfile - function but it doesn't work with nd array. Is this good enough? x = numpy.zeros( (10, 10) ) f = open('out.txt', 'w') print

Writing 2d array in an ascci file

2006-09-28 Thread [EMAIL PROTECTED]
Hi, I want to write an 2d array in an ascii file using numpy. There's the - tofile / fromfile - function but it doesn't work with nd array. Thanks, CH. -- http://mail.python.org/mailman/listinfo/python-list

Re: 2d array slicing problem

2005-11-26 Thread Robert Kern
Tune Kamae (sent by Nabble.com) wrote: > I am thinking to upgrade my desktop to 64bit cpu with 16GB memory to handle > large astronomical images and data. I wonder if > 1) the latest numarry (besides 2d slicing) has been tested with one or more > 64 bit CPU and Linux distributions Certainly.

Re: 2d array slicing problem

2005-11-26 Thread Tune Kamae (sent by Nabble.com)
I am thinking to upgrade my desktop to 64bit cpu with 16GB memory to handle large astronomical images and data.  I wonder if 1) the latest numarry (besides 2d slicing) has been tested with one or more     64 bit CPU and Linux distributions 2) with 64 bit address space, will numarray be able to h

Re: 2d array slicing problem

2005-10-07 Thread jeg
thanks, i ran it -- the only difference i got was the numarray version: 1.1.1 on the 686, and 1.3.3 on the 64bit... but i wouldn't have thought that would make too much difference. -- http://mail.python.org/mailman/listinfo/python-list

Re: 2d array slicing problem

2005-10-07 Thread jepler
Do you have a simple program that demonstrates the problem? I have an x86 machine with Python 2.3, and an x86_64 machine with Python 2.4 available. I wrote a simple test program which performs a slice operation, but it behaves the same on both platforms. Here's the program: #

Re: 2d array slicing problem

2005-10-07 Thread Robert Kern
jeg wrote: > dear all, > > i'm an astronomer working with 2d images -- 2d numarrays. i have a > script which basically does some operations on some images, and one of > the first steps is to find a galaxy on an image (at, say, a known x,y > coord), and create a sub-image by slicing out part of the

2d array slicing problem

2005-10-07 Thread jeg
dear all, i'm an astronomer working with 2d images -- 2d numarrays. i have a script which basically does some operations on some images, and one of the first steps is to find a galaxy on an image (at, say, a known x,y coord), and create a sub-image by slicing out part of the larger array to create

Re: 2D array

2004-12-10 Thread Adam DePrince
On Wed, 2004-12-08 at 16:22, Steven Bethard wrote: > Adam DePrince wrote: > > The use of None as the default parameter was on purpose; the lack of > > "magic" in python is often cited in religious wars between python and > > perl aficionados. Use of get(something, None) was on purpose, the level

Re: 2D array

2004-12-08 Thread Carl Banks
I am also not here to criticize style here, but I want to point something out. Something like a[1,2] might look wrong, but it's actually parsed specially by Python to accommodate slicing of multidimensional arrays. The difference is that, inside [], you can use slicing syntax, as in a[1:2,3:4]. B

Re: 2D array

2004-12-08 Thread Steven Bethard
Adam DePrince wrote: The use of None as the default parameter was on purpose; the lack of "magic" in python is often cited in religious wars between python and perl aficionados. Use of get(something, None) was on purpose, the level of familiarity with the language implied by the original question

Re: 2D array

2004-12-08 Thread Adam DePrince
On Wed, 2004-12-08 at 15:06, Steven Bethard wrote: > Adam DePrince wrote: > > If your data is sparse you might want to consider using a dictionary > > where the key is a tuple representing the coordinates. > > > > a = {} > > a[(0,0)] = 0 > > a[(0,1)] = 1 > [snip] > print a.get( (5,0), None ) >

Re: 2D array

2004-12-08 Thread Steven Bethard
Adam DePrince wrote: If your data is sparse you might want to consider using a dictionary where the key is a tuple representing the coordinates. a = {} a[(0,0)] = 0 a[(0,1)] = 1 [snip] print a.get( (5,0), None ) Good point. Note that you don't need the parentheses in the assignments or item acces

Re: 2D array

2004-12-08 Thread Adam DePrince
ment this in Python? thanks. > > If you're planning to do anything serious with a 2D array, you should > probably look at numarray: > http://www.stsci.edu/resources/software_hardware/numarray > > >>> import numarray as na > >>> arr = na.array(range

Re: 2D array

2004-12-07 Thread Steven Bethard
LutherRevisited wrote: I'm wanting to do something with a list that is basically a 2 dimensional array. I'm not so good with lists so can someone give me an example of how I might implement this in Python? thanks. If you're planning to do anything serious with a 2D array, you s

2D array

2004-12-07 Thread LutherRevisited
I'm wanting to do something with a list that is basically a 2 dimensional array. I'm not so good with lists so can someone give me an example of how I might implement this in Python? thanks. -- http://mail.python.org/mailman/listinfo/python-list