CustomXepr

@author: Sam Schott (ss2151@cam.ac.uk)

(c) Sam Schott; This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 2.0 UK: England & Wales License.

class main.CustomXepr(xepr=None, mercury=None, keithley=None)[source]

CustomXepr defines routines to control Bruker’s Xepr software and to run full ESR measurement cycles. When creating an instance of CustomXepr, you can pass instances of XeprAPI.XeprAPI, mercurygui.MercuryFeed and keithley2600.Keithley2600 to handle interactions with the respective instruments.

All CustomXepr methods that do not end with ‘_sync’ are executed in a worker thread in the order of their calls. Scheduling of jobs and retrieval of results is handled by manager.Manager. For instructions on how to schedule your own experiments, please refer to the documentation of manager.

Every asynchronous method has an equivalent method ending with ‘_sync’ which will be called immediately and block until it is done. Those synchronous equivalents are generated at runtime and not documented here.

You can use CustomXepr on its own, but it is recommended to start it with the function startup.run() in the startup module. This will automatically connect to available instruments and start CustomXepr’s graphical user interfaces.

Parameters:
  • xepr – Xepr instance from the Bruker Python XeprAPI. Defaults to None if not provided.
  • mercuryfeedmercurygui.MercuryFeed instance for live feed from MercuryiTC temperature controller. Defaults to None if not provided.
  • keithleykeithley2600.Keithley2600 instance from keithley2600 driver. Defaults to None if not provided.
notify_address

List with email addresses for status notifications.

temp_wait_time

Wait time until temperature is considered stable. Defaults to 120 sec.

temperature_tolerance

Temperature fluctuation tolerance. Defaults to 0.1 Kelvin.

sendEmail(body)[source]

Sends an email to the list of addresses given by notify_address. The email server and sender address can be configured in the config file.

Parameters:body (str) – Text to send.
sleep(seconds)[source]

Pauses for the specified amount of seconds. Sleeping can be aborted by the user.

Parameters:seconds (int) – Number of seconds to pause.
tune()[source]

Runs Xepr’s built-in tuning routine.

finetune()[source]

Runs Xepr’s built-in finetuning routine.

customtune(low_q=False)[source]

Custom tuning routine with higher accuracy. It takes longer than tune() and requires the spectrometer to be already close to tuned. In case of lossy samples, you can set lowQ to True so that the tuning routine will cycle through a smaller range of microwave powers. For lossy samples where the Q-value will be lower than 3000, it is recommended to manually tune the cavity.

Parameters:low_q (bool) – If True, the tuning routine will be adjusted for lossy samples.
tuneBias(tolerance=1)[source]

Tunes the diode bias only. A perfectly tuned bias results in a diode current of 200 mA for all microwave powers.

Parameters:tolerance (int) – Minimum diode current offset that must be achieved before tuneBias() returns.
tuneIris(tolerance=1)[source]

Tunes the cavity’s iris only. A perfectly tuned iris results in a diode current of 200 mA for all microwave powers.

Parameters:tolerance (int) – Minimum diode current offset that must be achieved before tuneIris() returns.
tuneFreq(tolerance=2)[source]

Tunes the microwave frequency only, to a lock offset close to zero.

Parameters:tolerance (int) – Minimum lock offset that must be achieved before tuneFreq() returns.
tunePhase()[source]

Tunes the phase of the MW reference arm only such that the diode current is maximized.

getQValueFromXepr()[source]

Gets the Q-Value as determined by Xepr, averaged over 20 readouts.

Returns:Measured Q-Value.
Return type:float
getQValueCalc(path=None)[source]

Calculates the Q-value by fitting the cavity mode picture to a Lorentzian resonance with a polynomial baseline. It uses all available zoom factors to resolve both sharp and broad resonances (high and low Q-values, respectively) and is therefore more accurate than getQValueFromXepr().

Parameters:path (str) – Filename where Q-Value mode picture is saved together with any metadata (temperature, time stamp).
Returns:Mode picture instance.
Return type:experiment.ModePicture
static getExpDuration(exp)[source]

Estimates the time required to run the given experiment. The returned value is given in seconds and is a lower limit, the actual run time may be longer due to fine-tuning between scans, waiting times for stabilization and flybacks.

Parameters:exp – Xepr experiment object to run.
Returns:Estimated experiment duration in seconds.
Return type:float
runXeprExperiment(exp, retune=True, settling_time=0, path=None, callback=None, **kwargs)[source]

Runs the Xepr experiment exp. Keyword arguments kwargs allow the user to pass experiment settings to Xepr (e.g., ‘ModAmp’ for modulation amplitude). Allowed parameters will depend on the type of experiment and its functional units, e.g., ‘mwBridge’, ‘fieldCtrl’ etc. You can get a list of all units and their parameters for a given experiment exp as follows:

>>> print(exp.getFuList())
    ['acqStart',
     'fieldCtrl',
     'fieldSweep',
     'freqCounter',
     'mwBridge',
     'recorder',
     'scanEnd',
     'signalChannel']
>>> print(exp.getFuParList('mwBridge'))
    ['AcqFineTuning',
     'AcqScanFTuning',
     'AcqSliceFTuning',
     'BrConnStatus',
     'BridgeCalib',
     'EMBType',
     'EWSMBC',
     'EmbBridge',
     'Power',
     'PowerAt0DB',
     'PowerAtten',
     'PowerAttenMon',
     'QValue',
     'TuneStateExpMon']

If a temperature controller is connected, CustomXepr monitors the temperature during the measurement and emits warnings when fluctuations repeatedly exceed the given temperature stability requirement.

If the path argument is given, the resulting data set is saved to the drive. Otherwise, a temporary file will be created (those are deleted periodically by the operating system). The temperature and its stability as well as the last- measurement Q-value (if available) are written to the Bruker ‘.DSC’ file.

Parameters:
  • exp – Xepr experiment object to run.
  • retune (bool) – Retune iris and freq between scans (default: True).
  • settling_time – Settling time in seconds between individual slice scans (default: 0).
  • path (str) – Path to file. If given, the data set will be saved to this path, otherwise, a temporary file will be created. No Xepr file name restrictions apply.
  • callback – Optional function to be called between individual scans. Will be called after retuning and the optional settling time. Will be called with the number of completed scans as a single argument. May return a single number which will be saved in the DSC file.
  • kwargs – Keyword arguments corresponding to Xepr experiment parameters. Allowed parameters will depend on the type of experiment.
Returns:

Xepr dataset.

Return type:

experiment.XeprData

saveCurrentData(path, exp=None)[source]

Saves the data from a given experiment in Xepr to the specified path. If exp is None the currently displayed data set is saved.

Xepr only allows file paths shorter than 128 characters.

Note

To save a just completed measurement, please use the path argument of runXeprExperiment(). This will automatically add temperature stability and Q-value information to your data files.

Parameters:
  • path (str) – Absolute path to save data file. The path must be compatible with Xepr, i.e., it must be shorter than 128 characters.
  • exp – Xepr experiment instance associated with data set. Defaults to currently selected experiment if not given.
setStandby()[source]

Sets the magnetic field to zero and the MW bridge to standby.

setTemperature(target, wait_stable=True)[source]

Sets the target temperature for the ESR900 cryostat and waits for it to stabilize within temp_wait_time with fluctuations below temperature_tolerance. Warns the user if this takes too long.

Parameters:
  • target (float) – Target temperature in Kelvin.
  • wait_stable (bool) – If True, this function will wait until the temperature is stable before it returns. See waitTemperatureStable()
setTemperatureRamp(ramp)[source]

Sets the temperature ramp speed for the cryostat in K/min.

Parameters:ramp (float) – Ramp in Kelvin per minute.
waitTemperatureStable(target, tolerance=None, wait_time=None)[source]

Waits for the cryostat temperature to stabilize.

Parameters:
  • target (float) – Target temperature in Kelvin.
  • tolerance (float) – Allowed fluctuations in kelvin. Defaults to temperature_tolerance if not given.
  • wait_time (float) – Time to wait for temperature to remain stable before returning (seconds). Defaults to temp_wait_time if not given.
getTemperature()[source]

Returns the current temperature in Kelvin.

getTemperatureSetpoint()[source]

Returns the temperature setpoint in Kelvin.

transferMeasurement(smu_gate='smua', smu_drain='smub', vg_start=10.0, vg_stop=-60.0, vg_step=1.0, vd_list=[-5, -60], t_int=0.1, delay=-1.0, pulsed=False, path=None)[source]

Records a transfer curve and returns the resulting data. If a valid path is path given, the data is also saved as a .txt file.

Parameters:
  • smu_gate – Name of SMU attached to the gate electrode of an FET.
  • smu_drain – Name of SMU attached to the drain electrode of an FET.
  • vg_start (float) – Start voltage of transfer sweep in Volts.
  • vg_stop (float) – End voltage of transfer sweep in Volts.
  • vg_step (float) – Voltage step size for transfer sweep in Volts.
  • vd_list (list) – List of drain voltage steps in Volts.
  • t_int (float) – Integration time in sec for every data point.
  • delay (float) – Settling time in sec before every measurement. Set to -1 for automatic delay.
  • pulsed (bool) – True or False for pulsed or continuous measurements.
  • path (str) – File path to save transfer curve data as .txt file.
Returns:

Transfer curve data.

Return type:

keithley2600.TransistorSweepData

outputMeasurement(smu_gate='smua', smu_drain='smub', vd_start=0.0, vd_stop=-60.0, vd_step=1.0, vg_list=[0, -20, -40, -60], t_int=0.1, delay=-1.0, pulsed=False, path=None)[source]

Records an output curve and returns the resulting data. If a valid path is given, the data is also saved as a .txt file.

Parameters:
  • smu_gate – Name of SMU attached to the gate electrode of an FET.
  • smu_drain – Name of SMU attached to the drain electrode of an FET.
  • vd_start (float) – Start voltage of output sweep in Volts .
  • vd_stop (float) – End voltage of output sweep in Volts.
  • vd_step (float) – Voltage step size for output sweep in Volts.
  • vg_list (list) – List of gate voltage steps in Volts.
  • t_int (float) – Integration time in sec for every data point.
  • delay (float) – Settling time in sec before every measurement. Set to -1 for automatic delay.
  • pulsed (bool) – True or False for pulsed or continuous measurements.
  • path (str) – File path to save output curve data as .txt file.
Returns:

Output curve data.

Return type:

keithley2600.TransistorSweepData

setVoltage(v, smu='smua')[source]

Sets the bias of the given Keithley SMU.

Parameters:
  • v (float) – Gate voltage in Volts.
  • smu (str) – Name of SMU. Defaults to the SMU saved as gate.
setCurrent(i, smu='smub')[source]

Applies a specified current to the selected Keithley SMU.

Parameters:
  • i (float) – Current in Ampere.
  • smu (str) – Name of SMU. Defaults to the SMU saved as drain.