This script helps to generate a coil addressing for any size (height, width). It uses the reference configuration (config150.json
) to dump a new one corresponding to the requested size and origin (top left, top right, bottom left, bottom right). First adjust the tweakable parameters corresponding to the desired size and then run the rest of the script, the JSON file is saved under ../config
.
In [ ]:
height, width = 15, 20 # Size of the generated configuration
In [ ]:
origin = "top", "left" # Where is the 0, 0 coordinate? top/bottom, left/right
In [ ]:
import json
In [ ]:
mapping = [[0]*width for h in range(height)]
In [ ]:
address = 0
for w in range(width):
coil = range(height) if w%2==0 and origin[0]=="top" or w%2==1 and origin[0]=="bottom" else range(height-1, -1, -1)
for h in coil:
mapping[h][w] = address
address += 1
if origin[1]=="right": raise NotImplementedError("left/right coil to be implemented")
In [ ]:
mapping
In [ ]:
with open("../arbalet/config/config150.json") as f:
reference = json.load(f)
In [ ]:
reference["mapping"] = mapping
In [ ]:
with open("../arbalet/config/config{}.json".format(height*width), 'w') as f:
json.dump(reference, f, indent=4)
The configuration file is saved under the config
directory of your local git repo. You must install this new configuration file before being able to run apps with this configuration. Just save it under the proper location (example: /usr/local/lib/python2.7/dist-packages/arbalet-0.0.1-py2.7.egg/config/config150.json
) or ask setup.py
to do this for you.