export subsets

6 views
Skip to first unread message

chris.m...@gmail.com

unread,
May 1, 2021, 12:54:27 PM5/1/21
to Glue users
Hi,

First of all THANKS a lot for this very useful tool!

I imported data from a csv file. I generated different scatter plot, and found in each of them some aberrant points that I easily selected using different subsets. I then checked that aberrant points may or not be common in different plots.
Now I want to export a table, in csv format, of only the data that are NOT in any subset, to have a clean version of my data, without the selected points. Is this possible? Or at least export all the points that are in the subsets, I could filter them out from another python script.
Is there any way to do this?
Thanks a lot,
Christophe

Eric Jensen

unread,
May 2, 2021, 9:06:27 AM5/2/21
to glue...@googlegroups.com
Hi Christophe,

I’m not a glue expert, but it looks like you should be able to do this by converting each subset to a Boolean mask.  You would need to open the iPython terminal in glue:


Then run something like this (untested, might need some syntax tweaks):

import numpy as np

data = dc[0]
# start with an all-true mask of the right shape:
mask = np.ones(data.shape, dtype=‘bool’)

# loop through the subsets, at each step negating the mask to
# keep only those points not in the subset:
for s in data.subsets:
   mask = np.logical_and(mask, ~ s.to_mask())

# apply to data:
clean_data = data[mask]
# then export as needed...

Hope this helps,

Eric


On May 1, 2021, at 12:54 PM, chris.m...@gmail.com <chris.m...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "Glue users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to glue-viz+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/glue-viz/ed29cd9a-89e1-46da-b941-151fbf27c477n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages