DAMARIS - An Introduction and Tutorialelement.fkp.physik.tu-darmstadt.de/damaris_cms/... ·...
Transcript of DAMARIS - An Introduction and Tutorialelement.fkp.physik.tu-darmstadt.de/damaris_cms/... ·...
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
DAMARIS - An Introduction and Tutorial
Dr. Markus Rosenstihl
Condensed Matter Physics Institute – AG Vogel – Technische Universitat Darmstadt
10.12.2014
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 1/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
1 MotivationOverview and Design PrinciplesArchitecture
2 DAMARIS Front End: BasicsExample: FIDExample: Pulse Length MeasurementsExample: Phase Cycling
3 DAMARIS Front End: Advanced ConceptsExample: Feed BackExample: Temperature ControllerExample: Digital Attenuator
4 Final RemarksOutlook and Future Development
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 2/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Motivation
DAMARIS stands for . . .
DArmstadt MAgnetic Resonance Instrumentation Softwareby Dr. Achim Gadke, AG Fujara (2005)
Why DAMARIS?
replace good, but aged, home made systemDOS based, ISA/Vesa bus cards
flexible control of home made/non standard hardwarestep motor/piezo positioning system for mechanical field cyclingcontrol of fast field cycling power supply (1 kA)PFG power supply
modern data acquisition hardware (PCI, PCI Express)much higher sampling rate, resolution, number of samples
flexible storage of resultsany ASCII format (CSV, Simpson, etc.)efficient binary format (HDF5)
currently 9.5 spectrometers are running DAMARIS
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 3/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
DAMARIS Architecture I
DAMARIS
front endback end
hardware data
Separation of tasks
Do one thing and do it good:
user interaction only with front end (GUI)
back end responsible for hardware
back end modifications usually not needed after initial setup
Instrumentation only
DAMARIS is for instrumentation, not analysis (possible, but non-interactive)
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 4/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
DAMARIS Architecture II
back end front end
RESULTS
JOBS
Back end
written in C++
hardware interface
jobs read from XML files
results saved in XML result files
Front end
GUI completely in Python
experiment design in Python
jobs written to XML files
data read from XML result files
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 5/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
DAMARIS Architecture III — Back End Processing
Processing principle
states describe experiment: pulse, wait, record data, etc.
states are converted to pulse programmer logic by state traversal
12. Wait3. Pulse 1
9. Loop n=10
1. Experiment
4. Wait
10. Wait5. PFG pulse on11. Pulse
7. Wait
8. Pulse 2
13. Pulse
6. PFG pulse off
2. Set RF source
repeat
5. PFG on 6. PFG off
1. Experiment
4. Wait 7. Wait
……
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 6/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
DAMARIS Architecture III — Back End Processing
Processing principle
states describe experiment: pulse, wait, record data, etc.
states are converted to pulse programmer logic by state traversal
12. Wait3. Pulse 1
9. Loop n=10
1. Experiment
4. Wait
10. Wait5. PFG pulse on11. Pulse
7. Wait
8. Pulse 2
13. Pulse
6. PFG pulse off
2. Set RF source
repeat
5. PFG on 6. PFG off
1. Experiment
4. Wait 7. Wait
……
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 6/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Supported Hardware
Pulse Programmer
SpinCore PulseBlaster 24bit
SpinCore PulseBlaster DDS III
ADC Acquisition Cards
Spectrum M2i40xx Series
Spectrum MI40xx Series
TiePie Handyscope HS3
Auxiliary
TecMag DAC-20
PTS Frequency Synthesizers(PTS-310, PTS-500)
Hardware coupled to software
Extending back end for other/additional hardware not trivial, but possible.Example: M2i40xx integration in 2012 by Stefan Reutter (PhD student).MI40xx driver source only available with NDA, binaries are freely distributable.
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 7/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
User Interface (Front End)
Experiment Script Result Script Log
Display Configuration
Display Source
Rudimentary Python for experiment and result scripts
Python programming language is easy!
all Python features usable: lists, if/else, for/while loops, etc.
lots of Python libraries, i.e. numpy/scipy (similar to Matlab)
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 8/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
DAMARIS ”Hello World” – Recording an FID
Experiment script
1 def fid_experiment(): # function describing the experiment2 e = Experiment() # begin sequence3 e.ttl_pulse(length=1e-6, value=1) # gating4 e.ttl_pulse(length=2e-6, value=1+2) # RF pulse + gating5 e.wait(length=10e-6) # dead time6 e.record(samples=1024, frequency=2e6, sensitivity=2) # ADC setup7 return e89 def experiment(): # function is executed by front end
10 for i in xrange(10): # repeat 10 times11 yield fid_experiment() # run experiment
Result script
1 def result():2 for timesignal in results: # loop over the incoming results3 data["Timesignal"] = timesignal # provide the timesignal to display
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 9/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
DAMARIS ”Hello World” – Recording an FID
Experiment script
1 def fid_experiment(): # function describing the experiment2 e = Experiment() # begin sequence3 e.ttl_pulse(length=1e-6, value=1) # gating4 e.ttl_pulse(length=2e-6, value=1+2) # RF pulse + gating5 e.wait(length=10e-6) # dead time6 e.record(samples=1024, frequency=2e6, sensitivity=2) # ADC setup7 return e89 def experiment(): # function is executed by front end
10 for i in xrange(10): # repeat 10 times11 yield fid_experiment() # run experiment
Result script
1 def result():2 for timesignal in results: # loop over the incoming results3 data["Timesignal"] = timesignal # provide the timesignal to display
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 9/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Example: Pulse Length Measurements
Experiment script
Modifications:
modifying parameters programmatically ( <= )
handing over information to result script
1 def fid_experiment(p90): # <= function takes parameter!2 e = Experiment()3 e.set_description("p90", p90) # <= hand over value to result script4 e.ttl_pulse(length=1e-6, value=1)5 e.ttl_pulse(length=p90, value=1+2) # <= variable pulse length p90!6 e.wait(length=10e-6)7 e.record(samples=1024, frequency=2e6, sensitivity=2)8 return e9
10 # this function is executed by front end11 def experiment():12 p90_list = lin_range(1e-6,3e-6,10) # <= 10 values, from 1 to 3 us13 for p in p90_list: # <= loop through list14 yield fid_experiment(p90=p) # <= run experiment
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 10/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Example: Pulse Length Measurements
Experiment script
Modifications:
modifying parameters programmatically ( <= )
handing over information to result script
1 def fid_experiment(p90): # <= function takes parameter!2 e = Experiment()3 e.set_description("p90", p90) # <= hand over value to result script4 e.ttl_pulse(length=1e-6, value=1)5 e.ttl_pulse(length=p90, value=1+2) # <= variable pulse length p90!6 e.wait(length=10e-6)7 e.record(samples=1024, frequency=2e6, sensitivity=2)8 return e9
10 # this function is executed by front end11 def experiment():12 p90_list = lin_range(1e-6,3e-6,10) # <= 10 values, from 1 to 3 us13 for p in p90_list: # <= loop through list14 yield fid_experiment(p90=p) # <= run experiment
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 10/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Example: Pulse Length Measurements
Result script I
Modifications:
retrieve parameters
storage/display
1 def result():2 for ts in results:3 p90 = ts.get_description("p90") # <= retrieve value4 data["Timesignal %e"%p90] = ts # <= create unique name for results
Note: data
Containera for results (data pool):
viewable in display tab
stored in data pool file (HDF5 file)
aPython dictionary
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 11/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Example: Pulse Length Measurements
Result script II
Modifications
retrieve parameters
storage/display + preliminary analysis
1 def result():2 signals = MeasurementResult() # <= "table" to store data3 for timesignal in results:4 p90 = timesignal.get_description("p90")5 signals[p90] = timesignal.y[0].max() # <= store signal maximum6 data["Pulse length"] = signals # <= display table7 data["Timesignal %e"%p90] = timesignal
Note: timesignal
holds time, real and imaginary part (x, y[0], y[1])
indexing, selection, i.e. values between index 10 and 20: y[0][10:20]
features: max, mean, etc., i.e. mean peak value: y[0][10:20].mean()
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 12/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Example: Phase Cycling
Modifications for CYCLOPS phase cycling
change receiver phase
data routing
Experiment script
1 def fid_experiment(p90, phase): # <= function takes new parameter!2 e.set_description("phase", phase) # <= hand over value to result script3 e.set_phase(phase) # <= change reference phase (degrees)4 e.record(samples=1024, frequency=2e6, sensitivity=2)
Result script
1 accu = Accumulation() # <= special type for accumulating signals2 tmp = timesignal + 0 # <= create copy to be modified3 phase = timesignal.get_description("phase")4 if phase == 90:5 tmp.y[0] = timesignal.y[1] # <= switch real with imaginary part6 tmp.y[1] = -timesignal.y[0]7 accu += tmp # <= add timesignal
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 13/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Covered until now
Basics:variable experimentsbasic information extractionaccumulation
Limitations:experiments independent of resultasynchronous work flowinformation flow from experiment to result script
Advanced concepts
Synchronization:react to results (feed back)wait for external conditions (stable temperature)
Communication with auxiliary devices:serial connections are easy!digitally controlled attenuator
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 14/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Feed Back: Stop Accumulation if SNR is Reached
Experiment script
1 def experiment():2 SNR=03 while SNR <= 100: # loop while SNR <= 1004 yield fid()5 synchronize() # wait for result script6 SNR = float(open("snr.dat").read()) # read SNR from file
Result script
1 accu = Accumulation()2 for ts in results:3 accu += ts4 noise = accu.y[0][-128:].std() # std. dev. of last 128 points5 SNR = accu.y[0].max()/noise6 open("snr.dat","w").write("%.2f"%noise) # write SNR to file
Note: synchronize()
stop writing job files until results are processed
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 15/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Auxiliary Devices: Temperature Controller
Wait until criteria is met
Simplistic implementation:
read temperature in fixed intervals
start experiment when set temperature is reached
Experiment script
1 import serial2 from time import sleep34 def experiment():5 s = serial.Serial("/dev/ttyUSB0") # connect to serial device6 T = 07 while T != 300: # loop8 s.write("KRDG?\n") # request current T9 T = float( s.readline() ) # receive response
10 sleep(10) # wait 10 s11 yield fid() # condition met: start experiment12 s.close() # close connection
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 16/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Digital Attenuator
Pulse shaping with digital attenuator
switch attenuator during pulse(GATE + RF)
multiple attenuation steps
parallel interface
-1 dB
-2 dB-4 dB
Line 2
Line 3
Line 4
-5 dB = -1 dB + -4 dB = Line 2 + Line 4
GATE
RF TTL
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 17/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Digital Attenuator
Experiment script
1 def fid_experiment(p90):2 e = Experiment()3 e.ttl_pulse(length=1e-6, value=1)4 # Gate + RF = 20 + 21 = 35 # -1 dB = 22 = 46 # -5 dB = 22 + 24 = 207 e.ttl_pulse(length=p90/3, value=3 + 20) # <= GATE + RF -5 dB8 e.ttl_pulse(length=p90/3, value=3 + 4) # <= GATE + RF -1 dB9 e.ttl_pulse(length=p90/3, value=3 + 20) # <= GATE + RF -5 dB
10 e.wait(length=10e-6)11 e.record(samples=1024, frequency=2e6, sensitivity=2)12 return e
Simplistic example
min. state length PulseBlaster: 90 ns
typical attenuation step: 0.5 dB
practical example: B. Kresse BSc. Thesis 2008
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 18/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Final remarks
Current state
in use for over 8 years: very stable, hardly crashes
mainly used with Debian/GNU Linux: DAMARIS packages ready to install
proven to be flexible and very adjustable
two external installments (beside Darmstadt):TU Dortmund (Prof. Roland Bohmer)FU Berlin (Prof. Hans-Martin Vieth, retired)
not difficult to learn, but uncommon concept
Future development
slow but steady, not many (back end) developers
constant adjustments needed, i.e. new OS release meansupdated/deprecated libraries
features geared for AG Fujara/Vogel: TD NMR, single nuclei
more work on documentation needed (updating, more user oriented)
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 19/19
Motivation DAMARIS Front End: Basics DAMARIS Front End: Advanced Concepts Final Remarks
Final remarks
Current state
in use for over 8 years: very stable, hardly crashes
mainly used with Debian/GNU Linux: DAMARIS packages ready to install
proven to be flexible and very adjustable
two external installments (beside Darmstadt):TU Dortmund (Prof. Roland Bohmer)FU Berlin (Prof. Hans-Martin Vieth, retired)
not difficult to learn, but uncommon concept
Future development
slow but steady, not many (back end) developers
constant adjustments needed, i.e. new OS release meansupdated/deprecated libraries
features geared for AG Fujara/Vogel: TD NMR, single nuclei
more work on documentation needed (updating, more user oriented)
Dr. Markus Rosenstihl AG Vogel – Technische Universitat Darmstadt 19/19