20181031a
- Other tests - new board =)
import spidev
import RPi.GPIO as GPIO
import time
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import json
import time
from pyUn0 import *
%matplotlib inline
pyexiv2 does not exist on RPi
x = us_spi()
x.JSON["firmware_version"]="f_un0"
x.JSON["experiment"]["description"]="Trying the v1.0 board"
x.JSON["experiment"]["probe"]="calibration"
x.JSON["experiment"]["target"] = "calibration"
x.JSON["V"]="25"
x.JSON["N"] = 1
x.init()
x.JSON["N"] = 1
Curve = x.CreateDACCurve(200,500,True)[0]
pyUn0.py:149: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(CS_FLASH,GPIO.OUT)
pyUn0.py:152: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(PRESET,GPIO.OUT)
Reset GPIO 23 - Low 1s
Reset GPIO 23 - High 0.2s
spi.cshigh is False
spi mode is 1
spi maxspeed is 2000000hz
Setting up the DAC
x.TestSPI(3)
Curve = x.CreateDACCurve(200,400,True)[0]
print Curve
Setting up the DAC
[200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 295, 300, 305, 310, 315, 320, 325, 330, 335, 340, 345, 350, 355, 360, 365, 370, 375, 380, 385, 390, 0, 0]
x.setPeriodAcq(200000)
Period between two acquisitions: 20000 us -- 0x0 0x4e 0x20
200000
x.setMultiLines(True)
x.setNLines(3)
x.setMsps(4)
A = x.setTimings(200,100,2000,3000,200000)
Remember to indicate how many lines
Number of lines: 3
Acquisition frequency set at 12.0 Msps
Pulse width: 200 ns -- 0x14
Pulses delay: 300 ns -- 0x1e
Poff: 2300 ns -- 0x0 0xe6
Delay between: 3000 ns -- 0x1 0x80
Acquisition length: 200000 ns -- 0x64 0x0
setPulseTrain Lacq 200000
NAcq = 7092
x.JSON["experiment"]["description"]="Testing if new batch is fine"
x.JSON["data"] = x.doAcquisition()
x.JSON["N"] = x.JSON["N"] + 1
0%
9%
19%
29%
39%
49%
59%
69%
79%
89%
99%
Took 1.70 seconds to transfer.
for 14186 transfers of data
20181031a-4.json: file saved.
LastJSON = x.JSON["N"] -1
print LastJSON-1
3
for MyDataFile in os.listdir("./"):
if MyDataFile.endswith(str(LastJSON)+".json"):
y = us_json()
y.JSONprocessing("./"+MyDataFile)
Data acquired
plt.plot(y.tmp)
plt.show()