Re: [Numpy-discussion] Change in behavior of np.concatenate for upcoming release

2012-09-15 Thread Han Genuit
You're welcome.

I do not have many expectations; only those you can expect from an
open source project. ;-)

On Sat, Sep 15, 2012 at 10:33 PM, Travis Oliphant  wrote:
> It's very nice to get your help.I hope I haven't inappropriately set 
> expectations :-)
>
> -Travis
>
> On Sep 15, 2012, at 3:14 PM, Han Genuit wrote:
>
>> Yeah, that merge was fast. :-)
>>
>> Regards,
>> Han
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Change in behavior of np.concatenate for upcoming release

2012-09-15 Thread Travis Oliphant
It's very nice to get your help.I hope I haven't inappropriately set 
expectations :-)

-Travis

On Sep 15, 2012, at 3:14 PM, Han Genuit wrote:

> Yeah, that merge was fast. :-)
> 
> Regards,
> Han
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

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


Re: [Numpy-discussion] Change in behavior of np.concatenate for upcoming release

2012-09-15 Thread Han Genuit
Yeah, that merge was fast. :-)

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


Re: [Numpy-discussion] Change in behavior of np.concatenate for upcoming release

2012-09-15 Thread Travis Oliphant
I was working on the same fix and so I saw your code was similar and merged it. 
   It needs to be back-ported to 1.7.0

Thanks,

-Travis

On Sep 15, 2012, at 11:06 AM, Han Genuit wrote:

> Okay, sent in a pull request: https://github.com/numpy/numpy/pull/443.
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

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


Re: [Numpy-discussion] Change in behavior of np.concatenate for upcoming release

2012-09-15 Thread Han Genuit
Okay, sent in a pull request: https://github.com/numpy/numpy/pull/443.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] easy way to change part of only unmasked elements value?

2012-09-15 Thread Chao YUE
but I think I personally prefer the reverse.
I would expect when I do
a[3:6]=1
the mask state would not change.

then I want to change the "base", I would use a.base[3:6]=1
then the mask state would change also.

By the way, I found b.data always be equal to b.base?

cheers,

Chao

On Tue, Sep 11, 2012 at 5:24 PM, Chao YUE  wrote:

> Dear Richard,
>
> this is what I want. Thanks!
>
> Chao
>
>
> On Tue, Sep 11, 2012 at 3:19 PM, Richard Hattersley  > wrote:
>
>> Hi Chao,
>>
>> If you don't mind modifying masked values, then if you write to the
>> underlying ndarray it won't touch the mask:
>>
>> >>> a = np.ma.masked_less(np.arange(10),5)
>> >>> a.base[3:6] = 1
>> >>> a
>>
>> masked_array(data = [-- -- -- -- -- 1 6 7 8 9],
>>  mask = [ True  True  True  True  True False False False
>> False False],
>>fill_value = 99)
>>
>> Regards,
>> Richard Hattersley
>>
>>
>> On 10 September 2012 17:43, Chao YUE  wrote:
>>
>>> Dear all numpy users,
>>>
>>> what's the easy way if I just want to change part of the unmasked array
>>> elements into another new value? like an example below:
>>> in my real case, I would like to change a subgrid of a masked numpy
>>> array to another value, but this grid include both masked and unmasked data.
>>> If I do a simple array[index1:index2, index3:index4] = another_value,
>>> those data with original True mask will change into False. I am using numpy
>>> 1.6.2.
>>> Thanks for any ideas.
>>>
>>> In [91]: a = np.ma.masked_less(np.arange(10),5)
>>>
>>> In [92]: or_mask = a.mask.copy()
>>> In [93]: a
>>> Out[93]:
>>> masked_array(data = [-- -- -- -- -- 5 6 7 8 9],
>>>  mask = [ True  True  True  True  True False False False
>>> False False],
>>>fill_value = 99)
>>>
>>>
>>> In [94]: a[3:6]=1
>>>
>>> In [95]: a
>>> Out[95]:
>>> masked_array(data = [-- -- -- 1 1 1 6 7 8 9],
>>>  mask = [ True  True  True False False False False False
>>> False False],
>>>fill_value = 99)
>>>
>>>
>>> In [96]: a = np.ma.masked_array(a,mask=or_mask)
>>>
>>> In [97]: a
>>> Out[97]:
>>> masked_array(data = [-- -- -- -- -- 1 6 7 8 9],
>>>  mask = [ True  True  True  True  True False False False
>>> False False],
>>>fill_value = 99)
>>>
>>> Chao
>>>
>>> --
>>>
>>> ***
>>> Chao YUE
>>> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
>>> UMR 1572 CEA-CNRS-UVSQ
>>> Batiment 712 - Pe 119
>>> 91191 GIF Sur YVETTE Cedex
>>> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>>>
>>> 
>>>
>>>
>>> ___
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>>>
>>
>> ___
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>
>
>
> --
>
> ***
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>
> 
>
>


-- 
***
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16

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


[Numpy-discussion] Change in ``round`` behavior for numpy scalars in python 3

2012-09-15 Thread Matthew Brett
Hi,

I just noticed that Python 3 raises an error for 0 dimensional numpy
arrays.  Here's Python 2.6:

In [14]: a = np.array(1.1)

In [15]: round(a)
Out[15]: 1.0

and Python 3.2:

In [3]: a = np.array(1.1)

In [4]: round(a)
---
TypeError Traceback (most recent call last)
/Users/mb312/dev_trees/ in ()
> 1 round(a)

TypeError: type numpy.ndarray doesn't define __round__ method

Should arrays implement __round__ ?Returning an error for 1D or above?

Best,

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


Re: [Numpy-discussion] Change in behavior of np.concatenate for upcoming release

2012-09-15 Thread Matthew Brett
Hi,

On Fri, Sep 14, 2012 at 11:25 PM, Han Genuit  wrote:
> I think there is something wrong with the implementation.. I would
> expect each incoming array in PyArray_ConcatenateFlattenedArrays to be
> flattened and the sizes of all of them added into a one-dimensional
> shape. Now the shape is two-dimensional, which does not make sense to
> me. Also the requirement that all sizes must be equal between the
> incoming arrays only makes sense when you want to stack them into a
> two-dimensional array, which makes it unnecessarily complicated. The
> difficulty here is to use PyArray_CopyAsFlat without having to
> transform/copy each incoming array to the priority dtype, because they
> can have different item sizes between them, but other than that it
> should be pretty straightforward, imo.
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

Thanks for the feedback. Feeling inadequate to a full understanding of
the code there, I've entered an issue for it:

https://github.com/numpy/numpy/issues/442

Ondrej - would you consider this a blocker for release?

Best,

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


[Numpy-discussion] [ANN] OpenOpt Suite release 0.42

2012-09-15 Thread Dmitrey



Hi all,


I'm glad to inform you about new OpenOpt Suite release 0.42
(2012-Sept-15). Main changes:


*  Some improvements for solver interalg, including handling of
categorical variables
*  Some parameters for solver gsubg
*  Speedup objective function for de and pswarm on FuncDesigner models
*  New global (GLP) solver: asa (adaptive simulated annealing)
*  Some new classes for network problems: TSP (traveling salesman
problem), STAB (maximum graph stable set)], MCP (maximum clique problem)
*  Improvements for FD XOR (and now it can handle many inputs)
*  Solver de has parameter "seed", also, now it works with PyPy
*  Function sign now is available in FuncDesigner
*  FuncDesigner interval analysis (and thus solver interalg) now can
handle non-monotone splines of 1st order
*  FuncDesigner now can handle parameter fixedVars as Python dict
*  Now scipy InterpolatedUnivariateSpline is used in FuncDesigner
interpolator() instead of UnivariateSpline. This creates backward
incompatibility - you cannot pass smoothing parameter (s) to interpolator
no longer.
*  SpaceFuncs: add Point weight, Disk, Ball and method contains(), bugfix
for importing Sphere, some new examples
*  Some improvements (essential speedup, new parameter interpolate for
P()) for our (currently commercial) FuncDesigner Stochastic Programming
addon
*  Some bugfixes


In our website ( http://openopt.org ) you could vote for most required
OpenOpt Suite development direction(s) (poll has been renewed, previous
results are here).


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