-
Notifications
You must be signed in to change notification settings - Fork 7
Misc: TODO, Wishlist,Notes
J.L Stevens edited this page Apr 17, 2015
·
1 revision
-
Remove fixedpoint entirely as we can use
fractions
instead (standard library, 2.7+) -
Automate periodic squashing of reference data and gh-pages git repos.
- Rename DICE tests to Conda and get it working
- Update Topographica tests
-
%load_ext
on doozy has been hacked to suppress the annoying reload messages. -
TemporalScatter
using 'name' in Image (wrong!)
Things to do given sufficient money and/or time:
- Implement Von Der Malsburg's model (does it end up with crystal structure?)
Sometime when the tests are passing and solid, I'd like to make the
change below, and similar changes in the different locations across
several packages that this horrible code has propagated. I'm emailing
this now just so I remember to do that and test it properly, though
anyone is welcome to make the change if it bothers them too. The code
could also be redefined as:
def wrap(lower,upper,x):
return (val-lower) % (upper-lower) + lower
but I'm not sure if that will work the same as using numpy's remainder
function, when given numpy array arguments. Let me know if you spot
any flaw in the new definition...
Jim
_______________________________________________________________________________
novo:~/research/topographica> git diff
diff --git a/topo/base/arrayutil.py b/topo/base/arrayutil.py
index 16ccc12..7b31548 100644
--- a/topo/base/arrayutil.py
+++ b/topo/base/arrayutil.py
@@ -4,7 +4,7 @@ General utility functions and classes for Topographica
that require numpy.
import re
-from numpy import sqrt,dot,arctan2,array2string,fmod,floor,array, \
+from numpy import sqrt,dot,arctan2,array2string,remainder,array, \
unravel_index,concatenate,set_printoptions,divide,maximum,minimum
from numpy import ufunc
@@ -136,13 +136,8 @@ def wrap(lower, upper, x):
Valid for cyclic quantities like orientations or hues.
"""
- #I have no idea how I came up with this algorithm; it should be simplified.
- #
- # Note that Python's % operator works on floats and arrays;
- # usually one can simply use that instead. E.g. to wrap array or
- # scalar x into 0,2*pi, just use "x % (2*pi)".
- range_=upper-lower
- return lower + fmod(x-lower + 2*range_*(1-floor(x/(2*range_))),
- # range_)
+ return remainder(x-lower,upper-lower) + lower
+
def array_argmax(arr):