# SetClass¶

class `abjad.pitch.SetClass.``SetClass`(cardinality=1, rank=1, *, lex_rank=None, transposition_only=None)

Set-class.

Makes SG2 set-class from Forte rank:

```>>> set_class = abjad.SetClass(4, 29)
>>> print(set_class)
SC(4-29){0, 1, 3, 7}
```

Makes SG2 set-class from lex rank:

```>>> set_class = abjad.SetClass(4, 29, lex_rank=True)
>>> print(set_class)
SC(4-29){0, 3, 6, 9}
```

Makes SG1 set-class:

```>>> set_class = abjad.SetClass(4, 29, transposition_only=True)
>>> print(set_class)
SC(4-29){0, 2, 6, 7}
```

Makes aggregate:

```>>> set_class = abjad.SetClass(12, 1, transposition_only=True)
>>> print(set_class)
SC(12-1){0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
```

Lists SG2 tetrachords, pentachords, hexachords by Forte rank:

```>>> set_classes = abjad.SetClass.list_set_classes(cardinality=4)
>>> for set_class in set_classes:
...     print(set_class)
...
SC(4-1){0, 1, 2, 3}
SC(4-2){0, 1, 2, 4}
SC(4-3){0, 1, 3, 4}
SC(4-4){0, 1, 2, 5}
SC(4-5){0, 1, 2, 6}
SC(4-6){0, 1, 2, 7}
SC(4-7){0, 1, 4, 5}
SC(4-8){0, 1, 5, 6}
SC(4-9){0, 1, 6, 7}
SC(4-10){0, 2, 3, 5}
SC(4-11){0, 1, 3, 5}
SC(4-12){0, 2, 3, 6}
SC(4-13){0, 1, 3, 6}
SC(4-14){0, 2, 3, 7}
SC(4-15){0, 1, 4, 6}
SC(4-16){0, 1, 5, 7}
SC(4-17){0, 3, 4, 7}
SC(4-18){0, 1, 4, 7}
SC(4-19){0, 1, 4, 8}
SC(4-20){0, 1, 5, 8}
SC(4-21){0, 2, 4, 6}
SC(4-22){0, 2, 4, 7}
SC(4-23){0, 2, 5, 7}
SC(4-24){0, 2, 4, 8}
SC(4-25){2, 6, 8, 9}
SC(4-26){0, 3, 5, 8}
SC(4-27){0, 2, 5, 8}
SC(4-28){0, 3, 6, 9}
SC(4-29){0, 1, 3, 7}
```
```>>> set_classes = abjad.SetClass.list_set_classes(cardinality=5)
>>> for set_class in set_classes:
...     print(set_class)
...
SC(5-1){0, 1, 2, 3, 4}
SC(5-2){0, 1, 2, 3, 5}
SC(5-3){0, 1, 2, 4, 5}
SC(5-4){0, 1, 2, 3, 6}
SC(5-5){0, 1, 2, 3, 7}
SC(5-6){0, 1, 2, 5, 6}
SC(5-7){0, 1, 2, 6, 7}
SC(5-8){0, 2, 3, 4, 6}
SC(5-9){0, 1, 2, 4, 6}
SC(5-10){0, 1, 3, 4, 6}
SC(5-11){0, 2, 3, 4, 7}
SC(5-12){0, 1, 3, 5, 6}
SC(5-13){0, 1, 2, 4, 8}
SC(5-14){0, 1, 2, 5, 7}
SC(5-15){0, 1, 2, 6, 8}
SC(5-16){0, 1, 3, 4, 7}
SC(5-17){0, 1, 3, 4, 8}
SC(5-18){0, 1, 4, 5, 7}
SC(5-19){0, 1, 3, 6, 7}
SC(5-20){0, 1, 3, 7, 8}
SC(5-21){0, 1, 4, 5, 8}
SC(5-22){0, 1, 4, 7, 8}
SC(5-23){0, 2, 3, 5, 7}
SC(5-24){0, 1, 3, 5, 7}
SC(5-25){0, 2, 3, 5, 8}
SC(5-26){0, 2, 4, 5, 8}
SC(5-27){0, 1, 3, 5, 8}
SC(5-28){0, 2, 3, 6, 8}
SC(5-29){0, 1, 3, 6, 8}
SC(5-30){0, 1, 4, 6, 8}
SC(5-31){0, 1, 3, 6, 9}
SC(5-32){0, 1, 4, 6, 9}
SC(5-33){0, 2, 4, 6, 8}
SC(5-34){0, 2, 4, 6, 9}
SC(5-35){0, 2, 4, 7, 9}
SC(5-36){0, 1, 2, 4, 7}
SC(5-37){0, 3, 4, 5, 8}
SC(5-38){0, 1, 2, 5, 8}
```
```>>> set_classes = abjad.SetClass.list_set_classes(cardinality=6)
>>> for set_class in set_classes:
...     print(set_class)
...
SC(6-1){0, 1, 2, 3, 4, 5}
SC(6-2){0, 1, 2, 3, 4, 6}
SC(6-3){0, 1, 2, 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 5, 6, 9}
SC(6-45){0, 2, 3, 4, 6, 9}
SC(6-46){0, 1, 2, 4, 6, 9}
SC(6-47){0, 1, 2, 4, 7, 9}
SC(6-48){0, 1, 2, 5, 7, 9}
SC(6-49){0, 1, 3, 4, 7, 9}
SC(6-50){0, 1, 4, 6, 7, 9}
```

There are 352 SG1 set-classes and 224 SG2 set-classes.

Attributes Summary

 `__str__` Gets string representation. `cardinality` Gets cardinality. `from_pitch_class_set` Makes set-class from pitch_class_set. `is_inversion_equivalent` Is true when set-class is inversion-equivalent. `lex_rank` Is true when set-class uses lex rank. `list_set_classes` List set-classes. `prime_form` Gets prime form. `rank` Gets rank. `transposition_only` Is true when set-class collects pitch-class sets related only by transposition.

Special methods

`(AbjadValueObject).``__copy__`(*arguments)

`(AbjadValueObject).``__eq__`(argument)

Is true when all initialization values of Abjad value object equal the initialization values of `argument`.

Returns true or false.

`(AbjadObject).``__format__`(format_specification='')

Set `format_specification` to `''` or `'storage'`. Interprets `''` equal to `'storage'`.

Returns string.

`(AbjadValueObject).``__hash__`()

Returns integer.

`(AbjadObject).``__repr__`()

Gets interpreter representation of Abjad object.

Returns string.

`__str__`()

Gets string representation.

Gets string of SG2 set-class with Forte rank:

```>>> set_class = abjad.SetClass(4, 29)
>>> print(set_class)
SC(4-29){0, 1, 3, 7}
```

Gets string of SG2 set-class with lex rank:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     lex_rank=True,
...     )
>>> print(set_class)
SC(4-29){0, 3, 6, 9}
```

Gets string of SG1 set-class:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     transposition_only=True,
...     )
>>> print(set_class)
SC(4-29){0, 2, 6, 7}
```

Returns string.

Class & static methods

static `from_pitch_class_set`(pitch_class_set, lex_rank=None, transposition_only=None)

Makes set-class from pitch_class_set.

```>>> pc_set = abjad.PitchClassSet([9, 0, 3, 5, 6])
>>> print(set_class)
SC(5-31){0, 1, 3, 6, 9}
```
```>>> pc_set = abjad.PitchClassSet([9, 0, 3, 5, 6])
...     pc_set,
...     lex_rank=True,
...     )
>>> print(set_class)
SC(5-22){0, 1, 3, 6, 9}
```
```>>> pc_set = abjad.PitchClassSet([9, 0, 3, 5, 6])
...     pc_set,
...     transposition_only=True,
...     )
>>> print(set_class)
SC(5-44){0, 2, 3, 6, 9}
```
```>>> pc_set = abjad.PitchClassSet([9, 11, 1, 2, 4, 6])
>>> print(set_class)
SC(6-32){0, 2, 4, 5, 7, 9}
```
```>>> pc_set = abjad.PitchClassSet([9, 11, 1, 2, 4, 6])
...     pc_set,
...     lex_rank=True,
...     )
>>> print(set_class)
SC(6-49){0, 2, 4, 5, 7, 9}
```
```>>> pc_set = abjad.PitchClassSet([9, 11, 1, 2, 4, 6])
...     pc_set,
...     transposition_only=True,
...     )
>>> print(set_class)
SC(6-70){0, 2, 4, 5, 7, 9}
```
```>>> pc_set = abjad.PitchClassSet([11, 0, 5, 6])
>>> print(set_class)
SC(4-9){0, 1, 6, 7}
```
```>>> pc_set = abjad.PitchClassSet([11, 0, 5, 6])
...     pc_set,
...     lex_rank=True,
...     )
>>> print(set_class)
SC(4-17){0, 1, 6, 7}
```
```>>> pc_set = abjad.PitchClassSet([11, 0, 5, 6])
...     pc_set,
...     transposition_only=True,
...     )
>>> print(set_class)
SC(4-17){0, 1, 6, 7}
```
```>>> pc_set = abjad.PitchClassSet([0, 4, 7])
>>> print(set_class)
SC(3-11){0, 3, 7}
```
```>>> pc_set = abjad.PitchClassSet([0, 4, 7])
...     pc_set,
...     lex_rank=True,
...     )
>>> print(set_class)
SC(3-11){0, 3, 7}
```
```>>> pc_set = abjad.PitchClassSet([0, 4, 7])
...     pc_set,
...     transposition_only=True,
...     )
>>> print(set_class)
SC(3-17){0, 4, 7}
```

Returns set-class.

static `list_set_classes`(cardinality=None, lex_rank=None, transposition_only=None)

List set-classes.

Lists SG2 set-classes of cardinality 4 with Forte rank:

```>>> set_classes = abjad.SetClass.list_set_classes(
...     cardinality=4,
...     )
>>> for set_class in set_classes:
...     print(set_class)
SC(4-1){0, 1, 2, 3}
SC(4-2){0, 1, 2, 4}
SC(4-3){0, 1, 3, 4}
SC(4-4){0, 1, 2, 5}
SC(4-5){0, 1, 2, 6}
SC(4-6){0, 1, 2, 7}
SC(4-7){0, 1, 4, 5}
SC(4-8){0, 1, 5, 6}
SC(4-9){0, 1, 6, 7}
SC(4-10){0, 2, 3, 5}
SC(4-11){0, 1, 3, 5}
SC(4-12){0, 2, 3, 6}
SC(4-13){0, 1, 3, 6}
SC(4-14){0, 2, 3, 7}
SC(4-15){0, 1, 4, 6}
SC(4-16){0, 1, 5, 7}
SC(4-17){0, 3, 4, 7}
SC(4-18){0, 1, 4, 7}
SC(4-19){0, 1, 4, 8}
SC(4-20){0, 1, 5, 8}
SC(4-21){0, 2, 4, 6}
SC(4-22){0, 2, 4, 7}
SC(4-23){0, 2, 5, 7}
SC(4-24){0, 2, 4, 8}
SC(4-25){2, 6, 8, 9}
SC(4-26){0, 3, 5, 8}
SC(4-27){0, 2, 5, 8}
SC(4-28){0, 3, 6, 9}
SC(4-29){0, 1, 3, 7}
```

Lists SG2 set-classes of cardinality 4 with lex rank:

```>>> set_classes = abjad.SetClass.list_set_classes(
...     cardinality=4,
...     lex_rank=True,
...     )
>>> for set_class in set_classes:
...     print(set_class)
SC(4-1){0, 1, 2, 3}
SC(4-2){0, 1, 2, 4}
SC(4-3){0, 1, 2, 5}
SC(4-4){0, 1, 2, 6}
SC(4-5){0, 1, 2, 7}
SC(4-6){0, 1, 3, 4}
SC(4-7){0, 1, 3, 5}
SC(4-8){0, 1, 3, 6}
SC(4-9){0, 1, 3, 7}
SC(4-10){0, 1, 4, 5}
SC(4-11){0, 1, 4, 6}
SC(4-12){0, 1, 4, 7}
SC(4-13){0, 1, 4, 8}
SC(4-14){0, 1, 5, 6}
SC(4-15){0, 1, 5, 7}
SC(4-16){0, 1, 5, 8}
SC(4-17){0, 1, 6, 7}
SC(4-18){0, 2, 3, 5}
SC(4-19){0, 2, 3, 6}
SC(4-20){0, 2, 3, 7}
SC(4-21){0, 2, 4, 6}
SC(4-22){0, 2, 4, 7}
SC(4-23){0, 2, 4, 8}
SC(4-24){0, 2, 5, 7}
SC(4-25){0, 2, 5, 8}
SC(4-26){0, 2, 6, 8}
SC(4-27){0, 3, 4, 7}
SC(4-28){0, 3, 5, 8}
SC(4-29){0, 3, 6, 9}
```

Lists SG1 set-classes of cardinality 4:

```>>> set_classes = abjad.SetClass.list_set_classes(
...     cardinality=4,
...     transposition_only=True,
...     )
>>> for set_class in set_classes:
...     print(set_class)
SC(4-1){0, 1, 2, 3}
SC(4-2){0, 1, 2, 4}
SC(4-3){0, 1, 2, 5}
SC(4-4){0, 1, 2, 6}
SC(4-5){0, 1, 2, 7}
SC(4-6){0, 1, 3, 4}
SC(4-7){0, 1, 3, 5}
SC(4-8){0, 1, 3, 6}
SC(4-9){0, 1, 3, 7}
SC(4-10){0, 1, 4, 5}
SC(4-11){0, 1, 4, 6}
SC(4-12){0, 1, 4, 7}
SC(4-13){0, 1, 4, 8}
SC(4-14){0, 1, 5, 6}
SC(4-15){0, 1, 5, 7}
SC(4-16){0, 1, 5, 8}
SC(4-17){0, 1, 6, 7}
SC(4-18){0, 2, 3, 4}
SC(4-19){0, 2, 3, 5}
SC(4-20){0, 2, 3, 6}
SC(4-21){0, 2, 3, 7}
SC(4-22){0, 2, 4, 5}
SC(4-23){0, 2, 4, 6}
SC(4-24){0, 2, 4, 7}
SC(4-25){0, 2, 4, 8}
SC(4-26){0, 2, 5, 6}
SC(4-27){0, 2, 5, 7}
SC(4-28){0, 2, 5, 8}
SC(4-29){0, 2, 6, 7}
SC(4-30){0, 2, 6, 8}
SC(4-31){0, 3, 4, 5}
SC(4-32){0, 3, 4, 6}
SC(4-33){0, 3, 4, 7}
SC(4-34){0, 3, 4, 8}
SC(4-35){0, 3, 5, 6}
SC(4-36){0, 3, 5, 7}
SC(4-37){0, 3, 5, 8}
SC(4-38){0, 3, 6, 7}
SC(4-39){0, 3, 6, 8}
SC(4-40){0, 3, 6, 9}
SC(4-41){0, 4, 5, 6}
SC(4-42){0, 4, 5, 7}
SC(4-43){0, 4, 6, 7}
```

Returns list of set-classes.

`cardinality`

Gets cardinality.

Gets cardinality of SG2 set-class with Forte rank:

```>>> set_class = abjad.SetClass(4, 29)
>>> print(set_class)
SC(4-29){0, 1, 3, 7}
```
```>>> set_class.cardinality
4
```

Gets cardinality of SG2 set-class with lex rank:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     lex_rank=True,
...     )
>>> print(set_class)
SC(4-29){0, 3, 6, 9}
```
```>>> set_class.cardinality
4
```

Gets cardinality of SG1 set-class:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     transposition_only=True,
...     )
>>> print(set_class)
SC(4-29){0, 2, 6, 7}
```
```>>> set_class.cardinality
4
```

Set to integer between 0 and 12, inclusive.

Returns integer between 0 and 12, inclusive.

`is_inversion_equivalent`

Is true when set-class is inversion-equivalent.

Is inversion-equivalent:

```>>> set_class = abjad.SetClass(4, 29)
>>> print(set_class)
SC(4-29){0, 1, 3, 7}
```
```>>> pitch_class_set = set_class.prime_form
>>> inverted_pitch_class_set = pitch_class_set.invert()
...     inverted_pitch_class_set
...     )
>>> print(inverted_set_class)
SC(4-29){0, 1, 3, 7}
```
```>>> set_class.is_inversion_equivalent
True
```

Is inversion-equivalent:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     lex_rank=True,
...     )
>>> print(set_class)
SC(4-29){0, 3, 6, 9}
```
```>>> pitch_class_set = set_class.prime_form
>>> inverted_pitch_class_set = pitch_class_set.invert()
...     inverted_pitch_class_set,
...     lex_rank=True,
...     )
>>> print(inverted_set_class)
SC(4-29){0, 3, 6, 9}
```
```>>> set_class.is_inversion_equivalent
True
```

Is not inversion-equivalent:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     transposition_only=True,
...     )
>>> print(set_class)
SC(4-29){0, 2, 6, 7}
```
```>>> pitch_class_set = set_class.prime_form
>>> inverted_pitch_class_set = pitch_class_set.invert()
...     inverted_pitch_class_set,
...     transposition_only=True,
...     )
>>> print(inverted_set_class)
SC(4-15){0, 1, 5, 7}
```
```>>> set_class.is_inversion_equivalent
False
```

Returns true or false.

`lex_rank`

Is true when set-class uses lex rank.

Uses Forte rank:

```>>> set_class = abjad.SetClass(4, 29)
>>> set_class
SetClass(cardinality=4, rank=29)
```
```>>> print(set_class)
SC(4-29){0, 1, 3, 7}
```

Uses lex rank:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     lex_rank=True,
...     )
>>> set_class
SetClass(cardinality=4, rank=29, lex_rank=True)
```
```>>> print(set_class)
SC(4-29){0, 3, 6, 9}
```

SG1 set-classes always use lex rank:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     transposition_only=True,
...     )
>>> set_class
SetClass(cardinality=4, rank=29, transposition_only=True)
```
```>>> print(set_class)
SC(4-29){0, 2, 6, 7}
```

Set to true, false or none.

Defaults to none.

Returns true, false or none.

`prime_form`

Gets prime form.

Gets prime form of SG2 set-class with Forte rank:

```>>> set_class = abjad.SetClass(4, 29)
>>> print(set_class)
SC(4-29){0, 1, 3, 7}
```
```>>> set_class.prime_form
PitchClassSet([0, 1, 3, 7])
```

Gets prime form of SG2 set-class with lex rank:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     lex_rank=True,
...     )
>>> print(set_class)
SC(4-29){0, 3, 6, 9}
```
```>>> set_class.prime_form
PitchClassSet([0, 3, 6, 9])
```

Gets prime form of SG1 set-class:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     transposition_only=True,
...     )
>>> print(set_class)
SC(4-29){0, 2, 6, 7}
```
```>>> set_class.prime_form
PitchClassSet([0, 2, 6, 7])
```

Returns numbered pitch-class set.

`rank`

Gets rank.

Gets rank of SG2 set-class with Forte rank:

```>>> set_class = abjad.SetClass(4, 29)
>>> print(set_class)
SC(4-29){0, 1, 3, 7}
```
```>>> set_class.rank
29
```

Gets rank of SG2 set-class with lex rank:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     lex_rank=True,
...     )
>>> print(set_class)
SC(4-29){0, 3, 6, 9}
```
```>>> set_class.rank
29
```

Gets rank of SG1 set-class:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     transposition_only=True,
...     )
>>> print(set_class)
SC(4-29){0, 2, 6, 7}
```
```>>> set_class.rank
29
```

Set to positive integer.

Returns positive integer.

`transposition_only`

Is true when set-class collects pitch-class sets related only by transposition.

Initializes SG2 set-class with Forte rank:

```>>> set_class = abjad.SetClass(4, 29)
>>> print(set_class)
SC(4-29){0, 1, 3, 7}
```

Initializes SG2 set-class with lex rank:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     lex_rank=True,
...     )
>>> print(set_class)
SC(4-29){0, 3, 6, 9}
```

Initializes SG1 set-class:

```>>> set_class = abjad.SetClass(
...     4, 29,
...     transposition_only=True,
...     )
>>> print(set_class)
SC(4-29){0, 2, 6, 7}
```

Set to true, false or none.

Defaults to none.

Returns true, false or none.