From interactpy at gmail.com Tue Nov 1 10:12:19 2016 From: interactpy at gmail.com (EV Petr) Date: Tue, 1 Nov 2016 16:12:19 +0200 Subject: [SciPy-User] mappping argument in scipy.ndimage.interpolation.geometric_transform Message-ID: Hi all, A few days ago I worked on the Moebius transformation of an image for a course in Complex Analysis: http://nbviewer.jupyter.org/github/empet/Math/blob/master/Moebius-transform-image.ipynb I?m mathematician and had no previous knowledge in image processing. Reading a few references across the web I succeeded to understand how the scipy.ndimage.interpolation.geometric_transform works. Discussing with a colleague who had the book Learning SciPy for Numerical and Scientific Computing - Second Edition https://www.safaribooksonline.com/library/view/learning-scipy-for/9781783987702/ he told me that my implementation differ from that in this book (see here a snippet showing the authors code: https://github.com/empet/Math/blob/master/Imags/Scipy-extract-book.PNG) I realized that the authors of the book did not know that geometric_transform implements the backward method, and instead of the inverse Moebius transform they passed the transform itself to geometric_transform function. I left a message on one of the authors github page, pointing out this issue, but it appears that he doesn?t agree with me (in fact he doesn?t understand the key point of the filled issue: https://github.com/rojassergio/Learning-Scipy/issues/1#issuecomment-257555364 ). That is why I ask people on this forum, who are more skilled than we are, to express their opinion. On friday I will illustrate for a group of student how the Moebius transform works and want to know whether my implementation is correct. Thanks, EP ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From grlee77 at gmail.com Thu Nov 3 13:25:30 2016 From: grlee77 at gmail.com (Gregory Lee) Date: Thu, 3 Nov 2016 13:25:30 -0400 Subject: [SciPy-User] ANN: PyWavelets v0.5.0 release Message-ID: On behalf of the PyWavelets development team I am pleased to announce the release of PyWavelets 0.5.0. PyWavelets is a Python toolbox implementing both discrete and continuous wavelet transforms (mathematical time-frequency transforms) with a wide range of built-in wavelets. C/Cython are used for the low-level routines, enabling high performance. Key Features of PyWavelets are: * 1D, 2D and nD Forward and Inverse Discrete Wavelet Transform (DWT and IDWT) * 1D, 2D and nD Multilevel DWT and IDWT * 1D and 2D Forward and Inverse Stationary Wavelet Transform * 1D and 2D Wavelet Packet decomposition and reconstruction * 1D Continuous Wavelet Transform * When multiple valid implementations are available, we have chosen to maintain consistency with MATLAB's Wavelet Toolbox. PyWavelets 0.5.0 is the culmination of 1 year of work. In addition to several new features, substantial refactoring of the underlying C and Cython code have been made. Highlights of this release include: - 1D continuous wavelet transforms - new discrete wavelets added (additional Debauchies and Coiflet wavelets) - new 'reflect' extension mode for discrete wavelet transforms - faster performance for multilevel forward stationary wavelet transforms (SWT) - n-dimensional support added to forward SWT - routines to convert multilevel DWT coefficients to and from a single array - axis support for multilevel DWT - substantial refactoring/reorganization of the underlying C and Cython code Full details in the release notes at: http://pywavelets.readthedocs.io/en/latest/release.0.5.0.html This release requires Python 2.6, 2.7 or 3.3-3.5 and Numpy 1.9.1 or greater. Sources can be found on https://pypi.python.org/pypi/PyWavelets and https://github.com/PyWavelets/pywt/releases. As always, new contributors are welcome to join us at https://github.com/PyWavelets/pywt -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew.brett at gmail.com Thu Nov 3 13:38:49 2016 From: matthew.brett at gmail.com (Matthew Brett) Date: Thu, 3 Nov 2016 10:38:49 -0700 Subject: [SciPy-User] ANN: PyWavelets v0.5.0 release In-Reply-To: References: Message-ID: Hi, On Thu, Nov 3, 2016 at 10:25 AM, Gregory Lee wrote: > On behalf of the PyWavelets development team I am pleased to announce the > release of PyWavelets 0.5.0. > > > PyWavelets is a Python toolbox implementing both discrete and continuous > wavelet transforms (mathematical time-frequency transforms) with a wide > range of built-in wavelets. C/Cython are used for the low-level routines, > enabling high performance. Key Features of PyWavelets are: > > * 1D, 2D and nD Forward and Inverse Discrete Wavelet Transform (DWT and > IDWT) > * 1D, 2D and nD Multilevel DWT and IDWT > * 1D and 2D Forward and Inverse Stationary Wavelet Transform > * 1D and 2D Wavelet Packet decomposition and reconstruction > * 1D Continuous Wavelet Transform > * When multiple valid implementations are available, we have chosen to > maintain consistency with MATLAB's Wavelet Toolbox. > > PyWavelets 0.5.0 is the culmination of 1 year of work. In addition to > several new features, substantial refactoring of the underlying C and Cython > code have been made. > > Highlights of this release include: > > - 1D continuous wavelet transforms > - new discrete wavelets added (additional Debauchies and Coiflet wavelets) > - new 'reflect' extension mode for discrete wavelet transforms > - faster performance for multilevel forward stationary wavelet transforms > (SWT) > - n-dimensional support added to forward SWT > - routines to convert multilevel DWT coefficients to and from a single array > - axis support for multilevel DWT > - substantial refactoring/reorganization of the underlying C and Cython code > > Full details in the release notes at: > http://pywavelets.readthedocs.io/en/latest/release.0.5.0.html > > This release requires Python 2.6, 2.7 or 3.3-3.5 and Numpy 1.9.1 or greater. > Sources can be found on https://pypi.python.org/pypi/PyWavelets and > https://github.com/PyWavelets/pywt/releases. Many thanks for this. I just triggered a build for OSX and Linux wheels from : https://github.com/MacPython/pywavelets-wheels (see the README there). The wheels should soon arrive at https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com . There are pypi upload instructions in the README, but I'm happy do that if you prefer. My pypi username is "matthew.brett". Cheers, Matthew From grlee77 at gmail.com Thu Nov 3 14:02:26 2016 From: grlee77 at gmail.com (Gregory Lee) Date: Thu, 3 Nov 2016 14:02:26 -0400 Subject: [SciPy-User] ANN: PyWavelets v0.5.0 release In-Reply-To: References: Message-ID: On Thu, Nov 3, 2016 at 1:38 PM, Matthew Brett wrote: > Many thanks for this. I just triggered a build for OSX and Linux > wheels from : https://github.com/MacPython/pywavelets-wheels (see the > README there). The wheels should soon arrive at > https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a > 43.ssl.cf2.rackcdn.com > . There are pypi upload instructions in the README, but I'm happy do > that if you prefer. My pypi username is "matthew.brett". > > Cheers, > > Matthew > > Thanks Matthew, that was fast! At what stage would I need your pypi username? I did the Windows wheel uploads from the command line using `twine -s build/*` where I had the sdist files and Win wheels in that folder. Can I just download the OS X and manylinux wheels from the link you provided and do the same here or am I missing something? -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew.brett at gmail.com Thu Nov 3 14:23:02 2016 From: matthew.brett at gmail.com (Matthew Brett) Date: Thu, 3 Nov 2016 11:23:02 -0700 Subject: [SciPy-User] ANN: PyWavelets v0.5.0 release In-Reply-To: References: Message-ID: Hi, On Thu, Nov 3, 2016 at 11:02 AM, Gregory Lee wrote: > > On Thu, Nov 3, 2016 at 1:38 PM, Matthew Brett > wrote: >> >> Many thanks for this. I just triggered a build for OSX and Linux >> wheels from : https://github.com/MacPython/pywavelets-wheels (see the >> README there). The wheels should soon arrive at >> >> https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com >> . There are pypi upload instructions in the README, but I'm happy do >> that if you prefer. My pypi username is "matthew.brett". >> >> Cheers, >> >> Matthew >> > > Thanks Matthew, that was fast! At what stage would I need your pypi > username? Sorry - that's only if you want to give me permission to upload the wheels to pypi. > I did the Windows wheel uploads from the command line using > `twine -s build/*` where I had the sdist files and Win wheels in that > folder. Can I just download the OS X and manylinux wheels from the link you > provided and do the same here or am I missing something? Sure - you can download the files from the link and then upload them with twine. I personally like to use a script to do that - see the instructions in the README at https://github.com/MacPython/pywavelets-wheels . The repo actually also builds Windows wheels - see https://ci.appveyor.com/project/matthew-brett/pywavelets-wheels Cheers, Matthew From grlee77 at gmail.com Thu Nov 3 16:21:47 2016 From: grlee77 at gmail.com (Gregory Lee) Date: Thu, 3 Nov 2016 16:21:47 -0400 Subject: [SciPy-User] ANN: PyWavelets v0.5.0 release In-Reply-To: References: Message-ID: On Thu, Nov 3, 2016 at 2:23 PM, Matthew Brett wrote: > Hi, > > > > > > Thanks Matthew, that was fast! At what stage would I need your pypi > > username? > > Sorry - that's only if you want to give me permission to upload the > wheels to pypi. > > I have added you as a Maintainer on the package, so I think you should now have access to upload. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew.brett at gmail.com Thu Nov 3 16:56:09 2016 From: matthew.brett at gmail.com (Matthew Brett) Date: Thu, 3 Nov 2016 13:56:09 -0700 Subject: [SciPy-User] ANN: PyWavelets v0.5.0 release In-Reply-To: References: Message-ID: Hi, On Thu, Nov 3, 2016 at 1:21 PM, Gregory Lee wrote: > > > On Thu, Nov 3, 2016 at 2:23 PM, Matthew Brett > wrote: >> >> Hi, >> >> >> > >> > Thanks Matthew, that was fast! At what stage would I need your pypi >> > username? >> >> Sorry - that's only if you want to give me permission to upload the >> wheels to pypi. >> > I have added you as a Maintainer on the package, so I think you should now > have access to upload. Thanks! Thanks for doing this. When I try and upload with twine, I get: twine upload -s PyWavelets-0.5.0-cp2* Uploading distributions to https://upload.pypi.org/legacy/ Uploading PyWavelets-0.5.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl [================================] 1759042/1759042 - 00:00:02 HTTPError: 400 Client Error: author_email: Invalid email address. for url: https://upload.pypi.org/legacy/ I guess this is because of: https://github.com/PyWavelets/pywt/blob/master/setup.py#L213 maintainer_email="http://groups.google.com/group/pywavelets", Did you succeed in uploading with twine? Cheers, Matthew From grlee77 at gmail.com Thu Nov 3 17:12:09 2016 From: grlee77 at gmail.com (Gregory Lee) Date: Thu, 3 Nov 2016 17:12:09 -0400 Subject: [SciPy-User] ANN: PyWavelets v0.5.0 release In-Reply-To: References: Message-ID: Yes, I did the uploads that are already there via twine. Do you think maybe it worked because my role on PyPI is listed as "Owner" rather than "Maintainer"? Another difference is that I did not try upload to that weelhouse url, but the older https://pypi.python.org/pypi one. On Thu, Nov 3, 2016 at 4:56 PM, Matthew Brett wrote: > Hi, > > On Thu, Nov 3, 2016 at 1:21 PM, Gregory Lee wrote: > > > > > > On Thu, Nov 3, 2016 at 2:23 PM, Matthew Brett > > wrote: > >> > >> Hi, > >> > >> > >> > > >> > Thanks Matthew, that was fast! At what stage would I need your pypi > >> > username? > >> > >> Sorry - that's only if you want to give me permission to upload the > >> wheels to pypi. > >> > > I have added you as a Maintainer on the package, so I think you should > now > > have access to upload. Thanks! > > Thanks for doing this. When I try and upload with twine, I get: > > twine upload -s PyWavelets-0.5.0-cp2* > > Uploading distributions to https://upload.pypi.org/legacy/ > > Uploading PyWavelets-0.5.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_ > intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl > > [================================] 1759042/1759042 - 00:00:02 > > HTTPError: 400 Client Error: author_email: Invalid email address. for > url: https://upload.pypi.org/legacy/ > > I guess this is because of: > > https://github.com/PyWavelets/pywt/blob/master/setup.py#L213 > > maintainer_email="http://groups.google.com/group/pywavelets", > > Did you succeed in uploading with twine? > > Cheers, > > Matthew > _______________________________________________ > 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 grlee77 at gmail.com Thu Nov 3 17:43:38 2016 From: grlee77 at gmail.com (Gregory Lee) Date: Thu, 3 Nov 2016 17:43:38 -0400 Subject: [SciPy-User] ANN: PyWavelets v0.5.0 release In-Reply-To: References: Message-ID: > > I have added you as a Maintainer on the package, so I think you should >> now >> > have access to upload. Thanks! >> >> Thanks for doing this. When I try and upload with twine, I get: >> >> twine upload -s PyWavelets-0.5.0-cp2* >> >> Uploading distributions to https://upload.pypi.org/legacy/ >> >> Uploading PyWavelets-0.5.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_in >> tel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl >> >> [================================] 1759042/1759042 - 00:00:02 >> >> HTTPError: 400 Client Error: author_email: Invalid email address. for >> url: https://upload.pypi.org/legacy/ >> >> I guess this is because of: >> >> https://github.com/PyWavelets/pywt/blob/master/setup.py#L213 >> >> maintainer_email="http://groups.google.com/group/pywavelets", >> > I have uploaded all OS X and manylinux wheels now via twine (manual download from the URL followed by twine). I can open an issue on github related to figuring out the source of the issue you encountered. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexandrepfurlan at gmail.com Fri Nov 4 13:13:26 2016 From: alexandrepfurlan at gmail.com (Alexandre Furlan) Date: Fri, 4 Nov 2016 15:13:26 -0200 Subject: [SciPy-User] Fwd: using curve_fit with a fixed parameter In-Reply-To: References: Message-ID: ---------- Forwarded message ---------- From: Alexandre Furlan Date: 2016-11-04 14:59 GMT-02:00 Subject: using curve_fit with a fixed parameter To: scipy-user at scipy.org Hi all, I need to make a least square method of a model function, but a parameter of my model function is fixed (I don't change it). I my case, I have : def func(i,rij,eps,sigma) : where, i is similar "x", rij is a array used to obtain some parameters of the function, and eps and sigma are parameter that I want to optimize. I order to optimize these parameters I'm doing : for i in arange(len(rij)/natoms) : popt,pcov = curve_fit(LJ(i,rij,eps,sigma), x,Ek) where x = x[i] and Ek[i]. When make it, I have : TypeError('{!r} is not a Python function'.format(func)) TypeError: -0.019566048015813797 is not a Python function Do you known how to do this type of optmization using curve_fit ? many thanks for all Best Alexandre -------------- next part -------------- An HTML attachment was scrubbed... URL: From jorisvandenbossche at gmail.com Fri Nov 4 13:14:55 2016 From: jorisvandenbossche at gmail.com (Joris Van den Bossche) Date: Fri, 4 Nov 2016 18:14:55 +0100 Subject: [SciPy-User] ANN: pandas v0.19.1 released! Message-ID: Hi all, I'm pleased to announce the release of pandas 0.19.1. This is a bug-fix release from 0.19.0 and includes some small regression fixes, bug fixes and performance improvements. We recommend that all users upgrade to this version. See the v0.19.1 Whatsnew page for an overview of all bugs that have been fixed in 0.19.1. Thanks to all contributors! Joris --- *How to get it:* Source tarballs and windows/mac/linux wheels are available on PyPI (thanks to Christoph Gohlke for the windows wheels, and to Matthew Brett for setting up the mac/linux wheels). Conda packages are already available via the conda-forge channel (conda install pandas -c conda-forge). It will be available on the main channel shortly. *Issues:* Please report any issues on our issue tracker: https://github.com/pydata/ pandas/issues *Thanks to all the contributors of the 0.19.1 release:* - Adam Chainz - Anthonios Partheniou - Arash Rouhani - Ben Kandel - Brandon M. Burroughs - Chris - chris-b1 - Chris Warth - David Krych - dubourg - gfyoung - Iv?n Vall?s P?rez - Jeff Reback - Joe Jevnik - Jon M. Mease - Joris Van den Bossche - Josh Owen - Keshav Ramaswamy - Larry Ren - mattrijk - Michael Felt - paul-mannino - Piotr Chromiec - Robert Bradshaw - Sinhrks - Thiago Serafim - Tom Bird -------------- next part -------------- An HTML attachment was scrubbed... URL: From newville at cars.uchicago.edu Fri Nov 4 13:27:42 2016 From: newville at cars.uchicago.edu (Matt Newville) Date: Fri, 4 Nov 2016 12:27:42 -0500 Subject: [SciPy-User] Fwd: using curve_fit with a fixed parameter In-Reply-To: References: Message-ID: Alexandre, On Fri, Nov 4, 2016 at 12:13 PM, Alexandre Furlan < alexandrepfurlan at gmail.com> wrote: > > ---------- Forwarded message ---------- > From: Alexandre Furlan > Date: 2016-11-04 14:59 GMT-02:00 > Subject: using curve_fit with a fixed parameter > To: scipy-user at scipy.org > > > Hi all, > > I need to make a least square method of a model function, but a parameter > of my > model function is fixed (I don't change it). I my case, I have : > > def func(i,rij,eps,sigma) : > > where, i is similar "x", rij is a array used to obtain some parameters of > the function, and > eps and sigma are parameter that I want to optimize. I order to optimize > these parameters I'm doing : > > for i in arange(len(rij)/natoms) : > popt,pcov = curve_fit(LJ(i,rij,eps,sigma), x,Ek) > > where x = x[i] and Ek[i]. When make it, I have : > > TypeError('{!r} is not a Python function'.format(func)) > TypeError: -0.019566048015813797 is not a Python function > > Do you known how to do this type of optmization using curve_fit ? > > many thanks for all > > Best > > Alexandre > > You might find lmfit useful. It's a wrapper around many of the scipy.optimize functions to use Parameter objects that can be fixed, bounded, or constrained, and has many features and classes for data fitting problems. https://lmfit.github.io/lmfit-py/ --Matt Newville -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Fri Nov 4 23:17:54 2016 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Fri, 4 Nov 2016 20:17:54 -0700 (PDT) Subject: [SciPy-User] Close this group? Message-ID: Maybe this group needs to closed? No response for last 6 months. See discussion here: https://mail.scipy.org/pipermail/scipy-user/2016-October/037051.html From yw5aj at virginia.edu Fri Nov 11 04:06:38 2016 From: yw5aj at virginia.edu (Yuxiang Wang) Date: Fri, 11 Nov 2016 01:06:38 -0800 Subject: [SciPy-User] brentq solver gives a strange bug Message-ID: Dear all, When I run the following code snippet, everything works and x0 is within a and b: --- import numpy as np from scipy.optimize import newton, brentq E = 73000 A = 244.439436713 B = 520.091701874 n = 0.258964804689 strain_pt = 0.00722080901839 # 0.0613590727341 def eqn(stress_pt, strain_pt, A, B, n, E): return stress_pt - A - B * (strain_pt - stress_pt / E) ** n x0, r = brentq(eqn, args=(strain_pt, A, B, n, E), a=A, b=strain_pt * E, full_output=True) --- But when I run the following complete code (actually not that long, and self-contained): --- import numpy as np from scipy.optimize import brentq E = 73000 A = 244.439436713 B = 520.091701874 n = 0.258964804689 def eqn(stress_pt, strain_pt, A, B, n, E): return stress_pt - A - B * (strain_pt - stress_pt / E) ** n strain = np.logspace(0, 4, 100, endpoint=True) / 1e4 stress = np.empty_like(strain) for i in range(strain.shape[0]): if strain[i] <= A / E: stress[i] = E * strain[i] else: stress[i], r = brentq(eqn, args=(strain[i], A, B, n, E), a=A, b=strain[i] * E, full_output=True) --- Some solutions are out of the bracket! If I do: for i in range(strain.shape[0]): if strain[i] <= A / E: stress[i] = E * strain[i] else: stress[i], r = brentq(eqn, args=(strain[i], A, B, n, E), a=A, b=strain[i] * E, full_output=True) if stress[i] < A: print(r) I can see two data points being wrong. Obviously, at i == 46 and i == 69, we have x0 = 0.0 which is out of [a, b]. Could anyone please check whether this is repeatable on your machine? Shawn -------------- next part -------------- An HTML attachment was scrubbed... URL: From yw5aj at virginia.edu Fri Nov 11 12:15:58 2016 From: yw5aj at virginia.edu (Yuxiang Wang) Date: Fri, 11 Nov 2016 09:15:58 -0800 Subject: [SciPy-User] brentq solver gives a strange bug In-Reply-To: References: Message-ID: Dear all, Found the error - as always, it turned out to be my problem in defining the function. When strain_pt - stress_pt / E are too close to zero, sometimes we have a round-off error to cause it to be negative (-1e-18 or so). Taking the power of that causes nan, which is why the solution failed. Thanks, Shawn On Fri, Nov 11, 2016 at 1:06 AM, Yuxiang Wang wrote: > Dear all, > > When I run the following code snippet, everything works and x0 is within a > and b: > > --- > import numpy as np > from scipy.optimize import newton, brentq > > > E = 73000 > A = 244.439436713 > B = 520.091701874 > n = 0.258964804689 > strain_pt = 0.00722080901839 # 0.0613590727341 > > > def eqn(stress_pt, strain_pt, A, B, n, E): > return stress_pt - A - B * (strain_pt - stress_pt / E) ** n > > > x0, r = brentq(eqn, args=(strain_pt, A, B, n, E), a=A, b=strain_pt * E, > full_output=True) > --- > > > But when I run the following complete code (actually not that long, and > self-contained): > > > --- > > import numpy as np > from scipy.optimize import brentq > > > E = 73000 > A = 244.439436713 > B = 520.091701874 > n = 0.258964804689 > > > def eqn(stress_pt, strain_pt, A, B, n, E): > return stress_pt - A - B * (strain_pt - stress_pt / E) ** n > > > strain = np.logspace(0, 4, 100, endpoint=True) / 1e4 > stress = np.empty_like(strain) > > > for i in range(strain.shape[0]): > if strain[i] <= A / E: > stress[i] = E * strain[i] > else: > stress[i], r = brentq(eqn, args=(strain[i], A, B, n, E), a=A, > b=strain[i] * E, full_output=True) > > --- > > Some solutions are out of the bracket! > > If I do: > > for i in range(strain.shape[0]): > if strain[i] <= A / E: > stress[i] = E * strain[i] > else: > stress[i], r = brentq(eqn, args=(strain[i], A, B, n, E), a=A, > b=strain[i] * E, full_output=True) > if stress[i] < A: > print(r) > > I can see two data points being wrong. Obviously, at i == 46 and i == 69, > we have x0 = 0.0 which is out of [a, b]. > > Could anyone please check whether this is repeatable on your machine? > > Shawn > -- Yuxiang "Shawn" Wang, PhD Biomechanical experiments & simulations yw5aj at virginia.edu +1 (434) 284-0836 -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.mikolas1 at gmail.com Fri Nov 11 19:04:21 2016 From: david.mikolas1 at gmail.com (David Mikolas) Date: Sat, 12 Nov 2016 08:04:21 +0800 Subject: [SciPy-User] brentq solver gives a strange bug In-Reply-To: References: Message-ID: Good catch! Sooner or later everyone gets bitten by roundoff. Printing or plotting at the first sign of trouble is a good reflex. The OP of my first stackexchange answer here http://stackoverflow.com/a/29482967/3904031 had run an algorithm which did not accommodate roundoff error for years without trouble. Just a side note, the SciPy brentq has unexpected behavior if nan appears in one of the limits. See https://github.com/scipy/scipy/issues/3089#issuecomment-68090203 On Sat, Nov 12, 2016 at 1:15 AM, Yuxiang Wang wrote: > Dear all, > > Found the error - as always, it turned out to be my problem in defining > the function. > > When strain_pt - stress_pt / E are too close to zero, sometimes we have a > round-off error to cause it to be negative (-1e-18 or so). Taking the power > of that causes nan, which is why the solution failed. > > Thanks, > > Shawn > > On Fri, Nov 11, 2016 at 1:06 AM, Yuxiang Wang wrote: > >> Dear all, >> >> When I run the following code snippet, everything works and x0 is within >> a and b: >> >> --- >> import numpy as np >> from scipy.optimize import newton, brentq >> >> >> E = 73000 >> A = 244.439436713 >> B = 520.091701874 >> n = 0.258964804689 >> strain_pt = 0.00722080901839 # 0.0613590727341 >> >> >> def eqn(stress_pt, strain_pt, A, B, n, E): >> return stress_pt - A - B * (strain_pt - stress_pt / E) ** n >> >> >> x0, r = brentq(eqn, args=(strain_pt, A, B, n, E), a=A, b=strain_pt * E, >> full_output=True) >> --- >> >> >> But when I run the following complete code (actually not that long, and >> self-contained): >> >> >> --- >> >> import numpy as np >> from scipy.optimize import brentq >> >> >> E = 73000 >> A = 244.439436713 >> B = 520.091701874 >> n = 0.258964804689 >> >> >> def eqn(stress_pt, strain_pt, A, B, n, E): >> return stress_pt - A - B * (strain_pt - stress_pt / E) ** n >> >> >> strain = np.logspace(0, 4, 100, endpoint=True) / 1e4 >> stress = np.empty_like(strain) >> >> >> for i in range(strain.shape[0]): >> if strain[i] <= A / E: >> stress[i] = E * strain[i] >> else: >> stress[i], r = brentq(eqn, args=(strain[i], A, B, n, E), a=A, >> b=strain[i] * E, full_output=True) >> >> --- >> >> Some solutions are out of the bracket! >> >> If I do: >> >> for i in range(strain.shape[0]): >> if strain[i] <= A / E: >> stress[i] = E * strain[i] >> else: >> stress[i], r = brentq(eqn, args=(strain[i], A, B, n, E), a=A, >> b=strain[i] * E, full_output=True) >> if stress[i] < A: >> print(r) >> >> I can see two data points being wrong. Obviously, at i == 46 and i == 69, >> we have x0 = 0.0 which is out of [a, b]. >> >> Could anyone please check whether this is repeatable on your machine? >> >> Shawn >> > > > > -- > Yuxiang "Shawn" Wang, PhD > Biomechanical experiments & simulations > yw5aj at virginia.edu > +1 (434) 284-0836 > > _______________________________________________ > 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 ralf.gommers at gmail.com Mon Nov 14 14:09:19 2016 From: ralf.gommers at gmail.com (Ralf Gommers) Date: Tue, 15 Nov 2016 08:09:19 +1300 Subject: [SciPy-User] mailing list migration to scipy-user@python.org In-Reply-To: References: Message-ID: On Tue, Nov 15, 2016 at 4:01 AM, Didrik Pinte wrote: > Hi everyone, > > In order to improve the level of service around the SciPy organisation > mailing lists, we've started migrating to the python.org mailman. > > The scipy-user mailing list has been transferred and now lives here: > > https://mail.python.org/mailman/listinfo/scipy-user > > User subscription and archives have all been transferred. You should only > change your address book and mail filters to use the new e-mail address of > the list: scipy-user at python.org. > > The old mailing list (scipy-user at scipy.org) will be made read-only . > > Let us know if you have any troubles with the migration. > Thanks Didrik! Ralf -------------- next part -------------- An HTML attachment was scrubbed... URL: From grlee77 at gmail.com Tue Nov 29 19:40:47 2016 From: grlee77 at gmail.com (Gregory Lee) Date: Tue, 29 Nov 2016 19:40:47 -0500 Subject: [SciPy-User] ANN: PyWavelets 0.5.1 Release Message-ID: Dear all, On behalf of the PyWavelets development team I am pleased to announce the release of PyWavelets 0.5.1. This is a bug-fix only release with no new features as compared to 0.5.0. PyWavelets is a Python toolbox implementing both discrete and continuous wavelet transforms (mathematical time-frequency transforms) with a wide range of built-in wavelets. C/Cython are used for the low-level routines, enabling high performance. Key Features of PyWavelets are: * 1D, 2D and nD Forward and Inverse Discrete Wavelet Transform (DWT and IDWT) * 1D, 2D and nD Multilevel DWT and IDWT * 1D and 2D Forward and Inverse Stationary Wavelet Transform * 1D and 2D Wavelet Packet decomposition and reconstruction * 1D Continuous Wavelet Transform * When multiple valid implementations are available, we have chosen to maintain consistency with MATLAB's Wavelet Toolbox. Bugs Fixed ========== In release 0.5.0 the wrong edge mode was used for the following three deprecated mode names: ``ppd``, ``sp1``, and ``per``. All deprecated edge mode names are now correctly converted to the corresponding new names. One-dimensional discrete wavelet transforms did not properly respect the ``axis`` argument for complex-valued data. Prior to this release, the last axis was always transformed for arrays with complex dtype. This fix affects ``dwt``, ``idwt``, ``wavedec``, ``waverec``. -------------- next part -------------- An HTML attachment was scrubbed... URL: