DAMARIS - An Introduction and Tutorial

Werbung
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 Universität Darmstadt
10.12.2014
Dr. Markus Rosenstihl
AG Vogel – Technische Universität Darmstadt
1/19
Motivation
DAMARIS Front End: Basics
DAMARIS Front End: Advanced Concepts
1
Motivation
Overview and Design Principles
Architecture
2
DAMARIS Front End: Basics
Example: FID
Example: Pulse Length Measurements
Example: Phase Cycling
3
DAMARIS Front End: Advanced Concepts
Example: Feed Back
Example: Temperature Controller
Example: Digital Attenuator
4
Final Remarks
Outlook and Future Development
Dr. Markus Rosenstihl
AG Vogel – Technische Universität Darmstadt
Final Remarks
2/19
Motivation
DAMARIS Front End: Basics
DAMARIS Front End: Advanced Concepts
Final Remarks
Motivation
DAMARIS stands for . . .
DArmstadt MAgnetic Resonance Instrumentation Software
by Dr. Achim Gädke, AG Fujara (2005)
Why DAMARIS?
replace good, but aged, home made system
DOS based, ISA/Vesa bus cards
flexible control of home made/non standard hardware
step motor/piezo positioning system for mechanical field cycling
control 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 results
any ASCII format (CSV, Simpson, etc.)
efficient binary format (HDF5)
currently 9.5 spectrometers are running DAMARIS
Dr. Markus Rosenstihl
AG Vogel – Technische Universität Darmstadt
3/19
Motivation
DAMARIS Front End: Basics
DAMARIS Front End: Advanced Concepts
Final Remarks
DAMARIS Architecture I
DAMARIS
back end
front 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 Universität Darmstadt
4/19
Motivation
DAMARIS Front End: Basics
DAMARIS Front End: Advanced Concepts
Final Remarks
DAMARIS Architecture II
JOBS
back end
front end
RESULTS
Front end
Back end
written in C++
GUI completely in Python
hardware interface
experiment design in Python
jobs read from XML files
jobs written to XML files
results saved in XML result files
data read from XML result files
Dr. Markus Rosenstihl
AG Vogel – Technische Universität 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
2. Set RF source
1. Experiment
13. Pulse
3. Pulse 1
9. Loop n=10
4. Wait
5. PFG pulse on
6. PFG pulse off
Dr. Markus Rosenstihl
8. Pulse 2
10. Wait
7. Wait
AG Vogel – Technische Universität Darmstadt
12. Wait
11. Pulse
repeat
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
1. Experiment
2. Set RF source
13. Pulse
3. Pulse 1
9. Loop n=10
4. Wait
5. PFG pulse on
8. Pulse 2
6. PFG pulse off
11. Pulse
10. Wait
repeat
7. Wait
1. Experiment
…
4. Wait
5. PFG on
Dr. Markus Rosenstihl
12. Wait
…
7. Wait
6. PFG off
AG Vogel – Technische Universität Darmstadt
6/19
Motivation
DAMARIS Front End: Basics
DAMARIS Front End: Advanced Concepts
Final Remarks
Supported Hardware
Pulse Programmer
Auxiliary
SpinCore PulseBlaster 24bit
TecMag DAC-20
SpinCore PulseBlaster DDS III
PTS Frequency Synthesizers
(PTS-310, PTS-500)
ADC Acquisition Cards
Spectrum M2i40xx Series
Spectrum MI40xx Series
TiePie Handyscope HS3
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 Universität 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 Universität Darmstadt
8/19
Motivation
DAMARIS Front End: Basics
DAMARIS Front End: Advanced Concepts
Final Remarks
DAMARIS ”Hello World” – Recording an FID
Experiment script
1
2
3
4
5
6
7
8
9
10
11
def fid_experiment():
#
e = Experiment()
#
e.ttl_pulse(length=1e-6, value=1)
#
e.ttl_pulse(length=2e-6, value=1+2) #
e.wait(length=10e-6)
#
e.record(samples=1024, frequency=2e6,
return e
def experiment():
for i in xrange(10):
yield fid_experiment()
Dr. Markus Rosenstihl
function describing the experiment
begin sequence
gating
RF pulse + gating
dead time
sensitivity=2) # ADC setup
# function is executed by front end
# repeat 10 times
# run experiment
AG Vogel – Technische Universität Darmstadt
9/19
Motivation
DAMARIS Front End: Basics
DAMARIS Front End: Advanced Concepts
Final Remarks
DAMARIS ”Hello World” – Recording an FID
Experiment script
1
2
3
4
5
6
7
8
9
10
11
def fid_experiment():
#
e = Experiment()
#
e.ttl_pulse(length=1e-6, value=1)
#
e.ttl_pulse(length=2e-6, value=1+2) #
e.wait(length=10e-6)
#
e.record(samples=1024, frequency=2e6,
return e
def experiment():
for i in xrange(10):
yield fid_experiment()
function describing the experiment
begin sequence
gating
RF pulse + gating
dead time
sensitivity=2) # ADC setup
# function is executed by front end
# repeat 10 times
# run experiment
Result script
1
2
3
def result():
for timesignal in results:
# loop over the incoming results
data["Timesignal"] = timesignal # provide the timesignal to display
Dr. Markus Rosenstihl
AG Vogel – Technische Universität 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
Dr. Markus Rosenstihl
AG Vogel – Technische Universität 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
2
3
4
5
6
7
8
9
10
11
12
13
14
def fid_experiment(p90):
#
e = Experiment()
e.set_description("p90", p90)
#
e.ttl_pulse(length=1e-6, value=1)
e.ttl_pulse(length=p90, value=1+2) #
e.wait(length=10e-6)
e.record(samples=1024, frequency=2e6,
return e
<= function takes parameter!
<= hand over value to result script
<= variable pulse length p90!
sensitivity=2)
# this function is executed by front end
def experiment():
p90_list = lin_range(1e-6,3e-6,10) # <= 10 values, from 1 to 3 us
for p in p90_list:
# <= loop through list
yield fid_experiment(p90=p)
# <= run experiment
Dr. Markus Rosenstihl
AG Vogel – Technische Universität 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
2
3
4
def result():
for ts in results:
p90 = ts.get_description("p90")
data["Timesignal %e"%p90] = ts
# <= retrieve value
# <= create unique name for results
Note: data
Containera for results (data pool):
viewable in display tab
stored in data pool file (HDF5 file)
a
Python dictionary
Dr. Markus Rosenstihl
AG Vogel – Technische Universität 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
2
3
4
5
6
7
def result():
signals = MeasurementResult()
# <= "table" to store data
for timesignal in results:
p90 = timesignal.get_description("p90")
signals[p90] = timesignal.y[0].max()
# <= store signal maximum
data["Pulse length"] = signals
# <= display table
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 Universität 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
2
3
4
def fid_experiment(p90, phase):
# <= function takes new parameter!
e.set_description("phase", phase) # <= hand over value to result script
e.set_phase(phase)
# <= change reference phase (degrees)
e.record(samples=1024, frequency=2e6, sensitivity=2)
Result script
1
2
3
4
5
6
7
accu = Accumulation()
# <= special type for accumulating signals
tmp = timesignal + 0
# <= create copy to be modified
phase = timesignal.get_description("phase")
if phase == 90:
tmp.y[0] = timesignal.y[1]
# <= switch real with imaginary part
tmp.y[1] = -timesignal.y[0]
accu += tmp
# <= add timesignal
Dr. Markus Rosenstihl
AG Vogel – Technische Universität Darmstadt
13/19
Motivation
DAMARIS Front End: Basics
DAMARIS Front End: Advanced Concepts
Final Remarks
Covered until now
Basics:
variable experiments
basic information extraction
accumulation
Limitations:
experiments independent of result
asynchronous work flow
information 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 Universität 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
2
3
4
5
6
def experiment():
SNR=0
while SNR <= 100:
# loop while SNR <= 100
yield fid()
synchronize()
# wait for result script
SNR = float(open("snr.dat").read()) # read SNR from file
Result script
1
2
3
4
5
6
accu = Accumulation()
for ts in results:
accu += ts
noise = accu.y[0][-128:].std()
# std. dev. of last 128 points
SNR = accu.y[0].max()/noise
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 Universität 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
2
3
4
5
6
7
8
9
10
11
12
import serial
from time import sleep
def experiment():
s = serial.Serial("/dev/ttyUSB0")
T = 0
while T != 300:
s.write("KRDG?\n")
T = float( s.readline() )
sleep(10)
yield fid()
s.close()
Dr. Markus Rosenstihl
# connect to serial device
#
#
#
#
#
#
loop
request current T
receive response
wait 10 s
condition met: start experiment
close connection
AG Vogel – Technische Universität Darmstadt
16/19
Motivation
DAMARIS Front End: Basics
DAMARIS Front End: Advanced Concepts
Final Remarks
Digital Attenuator
RF TTL
Pulse shaping with digital attenuator
GATE
switch attenuator during pulse
(GATE + RF)
Line 2
-1 dB
multiple attenuation steps
Line 3
parallel interface
Line 4
-2 dB
-4 dB
-5 dB = -1 dB + -4 dB = Line 2 + Line 4
Dr. Markus Rosenstihl
AG Vogel – Technische Universität Darmstadt
17/19
Motivation
DAMARIS Front End: Basics
DAMARIS Front End: Advanced Concepts
Final Remarks
Digital Attenuator
Experiment script
1
2
3
4
5
6
7
8
9
10
11
12
def fid_experiment(p90):
e = Experiment()
e.ttl_pulse(length=1e-6, value=1)
# Gate + RF = 20 + 21 = 3
# -1 dB
= 22 = 4
# -5 dB
= 22 + 24 = 20
e.ttl_pulse(length=p90/3, value=3 + 20) # <= GATE + RF -5 dB
e.ttl_pulse(length=p90/3, value=3 + 4) # <= GATE + RF -1 dB
e.ttl_pulse(length=p90/3, value=3 + 20) # <= GATE + RF -5 dB
e.wait(length=10e-6)
e.record(samples=1024, frequency=2e6, sensitivity=2)
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 Universität 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 Böhmer)
FU Berlin (Prof. Hans-Martin Vieth, retired)
not difficult to learn, but uncommon concept
Dr. Markus Rosenstihl
AG Vogel – Technische Universität 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 Böhmer)
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 means
updated/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 Universität Darmstadt
19/19
Herunterladen