def source_class(self):
     '''
     Specify the source class as a function in case future descendant classes want to use a different type of source
     '''        
     from riglib import motiontracker
     cls = motiontracker.make(self.marker_count, cls=motiontracker.Simulate)
     return cls, dict(radius=(100,100,50), offset=(-150,0,0))
 def source_class(self):
     '''
     Specify the source class as a function in case future descendant classes want to use a different type of source
     '''
     from riglib import motiontracker
     cls = motiontracker.make(self.marker_count, cls=motiontracker.AligningSystem)
     return cls, dict()
import time
import numpy as np
import tempfile
import glob
np.set_printoptions(suppress=True)
from riglib.sink import sinks, PrintSink
from riglib import source
from riglib import motiontracker, hdfwriter, nidaq

Motion = motiontracker.make(38, motiontracker.System)
datasource = source.DataSource(Motion)
tf = tempfile.NamedTemporaryFile()
sinks.start(hdfwriter.HDFWriter, filename=tf.name)
sinks.register(Motion)


datasource.start()
time.sleep(10)
datasource.stop()
sinks.stop()
time.sleep(2)

import tables
h5 = tables.openFile(tf.name)
caldat = h5.root.motiontracker[1024:, -6:,:3]

d = glob.glob("/storage/calibrations/alignment*.npz")
motiontracker.make_autoalign_reference(caldat, "/storage/calibrations/alignment%d.npz"%len(d))
import time
import numpy as np
np.set_printoptions(suppress=True)
from riglib.sink import sinks, PrintSink
from riglib import source
from riglib import motiontracker, hdfwriter, nidaq, calibrations

Motion = motiontracker.make(8, motiontracker.AligningSystem)

datasource = source.DataSource(Motion)
datasource.filter = calibrations.AutoAlign()
#sinks.start(nidaq.SendRowByte)
#sinks.register(Motion)

sinks.start(hdfwriter.HDFWriter, filename="/tmp/test.hdf")
#sinks.start(PrintSink)
sinks.register(Motion)

datasource.start()
print "reading for 10 seconds..."
try:
    while True:
        print datasource.get()
        time.sleep(0.01)
except KeyboardInterrupt:
    pass
datasource.stop()

sinks.stop()
print "complete!"
Esempio n. 5
0
import time
import numpy as np
import tempfile
import glob
np.set_printoptions(suppress=True)
from riglib.sink import sinks, PrintSink
from riglib import source
from riglib import motiontracker, hdfwriter, nidaq

Motion = motiontracker.make(38, motiontracker.System)
datasource = source.DataSource(Motion)
tf = tempfile.NamedTemporaryFile()
sinks.start(hdfwriter.HDFWriter, filename=tf.name)
sinks.register(Motion)

datasource.start()
time.sleep(10)
datasource.stop()
sinks.stop()
time.sleep(2)

import tables
h5 = tables.openFile(tf.name)
caldat = h5.root.motiontracker[1024:, -6:, :3]

d = glob.glob("/storage/calibrations/alignment*.npz")
motiontracker.make_autoalign_reference(
    caldat, "/storage/calibrations/alignment%d.npz" % len(d))