def start(self): comm = MPI.COMM_WORLD m = Mjolnir() x = self.deg / self.step x = int(x) self.data = {} for i in xrange(x): m.moveRotMotor(self.step) comm.send("next", dest = 0, tag = 0) comm.send([self.timestamp, i], dest = 0, tag = 1) #self.data[i] = comm.recv(source = 1, tag = 0) if comm.recv(source = 0, tag = 0) == "done": continue time.sleep(1) comm.send("terminated", dest = 0, tag = 0) print "completed"
from __future__ import division import sys sys.path.insert(0, "../helpers") from mjolnir import Mjolnir import numpy as np import time import serial """ move 0.050 micron for like, 200 times? then take 10e4 readings and then move again """ N = 500 motor = Mjolnir() light = serial.Serial(port = '/dev/ttyACM0',baudrate = 19200,parity = 'N',stopbits = 1,bytesize = 8) data = [] f = open("data_{}".format(time.strftime("%Y%m%d_%H%M")),'w') for i in xrange(N): print "moving motor" motor.moveLinMotor(0.050) j = [] for _ in xrange(1000000): x = light.readline() x = x.strip() #print(x) try:
import sys import serial sys.path.insert(0, '../helpers') from mjolnir import Mjolnir import numpy as np import time kek = Mjolnir() import shutil kek.moveRotMotor(500) window = [0] * 10 #N = n_readings = 110 #dtheta = 2.0/N a = 0.00890 b = 0.01 light = serial.Serial(port = '/dev/ttyACM0', baudrate=19200,parity='N',stopbits=1,bytesize=8) data = [] fn = time.strftime("%Y%m%d_%H%M") f = open("{}".format(fn), "w") g = open("rawspec_{}".format(fn), "w") for j in xrange(int(1000)): print j try: kek.moveRotMotor(-1) # time.sleep(1)
import sys, os, json import time sys.path.insert(0,'../helpers') from mjolnir import Mjolnir import argparse parser = argparse.ArgumentParser() parser.add_argument('s', type = int) args = parser.parse_args() m = Mjolnir() print args.s #print "imagine that the motor moved a little" m.moveRotMotor(args.s)