Re: [Numpy-discussion] scipy curve_fit variable list of optimisation parameters

2016-08-03 Thread Siegfried Gonzi
nc2 to (note the *): def func2( x, *a ): # Bessel function tmp = scipy.special.j0( x[:,:] ) return np.dot( tmp[:,:] , a[:] ) and call it: N = number of optimisation parameters popt = scipy.optimize.curve_fit( func2, x, yi , p0=[1.0]*N) Regards, Siegfried Gonzi Met Office,

[Numpy-discussion] scipy curve_fit variable list of optimisation parameters

2016-08-02 Thread Siegfried Gonzi
: F(r) = SUM_i_to_N [ A(i) * bessel_function_J0(i * r) ] Thanks, Siegfried Gonzi -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. ___ NumPy-Discussion mailing list NumPy-Discussion@scip

[Numpy-discussion] f2py and string arrays (need help)

2014-05-28 Thread Siegfried Gonzi
Hi all Given the following pseudo code: == SUBROUTINE READ_B( FILENAME, ix,iy,iz,nx, OUT_ARRAY, out_cat) IMPLICIT NONE INTEGER*4, INTENT(IN) :: IX, iy, iz, nx REAL*4,INTENT(OUT) :: OUT_ARRAY(nx,IX, iy, iz) CHARACTER, dimension(nx,40),intent(out) ::OUT_CAT CHARACTER(LEN=

Re: [Numpy-discussion] Easter Egg or what I am missing here?

2014-05-21 Thread Siegfried Gonzi
t-Type: text/plain; charset=UTF-8 On 5/21/14, Siegfried Gonzi > wrote: >> >Please would anyone tell me the following is an undocumented bug >> >otherwise I will lose faith in everything: >> > >> >== >> >import nump

[Numpy-discussion] Easter Egg or what I am missing here?

2014-05-21 Thread Siegfried Gonzi
Please would anyone tell me the following is an undocumented bug otherwise I will lose faith in everything: == import numpy as np years = [2004,2005,2006,2007] dates = [20040501,20050601,20060801,20071001] for x in years: print 'year ',x xy = np.array([x*1.0e-4 for x in dates]).a

Re: [Numpy-discussion] IDL vs Python parallel computing

2014-05-08 Thread Siegfried Gonzi
On 08/05/2014 04:00, numpy-discussion-requ...@scipy.org wrote: > Send NumPy-Discussion mailing list submissions to > numpy-discussion@scipy.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.scipy.org/mailman/listinfo/numpy-discussion > or, via email, send a

Re: [Numpy-discussion] IDL vs Python parallel computing

2014-05-07 Thread Siegfried Gonzi
omputing > To: numpy-discussion@scipy.org > Message-ID: > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 03/05/14 23:56, Siegfried Gonzi wrote: > > I noticed IDL uses at least 400% (4 processors or cores) out of the box > > for simple things like r

[Numpy-discussion] IDL vs Python parallel computing

2014-05-03 Thread Siegfried Gonzi
Hi all I noticed IDL uses at least 400% (4 processors or cores) out of the box for simple things like reading and processing files, calculating the mean etc. I have never seen this happening with numpy except for the linalgebra stuff (e.g lapack). Any comments? Thanks, Siegfried -- The U

[Numpy-discussion] string replace

2014-04-20 Thread Siegfried Gonzi
Hi all I know this is not numpy related but a colleague insists the following is supposed to work. But it doesn't: == line_left = './erfo/restart.ST010.EN0001-EN0090.MMDDhh' enafix = 'ST000.EN0001-EN0092' line_left = line_left.replace('STYYY.EN-EN', enafix) print 'line_left',line_lef

[Numpy-discussion] Need help with np.ma.median and np.apply_along_axis

2013-12-20 Thread Siegfried Gonzi
Please have a look at version1 and version2. What are my other options here? Do I need to go the cython route here? Thanks, Siegfried == My array is as follows (shown here for dummy values; and yes this kind of arrays do exist: 150 observations x 8 years x 366 days x 24 hours x 7 model level

[Numpy-discussion] Python parallel programming on Mac OS X Maverick

2013-10-28 Thread Siegfried Gonzi
Hi all Quick question: What is the minimum RAM requirement for doing parallel programming with Python/Numpy on Mac OS X Maverick? I am about to buy a Macbook Pro 15" and I'd like to know if 8GB RAM (with SSD flash storage) for the Haswell quad core will be enough. I have never done any paralle

Re: [Numpy-discussion] NumPy-Discussion Digest, Vol 85, Issue 19

2013-10-07 Thread Siegfried Gonzi
code at the command line. I am definitely not one of the best programmers out there but I used "help" a lot in my IDL scripts and code. Our research group is migrating away from IDL towards Python. I think Python's help is not the same than IDL's help. I know copying t

[Numpy-discussion] Equivalent to IDL's help function

2013-10-07 Thread Siegfried Gonzi
Hi all What is the equivalent to IDL its help function, e.g. == IDL> a = make_array(23,23,) IDL> help,a will result in: A FLOAT = Array[23, 23] or IDL> a = create_struct('idl',23) IDL> help,a gives: A STRUCT= -> Array[1] == I have been looking for i

Re: [Numpy-discussion] numpy where function on different sized arrays

2012-11-25 Thread Siegfried Gonzi
On 25 Nov 2012, at 00:29, numpy-discussion-requ...@scipy.org wrote: > > Message: 3 > Date: Sat, 24 Nov 2012 23:23:36 +0100 > From: Da?id > Subject: Re: [Numpy-discussion] numpy where function on different > sized arrays > To: Discussion of Numerical Python > Message-ID: > > Conte

Re: [Numpy-discussion] numpy where function on different size

2012-11-24 Thread Siegfried Gonzi
> Message: 6 > Date: Sat, 24 Nov 2012 20:36:45 + > From: Siegfried Gonzi > Subject: [Numpy-discussion] numpy where function on different size > Hi all >This must have been answered in the past but my google search > capabilities are not the best. >Given an array A sa

[Numpy-discussion] numpy where function on different sized arrays

2012-11-24 Thread Siegfried Gonzi
Hi all This must have been answered in the past but my google search capabilities are not the best. Given an array A say of dimension 40x60 and given another array/vector B of dimension 20 (the values in B occur only once). What I would like to do is the following which of course does not w