facet_subsets

glue.core.util.facet_subsets(data_collection, cid, lo=None, hi=None, steps=5, prefix='', log=False)[source]

Create a series of subsets that partition the values of a particular attribute into several bins

This creates steps new subset groups, adds them to the data collection, and returns the list of newly created subset groups.

Parameters
dataDataCollection

The DataCollection object to use

cidComponentID

The ComponentID to facet on

lofloat, optional

The lower bound for the faceting. Defaults to minimum value in data

hifloat, optional

The upper bound for the faceting. Defaults to maximum value in data

stepsint, optional

The number of subsets to create. Defaults to 5

prefixstr, optional

If present, the new subset labels will begin with prefix

logbool, optional

If True, space divisions logarithmically. Default is False

Returns
subset_groupsiterable

List of SubsetGroup instances added to data

Examples

facet_subset(data, data.id['mass'], lo=0, hi=10, steps=2)

creates 2 new subsets. The first represents the constraint 0 <= mass < 5. The second represents 5 <= mass <= 10:

facet_subset(data, data.id['mass'], lo=10, hi=0, steps=2)

Creates 2 new subsets. The first represents the constraint 10 >= x > 5 The second represents 5 >= mass >= 0:

facet_subset(data, data.id['mass'], lo=0, hi=10, steps=2, prefix='m')

Labels the subsets m_1 and m_2.

Note that the last range is inclusive on both sides. For example, if lo is 0 and hi is 5, and steps is 5, then the intervals for the subsets are [0,1), [1,2), [2,3), [3,4), and [4,5].