The issue is you placed the smu.measure.autozero.enable = smu.OFF command too early. By placing it with the source commands, before you set smu.measure.func, you are setting the autozero behavior for the smu.FUNC_DC_CURRENT measure function. Move that command below smu.measure.func = smu.FUNC_DC_VOLTAGE and you'll get the faster ramp behavior every time.
How I discovered this (since the same process can help with script debugging in general):
- I noticed that reset() always resulted in the first run having the lower ramp rate. This means it must be something in the instrument settings.
- I created 2 config lists, MySourceList and MyMeasList
- In the code, before starting the sweep, I added commands to save the current settings to those config lists: smu.source.configlist.store("MySourceList"), and the equivalent for MyMeasList
- After running the function twice, to see the problem behavior, I opened the ConfigLists from the front panel. The front panel interface highlights what settings change between each ConfigList entry. There were no changes in the Source list, but the Meas list showed that on the second run, smu.measure.autozero.enable was set to smu.OFF, so it must've been on the first run.
A other few notes:
- You're setting "smu.source.autodelay = 1e-3", but smu.source.autodelay can only be on or off. Do you mean to be setting smu.source.delay to 1e-3? Right now you are turning autodelay off, but keeping smu.source.delay at 0.
- You are measuring twice at each sweep point with smu.measure.read(), your code accounts for it, I'm just curious why?