Closed prakhub closed 7 months ago
Thank you for spotting this! I'll provide a fix for setting the correct source voltage range.
Concerning auto range, if it might be useful for some measurements to switch the voltage range during measurement, is see two options:
https://github.com/hephy-dd/diode-measurement/blob/41115b3e2f32db1416f6e07113283881899ce8c3/diode_measurement/measurement/__init__.py#L552
Setting the source range to the end voltage is incorrect if the start voltage is larger than the end voltage. For example, if we want to measure from -2V to 0V, the source range will be set to the minimum (200 mV) for the K2470 and the begin voltage (-2V) will fail to be set.
I'd propose to set the range to the larger of the two (ramp.begin / ramp.end), similar to https://github.com/hephy-dd/diode-measurement/blob/41115b3e2f32db1416f6e07113283881899ce8c3/diode_measurement/measurement/__init__.py#L658
By the way, does it make sense to implement changing the source range during a measurement (basically autoranging)?