Package jazzparser :: Package formalisms :: Package music_halfspan :: Package semantics :: Class EnharmonicCoordinate
[hide private]
[frames] | no frames]

Class EnharmonicCoordinate

source code

                           object --+        
                                    |        
base.semantics.lambdacalc.LogicalForm --+    
                                        |    
       base.semantics.lambdacalc.Terminal --+
                                            |
                               object --+   |
                                        |   |
         base.semantics.temporal.Temporal --+
                                            |
                                           EnharmonicCoordinate
Known Subclasses:

A four-dimensional coordinate. Stores the coordinate (x,y) within an enharmonic (4x3) block, and the coordinate (X,Y) that locates the enharmonic block within the infinite space.

Note that if x and y are set outside the range, they'll just be taken mod 4 and 3 respectively. If you want to set x,y and X,Y from a 2D coordinate, use from_harmonic_coord or the + operator.

This is used in the semantics as a tonic point.

Instance Methods [hide private]
 
__init__(self, coord=(0, 0), block=(0, 0), time=None, duration=None, delta=False, *args, **kwargs)
Builds a basic logical form object.
source code
 
__str__(self)
str(x)
source code
 
format_result(self)
When displaying LFs for results, the enharmonic block has no meaning and is just confusing.
source code
 
__repr__(self)
repr(x)
source code
 
get_start_time(self) source code
 
harmonic_str(self)
A string representation of the coordinate that's like the normal __str__, but displays the harmonic coordinate, rather than the enharmonic 4-tuple.
source code
 
__eq__(self, other)
This should be overridden by subclasses.
source code
 
copy(self)
This should be overridden by subclasses.
source code
 
set_time(self, time)
Should be overridden by subclasses.
source code
 
_get_x(self) source code
 
_set_x(self, x) source code
 
_get_y(self) source code
 
_set_y(self, y) source code
 
_get_X(self) source code
 
_set_X(self, X) source code
 
_get_Y(self) source code
 
_set_Y(self, Y) source code
 
nearest(self, coord)
Given a 2D coord within an enharmonic block, returns an EnharmonicCoordinate for the instance of that point that is closest to this enharmonic coordinate.
source code
 
add_coord(self, coord=(0, 0), delta=False)
Returns an enharmonic coordinate that results from adding the 2D harmonic coordinates to this enharmonic coordinate.
source code
 
__add__(self, other)
Define addition for 2D coordinates (same as add_coord) and EnharmonicCoordinates.
source code
 
__sub__(self, other)
Define subtraction for 2D coordinates and EnharmonicCoordinates.
source code

Inherited from base.semantics.lambdacalc.Terminal: alpha_convert, alpha_equivalent, beta_reduce, get_bound_variables, get_children, get_variables, replace_immediate_constituent, substitute

Inherited from base.semantics.lambdacalc.LogicalForm: __ne__, get_ancestor_bound_variables, get_instances, get_unbound_variables, replace_in_parent

Inherited from base.semantics.temporal.Temporal: get_literal_time_list, get_path_times, get_time_list, set_all_times, simultaneous

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Static Methods [hide private]
 
from_harmonic_coord(coord)
Creates an enharmonic coordinate from a harmonic coordinate, given as a 2-tuple.
source code
Class Variables [hide private]
  timed_object = True
  delta = False
Properties [hide private]
  zero_coord
Returns the 2D coordinate within an enharmonic block.
  block_coord
Returns the 2D location of the enharmonic block in which this coordinate lies.
  harmonic_coord
Returns the 2D coordinate (relative to the origin block) that this enharmonic coordinate represents.
  x
  y
  X
  Y

Inherited from base.semantics.temporal.Temporal: duration, time

Inherited from object: __class__

Method Details [hide private]

__init__(self, coord=(0, 0), block=(0, 0), time=None, duration=None, delta=False, *args, **kwargs)
(Constructor)

source code 

Builds a basic logical form object.

Parameters:
  • delta (bool) - whether this represents a vector, rather than a point, in the tonal space. A delta coordinate will never show in roman numeral format
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

format_result(self)

source code 

When displaying LFs for results, the enharmonic block has no meaning and is just confusing. Just show the (x,y) pair.

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__eq__(self, other)
(Equality operator)

source code 

This should be overridden by subclasses.

Overrides: base.semantics.lambdacalc.LogicalForm.__eq__
(inherited documentation)

copy(self)

source code 

This should be overridden by subclasses.

Overrides: base.semantics.lambdacalc.LogicalForm.copy
(inherited documentation)

set_time(self, time)

source code 

Should be overridden by subclasses.

Sets the start time of this logical form. This is different to just setting the time property: using set_time() may pass the time property down to its children if that is appropriate for the semantic type.

It is also distinct from set_all_times(), which recursively sets the time on all children.

This must be provided by all subclasses.

Overrides: base.semantics.temporal.Temporal.set_time
(inherited documentation)

nearest(self, coord)

source code 

Given a 2D coord within an enharmonic block, returns an EnharmonicCoordinate for the instance of that point that is closest to this enharmonic coordinate.

Parameters:
  • coord (2-tuple or EnharmonicCoordinate) - if given as a tuple, should be a coordinate within a block (i.e. between (0,0) and (4,3)); if an EC, the EC's zero coord will be used

add_coord(self, coord=(0, 0), delta=False)

source code 

Returns an enharmonic coordinate that results from adding the 2D harmonic coordinates to this enharmonic coordinate.

E.g. <(0,1)/(0,0)> + (-1,0) = <(3,0)/(-1,0)> and <(1,0)/(0,0)> + (-1,0) = <(0,0)/(0,0)>

__sub__(self, other)
(Subtraction operator)

source code 

Define subtraction for 2D coordinates and EnharmonicCoordinates.

Result is always a delta.


Property Details [hide private]

zero_coord

Returns the 2D coordinate within an enharmonic block. Equivalently, locates this coordinate in the zeroth enharmonic block.

Get Method:
unreachable.zero_coord(self) - Returns the 2D coordinate within an enharmonic block.

block_coord

Returns the 2D location of the enharmonic block in which this coordinate lies.

Get Method:
unreachable.block_coord(self) - Returns the 2D location of the enharmonic block in which this coordinate lies.

harmonic_coord

Returns the 2D coordinate (relative to the origin block) that this enharmonic coordinate represents.

Get Method:
unreachable.harmonic_coord(self) - Returns the 2D coordinate (relative to the origin block) that this enharmonic coordinate represents.

x

Get Method:
_get_x(self)
Set Method:
_set_x(self, x)

y

Get Method:
_get_y(self)
Set Method:
_set_y(self, y)

X

Get Method:
_get_X(self)
Set Method:
_set_X(self, X)

Y

Get Method:
_get_Y(self)
Set Method:
_set_Y(self, Y)