Re: [Numpy-discussion] IDE's for numpy development?

2015-04-01 Thread Eraldo Pomponi
Sorry for the OT and top-posting but,

It reminds me of ITex (https://www.youtube.com/watch?v=eKaI78K_rgA) ...

On Wed, Apr 1, 2015 at 6:43 PM, Yuxiang Wang yw...@virginia.edu wrote:

 That would really be hilarious - and IFortran probably! :)

 Shawn

 On Wed, Apr 1, 2015 at 12:07 PM, Benjamin Root ben.r...@ou.edu wrote:
  mixed C and python development? I would just wait for the Jupyter folks
 to
  create IC and maybe even IC++!
 
  On Wed, Apr 1, 2015 at 12:04 PM, Charles R Harris
  charlesr.har...@gmail.com wrote:
 
  Hi All,
 
  In a recent exchange Mark Wiebe suggested that the lack of support for
  numpy development in Visual Studio might limit the number of developers
  attracted to the project. I'm a vim/console developer myself and make no
  claim of familiarity with modern development tools, but I wonder if such
  tools might now be available for Numpy. A quick google search turns up a
  beta plugin for Visual Studio,, and there is an xcode IDE for the mac
 that
  apparently offers some Python support. The two things that I think are
  required are: 1) support for mixed C, python developement and 2)
 support for
  building and testing numpy. I'd be interested in information from anyone
  with experience in using such an IDE and ideas of how Numpy might make
 using
  some of the common IDEs easier.
 
  Thoughts?
 
  Chuck
 
  ___
  NumPy-Discussion mailing list
  NumPy-Discussion@scipy.org
  http://mail.scipy.org/mailman/listinfo/numpy-discussion
 
 
 
  ___
  NumPy-Discussion mailing list
  NumPy-Discussion@scipy.org
  http://mail.scipy.org/mailman/listinfo/numpy-discussion
 



 --
 Yuxiang Shawn Wang
 Gerling Research Lab
 University of Virginia
 yw...@virginia.edu
 +1 (434) 284-0836
 https://sites.google.com/a/virginia.edu/yw5aj/
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] 100 Numpy exercices

2014-05-28 Thread Eraldo Pomponi

 It doesn't use stride_tricks, and seberg doesn't quite like it, but this
 made the rounds in StackOverflow a couple of years ago:


 http://stackoverflow.com/questions/16970982/find-unique-rows-in-numpy-array/16973510#16973510

 It may not work properly on floats, but I think it is a very cool use of
 dtypes. Then again I'm obviously biased...


I remained astonished when I discovered this trick just the day before
Nicolas posted about his amazing contribution  and for my use case (int
matrices) it is working perfectly ...
another candy, again from you Jaime is the fast moving average in:

http://stackoverflow.com/a/14314054

but at a much lower ranking respect to the previous one :P .

Let me thank you all a lot for making the life of mine and many others
easier
sharing your knowledge.

Cheers,
Eraldo
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] getting the equivalent complex dtype from a real or int array

2013-10-30 Thread Eraldo Pomponi
 We really ought to have a special page for all of Robert's little gems!


I'm totally in favor or having that page. In my gmail account almost every
Robert's answer gets a star!!!
Maybe one day I'll try to put them together.

Cheers,
EP
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Array accumulation in numpy

2013-02-19 Thread Eraldo Pomponi
Dear Tony,

I would suggest to look at this post already mentioned by Benjamin .
maybe it fits with your needs!
http://numpy-discussion.10968.n7.nabble.com/Pre-allocate-array-td4870.html

Cheers,
Eraldo



On Tue, Feb 19, 2013 at 4:24 PM, Tony Ladd tl...@che.ufl.edu wrote:

 Thanks to all for a very quick response. np.bincount does what I need.

 Tony

 On 02/19/2013 10:04 AM, Benjamin Root wrote:
 
 
  On Tue, Feb 19, 2013 at 10:00 AM, Tony Ladd tl...@che.ufl.edu
  mailto:tl...@che.ufl.edu wrote:
 
  I want to accumulate elements of a vector (x) to an array (f) based
 on
  an index list (ind).
 
  For example:
 
  x=[1,2,3,4,5,6]
  ind=[1,3,9,3,4,1]
  f=np.zeros(10)
 
  What I want would be produced by the loop
 
  for i=range(6):
   f[ind[i]]=f[ind[i]]+x[i]
 
  The answer is f=array([ 0.,  7.,  0.,  6.,  5.,  0.,  0.,  0.,
   0., 3.])
 
  When I try to use implicit arguments
 
  f[ind]=f[ind]+x
 
  I get f=array([ 0.,  6.,  0.,  4.,  5.,  0.,  0.,  0.,  0.,  3.])
 
 
  So it takes the last value of x that is pointed to by ind and adds
  it to
  f, but its the wrong answer when there are repeats of the same
  entry in
  ind (e.g. 3 or 1)
 
  I realize my code is incorrect, but is there a way to make numpy
  accumulate without using loops? I would have thought so but I cannot
  find anything in the documentation.
 
  Would much appreciate any help - probably a really simple question.
 
  Thanks
 
  Tony
 
 
  I believe you are looking for the equivalent of accumarray in Matlab?
 
  Try this:
 
  http://www.scipy.org/Cookbook/AccumarrayLike
 
  It is a bit touchy about lists and 1-D numpy arrays, but it does the job.
  Also, I think somebody posted an optimized version for simple sums
  recently to this list.
 
  Cheers!
  Ben Root
 
 
 
  ___
  NumPy-Discussion mailing list
  NumPy-Discussion@scipy.org
  http://mail.scipy.org/mailman/listinfo/numpy-discussion

 --
 Tony Ladd

 Chemical Engineering Department
 University of Florida
 Gainesville, Florida 32611-6005
 USA

 Email: tladd-(AT)-che.ufl.edu
 Webhttp://ladd.che.ufl.edu

 Tel:   (352)-392-6509
 FAX:   (352)-392-9514



 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] scipy installation problem

2011-12-14 Thread Eraldo Pomponi
Dear Alexe,

I'm not sure I understood what you mean by install like Ralf.
However, I would also suggest, if you are using Eclipse and PyDev, (after
installing new modules) to remove the current python interpreter (from
Eclipse options) and then re-add it so that the whole pythonpath will be
re-scanned and you will not see any  red  underline (with the msg: module
not found) in your python editor.

Cheers,
Eraldo


On Wed, Dec 14, 2011 at 10:52 PM, Ralf Gommers
ralf.gomm...@googlemail.comwrote:



 On Wed, Dec 14, 2011 at 10:38 PM, Alex Ter-Sarkissov 
 ater1...@gmail.comwrote:

 I'm using Eclipse (PyDev) on MacOS. I downloaded scipy010, installed it
 and added path to .mpkg file to PYTHONPATH and scipy to forced built-in.
 Nothing worked, I keep getting 'module scipy not found'. I then removed the
 link to the .mpkg and still nothing works. Strange enough, numpy works just
 fine. What should I do?


 Not sure what you mean by install here, but you're supposed to
 double-click the mpkg installer to run it, not put it on your PYTHONPATH.
 Note that to use the provided dmg installer, you have to also use the
 matching python from python.org

 Ralf



 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy.mean problems

2011-12-13 Thread Eraldo Pomponi
Hi Fred,

I would suggest you to have a look at pandas (http://pandas.sourceforge.net/)
. It was
really helpful for me. It seems well suited for the type of data that you
are working
with. It has nice brodcasting capabilities to apply numpy functions to a
set column.
http://pandas.sourceforge.net/basics.html#descriptive-statistics
http://pandas.sourceforge.net/basics.html#function-application

Cheers,
Eraldo


On Sun, Dec 11, 2011 at 1:49 PM, ferreirafm ferreir...@lim12.fm.usp.brwrote:



 Aronne Merrelli wrote:
 
  I can recreate this error if tab is a structured ndarray - what is the
  dtype of tab?
 
  If that is correct, I think you could fix this by simplifying things.
  Since
  tab is already an ndarray, you should not need to convert it back into a
  python list. By converting the ndarray back to a list you are making an
  extra level of wrapping as a python object, which is ultimately why you
  get that error about adding numpy.void.
 
  Unfortunately you cannot take directly take a mean of a struct dtype;
  structs are generic so they could have fields with strings, or objects,
  etc, that would be invalid for a mean calculation. However the following
  code fragment should work pretty efficiently. It will make a 1-element
  array of the same dtype as tab, and then populate it with the mean value
  of
  all elements where the length is = 15. Note that dtype.fields.keys()
  gives
  you a nice way to iterate over the fields in the struct dtype:
 
  length_mask = tab['length'] = 15
  tab_means = np.zeros(1, dtype=tab.dtype)
  for k in tab.dtype.fields.keys():
  tab_means[k] = np.mean( tab[k][mask] )
 
  In general this would not work if tab has a field that is not a simple
  numeric type, such as a str, object, ... But it looks like your arrays
 are
  all numeric from your example above.
 
  Hope that helps,
  Aronne
 
 HI Aronne,
 Thanks for your replay. Indeed, tab is a mix of different column types:
 tab.dtype:
 [('sgi', 'i8'), ('length', 'i8'), ('nident', 'i8'), ('pident', 'f8'),
 ('positive', 'i8'), ('ppos', 'f8'), ('mismatch', 'i8'), ('qstart',
 'i8'), ('qend', 'i8'), ('sstart', 'i8'), ('send', 'i8'), ('gapopen',
 'i8'), ('gaps', 'i8'), ('evalue', 'f8'), ('bitscore', 'f8'), ('score',
 'f8')]
  Interestingly, I couldn't be able to import some columns of digits as
 strings like as with R dataframe objects.
 I'll try to adapt your example to my needs and let you know the results.
 Regards.

 --
 View this message in context:
 http://old.nabble.com/numpy.mean-problems-tp32945124p32955052.html
 Sent from the Numpy-discussion mailing list archive at Nabble.com.

 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy.mean problems

2011-12-13 Thread Eraldo Pomponi
Hi Fred,

Pandas has a nice interface to PyTable if you still need it:

http://pandas.sourceforge.net/io.html#hdf5-pytables

However, my intention was just to point you to pandas because it
is really a powerful tool if you need to deal with tabular heterogenic
data. It is also important to notice that there are plans in the numpy
community to include/port part of this package directly in the codebase.
This says a lot about how good it is...

Best,
Eraldo

On Tue, Dec 13, 2011 at 9:01 PM, ferreirafm ferreir...@lim12.fm.usp.brwrote:


 Hi Eraldo,
 Thanks for your suggestion. I was using pytables but give up after known
 that some very useful capabilities are sold as a professional package.
 However, it still useful to many printing and data manipulation and, also,
 it can handle extremely large datasets (which is not my case.).
 Regards,
 Fred


 Eraldo Pomponi wrote:
 
  I would suggest you to have a look at pandas
  (http://pandas.sourceforge.net/)
  . It was
  really helpful for me. It seems well suited for the type of data that you
  are working
  with. It has nice brodcasting capabilities to apply numpy functions to
 a
  set column.
  http://pandas.sourceforge.net/basics.html#descriptive-statistics
  http://pandas.sourceforge.net/basics.html#function-application
 
  Cheers,
  Eraldo
 

 --
 View this message in context:
 http://old.nabble.com/numpy.mean-problems-tp32945124p32970295.html
 Sent from the Numpy-discussion mailing list archive at Nabble.com.

 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion