On Tue, Oct 6, 2009 at 4:28 PM, Pierre GM <pgmdevlist@gmail.com> wrote:

On Oct 6, 2009, at 4:42 PM, Gökhan Sever wrote:

> Hello,
>
> I have a sample masked array data as shown below.
>
> 1-) When I list the whole array I see the fill value correctly.
> However below that line, when I do access the 5th element,
> fill_value flies upto 1e+20. What might be wrong here?

Nothing. Your 5th element is the special constant numpy.ma.masked,
which has its own filling_value by default. I'll check whether it's
worth inheriting the fill_value from the original array. If you could
give me a test case where you'd need that value to keep the original
filling_value, that'd help me make up my mind.

Seeing a different filling value is causing confusion. Both for myself, and when I try to demonstrate the usage of masked array to other people. Also say, if I want to replace that one element back to its original state will it use fill_value as 1e+20 or 999999.9999?
 

> 2-) What is wrong with the arccos calculation? Should not that
> result the same as with cos(d) result?

I first tested on 1.3.0, and later on my laptop using 1.4dev version which is about an old month built.

Once again the results for each arc... function

I[31]: d
O[31]:
masked_array(data = --,
             mask = True,
       fill_value = 1e+20)


I[26]: arccos(d)
O[26]:
masked_array(data = 1.57079632679,
             mask = False,
       fill_value = 1e+20)


I[28]: arccosh(d)
O[28]:
masked_array(data = nan,
             mask = False,
       fill_value = 1e+20)


I[30]: arcsin(d)
O[30]:
masked_array(data = 0.0,
             mask = False,
       fill_value = 1e+20)


I[32]: arcsinh(d)
O[32]:
masked_array(data = --,
             mask = True,
       fill_value = 1e+20)


I[33]: arctan(d)
O[33]:
masked_array(data = --,
             mask = True,
       fill_value = 1e+20)


I[35]: arctanh(d)
O[35]:
masked_array(data = 0.0,
             mask = False,
       fill_value = 1e+20)


Only arcsinh and arctan results correctly.

 

Mmh, what numpy are you using ? When I try with a recent one,
np.arccos does output ma.masked...
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion



--
Gökhan