PitchArrayCell

class pitchtools.PitchArrayCell(pitches=None, width=1)

Pitch array cell.

Example 1. A pitch array cell:

>>> array = pitchtools.PitchArray([[1, 2, 1], [2, 1, 1]])
>>> print(array)
[ ] [     ] [ ]
[     ] [ ] [ ]
>>> cell = array[0][1]
>>> cell
PitchArrayCell(width=2)
>>> cell.column_indices
(1, 2)
>>> cell.indices
(0, (1, 2))
>>> cell.is_first_in_row
False
>>> cell.is_last_in_row
False
>>> cell.next
PitchArrayCell(width=1)
>>> print(format(cell.parent_array))
pitchtools.PitchArray(
    rows=(
        pitchtools.PitchArrayRow(
            cells=(
                pitchtools.PitchArrayCell(
                    width=1,
                    ),
                pitchtools.PitchArrayCell(
                    width=2,
                    ),
                pitchtools.PitchArrayCell(
                    width=1,
                    ),
                ),
            ),
        pitchtools.PitchArrayRow(
            cells=(
                pitchtools.PitchArrayCell(
                    width=2,
                    ),
                pitchtools.PitchArrayCell(
                    width=1,
                    ),
                pitchtools.PitchArrayCell(
                    width=1,
                    ),
                ),
            ),
        ),
    )
>>> print(format(cell.parent_column))
pitchtools.PitchArrayColumn(
    cells=(
        pitchtools.PitchArrayCell(
            width=2,
            ),
        pitchtools.PitchArrayCell(
            width=2,
            ),
        ),
    )
>>> print(format(cell.parent_row))
pitchtools.PitchArrayRow(
    cells=(
        pitchtools.PitchArrayCell(
            width=1,
            ),
        pitchtools.PitchArrayCell(
            width=2,
            ),
        pitchtools.PitchArrayCell(
            width=1,
            ),
        ),
    )
>>> cell.pitches is None
True
>>> cell.previous
PitchArrayCell(width=1)
>>> cell.row_index
0
>>> cell.item
2
>>> cell.width
2

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_pitchtools { graph [label=pitchtools]; "abjad.tools.pitchtools.PitchArrayCell.PitchArrayCell" [color=black, fontcolor=white, group=2, label=<<B>PitchArrayCell</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.pitchtools.PitchArrayCell.PitchArrayCell"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

append_pitch(pitch) Appends pitch to cell.
column_indices Gets column start and stop indices.
column_start_index Gets column start index.
column_stop_index Gets column stop index.
indices Gets indices.
is_first_in_row Is true when pitch array cell is first in row.
is_last_in_row Is true when pitch array cell is last in row.
item Gets item.
matches_cell(arg) Is true when pitch array cell matches arg.
next Gets next pitch array cell in row after this pitch array cell.
parent_array Gets parent array.
parent_column Gets parent column.
parent_row Gets parent row.
pitches Gets and sets pitches of pitch array cell.
previous Gets pitch array cell in row prior to this pitch array cell.
row_index Gets row index.
weight Gets weight.
width Gets width.
__eq__(expr) Is true when ID of expr equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__hash__() Hashes Abjad object.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.
__str__() Gets string representation of pitch array cell.

Read-only properties

PitchArrayCell.column_indices

Gets column start and stop indices.

Example 1. Gets column start and stop indices of cell in array:

>>> array = pitchtools.PitchArray([[1, 2, 1], [2, 1, 1]])
>>> cell = array[0][1]
>>> cell.column_indices
(1, 2)

Example 2. Gets column start and stop indices of cell outside array:

>>> cell = pitchtools.PitchArrayCell()
>>> cell.column_indices is None
True

Returns tuple or none.

PitchArrayCell.column_start_index

Gets column start index.

Example 1. Gets column start index of cell in array:

>>> array = pitchtools.PitchArray([[1, 2, 1], [2, 1, 1]])
>>> cell = array[0][1]
>>> cell.column_start_index
1

Example 2. Gets column start index of cell outside array:

>>> cell = pitchtools.PitchArrayCell()
>>> cell.column_start_index is None
True

Returns nonnegative integer or none.

PitchArrayCell.column_stop_index

Gets column stop index.

Example 1. Gets column stop index of cell in array:

>>> array = pitchtools.PitchArray([[1, 2, 1], [2, 1, 1]])
>>> cell = array[0][1]
>>> cell.column_stop_index
2

Example 2. Gets column stop index of cell outside array:

>>> cell = pitchtools.PitchArrayCell()
>>> cell.column_stop_index is None
True

Returns nonnegative integer or none.

PitchArrayCell.indices

Gets indices.

Returns pair.

PitchArrayCell.is_first_in_row

Is true when pitch array cell is first in row. Otherwise false.

Returns true or false.

PitchArrayCell.is_last_in_row

Is true when pitch array cell is last in row. Otherwise false.

Returns true or false.

PitchArrayCell.item

Gets item.

Complicated return type.

PitchArrayCell.next

Gets next pitch array cell in row after this pitch array cell.

Returns pitch array cell.

PitchArrayCell.parent_array

Gets parent array.

Return pitch array.

PitchArrayCell.parent_column

Gets parent column.

Returns pitch array column.

PitchArrayCell.parent_row

Gets parent row.

Returns pitch array row.

PitchArrayCell.previous

Gets pitch array cell in row prior to this pitch array cell.

Returns pitch array cell.

PitchArrayCell.row_index

Gets row index.

Returns nonnegative integer or none.

PitchArrayCell.weight

Gets weight.

Weight defined equal to number of pitches in cell.

Returns nonnegative integer.

PitchArrayCell.width

Gets width.

Width defined equal to number of columns spanned by cell.

Returns positive integer.

Read/write properties

PitchArrayCell.pitches

Gets and sets pitches of pitch array cell.

Returns list.

Methods

PitchArrayCell.append_pitch(pitch)

Appends pitch to cell.

Returns none.

PitchArrayCell.matches_cell(arg)

Is true when pitch array cell matches arg. Otherwise false.

Returns true or false.

Special methods

(AbjadObject).__eq__(expr)

Is true when ID of expr equals ID of Abjad object. Otherwise false.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(AbjadObject).__hash__()

Hashes Abjad object.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(AbjadObject).__ne__(expr)

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

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

PitchArrayCell.__str__()

Gets string representation of pitch array cell.

Returns string.