[Numpy-discussion] Newbie MA question
Cath Lawrence
Cath.Lawrence at anu.edu.au
Wed Aug 7 20:18:01 EDT 2002
Hi,
I'm not sure this is the right list - looking at the archives you guys
look more like developers more than users.
Any pointers to the proper place, or TFMs to R, are welcome. (Yes, I
have & have read the Numerical Python documentation.)
That said, I'm trying to use masked arrays (for a bioinformatics app
calculating stats on distances between pairs of amino acids, if you want
to know) and am having a little trouble printing.
One possible bug - "x.__str__()" and "x.__repr__()" show different
typecodes.
Example:
>>> import MA
>>> id = MA.identity(20)
>>> r = MA.ones((20,20))*1.0
>>> rm = MA.MaskedArray(r, mask=id)
>>> rm # ie, call x.__repr__()
array(data =
array (20,20) , type = d, has 400 elements,
mask =
array (20,20) , type = 1, has 400 elements,
fill_value=[ 1.00000002e+20,])
>>> print rm # ie, call x.__str__()
array (20,20) , type = O, has 400 elements
>>>
Secondly, I can't see how to make this print the whole thing if I want
it. Which I do; all my matrices are 20*20 'cause there are 20 amino
acids.
The Numeric.array2string method can't be used because the data is always
masked.
The best I've found so far is to make a Numeric array by filling with an
impossible number like -1, then use array2string. But visually it would
be nicer to see the masked values as "--".
Thanks for any help,
regards,
Cath
Cath Lawrence, Cath.Lawrence at anu.edu.au
Scientific Programmer, Centre for Bioinformation Science,
John Curtin School of Medical Research
Australian National University, Canberra ACT 0200
ph: Maths (02) 6125 2904; JCSMR (02) 6125 0417;
mobile: 0421-902694 fax: (02) 61254712
More information about the NumPy-Discussion
mailing list