Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assume incoming locations might be plain dicts and wrap them. #110

Merged
merged 1 commit into from
May 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ Lib/mutatorMath/test/ufo/testData
Lib/mutatorMath/test/ufo/data/instances
Lib/mutatorMath/test/ufo/data/no_warpmap_test.designspace
Lib/mutatorMath/test/ufo/data/warpmap_test.designspace
.pytest_cache
8 changes: 4 additions & 4 deletions Lib/mutatorMath/objects/mutator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def buildMutator(items, axes=None, bias=None):
# the order itself does not matter, but we should always build in the same order.
items = sorted(items)
if not bias:
bias = biasFromLocations([bender(loc) for loc, obj in items], True)
bias = biasFromLocations([bender(Location(loc)) for loc, obj in items], True)
else:
# note: this means that the actual bias might be different from the initial value.
bias = bender(bias)
Expand All @@ -39,14 +39,14 @@ def buildMutator(items, axes=None, bias=None):
ofx = []
onx = []
for loc, obj in items:
loc = bender(loc)
loc = bender(Location(loc))
if (loc-bias).isOrigin():
m.setNeutral(obj)
break
if m.getNeutral() is None:
raise MutatorError("Did not find a neutral for this system", m)
for loc, obj in items:
locbent = bender(loc)
locbent = bender(Location(loc))
#lb = loc-bias
lb = locbent-bias
if lb.isOrigin(): continue
Expand Down Expand Up @@ -214,7 +214,7 @@ def makeInstance(self, aLocation):
Calculate an instance with the right bias and add the neutral.
aLocation: expected to be in input space
"""
aLocation = self._bender(aLocation)
aLocation = self._bender(Location(aLocation))
if not aLocation.isAmbivalent():
instanceObject = self.getInstance(aLocation-self._bias)
else:
Expand Down