-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raysu 2023 0519 #162
base: master
Are you sure you want to change the base?
Raysu 2023 0519 #162
Changes from all commits
3e0a632
dc342b1
cab0308
42e81ff
ddee3d2
6395069
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -471,7 +471,7 @@ function ScanFastDacSlow(instrID, start, fin, channels, numpts, delay, ramprate, | |
RampStartFD(S, ignore_lims=1) | ||
|
||
// Let gates settle | ||
sc_sleep(S.delayy) | ||
sc_sleep(15) | ||
|
||
// Make Waves and Display etc | ||
InitializeScan(S) | ||
|
@@ -487,6 +487,7 @@ function ScanFastDacSlow(instrID, start, fin, channels, numpts, delay, ramprate, | |
sc_sleep(S.delayy) | ||
i = 0 | ||
do | ||
|
||
rampToNextSetpoint(S, i, fastdac=1, ignore_lims=1) // Ramp x to next setpoint | ||
sc_sleep(S.delayx) | ||
if (s.is2d) | ||
|
@@ -507,7 +508,7 @@ function ScanFastDacSlow(instrID, start, fin, channels, numpts, delay, ramprate, | |
endif | ||
endfor | ||
|
||
|
||
// Save by default | ||
if (nosave == 0) | ||
EndScan(S=S) | ||
|
@@ -900,8 +901,8 @@ end | |
|
||
|
||
|
||
function Scank2400(instrID, startx, finx, channelsx, numptsx, delayx, rampratex, [y_label, comments, nosave]) //Units: mV | ||
variable instrID, startx, finx, numptsx, delayx, rampratex, nosave | ||
function Scank2400(instrID, startx, finx, channelsx, numptsx, delayx, rampratex, [y_label, comments, nosave, ramp]) //Units: mV | ||
variable instrID, startx, finx, numptsx, delayx, rampratex, nosave, ramp | ||
string channelsx, y_label, comments | ||
//abort "WARNING: This scan has not been tested with an instrument connected. Remove this abort and test the behavior of the scan before running on a device!" | ||
|
||
|
@@ -921,10 +922,10 @@ function Scank2400(instrID, startx, finx, channelsx, numptsx, delayx, rampratex, | |
// PreScanChecksKeithley(S) | ||
|
||
// Ramp to start without checks because checked above | ||
rampK2400Voltage(S.instrIDx, startx) | ||
rampK2400Voltage(S.instrIDx, startx, ramprate = rampratex) | ||
|
||
// Let gates settle | ||
sc_sleep(S.delayy*20) | ||
sc_sleep(5) | ||
|
||
// Make waves and graphs etc | ||
initializeScan(S) | ||
|
@@ -933,9 +934,14 @@ function Scank2400(instrID, startx, finx, channelsx, numptsx, delayx, rampratex, | |
variable i=0, setpointx | ||
do | ||
setpointx = S.startx + (i*(S.finx-S.startx)/(S.numptsx-1)) | ||
// rampK2400Voltage(S.instrIDx, setpointx, ramprate=S.rampratex) | ||
setK2400Voltage(S.instrIDx, setpointx) | ||
sc_sleep(S.delayx) | ||
if (ramp ==1) | ||
rampK2400Voltage(S.instrIDx, setpointx, ramprate=S.rampratex) | ||
asleep(S.delayx) | ||
else | ||
setK2400Voltage(S.instrIDx, setpointx) | ||
sc_sleep(S.delayx) | ||
endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not essential, but nice to keep orderly indenting. |
||
|
||
RecordValues(S, i, i) | ||
i+=1 | ||
while (i<S.numptsx) | ||
|
@@ -971,11 +977,11 @@ function Scank24002D(instrIDx, startx, finx, numptsx, delayx, rampratex, instrID | |
// PreScanChecksKeithley(S) | ||
|
||
// Ramp to start without checks because checked above | ||
rampK2400Voltage(S.instrIDx, startx) | ||
rampK2400Voltage(S.instrIDy, starty) | ||
rampK2400Voltage(S.instrIDx, startx, ramprate = rampratex) | ||
rampK2400Voltage(S.instrIDy, starty, ramprate = rampratey) | ||
|
||
// Let gates settle | ||
sc_sleep(S.delayy*5) | ||
sc_sleep(8) | ||
|
||
// Make waves and graphs etc | ||
initializeScan(S) | ||
|
@@ -987,7 +993,6 @@ function Scank24002D(instrIDx, startx, finx, numptsx, delayx, rampratex, instrID | |
setpointy = S.starty + (i*(S.finy-S.starty)/(S.numptsy-1)) | ||
rampK2400Voltage(S.instrIDy, setpointy, ramprate=S.rampratey) | ||
rampK2400Voltage(S.instrIDx, setpointx, ramprate=S.rampratex) | ||
|
||
sc_sleep(S.delayy) | ||
j=0 | ||
do | ||
|
@@ -1371,10 +1376,10 @@ function ScanLS625Magnet(instrID, startx, finx, numptsx, delayx, [y_label, comme | |
setpointx = S.startx + (i*(S.finx-S.startx)/(S.numptsx-1)) | ||
if(fast==1) | ||
setlS625field(S.instrIDx, setpointx) | ||
sc_sleep(max(S.delayx, (0.05+60*abs(finx-startx)/numptsx/ramprate))) | ||
sc_sleep(max(S.delayx, (S.delayx+60*abs(finx-startx)/numptsx/ramprate))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this math do? Looks like you have the time in minutes for a ramp to complete divided by the number of points in x. So if you take 1 data point this is the same as setlS625fieldwait(S.instrIDx, setpointx) but if you take 1e6 data points then you will start collecting data immediately?? |
||
else | ||
setlS625fieldwait(S.instrIDx, setpointx) | ||
sc_sleep(S.delayx) | ||
// sc_sleep(S.delayx) | ||
endif | ||
RecordValues(S, i, i) | ||
i+=1 | ||
|
@@ -1388,7 +1393,6 @@ function ScanLS625Magnet(instrID, startx, finx, numptsx, delayx, [y_label, comme | |
endif | ||
end | ||
|
||
|
||
function ScanBabyDACLS625Magnet2D(bdID, startx, finx, channelsx, numptsx, delayx, rampratex, magnetID, starty, finy, numptsy, delayy, rampratey, [startxs, finxs, y_label, comments, nosave]) //Units: mV | ||
// Sweeps BabyDAC on x-axis and Keithley on y-axis | ||
variable bdID, startx, finx, numptsx, delayx, rampratex, magnetID, starty, finy, numptsy, delayy, rampratey, nosave | ||
|
@@ -1519,6 +1523,74 @@ function ScanFastDACLS625Magnet2D(fdID, startx, finx, channelsx, magnetID, start | |
end | ||
|
||
|
||
function ScanFastDACIPS120Magnet2D(fdID, startx, finx, channelsx, magnetID, starty, finy, numptsy, [numpts, sweeprate, rampratex, delayy, startxs, finxs, y_label, comments, nosave, use_AWG]) | ||
// 2D Scan with Fastdac on x-axis and magnet on y-axis | ||
// Note: Must provide numptsx OR sweeprate in optional parameters instead | ||
// Note: channels should be a comma-separated string ex: "0,4,5" | ||
variable fdID, startx, finx, starty, finy, numptsy, numpts, sweeprate, magnetID, rampratex, delayy, nosave, use_AWG | ||
string channelsx, y_label, comments, startxs, finxs | ||
//abort "WARNING: This scan has not been tested with an instrument connected. Remove this abort and test the behavior of the scan before running on a device!" | ||
|
||
// Set defaults | ||
delayy = ParamIsDefault(delayy) ? 0.01 : delayy | ||
comments = selectstring(paramisdefault(comments), comments, "") | ||
startxs = selectstring(paramisdefault(startxs), startxs, "") | ||
finxs = selectstring(paramisdefault(finxs), finxs, "") | ||
|
||
// Reconnect instruments | ||
sc_openinstrconnections(0) | ||
|
||
// Put info into scanVars struct (to more easily pass around later) | ||
struct ScanVars S | ||
// Init FastDAC part like usual, then manually set the rest | ||
initScanVarsFD(S, fdID, startx, finx, channelsx=channelsx, rampratex=rampratex, numptsx=numpts, sweeprate=sweeprate, numptsy=numptsy, delayy=delayy, \ | ||
startxs=startxs, finxs=finxs, comments=comments) | ||
S.instrIDy = magnetID | ||
s.is2d = 1 | ||
S.starty = starty | ||
S.finy = finy | ||
S.y_label = selectString(paramIsDefault(y_label), y_label, "Magnet /mT") | ||
|
||
// Check software limits and ramprate limits and that ADCs/DACs are on same FastDAC | ||
PreScanChecksFD(S, x_only=1) | ||
// PreScanChecksMagnet(S, y_only=1) | ||
|
||
// Ramp to start without checks | ||
RampStartFD(S, x_only=1, ignore_lims=1) | ||
setips120fieldWait(S.instrIDy, S.starty) // Ramprate should be set beforehand for magnets | ||
|
||
// Let gates settle | ||
sc_sleep(S.delayy*3) | ||
|
||
// Initialize waves and graphs | ||
initializeScan(S) | ||
|
||
// Main measurement loop | ||
variable setpointy | ||
variable i=0, j=0 | ||
string chy | ||
for(i=0; i<S.numptsy; i++) | ||
// Ramp slow axis | ||
setpointy = S.starty + (i*(S.finy-S.starty)/(S.numptsy-1)) | ||
setips120fieldWait(S.instrIDy, setpointy) // Ramprate should be set beforehand for magnets | ||
|
||
// Ramp to start of fast axis | ||
RampStartFD(S, ignore_lims=1, x_only=1) | ||
sc_sleep(S.delayy) | ||
|
||
// Record fast axis | ||
scfd_RecordValues(S, i) | ||
endfor | ||
|
||
// Save by default | ||
if (nosave == 0) | ||
EndScan(S=S) | ||
else | ||
dowindow /k SweepControl | ||
endif | ||
end | ||
|
||
|
||
function ScanFastDacSlowLS625Magnet2D(instrIDx, startx, finx, channelsx, numptsx, delayx, rampratex, magnetID, starty, finy, numptsy, delayy, [rampratey, y_label, comments, nosave]) | ||
// sweep one or more FastDAC channels but in the ScanController way (not ScanControllerFastdac). I.e. ramp, measure, ramp, measure... | ||
// channels should be a comma-separated string ex: "0, 4, 5" | ||
|
@@ -1531,6 +1603,7 @@ function ScanFastDacSlowLS625Magnet2D(instrIDx, startx, finx, channelsx, numptsx | |
// Set defaults | ||
comments = selectstring(paramisdefault(comments), comments, "") | ||
y_label = selectstring(paramisdefault(y_label), y_label, "") | ||
|
||
// Initialize ScanVars | ||
struct ScanVars S | ||
|
||
|
@@ -1551,7 +1624,7 @@ function ScanFastDacSlowLS625Magnet2D(instrIDx, startx, finx, channelsx, numptsx | |
setlS625fieldWait(S.instrIDy, starty ) | ||
|
||
// Let gates settle | ||
asleep(S.delayy*10) | ||
asleep(S.delayy) | ||
|
||
// Make Waves and Display etc | ||
InitializeScan(S) | ||
|
@@ -1562,15 +1635,17 @@ function ScanFastDacSlowLS625Magnet2D(instrIDx, startx, finx, channelsx, numptsx | |
do | ||
setpointx = S.startx | ||
setpointy = S.starty + (i*(S.finy-S.starty)/(S.numptsy-1)) | ||
setlS625field(S.instrIDy, setpointy) | ||
rampMultipleFDAC(S.instrIDx,channelsx,setpointx,ramprate=S.rampratex, ignore_lims=1) | ||
setlS625fieldwait(S.instrIDy, setpointy, short_wait = 1) | ||
rampMultipleFDAC(S.instrIDx,channelsx, setpointx, ramprate=S.rampratex, ignore_lims=1) | ||
setlS625fieldwait(S.instrIDy, setpointy) | ||
sc_sleep(S.delayy) | ||
j=0 | ||
do | ||
setpointx = S.startx + (j*(S.finx-S.startx)/(S.numptsx-1)) | ||
rampMultipleFDAC(S.instrIDx,channelsx,setpointx,ramprate=S.rampratex, ignore_lims=1) | ||
sc_sleep(S.delayx) | ||
// if (mod(j, 100) == 0) | ||
// sc_sleep(S.delayx) | ||
// endif | ||
RecordValues(S, i, j) | ||
j+=1 | ||
while (j<S.numptsx) | ||
|
@@ -1626,15 +1701,14 @@ function ScanK2400LS625Magnet2D(keithleyID, startx, finx, numptsx, delayx, rampr | |
do | ||
setpointx = S.startx | ||
setpointy = S.starty + (i*(S.finy-S.starty)/(S.numptsy-1)) | ||
setlS625fieldWait(S.instrIDy, setpointy) | ||
setlS625field(S.instrIDy, setpointy) | ||
rampK2400Voltage(S.instrIDx, setpointx, ramprate=S.rampratex) | ||
// setK2400Voltage(S.instrIDy, setpointy) | ||
|
||
setlS625fieldWait(S.instrIDy, setpointy, short_wait = 1) | ||
sc_sleep(S.delayy) | ||
j=0 | ||
do | ||
setpointx = S.startx + (j*(S.finx-S.startx)/(S.numptsx-1)) | ||
rampK2400Voltage(S.instrIDx, setpointx, ramprate=S.rampratex) | ||
setK2400Voltage(S.instrIDx, setpointx) | ||
sc_sleep(S.delayx) | ||
RecordValues(S, i, j) | ||
j+=1 | ||
|
@@ -1669,7 +1743,7 @@ function ScanSRSFrequency(instrID, startx, finx, numptsx, delayx, nosave) | |
SetSRSFrequency(S.instrIDx,startx) | ||
|
||
// Let gates settle | ||
sc_sleep(S.delayy*10) | ||
sc_sleep(2) | ||
|
||
// Make waves and graphs etc | ||
initializeScan(S) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is probably better to keep delayy instead of hard coding a 2 second sleep. It would be better to add an optional parameter to Scank2400 that allows you to set delayy and if not set will use default of 2.