a matlab interface to acquire and analyse beam spectra ... s… · a matlab interface to acquire...

31
A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V¨ alimaa CERN August 27, 2014 1 / 21

Upload: others

Post on 11-May-2020

20 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

A Matlab Interface to Acquire and Analyse BeamSpectra Using a Large Memory Digitizer

A. Valimaa

CERN

August 27, 2014

1 / 21

Page 2: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Let Me Present Myself

WHOAlpo Valimaa

FROMFinland, Aalto University

STUDYINGEngineering Physics and Mathematics

HERE FORCERN Summer Student Program June 16 - August 29, 2014

2 / 21

Page 3: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Idea Behind

For Operations Research there exists a system (OASIS) whichsatisfies the users. For MD, there is potential for a flexible dataacquisition tool that can provide more information than it isneeded to Operate at known parameter region, to have a betterview when trying new things.

The idea was to develop a user interface for digitizer to gain w.r.t.some specs if compared to the oscilloscope in use and to have anenvironment where to start data post-processing.

3 / 21

Page 4: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Data Acquisition Tool

What? A digitizer by SP Devices

Model ADQ214

Quality 14-bit

Memory 64 MSamples

Sampling frequency 800/n MHz, n=2,3,4,...,20

Flexibility Great

Resolution At 400 MHz one achieves a frequency resolution of 1kHz for an event lasting 1 ms.

More Info Here

4 / 21

Page 5: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Sampling Frequency vs Recording Time

0 200 400 600 800 1000 1200 1400 1600 18000

50

100

150

200

250

300

350

400

450

Recording Time [ms]

Sam

plin

g F

requency [M

Hz]

ADQ214

With ADQ214 we are fully covering the basic cycle length in PSwhich is 1.2 seconds.

5 / 21

Page 6: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Data Acquisition Tool

One can think of ADQ214 digitizer being a camera with 64megapixels. A camera producing such images for which exposuretime can be changed afterwards.

6 / 21

Page 7: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Oscilloscope vs Digitizer

Device Tektronix MDO4054-3

Strength All-in-one package

/ More tools than necessary forour purpose

Device SPD ADQ214

Strength High-quality, fast rateand large memory

/ Requires applicationdevelopment

7 / 21

Page 8: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Oscilloscope vs Digitizer

Quality 12-bit /

Memory 4 ch x 20 MS /

Analog BW 500 MHz

Signal processing Analog ,

Spectrogram No /

Quality 14-bit ,

Memory 2 ch x 64 MS ,

Analog BW 850 MHz

Signal processing Afterdigitization with computer

Spectrogram Interface for it nowdeveloped ,

8 / 21

Page 9: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Oscilloscope vs Digitizer

Upgradability Buy a new one /

Price More /

Upgradability Upgrade device,computer or modify code.

Price Less ,

9 / 21

Page 10: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Matlab Interface - GUI

GUI Controlled by Matlab class. Consists of a spectrogram view,slider widget and file open button.

View 512 x 1024 ≈ half MP. Use click+ctrl and click+shift tozoom in and out. Adjust spectrogram parameters to the view.

Slider Use slider to balance with time and frequency resolutions.

10 / 21

Page 11: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Code (more in the appendix)

classdef myClass < matlab.Systemproperties

gui h % GUI handle structurein % Input data structureout % Output data structurelayerNumber % This indicates of the layerlayer % Use this to navigatecheckTimer % Timer object

endproperties (Logical)

debug=false;endmethods

%--------Main functions---------------end %Methods(Static)

end %Classdef

11 / 21

Page 12: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

nToF Cycle Spectrum

Time[ms]

Fre

quency[M

Hz]

200 4000

10

20

30

40

Σ signal. Whole cycle shown from injection to extraction. Noteconstant betatron frequency but varying content of highfrequencies during cycle.

12 / 21

Page 13: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

nToF Cycle Spectrum

Time[ms]

Fre

quency[M

Hz]

Overview of TOF Cycle as Seen in H Signal. RF Clock.

200 400 600

10

20

30

40

Corresponding spectrogram of nToF cycle but now with H signal.

13 / 21

Page 14: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

nToF Cycle Spectrum (zooming)

Time[ms]

Fre

quency[M

Hz]

Fluctuation of High Frequency Content at Injection. Sum Signal of TOF Beam. RF Clock.

19 200

10

20

30

Fluctuation of high frequency content can be seen during the firstms after injection. It implies oscillation of bunch size.

14 / 21

Page 15: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

nToF Cycle Spectrum

Time[ms]

Fre

quency[M

Hz]

Fluctuation of High Frequency Content After Transition. H Signal of TOF Beam. RF Clock.

152 154 156 158 160 162

10

20

30

40

Transition is a critical point in the cycle regarding beam losses.This was seen also in H signal as sudden rise of highest frequencies.

15 / 21

Page 16: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

nToF Cycle SpectrumExtraction

Time[ms]

Fre

quency[M

Hz]

Bunch Compression Before Extraction. Sum Signal of TOF Beam. RF Clock.

562 564 566 5680

10

20

30

40

For nToF cycle we see the so-called sharp extraction. The wholebeam is extracted at once.

16 / 21

Page 17: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Peak Detection

Time[ms]

Fre

qu

en

cy[M

Hz]

200 400

0.2

0.4

0.6

0.8

1

We had an algorithm to find the nearest significant peak (nearestin the frequency domain).

17 / 21

Page 18: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Peak Detection

Time[ms]

Fre

qu

en

cy[M

Hz]

200 400

0.2

0.4

0.6

0.8

1

We developed it further to follow a curve.

18 / 21

Page 19: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Peak Detection

Time[ms]

Fre

quency[M

Hz]

200 400

2

4

6

8

One can use it f.ex. to extract information of the synchrotronfrequency.

19 / 21

Page 20: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Gating

Nu

mb

er

of

Tu

rns

Time (ns)

Tomoscopy at Injection

100 200 300 400 500 600 700 800

1000

2000

3000

4000

5000

With external clock we lose the information of time but we canrecord the beam position w.r.t. RF clock and gating is possible.

20 / 21

Page 21: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Conclusions

In this presentation I reported the work done during my summerstudentship at CERN.

I I developed a Matlab class and a Matlab GUI for a fast andeasy post-processing of the data acquired with the ADQ214

I I show few examples using the Σ and H signal of the nToFcycle:i one single data measurement the “64 MP” image candeliver a lot of information and a give almost a completeoverview of the beam passage in the cycle

I To spot something more local, one can use the gating.

Thank you!

21 / 21

Page 22: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

Conclusions

In this presentation I reported the work done during my summerstudentship at CERN.

I I developed a Matlab class and a Matlab GUI for a fast andeasy post-processing of the data acquired with the ADQ214

I I show few examples using the Σ and H signal of the nToFcycle:i one single data measurement the “64 MP” image candeliver a lot of information and a give almost a completeoverview of the beam passage in the cycle

I To spot something more local, one can use the gating.

Thank you!

21 / 21

Page 23: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Code I

classdef myClass< matlab.Systemproperties

gui h % GUI handle structurein % Input data structureout % Output data structurelayerNumber % This indicates of the current ...

layerlayer % Use this to navigate through ...

different zoom layerscheckTimer % Timer object

endproperties (Logical)

debug=false;endmethods

%--------Main ...functions----------------------------------------------------

%Class and GUI

22 / 21

Page 24: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Code IIfunction obj = myClass(varargin)function createGui(obj,varargin)function initializeMyClass(obj)function delete(obj)function switchChannel(obj)function closeFigureFcn(obj,varargin)

%Data Processingfunction ...

[nfft,noverlap,nWindows]=giveParametersForFFT(obj,method)function mySpectro(obj,varargin)function myMatrix=addWindow(¬,myMatrix,varargin)function plotSpectro(obj,hAxes)

%Imagefunction updateGraph(obj,hAxes)function updateLabels(obj,¬,callerFcn)function ...

[h,ds data]=dsimagesc(¬,data,hAxes,method)

23 / 21

Page 25: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Code III

%Zoomfunction computationalZoom(obj)function select pts callback(obj,¬,¬)function zoom in callback(obj,¬,¬)function zoom out callback(obj,¬,¬)function calculate callback(obj,¬,¬)function view callback(obj)function axesButtonDownFcn(obj,hObj,¬)function ZoomInCallback(obj,¬,event)function showRegion(obj,fCenter,fWidth,t0,tend)

%Peaksfunction ...

[locMatrix,locMatric i]=findHarmonics(obj)function ...

[line,line i,ind]=findNearestLine(obj,varargin)function ...

[line,line i]=loopAlongTheLine(obj,method,startingPoint i)function [peak,peak i]=getNearbyPeak(¬,data)

24 / 21

Page 26: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Code IVfunction ...

[peak,peak i]=enhancedPeakPrecision(obj,peak i,values i,values)function ...

[loc,loc i,amplitude]=findNearestPeak(obj,varargin)function ...

[peaks,peaks i]=findPeaks(¬,type,value,varargin)function ind=findNextBunch(obj,i0)

%Sliderfunction updateSliderValue(obj)function slider callback(obj,hObj,¬)function ...

[smin,smax]=EvaluateSliderValueRange(obj)

%Gatefunction ...

getBaseFreqAtBunch(obj,baseFreq i,baseFreq,nBunch)function ...

gateMatrix=gateSignal(obj,nTurns,clockType,varargin)function loopGatedSignal(obj,gateMatrix)

25 / 21

Page 27: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Code Vfunction plotTransition(obj)function plotInjection(obj)function plotExtraction(obj)

%Slices - amplitude plotsfunction ...

[timeMatrix,freqMatrix,nfft,nWindows,times,freqs,accuracy]=constructSlices(obj)function plotSlices(obj,varargin)function ...

varargout=amplitudePlot(obj,type,value,nfft,nWindows,strTitle)

%Event Handlingfunction ...

listenToExtTrigger(obj,myDevice,timePeriod)function listenToSwTrigger(obj,myDevice)function listenToDataSavings(obj,myDevice)function respondToTriggered(obj,src,¬)function respondToDataSaving(obj,myDevice,¬)

%File Handling

26 / 21

Page 28: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Code VI

function reLoad(obj)function LoadMostRecent(obj)function LoadFile Callback(obj,¬,¬)function saveData(obj,myDevice)function figureName=saveFig(obj,varargin)function openInMyClass(obj,myDev)

%--------Short ...functions---------------------------------------------------

%Positionfunction ...

[coord,str,varargout]=position2Coordinates(obj,pos,varargin)function ...

value i=coordinate2Position(obj,varargin)function value=getCurrentCoordinate(obj)function value i=getCurrentPosition(obj)function [iLower,iUpper]=getCurrentIndex(obj)

%Notation

27 / 21

Page 29: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Code VIIfunction ...

[str,exponent value,preval]=value2ScientificNotation(¬,value,varargin)function ...

str=getValuePlusMinusAccuracy(obj,value,type,accuracy)

%Indexesfunction index=lim2ind(¬,limit)function limit=ind2lim(¬,limit)

%Marksfunction MarkPosition(obj,position,varargin)function ClearMarks(obj)

%Constrainfunction [x0, xend, ...

shifted]=shiftPositionNearEdges(obj,x0,xend)function rect=constrainRect(obj,rect,varargin)function ...

TF=isWithinLimits(¬,hAxes,point,varargin)

28 / 21

Page 30: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Code VIII%Get Valuefunction [nfft,nWindows]=getNFFT(obj,N data)function fNumber=getFNumber(obj)function mySignal=getSignal(obj,type)

%Testfunction testConsistency(obj)function testMyClass(obj)

%Viewfunction cleanView(obj)function normalView(obj)

%Image Colorsfunction fadeColors(obj)function returnColors(obj)function brighten(obj)function darken(obj)

%Other

29 / 21

Page 31: A Matlab Interface to Acquire and Analyse Beam Spectra ... S… · A Matlab Interface to Acquire and Analyse Beam Spectra Using a Large Memory Digitizer A. V alimaa CERN August 27,

The Code IX

function printDebug(obj,str)function stopTimer(obj,varargin)

endmethods(Static)

function a = example()function ...

[tickLabels,tickPlaces,counter]=FindMyTicks4(physicalLimits,indexLimits,exponentValue)function myCompress(data)function myCompress16(data,smallest increment)function S=myCompress8(data)function data=unCompress8(S)function ...

[offset,varargout]=calibrate(signal,type,varargin)end %Methods(Static)

end %Classdef

30 / 21