Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Instrument control suite for Bruker E500, MercuryiTC and Keithley 2600.

License

NotificationsYou must be signed in to change notification settings

OE-FET/customxepr

Repository files navigation

Documentation Status

Warning: Version 2.3.3 is the last release that supports Python 2.7. All newerreleases only support Python 3.6 and higher.

CustomXepr

A Python instrument controller and GUI for Bruker E500 EPR spectrometers, MercuryiTCtemperature controllers and Keithley 2600 series source measurement units. CustomXeprrelies on the python driverskeithley2600 andmercuryitc and the respective user interfaceskeithleygui andmercurygui for functionality regarding theKeithley 2600 and MercuryiTC instruments.

Screenshot of CustomXepr GUI

Overview

CustomXepr for Linux and macOS enables the interaction with all instruments involved infield induced electron spin resonance (FI-EPR) measurements: the Bruker E500 spectrometer,through Bruker's Xepr Python API, the Oxford Instruments MercuryiTC temperaturecontroller, and the Keithley 2600 series of source measurement units (SMUs). The programsuite is structured into drivers and user interfaces for individual instruments (externalpackages), CustomXepr's main class which provides higher level functions that oftencombine functionality from multiple instruments, and a manager which handles thescheduling of experiments.

The aim of CustomXepr is twofold: First and foremost, it enables the user to automate andschedule full measurement plans which may run for weeks without user input. Second, itcomplements the functionality of Bruker's Xepr control software. This includes forinstance powerful logging capabilities, a more accurate determination of the cavity'sQ-value from its frequency response, more reliable tuning of the cavity, the ability tore-tune the cavity during long-running measurements, logging of the cryostat temperatureduring measurements, and many more. Low level functionality and communication with thespectrometer remains with Xepr.

CustomXepr structure

Finally, CustomXepr fully supports Bruker BES3T data files (DSC, DTA, etc). Thecustomxepr.experiment.XeprData class enables loading, plotting, modifying and saving suchdata files from regular, 2D or pulsed experiements. It also supports reading and plottingthe pulse sequences used to acquire the data, as saved in the DSC file. More informationis provided in the API documentation for theXeprDataclass.

Installation

Make sure that you have PyQt or PySide installed on your system (all other dependencieswill be installed automatically). Then install CustomXepr by running in a terminal:

$ pip install git+https://github.com/OE-FET/customxepr

Instrument communication

CustomXepr communicates with with the Keithley and MercuryiTC through NI-VISA or pyvisa-pyand is therefore independent of the actual interface, e.g., Ethernet, USB, or GPIB.Connections to the EPR spectrometer are handled through Bruker's Xepr Python API.

Usage

CustomXepr can be run interactively from a Jupyter console, or as a standalone program. Inthe latter case, it will create its own internal Jupyter console for the user to runcommands.

You can start CustomXepr from a Python command prompt as follows:

>>>fromcustomxeprimportrun_gui>>>run_gui()

To start the CustomXepr GUI from a console / terminal, runcustomxepr.

CustomXepr has a user interface which displays all jobs waiting in the queue, all resultsreturned from previous jobs, and all logging messages. Common tasks such as pausing,aborting and clearing jobs, plotting and saving returned data, and setting temperaturestability tolerances can be performed through the interface itself. However, apart fromtuning the cavity and reading a Q-factor, all jobs must be scheduled programmaticallythrough the provided Jupyter console.

Job-scheduling

CustomXepr's core consists of functions for preconfigured tasks, such as changing thecryostat temperature, recording a transfer curve, performing a preconfigured EPRmeasurement. For instance,customXepr.setTemperature(110) tells the MercuryiTC to changeits temperature set-point to 110 K and waits until the latter is reached and maintainedwith the desired stability (default: ±0.1 K for 120 sec). It also adjusts the helium flowif necessary and warns the user if the target temperature cannot be reached within theexpected time.customXepr.runExperiment(powersat) will run the preconfigured EPRmeasurement "powersat" while tuning the cavity between scans and monitoring thetemperature stability during the measurement.

Such built in jobs are not performed immediately but are queued and run after thesuccessful completion of the previous jobs. Any data returned by a job, such as a transfercurve or a cavity mode picture, will be kept in a result queue and saved to a specifiedfile if requested. If the returned object hassave andplot methods implemented, onecan right-click on its entry in the GUI to plot the data or save it to the hard drive.

CustomXepr functions that are expected to run for longer than 1 sec can gracefully abortupon user request without leaving the setup in an inconsistent state.

Screenshot of CustomXepr GUI

In addition, the queuing system can be used to manually schedule any user-specified jobs,related or unrelated to the EPR setup and its ancillary equipment. This can be done withthequeued_exec decorator fromcustomxepr.manager:

>>>importtime>>>fromcustomxepr.managerimportManager>>>manager=Manager()>>># create test function>>>@manager.queued_exec...deftest_func(*args):...# do something...foriinrange(0,10):...time.sleep(1)...# check for requested aborts...ifmanager.abort.is_set():...break...returnargs# return input arguments>>># run the function: this will return immediately>>>test_func('test succeeded')

The result returned bytest_func can be retrieved from the result queue as follows:

>>>result=manager.result_queue.get()# blocks until result is available>>>print(result)testsucceeded

More information regarding the manual scheduling of experiments can be foundhere.

Logging and error handling

The detection and escalation of possible problems is key to enabling unattendedmeasurements. Otherwise the user may come back after two days expecting a completedmeasurement cycle, only to see that the helium dewar was emptied a day ago or that theprogram got stuck asking the user if it should really override a data file. CustomXeprtherefore includes logging capabilities to track the progress of jobs and notify the userof potential problems.

All CustomXepr methods release logging messages during their execution which may have thelevels "status", "info", "warning", and "error". Status notifications will only be shownin the user interface and typically contain information about the progress of a job(number of completed scans in an EPR measurement, countdown until the temperature isstable, etc). Info notifications typically contain information about the beginning orcompletion of a job (e.g., "Waiting for temperature to stabilize.", "All scanscomplete."), and potentially useful information about how the job was completed (e.g.,"Temperature stable at 120.01±0.02 K during scans.").

Warning notifications are logged when CustomXepr believes that there may be a problemwhich requires user intervention, for instance if a job is taking significantly longerthan expected, or if the gas flow required to maintain a certain temperature is unusuallyhigh. Finally, error messages are released if CustomXepr is unable to proceed with a job,in which case it will abort and pause all pending jobs. Such errors may include loss ofcommunication with an instrument, repeated strong temperature fluctuations during an EPRmeasurement, etc.

By default, all messages of level "info" and higher are saved to a log file in the user'shome directory and messages of level "warning" and higher are sent as an email to theuser's address. In addition, temperature readings are saved to a log file every 5 min,allowing the user to retrospectively confirm the temperature stability duringmeasurements.

Screenshot of CustomXepr GUI

Mercury controls

CustomXepr includes a higher-level worker thread which regularly queries the MercuryiTCfor its sensor readings and provides a live stream of this data to other parts of thesoftware. This prevents individual functions from querying the MercuryiTC directly andcausing unnecessary overhead.

The user interface for the cryostat plots historic temperature readings going back up to24 h and provides access to relevant temperature control settings such as gas flow, heaterpower, and ramping speed while lower-level configurations such as calibration tables mustbe changed programmatically through the provided Jupyter console.

The MercuryiTC user interface and driver have been split off as separate packagesmercuryitc andmercurygui.

Screenshot of Mercury GUI

Keithley controls

As with the cryostat, CustomXepr includes a high-level user interface for Keithley 2600series instruments which allows the user to configure, record and save voltage sweeps suchas transfer and output measurements. Since there typically is no need to provide a livestream of readings from the Keithley, the data from an IV-curve is buffered locally on theinstrument and only transferred to CustomXepr after completion of a measurement.

The Keithley 2600 user interface and driver have been split off as separate packageskeithley2600 andkeithleygui.

Screenshot of Keithley GUI

Example code

A measurement script is given below which uses CustomXepr to cycles through differenttemperatures and records EPR spectra and transfer curves at each step. When run from aninteractive Python console, it is possible to then uses the createdcustomxepr instanceto pause or resume and even abort running measurements.

fromXeprAPIimportXeprfromkeithley2600importKeithley2600frommercuryitcimportMercuryITCfromcustomxeprimportCustomXepr# Connect to individual instruments.xepr=Xepr()mercury=MercuryITC("MERCURY_VISA_ADDRESS")keithley=Keithley2600("KEITHLEY_VISA_ADDRESS")# Create a new instance of CustomXepr to coordinate measurements.customxepr=CustomXepr(xepr,mercury,keithley)# Get a preconfigured experiment from Xepr.exp=xepr.XeprExperiment('Experiment')# Set up different modulation amplitudes in Gauss for different temperatures.modAmp= {5:3,50:2,100:1,150:1,200:1,250:1.5,300:2}# Specify folder to save data.folder='/path/to/folder'title='my_sample'forTin [5,50,100,150,200,250,300]:# =================================================================# Prepare temperature# =================================================================customxepr.setTemperature(T)# set desired temperaturecustomxepr.customtune()# tune the cavitycustomxepr.getQValueCalc(folder,T)# measure and save the Q factor# =================================================================# Perform FET measurements# =================================================================# Generate file name for transfer curve.transfer_file='{}/{}_{}K_transfer.txt'.format(folder,title,T)# Record default transfer curve and save to file.customxepr.transferMeasurement(path=transfer_file)# =================================================================# Perform EPR measurements at Vg = -70V and Vg = 0V# =================================================================forVgin [0,-70]:customxepr.setVoltage(Vg,smu='smua')# bias gate# Perform preconfigured EPR measurement, save to file.esr_file='{}/{}_{}K_Vg_{}V.txt'.format(folder,title,T,Vg)customxepr.runXeprExperiment(exp,path=esr_file,ModAmp=modAmp[T])customxepr.setVoltage(0,smu='smua')# set gate voltage to zerocustomxepr.setStandby()# Ramp down field and set MW bridge to standby.

In this code, all functions belonging to CustomXepr will be added to the job queue andwill be carried out successively such that, for instance, EPR measurements will not startwhile the temperature is still being ramped. Note that this example script will not loada graphical user interface.

Email notifications

By default, email notifications are sent from 'customxepr@outlook.com'. CustomXepr at the momentprovides no way to modify the email settings via the user interface, but you can set them manuallyin the config file in your home directory: '~/.CustomXepr/CustomXepr.ini'. Changes will be appliedwhen restarting CustomXper.

By default, the relevant section in the config file reads:

[SMTP]mailhost = localhostport = 0fromaddr = ss2151@cam.ac.ukcredentials =secure =

Authentication credentials can be specified as a tuple(username, password). To specify the useof a secure protocol (TLS), pass in a tuple for thesecure argument. This will only be used whenauthentication credentials are supplied. The tuple will be either an empty tuple, or a single-valuetuple with the name of a keyfile, or a 2-value tuple with the names of the keyfile and certificatefile.

Requirements

System requirements:

  • Linux or macOS
  • Python 2.7 or 3.6 and higher

Recommended:

  • Bruker Xepr software with Python XeprAPI (required for EPR related functions),a Python 3 version of the API is availablehere
  • Postfix - mail transfer agent (required for email notifications from localhost)

Required python modules:

  • PyQt5 >= 5.9

Recommended python modules:

  • pyusb (only when using pyvisa-py backend)
  • pyserial (only when using pyvisa-py backend)

Acknowledgements

  • Config modules are based on the implementation fromSpyder.
  • Scientific spin boxes are taken fromqudi.

About

Instrument control suite for Bruker E500, MercuryiTC and Keithley 2600.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp