# SetClass¶

class `pitchtools.``SetClass`(cardinality=1, rank=1, lex_rank=None, transposition_only=None)

Set-class.

```>>> import abjad
```

Initializes transposition-inversion set-class (with Forte rank):

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

There are 224 transposition-inversion set-classes.

Initializes transposition-inversion set-class (with lex rank):

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

There are 224 transposition-inversion set-classes.

Initializes transposition-only set-class:

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

There are 352 transposition-only set-classes.

Initializes 12-ET 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}
```

## Attribute summary¶

 `cardinality` Gets cardinality. `from_pitch_class_set`(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`([cardinality, lex_rank, …]) 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. `__copy__`(*arguments) Copies Abjad value object. `__eq__`(argument) Is true when all initialization values of Abjad value object equal the initialization values of argument. `__format__`([format_specification]) Formats Abjad object. `__hash__`() Hashes Abjad value object. `__ne__`(argument) Is true when Abjad object does not equal argument. `__repr__`() Gets interpreter representation of Abjad object. `__str__`() Gets string representation.

`SetClass.``cardinality`

Gets cardinality.

Gets cardinality of transposition-inversion 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 transposition-inversion 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 transposition-only 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.

`SetClass.``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-16){0, 1, 5, 8}
```
```>>> set_class.is_inversion_equivalent
False
```

Returns true or false.

`SetClass.``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}
```

Transposition-only 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.

`SetClass.``prime_form`

Gets prime form.

Gets prime form of transposition-inversion 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 transposition-inversion 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 transposition-only 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.

`SetClass.``rank`

Gets rank.

Gets rank of transposition-inversion 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 transposition-inversion 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 transposition-only 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.

`SetClass.``transposition_only`

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

Initializes transposition-inversion set-class (with Forte rank):

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

Initializes transposition-inversion 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 transposition-only 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.

## Class & static methods¶

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

Makes set-class from pitch_class_set.

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-31){0, 1, 4, 7, 8}
```

Makes set-class from pitch-class set:

```>>> 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-32){0, 1, 3, 4, 6, 9}
```

Makes set-class from pitch-class set:

```>>> 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-9){0, 1, 3, 7}
```

Returns set-class.

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

List set-classes.

Lists transposition-inversion 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}
```

There are 29 transposition-inversion set-classes of cardinality 4.

Lists transposition-inversion 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}
```

There are 29 transposition-inversion set-classes of cardinality 4:

Lists transposition-only 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}
```

There are 43 transposition-only set-classes of cardinality 4.

Returns list of set-classes.

## 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).``__ne__`(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

`(AbjadObject).``__repr__`()

Gets interpreter representation of Abjad object.

Returns string.

`SetClass.``__str__`()

Gets string representation.

Gets string of transposition-inversion set-class (with Forte rank):

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

Gets string of transposition-inversion 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 transposition-only set-class:

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

Returns string.