From killermilind at gmail.com Thu Feb 4 03:57:55 2016 From: killermilind at gmail.com (Milind R) Date: Thu, 4 Feb 2016 14:27:55 +0530 Subject: [SciPy-User] Delivery Status Notification (Failure) In-Reply-To: References: Message-ID: Hi all, I was about to download the numpy package, but noticed that the py35 version of NumPy 1.9.2, 1.9.3, and 1.10.1 are all at least thrice as large as the py34 and py27 versions (x64: 99MB, x86: 63MB). I could not find any documentation, so wanted to ask regular users : why is it so huge? Platform : Windows 7 x64, Python 3.5 on Anaconda 2.4.1 Regards, Milind Regards, Milind On Wed, Feb 3, 2016 at 5:17 PM, Mail Delivery Subsystem < mailer-daemon at googlemail.com> wrote: > Delivery to the following recipient failed permanently: > > scipy-user at scipy.org > > Technical details of permanent failure: > Google tried to deliver your message, but it was rejected by the server > for the recipient domain scipy.org by mail.scipy.org. [23.253.247.54]. > > The error that the other server returned was: > 554 Currently Sending Spam See: > http://www.sorbs.net/lookup.shtml?209.85.214.171 > > > ----- Original message ----- > > DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; > d=gmail.com; s=20120113; > h=mime-version:date:message-id:subject:from:to:content-type; > bh=05GEFGWG7B85JhsZn/MylJZ17h8DRqqcvoiacCi2SO8=; > > b=h4ji5HLhBksAUSAbfMK9NmoQ3jN5Ob+mx+uSLQ3lWZsF77uJLQWKM6vaiLxn25SFmL > > c1OLOFwM0aeavCjIqVubGzyqLcbt6moUeGTG7mI+GTQy3T2NeNqOLZc+v1/QJilh8nSr > > vZ+L8e8a9wtCMmzkpqY+Dser6PekuqdbkvRxLvFp8Fazup1CXMRyjeo0BX3UbchIxqYn > > t+mVv8385keKL4c01vYmFdWZLJjdV0e3ZAKDGdEfXJgkPLRzsA3tJkcWs8xlxZY8dYba > > nJwHVm7U1I12E7cPUDWkdXE6dN7YVqRZY6Sk+1+dNUpCW94YVRzuLSNhfcQi7esU1nlZ > OHyw== > X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; > d=1e100.net; s=20130820; > h=x-gm-message-state:mime-version:date:message-id:subject:from:to > :content-type; > bh=05GEFGWG7B85JhsZn/MylJZ17h8DRqqcvoiacCi2SO8=; > > b=STYc9ijmGq8r4KxTRkh9oJKxljHrFhtHrz5eyIu2ltkHGZUdvzgOGJVy4iXwp3qsH8 > > nyhyyji5fxmLzvUuHbX2vKn0cV9HFoQys70qby2r6uXcnuT+IY5weRcvgV2HiocfgUcE > > t9qYtdoZdYx8XzlGAFwCPlaE0xMjhNNMDpHBpnghLpXcE++GEzm84InAIJrvZt9q9Jzz > > n1ya4h0T/J8uyH6RWiAqSlNqzKBl1ZoEBKlJpGCrMIr3w+/H5Ae42cPewFPxQ4nfD4Fe > > SFCbk2s0Ou8vCBhYZnrDpn78ibkzfFxM2znZDnDMUWxp/fRRQuRz1U0eaZWHt7KYcIpP > ee2A== > X-Gm-Message-State: > AG10YOTCj95R3f58xtCfpgtDltteDIvW1/LbVu4O82eQykaxZyR61dBOqhB3Zj/ZleCWGE83CsSBHv0uZhNq9Q== > MIME-Version: 1.0 > X-Received: by 10.182.166.1 with SMTP id zc1mr1323024obb.23.1454500075993; > Wed, 03 Feb 2016 03:47:55 -0800 (PST) > Received: by 10.76.37.103 with HTTP; Wed, 3 Feb 2016 03:47:55 -0800 (PST) > Date: Wed, 3 Feb 2016 17:17:55 +0530 > Message-ID: < > CACaumOd-HFAMDo-M_iTx_SKE49a7FYa8QynbdEah8Meejp26iQ at mail.gmail.com> > Subject: NumP-py35 package size > From: Milind R > To: scipy-user at scipy.org > Content-Type: multipart/alternative; boundary=e89a8ff1cd405b1a61052adc30f6 > > Hi all, > > I was about to download the numpy package, but noticed that the py35 > version of NumPy 1.9.2, 1.9.3, and 1.10.1 are all at least thrice as large > as the py34 and py27 versions (x64: 99MB, x86: 63MB). I could not find any > documentation, so wanted to ask regular users : why is it so huge? > > Platform : Windows 7 x64, Python 3.5 on Anaconda 2.4.1 > > Regards, > Milind > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew.brett at gmail.com Thu Feb 4 04:01:30 2016 From: matthew.brett at gmail.com (Matthew Brett) Date: Thu, 4 Feb 2016 01:01:30 -0800 Subject: [SciPy-User] Delivery Status Notification (Failure) In-Reply-To: References: Message-ID: Hi, On Thu, Feb 4, 2016 at 12:57 AM, Milind R wrote: > Hi all, > > I was about to download the numpy package, but noticed that the py35 version > of NumPy 1.9.2, 1.9.3, and 1.10.1 are all at least thrice as large as the > py34 and py27 versions (x64: 99MB, x86: 63MB). I could not find any > documentation, so wanted to ask regular users : why is it so huge? > > Platform : Windows 7 x64, Python 3.5 on Anaconda 2.4.1 I think you want the Anaconda mailing list for that question - the scipy team doesn't build the Anaconda binaries... https://groups.google.com/a/continuum.io/forum/#!forum/anaconda Cheers, Matthew From bryanv at continuum.io Thu Feb 4 17:05:24 2016 From: bryanv at continuum.io (Bryan Van de Ven) Date: Thu, 4 Feb 2016 16:05:24 -0600 Subject: [SciPy-User] ANN: Bokeh 0.11.1 released Message-ID: <6BE0C8EE-2EAF-46AA-82B1-6B7649BF0E05@continuum.io> Hi all, I am please to announce a new point release of Bokeh, version 0.11.1, is now available. Installation instructions can be found in the usual location: http://bokeh.pydata.org/en/latest/docs/installation.html This release focused on providing bug fixes, small features, and documentation improvements. Highlights include: * documentation: - instructions for running Bokeh server behind an SSL terminated proxy - Quickstart update and cleanup * bugfixes: - notebook comms handles work properly - MultiSelect works - Oval legend renders correctly - Plot title orientation setting works - Annulus glyph works on IE/Edge * features: - preview of new streaming API in OHLC demo - undo/redo tool add, reset tool now resets plot size - "bokeh static" and "bokeh sampledata" commands - can now create Bokeh apps directly from Jupyter Notebooks - headers and content type now configurable on AjaxDataSource - new network config options for "bokeh serve" For full details, refer to the CHANGELOG in the GitHub repository, and the full release notes (http://bokeh.pydata.org/en/latest/docs/releases/0.11.1.html) Issues, enhancement requests, and pull requests can be made on the Bokeh Github page: https://github.com/bokeh/bokeh Full documentation is available at http://bokeh.pydata.org/en/0.11.1 Questions can be directed to the Bokeh mailing list: bokeh at continuum.io Thanks, Bryan From cell at michaelclerx.com Mon Feb 8 17:55:36 2016 From: cell at michaelclerx.com (Michael Clerx) Date: Mon, 8 Feb 2016 23:55:36 +0100 Subject: [SciPy-User] "Trust-region-reflective" method for optimization Message-ID: <56B91CE8.3040006@michaelclerx.com> Dear all, Does anyone know if the "trust-region-reflective" optimization method used in Matlab has a NumPy/SciPy equivalent? http://mathworks.com/help/optim/ug/lsqnonlin.html#input_argument_options I'm looking for an implementation of the same algorithm, not just any type of nonlinear optimization. thanks, Michael From evgeny.burovskiy at gmail.com Tue Feb 9 00:06:46 2016 From: evgeny.burovskiy at gmail.com (Evgeni Burovski) Date: Tue, 9 Feb 2016 05:06:46 +0000 Subject: [SciPy-User] "Trust-region-reflective" method for optimization In-Reply-To: <56B91CE8.3040006@michaelclerx.com> References: <56B91CE8.3040006@michaelclerx.com> Message-ID: Yes: http://docs.scipy.org/doc/scipy-0.17.0/reference/generated/scipy.optimize.least_squares.html#scipy.optimize.least_squares Cheers, Evgeni 09.02.2016 1:55 ???????????? "Michael Clerx" ???????: > Dear all, > > Does anyone know if the "trust-region-reflective" optimization method used > in Matlab has a NumPy/SciPy equivalent? > > http://mathworks.com/help/optim/ug/lsqnonlin.html#input_argument_options > > I'm looking for an implementation of the same algorithm, not just any type > of nonlinear optimization. > > thanks, > Michael > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From charlesr.harris at gmail.com Tue Feb 9 21:09:51 2016 From: charlesr.harris at gmail.com (Charles R Harris) Date: Tue, 9 Feb 2016 19:09:51 -0700 Subject: [SciPy-User] NumPy 1.11.0b3 released. Message-ID: Hi All, I'm pleased to announce the release of NumPy 1.11.0b3. This beta contains additional bug fixes as well as limiting the number of FutureWarnings raised by assignment to masked array slices. One issue that remains to be decided is whether or not to postpone raising an error for floats used as indexes. Sources may be found on Sourceforge and both sources and OS X wheels are availble on pypi. Please test, hopefully this will be that last beta needed. As a note on problems encountered, twine uploads continue to fail for me, but there are still variations to try. The wheeluploader downloaded wheels as it should, but could not upload them, giving the error message "HTTPError: 413 Client Error: Request Entity Too Large for url: https://www.python.org/pypi". Firefox also complains that http://wheels.scipy.org is incorrectly configured with an invalid certificate. Enjoy, Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: From yellowhat46 at gmail.com Thu Feb 11 14:23:32 2016 From: yellowhat46 at gmail.com (Vasco Gervasi) Date: Thu, 11 Feb 2016 20:23:32 +0100 Subject: [SciPy-User] Triangulate point cloud Message-ID: Hi all, I am looking for a way to traingulate a point cloud, in other words nodes to triangular. I tried scipy.spatial.Delaunay and ConvexHull, but for some reason it tends to connect nodes that are very far away. At this address you can find a good example of what I am looking for: https://paste.ee/p/RBank. As you can see I gave some points around the lateral face of a cylinder, the problems are - it connects nodes that are on the opposite side of the cylinder - if alseo connect nodes that are on the two front face of the cylinder This is just a simple example, I am trying to triangulate a more complex point cloud. So in my opinion the perfect solution would be to define the max distance between nodes that can be connected. Best regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From gary.ruben at gmail.com Thu Feb 11 18:35:53 2016 From: gary.ruben at gmail.com (gary ruben) Date: Fri, 12 Feb 2016 10:35:53 +1100 Subject: [SciPy-User] Triangulate point cloud In-Reply-To: References: Message-ID: Hi Vasco, Another possible option is vtk's Delaunay3D method. I used this a long time ago when it was one of the only options I could find that could reliably triangulate points on the surface of a sphere. It has a couple of parameters you can fiddle with to affect its behaviour: http://docs.enthought.com/mayavi/mayavi/auto/example_delaunay_graph.html Gary On 12 February 2016 at 06:23, Vasco Gervasi wrote: > Hi all, > I am looking for a way to traingulate a point cloud, in other words nodes > to triangular. > I tried scipy.spatial.Delaunay and ConvexHull, but for some reason it > tends to connect nodes that are very far away. > At this address you can find a good example of what I am looking for: > https://paste.ee/p/RBank. > As you can see I gave some points around the lateral face of a cylinder, > the problems are > - it connects nodes that are on the opposite side of the cylinder > - if alseo connect nodes that are on the two front face of the cylinder > This is just a simple example, I am trying to triangulate a more complex > point cloud. > So in my opinion the perfect solution would be to define the max distance > between nodes that can be connected. > > Best regards > > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From athanastasiou at gmail.com Fri Feb 12 07:48:15 2016 From: athanastasiou at gmail.com (Athanasios Anastasiou) Date: Fri, 12 Feb 2016 12:48:15 +0000 Subject: [SciPy-User] Triangulate point cloud In-Reply-To: References: Message-ID: Hello In addition to the already suggested ways of doing this: 1) If you don't have a prohibitively large dataset (a few hundred thousand points), you can evaluate their inter-point distance and then use that one to establish a threshold. If you do a histogram on point distance you will see clearly the bunches of points that are closely to each other and the bunches, or clusters, of points that are further apart. You can then determine the distance threshold that will exclude surfaces across the cylinder. 2) Another way I have found to do this is to use this plugin: http://blenderartists.org/forum/showthread.php?241950-A-Script-to-Skin-a-Point-Cloud-(for-Blender-2-6x-or-Later) for blender. It is really doing a good job and once your point cloud in in Blender you can use other tools to improve your mesh. In my case, I wrote a very simple script in Python to package my point cloud into a VRML pointset (http://www.c3.hu/cryptogram/vrmltut/part5.html) which was the easiest way in to import it to Blender. Hope this helps. All the best AA On Thu, Feb 11, 2016 at 11:35 PM, gary ruben wrote: > Hi Vasco, > > Another possible option is vtk's Delaunay3D method. I used this a long > time ago when it was one of the only options I could find that could > reliably triangulate points on the surface of a sphere. It has a couple of > parameters you can fiddle with to affect its behaviour: > http://docs.enthought.com/mayavi/mayavi/auto/example_delaunay_graph.html > > Gary > > On 12 February 2016 at 06:23, Vasco Gervasi wrote: > >> Hi all, >> I am looking for a way to traingulate a point cloud, in other words nodes >> to triangular. >> I tried scipy.spatial.Delaunay and ConvexHull, but for some reason it >> tends to connect nodes that are very far away. >> At this address you can find a good example of what I am looking for: >> https://paste.ee/p/RBank. >> As you can see I gave some points around the lateral face of a cylinder, >> the problems are >> - it connects nodes that are on the opposite side of the cylinder >> - if alseo connect nodes that are on the two front face of the cylinder >> This is just a simple example, I am trying to triangulate a more complex >> point cloud. >> So in my opinion the perfect solution would be to define the max distance >> between nodes that can be connected. >> >> Best regards >> >> _______________________________________________ >> SciPy-User mailing list >> SciPy-User at scipy.org >> https://mail.scipy.org/mailman/listinfo/scipy-user >> >> > > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yellowhat46 at gmail.com Fri Feb 12 08:24:40 2016 From: yellowhat46 at gmail.com (Vasco Gervasi) Date: Fri, 12 Feb 2016 14:24:40 +0100 Subject: [SciPy-User] Triangulate point cloud In-Reply-To: References: Message-ID: Thanks. I will try mayavi and blender. Regarding the suggestione number 1 of AA do you have an example. -------------- next part -------------- An HTML attachment was scrubbed... URL: From athanastasiou at gmail.com Fri Feb 12 09:41:43 2016 From: athanastasiou at gmail.com (Athanasios Anastasiou) Date: Fri, 12 Feb 2016 14:41:43 +0000 Subject: [SciPy-User] Triangulate point cloud In-Reply-To: References: Message-ID: Off the top of my head: from scipy.spatial import distance from scipy.stats import histogram from scipy import nan #p is your data structures that holds all of your data points, it can be n-dimensional of course. #Here, it is a list of tuples, suggesting a simple 2D problem. p=[(2,2),(5,5),(1,7),(2,3)] #Get the unique distances #If you have a huge amount of points, this is the point where the program might take a little bit of time until it comes back with the results. d = distance.pdist(p) #Get the distance matrix, this is always a square kxk matrix, where k is the index of a point in p #If you have a huge amount of points, this is the bit where the program a) takes a long time to finish, b) crashes because of memory issues. For very large problems, you can upload your points to a database server and run a query for it to calculate your distance matrix. So, you can hire a powerful EC2 (for example) instance and run your query there or run the query over a distributed configuration. Both options aiming to improve speed and capacity. Q = distance.squareform(d) #The d matrix are the unique values of the upper (or lower) diagonal part of Q. Q is much easier to work with (in terms of referencing), if you want the distance between any two point m,n you just Q[m,n]. #Here is the Euclidean Q for the above p. #array([[ 0. , 4.24264069, 5.09901951, 1. ], # [ 4.24264069, 0. , 4.47213595, 3.60555128], # [ 5.09901951, 4.47213595, 0. , 4.12310563], # [ 1. , 3.60555128, 4.12310563, 0. ]]) #Get the histogram of that H = histogram(d); #This could also be done on Q, by reshaping it to a 1 x (M*N) vector but if you have a huge number of points it is not advisable. You can see how quickly this eats up memory. #This can also be done with matplotlib.pyplot.hist(d) which will also draw the histogram for you besides returning it. If you want to free up some memory to fit even more data to your problem, you can round everything to a few decimal places and use integers. So, for example, int(round(5.678928527817364 * 10000))==56789, which is a nice little unsigned integer of 2 bytes instead of a double of 8 bytes. Of course this assumes that 4 decimals is accurate enough. To get back to your data range, just divide by 10000 and assign to (float or double). Hope this helps. All the best AA On Fri, Feb 12, 2016 at 1:24 PM, Vasco Gervasi wrote: > Thanks. I will try mayavi and blender. > Regarding the suggestione number 1 of AA do you have an example. > > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yellowhat46 at gmail.com Fri Feb 12 10:00:45 2016 From: yellowhat46 at gmail.com (Vasco Gervasi) Date: Fri, 12 Feb 2016 16:00:45 +0100 Subject: [SciPy-User] Triangulate point cloud In-Reply-To: References: Message-ID: Sorry but i didn't understand how to use the histogram [H] to find the connectivity. Thank you very much. -------------- next part -------------- An HTML attachment was scrubbed... URL: From athanastasiou at gmail.com Fri Feb 12 10:07:31 2016 From: athanastasiou at gmail.com (Athanasios Anastasiou) Date: Fri, 12 Feb 2016 15:07:31 +0000 Subject: [SciPy-User] Triangulate point cloud In-Reply-To: References: Message-ID: Ah, the above code will not help you connect the right points, this is still a triangulation problem. The above code will help you determine the distance threshold you need to use (in other tools or algorithms, including the surface plugin of blender) to avoid artifacts such as those that you are describing in your original question (i.e. surfaces across a cylinder). Otherwise, you would have to estimate this with trial and error. All the best AA On Fri, Feb 12, 2016 at 3:00 PM, Vasco Gervasi wrote: > Sorry but i didn't understand how to use the histogram [H] to find the > connectivity. > > Thank you very much. > > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fboulogne at sciunto.org Fri Feb 12 10:46:31 2016 From: fboulogne at sciunto.org (=?UTF-8?Q?Fran=c3=a7ois_Boulogne?=) Date: Fri, 12 Feb 2016 10:46:31 -0500 Subject: [SciPy-User] Triangulate point cloud In-Reply-To: References: Message-ID: <56BDFE57.7060408@sciunto.org> You also have this code : https://github.com/pearu/pyvtk The doc has weaknesses, but I could make it work for my problem. Best, -- Fran?ois Boulogne. http://www.sciunto.org GPG: 32D5F22F From yellowhat46 at gmail.com Sat Feb 13 05:17:00 2016 From: yellowhat46 at gmail.com (Vasco Gervasi) Date: Sat, 13 Feb 2016 11:17:00 +0100 Subject: [SciPy-User] Triangulate point cloud In-Reply-To: <56BDFE57.7060408@sciunto.org> References: <56BDFE57.7060408@sciunto.org> Message-ID: Fran?ois could you share an example for pyvtk, because examples in https://github.com/pearu/pyvtk/tree/master/examples do not work. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From yellowhat46 at gmail.com Sat Feb 13 08:40:32 2016 From: yellowhat46 at gmail.com (Vasco Gervasi) Date: Sat, 13 Feb 2016 14:40:32 +0100 Subject: [SciPy-User] Triangulate point cloud In-Reply-To: References: <56BDFE57.7060408@sciunto.org> Message-ID: Seems that I found a good solution [I will try later with real data]. Using pyevtk I am able to create a .vtu file: > import numpy > from pyevtk.hl import pointsToVTK > n = 10**5 > x = numpy.random.randn(n) > y = numpy.random.randn(n) > z = numpy.random.randn(n) > d = numpy.random.randn(n) > pointsToVTK("./points", x, y, z, data = {"C" : d}) Then open the points.vtu file in paraview and run Filters -> Alphabetical -> Delauny3D. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffreback at gmail.com Sat Feb 13 19:53:15 2016 From: jeffreback at gmail.com (Jeff Reback) Date: Sat, 13 Feb 2016 19:53:15 -0500 Subject: [SciPy-User] ANN: pandas v0.18.0rc1 - RELEASE CANDIDATE Message-ID: Hi, I'm pleased to announce the availability of the first release candidate of Pandas 0.18.0. Please try this RC and report any issues here: Pandas Issues We will be releasing officially in 1-2 weeks or so. **RELEASE CANDIDATE 1** This is a major release from 0.17.1 and includes a small number of API changes, several new features, enhancements, and performance improvements along with a large number of bug fixes. We recommend that all users upgrade to this version. Highlights include: - pandas >= 0.18.0 will no longer support compatibility with Python version 2.6 GH7718 or version 3.3 GH11273 - Moving and expanding window functions are now methods on Series and DataFrame similar to .groupby like objects, see here . - Adding support for a RangeIndex as a specialized form of the Int64Index for memory savings, see here . - API breaking .resample changes to make it more .groupby like, see here - Removal of support for positional indexing with floats, which was deprecated since 0.14.0. This will now raise a TypeError, see here - The .to_xarray() function has been added for compatibility with the xarray package see here . - Addition of the .str.extractall() method , and API changes to the the .str.extract() method , and the .str.cat() method - pd.test() top-level nose test runner is available GH4327 See the Whatsnew for much more information. Best way to get this is to install via conda from our development channel. Builds for osx-64,linux-64,win-64 for Python 2.7 and Python 3.5 are all available. conda install pandas=v0.18.0rc1 -c pandas Thanks to all who made this release happen. It is a very large release! Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: From yellowhat46 at gmail.com Mon Feb 15 14:48:44 2016 From: yellowhat46 at gmail.com (Vasco Gervasi) Date: Mon, 15 Feb 2016 20:48:44 +0100 Subject: [SciPy-User] 3D scatter data interpolate Message-ID: Hi all, I would like to interpolate 3D scatter data. I have some 3D points, each point has an associated value, I would like to interpolate these point to calculate the value of a random point. This example may help to understand: > from math import cos, sin > from scipy.interpolate import Rbf > from numpy import linspace, pi > from mpl_toolkits.mplot3d import Axes3D > import matplotlib.pyplot as plt > #%% Data > R = 10.0 > x = list() > y = list() > z = list() > c = list() > for i in linspace(0.0,10.0,11): > for t in linspace(0.0,2*pi,90): > x.append(R*cos(t)) > y.append(R*sin(t)) > z.append(i) > c.append(i) > #%% Plot > fig = plt.figure() > ax = fig.add_subplot(111, projection='3d') > sc = ax.scatter(x, y, z, c=z) > ax.set_xlabel('X') > ax.set_ylabel('Y') > ax.set_zlabel('Z') > plt.colorbar(sc) > #%% > rbfi = Rbf(x, y, z, c) > xi = [0,0] > yi = [0,0] > zi = [0,1] > print rbfi(xi, yi, zi) As you can see here we have some points over a cylinder, each point has associate a value (color), which in this case is the z-coordinate. scipy.interpolate.Rbf should answer my problem, to better understsand how it works I gave it some points [[0,0,0],[0,0,1]], but the result of rbfi(xi, yi, zi) is [-1.04833984 -0.10205078]. I expected that a point along the axis, aligned with some point should return the z-coordinate of this point [0, 1] but got some negative number. Any ideas? Do you have any alternative that I can use to have a linear interpolation or by the nearest? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From gary.ruben at gmail.com Sat Feb 20 20:10:57 2016 From: gary.ruben at gmail.com (gary ruben) Date: Sun, 21 Feb 2016 12:10:57 +1100 Subject: [SciPy-User] 3D scatter data interpolate In-Reply-To: References: Message-ID: Hi Vasco, Sorry for not replying sooner. I thought I had a self-contained example of using the scipy.ndimage.map_coordinates() function to do this. I can't find it though. It may help to look at how I used map_coordinates() to interpolate a vector field to map the vector onto a sphere: https://gist.github.com/gazzar/369ed55f15045bb99cae That code is pretty old now and I don't have any small test data sets for it, so just take a look and see if it helps, Gary On 16 February 2016 at 06:48, Vasco Gervasi wrote: > Hi all, > I would like to interpolate 3D scatter data. > I have some 3D points, each point has an associated value, I would like to > interpolate these point to calculate the value of a random point. > This example may help to understand: > >> from math import cos, sin >> from scipy.interpolate import Rbf >> from numpy import linspace, pi >> from mpl_toolkits.mplot3d import Axes3D >> import matplotlib.pyplot as plt >> #%% Data >> R = 10.0 >> x = list() >> y = list() >> z = list() >> c = list() >> for i in linspace(0.0,10.0,11): >> for t in linspace(0.0,2*pi,90): >> x.append(R*cos(t)) >> y.append(R*sin(t)) >> z.append(i) >> c.append(i) >> #%% Plot >> fig = plt.figure() >> ax = fig.add_subplot(111, projection='3d') >> sc = ax.scatter(x, y, z, c=z) >> ax.set_xlabel('X') >> ax.set_ylabel('Y') >> ax.set_zlabel('Z') >> plt.colorbar(sc) >> #%% >> rbfi = Rbf(x, y, z, c) >> xi = [0,0] >> yi = [0,0] >> zi = [0,1] >> print rbfi(xi, yi, zi) > > As you can see here we have some points over a cylinder, each point has > associate a value (color), which in this case is the z-coordinate. > scipy.interpolate.Rbf should answer my problem, to better understsand how > it works I gave it some points [[0,0,0],[0,0,1]], but the result of > rbfi(xi, yi, zi) is [-1.04833984 -0.10205078]. > I expected that a point along the axis, aligned with some point should > return the z-coordinate of this point [0, 1] but got some negative number. > Any ideas? > Do you have any alternative that I can use to have a linear interpolation > or by the nearest? > > Thanks > > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bhmerchant at gmail.com Sat Feb 20 20:53:39 2016 From: bhmerchant at gmail.com (Brian Merchant) Date: Sat, 20 Feb 2016 17:53:39 -0800 Subject: [SciPy-User] Cython-izing calls to scipy.integrate.odeint: is my minimal example a good way to go about it? Message-ID: Hi all, The major bottleneck in my simulation code is the function supplied to `scipy.integrate.odeint` (call it `f`). `f` requires a lot of additional parameters (which are usually passed in as a tuple to the args keyword of `odeint`). Based on some stuff I found on the internet, I am thinking of making `f` a Cython extension type with the methods __init__ and __call__. Here's a minimal example: https://gist.github.com/bmer/10e6ec268677288b2d60 Now, I can pass `f` to `odeint` after I initialize it, and everything works okay (tried it out). Is this the best I can do in terms of efficiency? Kind regards, Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: From yellowhat46 at gmail.com Sun Feb 21 09:48:24 2016 From: yellowhat46 at gmail.com (Vasco Gervasi) Date: Sun, 21 Feb 2016 15:48:24 +0100 Subject: [SciPy-User] 3D scatter data interpolate In-Reply-To: References: Message-ID: Sorry but I am not able to understand how map_coordinates works. Let's say that I am in 2D and I have the points [x=0, y=0] and [x=1, y=1], and each point has associated a value [x=0, y=0, v=0] and [x=1, y=1, v=2]. My input for map_coordinates should be: > in_data = np.array([[0.,0.,0.], > [1.,1.,2.]]) I would like to interpolate in the middle point [x=0.5, y=0.5] so the coordinates should be; > lookpoints = np.array([[0.5, 0.5]]).T > So: > s = map_coordinates(in_data, lookpoints, order=1) > But i get s=0.5 not 1. What am I doing wrong? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Sun Feb 21 20:36:54 2016 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Mon, 22 Feb 2016 12:36:54 +1100 Subject: [SciPy-User] 3D scatter data interpolate In-Reply-To: References: Message-ID: Hi Vasco, The input to map_coordinates should be a regularly-sampled array, like an image. In your case, you've provided an input image of shape (2, 3). In the format you're thinking, (x, y, val) tuples, the input you have provided would be expressed as: [[0, 0, 0], [0, 1, 0], [0, 2, 0], [1, 0, 1], [1, 1, 1], [1, 2, 2]] As you can see, using linear interpolation at (0.5, 0.5) in that image interpolates between the values 0, 0, 1, 1, thus resulting in 0.5. Juan. On Mon, Feb 22, 2016 at 1:48 AM, Vasco Gervasi wrote: > Sorry but I am not able to understand how map_coordinates works. > Let's say that I am in 2D and I have the points [x=0, y=0] and [x=1, y=1], > and each point has associated a value [x=0, y=0, v=0] and [x=1, y=1, v=2]. > My input for map_coordinates should be: > >> in_data = np.array([[0.,0.,0.], >> [1.,1.,2.]]) > > I would like to interpolate in the middle point [x=0.5, y=0.5] so the > coordinates should be; > >> lookpoints = np.array([[0.5, 0.5]]).T >> > So: > >> s = map_coordinates(in_data, lookpoints, order=1) >> > But i get s=0.5 not 1. > What am I doing wrong? > > Thanks > > > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yellowhat46 at gmail.com Mon Feb 22 02:58:45 2016 From: yellowhat46 at gmail.com (Vasco Gervasi) Date: Mon, 22 Feb 2016 08:58:45 +0100 Subject: [SciPy-User] 3D scatter data interpolate In-Reply-To: References: Message-ID: So how can do if the input is not a regularly-sampled array? Like some scattered data? In my last mail I have just 2 points now are 6. Thank you very much -------------- next part -------------- An HTML attachment was scrubbed... URL: From nelle.varoquaux at gmail.com Mon Feb 22 04:15:51 2016 From: nelle.varoquaux at gmail.com (Nelle Varoquaux) Date: Mon, 22 Feb 2016 10:15:51 +0100 Subject: [SciPy-User] Scipy2016: call for proposals Message-ID: Dear all, SciPy 2016, the Fifteenth Annual Conference on Python in Science, takes place in Austin, TX on July, 11th to 17th. The conference features two days of tutorials by followed by three days of presentations, and concludes with two days of developer sprints on projects of interest to attendees. . The topics presented at SciPy are very diverse, with a focus on advanced software engineering and original uses of Python and its scientific libraries, either in theoretical or experimental research, from both academia and the industry. This year we are happy to announce two specialized tracks that run in parallel to the general conference (Data Science , High Performance Computing) and 8 mini-symposia (Earth and Space Science, Biology and Medicine, Engineering, Social Sciences, Special Purpose Databases, Case Studies in Industry, Education, Reproducibility) Submissions for talks and posters are welcome on our website ( http://scipy2016.scipy.org). In your abstract, please provide details on what Python tools are being employed, and how. The talk and poster submission deadline is March 25th, 2016, while the tutorial submission deadline is March, 21st, 2016. Important dates: Mar 21: Tutorial Proposals Due Mar 25: Talk and Poster Proposals Due May 11: Plotting Contest Submissions Due Apr 22: Tutorials Announced Apr 22: Financial Aid Submissions Due May 4: Talk and Posters Announced May 11: Financial Aid Recipients Notified May 22: Early Bird Registration Deadline Jul 11-12: SciPy 2016 Tutorials Jul 13-15: SciPy 2016 General Conference Jul 16-17: SciPy 2016 Sprints We look forward to an exciting conference and hope to see you in Austin in July! The Scipy 2016 http://scipy2016.scipy.org/ Conference Chairs: Aric Hagberg, Prabhu Ramachandran Tutorial Chairs: Justin Vincent, Ben Root Program Chair: Serge Rey, Nelle Varoquaux Proceeding Chairs: Sebastian Benthall -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Mon Feb 22 08:31:29 2016 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Tue, 23 Feb 2016 00:31:29 +1100 Subject: [SciPy-User] 3D scatter data interpolate In-Reply-To: References: Message-ID: Have a look at the functions in scipy.interpolate . `griddata` looks like what you need but is not defined for only two points in 2D: you need to define values for enough points to form a convex hull. (ie at a minimum, ndim + 1 points.) hth! Juan. On Mon, Feb 22, 2016 at 6:58 PM, Vasco Gervasi wrote: > So how can do if the input is not a regularly-sampled array? Like some > scattered data? > In my last mail I have just 2 points now are 6. > > Thank you very much > > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From charlesr.harris at gmail.com Mon Feb 22 20:47:35 2016 From: charlesr.harris at gmail.com (Charles R Harris) Date: Mon, 22 Feb 2016 18:47:35 -0700 Subject: [SciPy-User] Numpy 1.11.0rc1 released. Message-ID: Hi All, I'm delighted to announce the release of Numpy 1.11.0rc1. Hopefully the issues discovered in 1.11.0b3 have been dealt with and this release can go on to become the official release. Source files and documentation can be found on Sourceforge , while source files and OS X wheels for Python 2.7, 3.3, 3.4, and 3.5 can be installed from Pypi. Please test thoroughly. Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: From charlesr.harris at gmail.com Tue Feb 23 07:02:41 2016 From: charlesr.harris at gmail.com (Charles R Harris) Date: Tue, 23 Feb 2016 05:02:41 -0700 Subject: [SciPy-User] Numpy 1.11.0rc1 released. In-Reply-To: References: Message-ID: On Mon, Feb 22, 2016 at 6:47 PM, Charles R Harris wrote: > Hi All, > > I'm delighted to announce the release of Numpy 1.11.0rc1. Hopefully the > issues discovered in 1.11.0b3 have been dealt with and this release can go > on to become the official release. Source files and documentation can be > found on Sourceforge > , while > source files and OS X wheels for Python 2.7, 3.3, 3.4, and 3.5 can be > installed from Pypi. Please test thoroughly. > Issues reported by Christoph at https://github.com/numpy/numpy/issues/7316. Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: From cimrman3 at ntc.zcu.cz Wed Feb 24 08:20:48 2016 From: cimrman3 at ntc.zcu.cz (Robert Cimrman) Date: Wed, 24 Feb 2016 14:20:48 +0100 Subject: [SciPy-User] ANN: SfePy 2016.1 Message-ID: <56CDAE30.8030108@ntc.zcu.cz> I am pleased to announce release 2016.1 of SfePy. Description ----------- SfePy (simple finite elements in Python) is a software for solving systems of coupled partial differential equations by the finite element method or by the isogeometric analysis (preliminary support). It is distributed under the new BSD license. Home page: http://sfepy.org Mailing list: http://groups.google.com/group/sfepy-devel Git (source) repository, issue tracker, wiki: http://github.com/sfepy Highlights of this release -------------------------- - major simplification of finite element field code - automatic checking of shapes of term arguments - improved mesh parametrization code and documentation - support for fieldsplit preconditioners of PETSc For full release notes see http://docs.sfepy.org/doc/release_notes.html#id1 (rather long and technical). Best regards, Robert Cimrman on behalf of the SfePy development team --- Contributors to this release in alphabetical order: Robert Cimrman Vladimir Lukes From baruchel at gmx.com Wed Feb 24 14:43:06 2016 From: baruchel at gmx.com (Thomas Baruchel) Date: Wed, 24 Feb 2016 20:43:06 +0100 (CET) Subject: [SciPy-User] Is this weird answer a bug in optimize.newton? Message-ID: Hi, with my students, this afternoon, I encountered the following annoying behaviour of Scipy: >>> from scipy import optimize >>> optimize.newton(lambda x: x**3-x+1, 0) 0.999999989980082 This is very weird, because the equation is rather simple with simple coefficients, and the initial point is simple also. Any teacher or student could fall into this case when trying to use optimize.newton. Of course, the answer is absolutely wrong. First, some facts: * using the function with the derivative gives the correct answer (we are not in some tricky case); * my students wrote pieces of code with Newton-Raphson algorithm returning the expected answer even without the derivative; they guessed the value of the derivative either by some (f(x+eps)-f(x-eps))/(2*eps) or (f(x+eps)-f(x))/eps, etc. All these methods worked well. I had a glance in the source code and found that: * the function is actually thinking the answer is correct (the answer has nothing to do with iterating too many times) because two consecutive values of x are close "enough". * the answer is returned after only 3 iterations (correct answer requires about 20 iterations). I think it has to do with the way the derivative is computed by Scipy (in order to call the f function only once in each iteration, the secant is computed by using f(x) for consecutive values of x (rather than by using some epsilon); furthermore, in order to start this method the function has to provide an arbitrary "second" value of x). Is it a bug? Regards. -- Thomas Baruchel From oscar.j.benjamin at gmail.com Wed Feb 24 18:36:08 2016 From: oscar.j.benjamin at gmail.com (Oscar Benjamin) Date: Wed, 24 Feb 2016 23:36:08 +0000 Subject: [SciPy-User] Is this weird answer a bug in optimize.newton? In-Reply-To: References: Message-ID: On 24 February 2016 at 19:43, Thomas Baruchel wrote: > with my students, this afternoon, I encountered the following annoying > behaviour of Scipy: > >>>> from scipy import optimize >>>> optimize.newton(lambda x: x**3-x+1, 0) > > 0.999999989980082 > > This is very weird, because the equation is rather simple with simple > coefficients, > and the initial point is simple also. Somehow the initial guess is problematic: In [1]: from scipy import optimize In [2]: optimize.newton(lambda x: x**3 - x + 1, 0) Out[2]: 0.999999989980082 In [3]: optimize.newton(lambda x: x**3 - x + 1, 0.1) Out[3]: -1.324717957244745 In [4]: optimize.newton(lambda x: x**3 - x + 1, -0.1) Out[4]: -1.3247179572447458 These last two are the correct answer: In [6]: from numpy import roots In [7]: roots([1, 0, -1, 1]) Out[7]: array([-1.32471796+0.j , 0.66235898+0.56227951j, 0.66235898-0.56227951j]) The only thing that jumps out to me is that you've picked an initial guess at which the function has a zero second derivative. I'm not sure why that would cause the method to fail but Newton solvers are sensitive to various singularities in the input function. -- Oscar From david.mikolas1 at gmail.com Wed Feb 24 19:21:42 2016 From: david.mikolas1 at gmail.com (David Mikolas) Date: Thu, 25 Feb 2016 08:21:42 +0800 Subject: [SciPy-User] Is this weird answer a bug in optimize.newton? In-Reply-To: References: Message-ID: First of all it sounds like your students are receiving a very good educational experience! typing help(optimize.newton) returns the following: fprime : function, optional The derivative of the function when available and convenient. If it is None (default), then the secant method is used. A look in https://en.wikipedia.org/wiki/Secant_method#Convergence returns the following: "If the initial values are not close enough to the root, then there is no guarantee that the secant method converges." So it looks like the behavior of scipy.optimize.newton in your example is neither unexpected nor a bug. On Thu, Feb 25, 2016 at 7:36 AM, Oscar Benjamin wrote: > On 24 February 2016 at 19:43, Thomas Baruchel wrote: > > with my students, this afternoon, I encountered the following annoying > > behaviour of Scipy: > > > >>>> from scipy import optimize > >>>> optimize.newton(lambda x: x**3-x+1, 0) > > > > 0.999999989980082 > > > > This is very weird, because the equation is rather simple with simple > > coefficients, > > and the initial point is simple also. > > Somehow the initial guess is problematic: > > In [1]: from scipy import optimize > > In [2]: optimize.newton(lambda x: x**3 - x + 1, 0) > Out[2]: 0.999999989980082 > > In [3]: optimize.newton(lambda x: x**3 - x + 1, 0.1) > Out[3]: -1.324717957244745 > > In [4]: optimize.newton(lambda x: x**3 - x + 1, -0.1) > Out[4]: -1.3247179572447458 > > These last two are the correct answer: > > In [6]: from numpy import roots > > In [7]: roots([1, 0, -1, 1]) > Out[7]: > array([-1.32471796+0.j , 0.66235898+0.56227951j, > 0.66235898-0.56227951j]) > > The only thing that jumps out to me is that you've picked an initial > guess at which the function has a zero second derivative. I'm not sure > why that would cause the method to fail but Newton solvers are > sensitive to various singularities in the input function. > > -- > Oscar > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.mikolas1 at gmail.com Wed Feb 24 19:25:56 2016 From: david.mikolas1 at gmail.com (David Mikolas) Date: Thu, 25 Feb 2016 08:25:56 +0800 Subject: [SciPy-User] Is this weird answer a bug in optimize.newton? In-Reply-To: References: Message-ID: Sorry - you are talking about the fact that it returns a wrong answer without indication that ti's wrong. Don't know if that's a "bug" but it's certainly incorrect behavior inherent to the secant method. On Thu, Feb 25, 2016 at 8:21 AM, David Mikolas wrote: > First of all it sounds like your students are receiving a very good > educational experience! > > typing help(optimize.newton) returns the following: > > fprime : function, optional > The derivative of the function when available and convenient. If it > is None (default), then the secant method is used. > > A look in https://en.wikipedia.org/wiki/Secant_method#Convergence returns > the following: > > "If the initial values are not close enough to the root, then there is no > guarantee that the secant method converges." > > So it looks like the behavior of scipy.optimize.newton in your example is > neither unexpected nor a bug. > > > > On Thu, Feb 25, 2016 at 7:36 AM, Oscar Benjamin < > oscar.j.benjamin at gmail.com> wrote: > >> On 24 February 2016 at 19:43, Thomas Baruchel wrote: >> > with my students, this afternoon, I encountered the following annoying >> > behaviour of Scipy: >> > >> >>>> from scipy import optimize >> >>>> optimize.newton(lambda x: x**3-x+1, 0) >> > >> > 0.999999989980082 >> > >> > This is very weird, because the equation is rather simple with simple >> > coefficients, >> > and the initial point is simple also. >> >> Somehow the initial guess is problematic: >> >> In [1]: from scipy import optimize >> >> In [2]: optimize.newton(lambda x: x**3 - x + 1, 0) >> Out[2]: 0.999999989980082 >> >> In [3]: optimize.newton(lambda x: x**3 - x + 1, 0.1) >> Out[3]: -1.324717957244745 >> >> In [4]: optimize.newton(lambda x: x**3 - x + 1, -0.1) >> Out[4]: -1.3247179572447458 >> >> These last two are the correct answer: >> >> In [6]: from numpy import roots >> >> In [7]: roots([1, 0, -1, 1]) >> Out[7]: >> array([-1.32471796+0.j , 0.66235898+0.56227951j, >> 0.66235898-0.56227951j]) >> >> The only thing that jumps out to me is that you've picked an initial >> guess at which the function has a zero second derivative. I'm not sure >> why that would cause the method to fail but Newton solvers are >> sensitive to various singularities in the input function. >> >> -- >> Oscar >> _______________________________________________ >> SciPy-User mailing list >> SciPy-User at scipy.org >> https://mail.scipy.org/mailman/listinfo/scipy-user >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmsachs at gmail.com Wed Feb 24 19:29:42 2016 From: jmsachs at gmail.com (Jason Sachs) Date: Wed, 24 Feb 2016 17:29:42 -0700 Subject: [SciPy-User] Is this weird answer a bug in optimize.newton? In-Reply-To: References: Message-ID: Brent's method (scipy.optimize.brentq) is probably the best general scalar (as opposed to multidimensional) root-finding algorithm, it's the scipy equivalent of MATLAB's fzero. Worth a read of Numerical Recipes to understand the different root-finding algorithms. The previous (2nd) edition is readable for free online: http://apps.nrbook.com/c/index.html and root-finding starts on p. 347. Chandrupatla's algorithm appears to be "better" than Brent's in the sense that both are robust and Chandrupatla's usually converges faster by a factor of 2-3x (and if not then follows Brent's within an extra iteration or two) -- but it's not well-known. I have a writeup here: http://www.embeddedrelated.com/showarticle/855.php On Wed, Feb 24, 2016 at 5:21 PM, David Mikolas wrote: > First of all it sounds like your students are receiving a very good > educational experience! > > typing help(optimize.newton) returns the following: > > fprime : function, optional > The derivative of the function when available and convenient. If it > is None (default), then the secant method is used. > > A look in https://en.wikipedia.org/wiki/Secant_method#Convergence returns > the following: > > "If the initial values are not close enough to the root, then there is no > guarantee that the secant method converges." > > So it looks like the behavior of scipy.optimize.newton in your example is > neither unexpected nor a bug. > > > > On Thu, Feb 25, 2016 at 7:36 AM, Oscar Benjamin > wrote: >> >> On 24 February 2016 at 19:43, Thomas Baruchel wrote: >> > with my students, this afternoon, I encountered the following annoying >> > behaviour of Scipy: >> > >> >>>> from scipy import optimize >> >>>> optimize.newton(lambda x: x**3-x+1, 0) >> > >> > 0.999999989980082 >> > >> > This is very weird, because the equation is rather simple with simple >> > coefficients, >> > and the initial point is simple also. >> >> Somehow the initial guess is problematic: >> >> In [1]: from scipy import optimize >> >> In [2]: optimize.newton(lambda x: x**3 - x + 1, 0) >> Out[2]: 0.999999989980082 >> >> In [3]: optimize.newton(lambda x: x**3 - x + 1, 0.1) >> Out[3]: -1.324717957244745 >> >> In [4]: optimize.newton(lambda x: x**3 - x + 1, -0.1) >> Out[4]: -1.3247179572447458 >> >> These last two are the correct answer: >> >> In [6]: from numpy import roots >> >> In [7]: roots([1, 0, -1, 1]) >> Out[7]: >> array([-1.32471796+0.j , 0.66235898+0.56227951j, >> 0.66235898-0.56227951j]) >> >> The only thing that jumps out to me is that you've picked an initial >> guess at which the function has a zero second derivative. I'm not sure >> why that would cause the method to fail but Newton solvers are >> sensitive to various singularities in the input function. >> >> -- >> Oscar >> _______________________________________________ >> SciPy-User mailing list >> SciPy-User at scipy.org >> https://mail.scipy.org/mailman/listinfo/scipy-user > > > > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > From jbednar at inf.ed.ac.uk Wed Feb 24 19:42:44 2016 From: jbednar at inf.ed.ac.uk (James A. Bednar) Date: Thu, 25 Feb 2016 00:42:44 +0000 Subject: [SciPy-User] ANN: Stop plotting your data -- HoloViews 1.4 released! Message-ID: <22222.19972.843557.670445@rockefeller.inf.ed.ac.uk> We are pleased to announce the fifth public release of HoloViews, a Python package for exploring and visualizing numerical data: http://holoviews.org HoloViews provides composable, sliceable, declarative data structures for building even complex visualizations easily. Instead of you having to explicitly and laboriously plot your data, HoloViews lets you simply annotate your data so that any part of it visualizes itself automatically. You can now work with large datasets as easily as you work with simple datatypes at the Python prompt. The new version can be installed using conda: conda install -c ioam holoviews Release 1.4 introduces major new features, incorporating over 1700 new commits and closing 142 issues: - Now supports both Bokeh (bokeh.pydata.org) and matplotlib backends, with Bokeh providing extensive interactive features such as panning and zooming linked axes, and customizable callbacks - DynamicMap: Allows exploring live streams from ongoing data collection or simulation, or parameter spaces too large to fit into your computer's or your browser's memory, from within a Jupyter notebook - Columnar data support: Underlying data storage can now be in Pandas dataframes, NumPy arrays, or Python dictionaries, allowing you to define HoloViews objects without copying or reformatting your data - New Element types: Area (area under or between curves), Spikes (sequence of lines, e.g. spectra, neural spikes, or rug plots), BoxWhisker (summary of a distribution), QuadMesh (nonuniform rasters), Trisurface (Delaunay-triangulated surface plots) - New Container type: GridMatrix (grid of heterogenous Elements) - Improved layout handling, with better support for varying aspect ratios and plot sizes - Improved help system, including recursively listing and searching the help for all the components of a composite object - Improved Jupyter/IPython notebook support, including improved export using nbconvert, and standalone HTML output that supports dynamic widgets even without a Python server - Significant performance improvements for large or highly nested data And of course we have fixed a number of bugs found by our very dedicated users; please keep filing Github issues if you find any! For the full list of changes, see: https://github.com/ioam/holoviews/releases HoloViews is now supported by Continuum Analytics, and is being used in a wide range of scientific and industrial projects. HoloViews remains freely available under a BSD license, is Python 2 and 3 compatible, and has minimal external dependencies, making it easy to integrate into your workflow. Try out the extensive tutorials at holoviews.org today! Jean-Luc R. Stevens Philipp Rudiger James A. Bednar Continuum Analytics, Inc., Austin, TX, USA School of Informatics, The University of Edinburgh, UK -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. From david.mikolas1 at gmail.com Wed Feb 24 20:05:25 2016 From: david.mikolas1 at gmail.com (David Mikolas) Date: Thu, 25 Feb 2016 09:05:25 +0800 Subject: [SciPy-User] Is this weird answer a bug in optimize.newton? In-Reply-To: References: Message-ID: I use scipy.optimize/brentq frequently and so far have had no problems... except: if one of the limits is np.nan (which can happen without you necessarily knowing about it) then there is trouble. I'm having difficulty finding my report. I wrote this in Stackoverfow but for some reason it seems to be missing. Here is a residual copy on a "mirror" http://w3foverflow.com/question/brentq-gives-wrong-results-and-reports-converged-if-limits-contain-a-nan-how-to-best-report/ Briefly - it sometimes returns an incorrect/invalid answer but indicates convergence=True. It can also sometimes take time running to the iteration limit before giving an incorrect/inavlid answer. With the first limit set to np.nan, it returns a wrong answer (0.0), but indicates convergence: With the second limit set to np.nan, and disp = False, it runs to the iteration limit, then returns nan as the answer and indicates convergence: With the second limit set to np.nan, and disp = True, it runs to the iteration limit, then raises: On Thu, Feb 25, 2016 at 8:29 AM, Jason Sachs wrote: > Brent's method (scipy.optimize.brentq) is probably the best general > scalar (as opposed to multidimensional) root-finding algorithm, it's > the scipy equivalent of MATLAB's fzero. > > Worth a read of Numerical Recipes to understand the different > root-finding algorithms. The previous (2nd) edition is readable for > free online: http://apps.nrbook.com/c/index.html and root-finding > starts on p. 347. > > Chandrupatla's algorithm appears to be "better" than Brent's in the > sense that both are robust and Chandrupatla's usually converges faster > by a factor of 2-3x (and if not then follows Brent's within an extra > iteration or two) -- but it's not well-known. I have a writeup here: > http://www.embeddedrelated.com/showarticle/855.php > > On Wed, Feb 24, 2016 at 5:21 PM, David Mikolas > wrote: > > First of all it sounds like your students are receiving a very good > > educational experience! > > > > typing help(optimize.newton) returns the following: > > > > fprime : function, optional > > The derivative of the function when available and convenient. If > it > > is None (default), then the secant method is used. > > > > A look in https://en.wikipedia.org/wiki/Secant_method#Convergence > returns > > the following: > > > > "If the initial values are not close enough to the root, then there is no > > guarantee that the secant method converges." > > > > So it looks like the behavior of scipy.optimize.newton in your example is > > neither unexpected nor a bug. > > > > > > > > On Thu, Feb 25, 2016 at 7:36 AM, Oscar Benjamin < > oscar.j.benjamin at gmail.com> > > wrote: > >> > >> On 24 February 2016 at 19:43, Thomas Baruchel wrote: > >> > with my students, this afternoon, I encountered the following annoying > >> > behaviour of Scipy: > >> > > >> >>>> from scipy import optimize > >> >>>> optimize.newton(lambda x: x**3-x+1, 0) > >> > > >> > 0.999999989980082 > >> > > >> > This is very weird, because the equation is rather simple with simple > >> > coefficients, > >> > and the initial point is simple also. > >> > >> Somehow the initial guess is problematic: > >> > >> In [1]: from scipy import optimize > >> > >> In [2]: optimize.newton(lambda x: x**3 - x + 1, 0) > >> Out[2]: 0.999999989980082 > >> > >> In [3]: optimize.newton(lambda x: x**3 - x + 1, 0.1) > >> Out[3]: -1.324717957244745 > >> > >> In [4]: optimize.newton(lambda x: x**3 - x + 1, -0.1) > >> Out[4]: -1.3247179572447458 > >> > >> These last two are the correct answer: > >> > >> In [6]: from numpy import roots > >> > >> In [7]: roots([1, 0, -1, 1]) > >> Out[7]: > >> array([-1.32471796+0.j , 0.66235898+0.56227951j, > >> 0.66235898-0.56227951j]) > >> > >> The only thing that jumps out to me is that you've picked an initial > >> guess at which the function has a zero second derivative. I'm not sure > >> why that would cause the method to fail but Newton solvers are > >> sensitive to various singularities in the input function. > >> > >> -- > >> Oscar > >> _______________________________________________ > >> SciPy-User mailing list > >> SciPy-User at scipy.org > >> https://mail.scipy.org/mailman/listinfo/scipy-user > > > > > > > > _______________________________________________ > > SciPy-User mailing list > > SciPy-User at scipy.org > > https://mail.scipy.org/mailman/listinfo/scipy-user > > > _______________________________________________ > SciPy-User mailing list > SciPy-User at scipy.org > https://mail.scipy.org/mailman/listinfo/scipy-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.mikolas1 at gmail.com Wed Feb 24 20:15:21 2016 From: david.mikolas1 at gmail.com (David Mikolas) Date: Thu, 25 Feb 2016 09:15:21 +0800 Subject: [SciPy-User] Is this weird answer a bug in optimize.newton? In-Reply-To: References: Message-ID: Ah - I see what happened - 365 days with zero votes. Can be accessed and reopened if signed in http://stackoverflow.com/questions/27792180/brentq-gives-wrong-results-and-reports-converged-if-limits-contain-a-nan-how On Thu, Feb 25, 2016 at 9:05 AM, David Mikolas wrote: > I use scipy.optimize/brentq frequently and so far have had no problems... > except: > > if one of the limits is np.nan (which can happen without you necessarily > knowing about it) then there is trouble. > > I'm having difficulty finding my report. I wrote this in Stackoverfow but > for some reason it seems to be missing. Here is a residual copy on a > "mirror" > > > http://w3foverflow.com/question/brentq-gives-wrong-results-and-reports-converged-if-limits-contain-a-nan-how-to-best-report/ > > Briefly - it sometimes returns an incorrect/invalid answer but indicates > convergence=True. It can also sometimes take time running to the iteration > limit before giving an incorrect/inavlid answer. > > With the first limit set to np.nan, it returns a wrong answer (0.0), but > indicates convergence: > > With the second limit set to np.nan, and disp = False, it runs to the > iteration limit, then returns nan as the answer and indicates convergence: > > With the second limit set to np.nan, and disp = True, it runs to the > iteration limit, then raises: > > > On Thu, Feb 25, 2016 at 8:29 AM, Jason Sachs wrote: > >> Brent's method (scipy.optimize.brentq) is probably the best general >> scalar (as opposed to multidimensional) root-finding algorithm, it's >> the scipy equivalent of MATLAB's fzero. >> >> Worth a read of Numerical Recipes to understand the different >> root-finding algorithms. The previous (2nd) edition is readable for >> free online: http://apps.nrbook.com/c/index.html and root-finding >> starts on p. 347. >> >> Chandrupatla's algorithm appears to be "better" than Brent's in the >> sense that both are robust and Chandrupatla's usually converges faster >> by a factor of 2-3x (and if not then follows Brent's within an extra >> iteration or two) -- but it's not well-known. I have a writeup here: >> http://www.embeddedrelated.com/showarticle/855.php >> >> On Wed, Feb 24, 2016 at 5:21 PM, David Mikolas >> wrote: >> > First of all it sounds like your students are receiving a very good >> > educational experience! >> > >> > typing help(optimize.newton) returns the following: >> > >> > fprime : function, optional >> > The derivative of the function when available and convenient. >> If it >> > is None (default), then the secant method is used. >> > >> > A look in https://en.wikipedia.org/wiki/Secant_method#Convergence >> returns >> > the following: >> > >> > "If the initial values are not close enough to the root, then there is >> no >> > guarantee that the secant method converges." >> > >> > So it looks like the behavior of scipy.optimize.newton in your example >> is >> > neither unexpected nor a bug. >> > >> > >> > >> > On Thu, Feb 25, 2016 at 7:36 AM, Oscar Benjamin < >> oscar.j.benjamin at gmail.com> >> > wrote: >> >> >> >> On 24 February 2016 at 19:43, Thomas Baruchel >> wrote: >> >> > with my students, this afternoon, I encountered the following >> annoying >> >> > behaviour of Scipy: >> >> > >> >> >>>> from scipy import optimize >> >> >>>> optimize.newton(lambda x: x**3-x+1, 0) >> >> > >> >> > 0.999999989980082 >> >> > >> >> > This is very weird, because the equation is rather simple with simple >> >> > coefficients, >> >> > and the initial point is simple also. >> >> >> >> Somehow the initial guess is problematic: >> >> >> >> In [1]: from scipy import optimize >> >> >> >> In [2]: optimize.newton(lambda x: x**3 - x + 1, 0) >> >> Out[2]: 0.999999989980082 >> >> >> >> In [3]: optimize.newton(lambda x: x**3 - x + 1, 0.1) >> >> Out[3]: -1.324717957244745 >> >> >> >> In [4]: optimize.newton(lambda x: x**3 - x + 1, -0.1) >> >> Out[4]: -1.3247179572447458 >> >> >> >> These last two are the correct answer: >> >> >> >> In [6]: from numpy import roots >> >> >> >> In [7]: roots([1, 0, -1, 1]) >> >> Out[7]: >> >> array([-1.32471796+0.j , 0.66235898+0.56227951j, >> >> 0.66235898-0.56227951j]) >> >> >> >> The only thing that jumps out to me is that you've picked an initial >> >> guess at which the function has a zero second derivative. I'm not sure >> >> why that would cause the method to fail but Newton solvers are >> >> sensitive to various singularities in the input function. >> >> >> >> -- >> >> Oscar >> >> _______________________________________________ >> >> SciPy-User mailing list >> >> SciPy-User at scipy.org >> >> https://mail.scipy.org/mailman/listinfo/scipy-user >> > >> > >> > >> > _______________________________________________ >> > SciPy-User mailing list >> > SciPy-User at scipy.org >> > https://mail.scipy.org/mailman/listinfo/scipy-user >> > >> _______________________________________________ >> SciPy-User mailing list >> SciPy-User at scipy.org >> https://mail.scipy.org/mailman/listinfo/scipy-user >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From baruchel at gmx.com Thu Feb 25 01:32:48 2016 From: baruchel at gmx.com (Thomas Baruchel) Date: Thu, 25 Feb 2016 07:32:48 +0100 (CET) Subject: [SciPy-User] Is this weird answer a bug in optimize.newton? In-Reply-To: References: Message-ID: On Wed, 24 Feb 2016, Oscar Benjamin wrote: > The only thing that jumps out to me is that you've picked an initial > guess at which the function has a zero second derivative. I'm not sure > why that would cause the method to fail but Newton solvers are > sensitive to various singularities in the input function. First, I thank you all for your answers. I am not absolutely sure it has to do with initial guess; as I said, the method works correctly when the derivative is provided or when it is computed by various methods. Furthermore (I forgot to tell it in my initial message), the function in Scipy would return the correct answer if some more terms were computed! By replacing if abs(p - p1) < tol: with if abs(p - p1) < tol and abs(p - p0) < tol: in Scipy's code, the correct answer is returned: of course this would imply computing one more term in most of the cases, but it wouldn't return too early in some weird cases where convergence is "fictive". Regards, -- Thomas Baruchel From oscar.j.benjamin at gmail.com Thu Feb 25 05:40:34 2016 From: oscar.j.benjamin at gmail.com (Oscar Benjamin) Date: Thu, 25 Feb 2016 10:40:34 +0000 Subject: [SciPy-User] Is this weird answer a bug in optimize.newton? In-Reply-To: References: Message-ID: On 25 February 2016 at 06:32, Thomas Baruchel wrote: > On Wed, 24 Feb 2016, Oscar Benjamin wrote: >> >> The only thing that jumps out to me is that you've picked an initial >> guess at which the function has a zero second derivative. I'm not sure >> why that would cause the method to fail but Newton solvers are >> sensitive to various singularities in the input function. > > > First, I thank you all for your answers. I am not absolutely sure it has to > do > with initial guess; as I said, the method works correctly when the > derivative is > provided or when it is computed by various methods. > > Furthermore (I forgot to tell it in my initial message), the function in > Scipy > would return the correct answer if some more terms were computed! > > By replacing > > if abs(p - p1) < tol: > with > if abs(p - p1) < tol and abs(p - p0) < tol: > > in Scipy's code, the correct answer is returned: of course this would imply > computing one more term in most of the cases, but it wouldn't return too > early > in some weird cases where convergence is "fictive". Maybe that is worth doing then. However as David says these methods are only really expected to converge if the algorithm begins close to the root. So it might be that the proposed improvement helps in some cases. It's also possible that there are other cases where it could cause problems. Generally these kinds of solvers are not robust at globally searching for a root. The Newton/secant methods are about rapid improvement of an estimate of the root so you should locate the root approximately first. (I would use this as a lesson for my students in understanding that the need to provide an initial guess is not just a formality). In your particular example the function has a single global root but it also has two stationary points. The initial guess that you provide is between the two stationary points and the root is outside of that interval. There aren't any theorems I know of that give any guarantee that either method will converge in this sort of situation. If you want guaranteed convergence bracket the root and use bisect: this is guaranteed to converge in a fixed number of iterations (barring floating point weirdness). -- Oscar