[AstroPy] Selecting data from ascii.table with multiple conditions

Joe Philip Ninan indiajoe at gmail.com
Fri Oct 25 05:27:38 EDT 2013


Hi Yannick, Tom and Jeonghyun,
Thanks for the examples. They all worked.
I loaded the data with ascii.read() tool.
What confused me was Mytable['ID']>60  returned an object which contains a
boolean data array and another mask array.
Which is why i thought, i had to add .data before taking logical &, to make
sure data array is used.

Am I correct in assuming that this object which returned will basically
work like a standard numpy masked array? It will all make sense that way.
Thanks,
-cheers
joe



On 25 October 2013 11:25, Yannick Roehlly <yannick.roehlly at oamp.fr> wrote:

> Le Fri, 25 Oct 2013 02:24:38 +0530,
> Joe Philip Ninan <indiajoe at gmail.com> a écrit :
>
> > Mytable[np.where((Mytable['ID']>60).data &
> > (Mytable['MAG']>18).data)]['MAG'].data.data
> >
> > Quite a lot of ".data" to be appended !!
> > Am i missing some feature astropy already has for doing these kind of
> > data selection from table?
>
> Hi Joe,
>
> How do you read your table ?
>
> Mytable[(Mytable['ID']>60) & (Mytable['MAG']>18)] should do what you
> want.
>
> Cheers,
>
> Yannick
>
> --
> You will never amount to much.
>                 -- Munich Schoolmaster, to Albert Einstein, age 10
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>



-- 
/---------------------------------------------------------------
"GNU/Linux: because a PC is a terrible thing to waste" -  GNU Generation

************************************************
Joe Philip Ninan    http://sites.google.com/site/jpninan/
Research Scholar        /________________\
DAA,                            | Vadakeparambil |
TIFR,                           | Pullad P.O.         |
Mumbai-05, India.      | Kerala, India      |
Ph: +917738438212   | PIN:689548       |
------------------------------\_______________/--------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20131025/f26ba862/attachment.html>


More information about the AstroPy mailing list