|
|
|
|
|
MATLAB
HIGH LEVEL APPLICATIONS |
|
|
This
web page lists the matlab applications and their composite functions, in the
control system of the SLAC accelerator complex. |
|
|
The
page is sourced from an excel spreadsheet, HLA_software.xslx, found in the AD
operations wiki at
http://ad-ops.slac.stanford.edu/wiki/index.php/High-level_Applications |
|
|
|
|
|
|
APPLICATION |
FILE NAME |
PURPOSE |
PERSON |
|
|
|
|
|
|
Align Cathode Laser |
|
GUI application to align laser
on cathode with solenoid scan. |
Matt Gibbs |
|
|
laser_cathodeAlign.fig |
|
|
|
|
laser_cathodeAlign.m |
|
|
|
|
|
|
|
|
Align
Laser Heater Beams |
GUI application to overlap the
laser heater beam with the electron beam. |
Matt Gibbs |
|
|
laser_heaterAlign.fig |
|
|
|
|
laser_heaterAlign.m |
|
|
|
|
|
|
|
|
Archive |
|
Trivial GUI to retrieve and
display PV values over some time interval. One such GUI
of many. |
Greg White |
|
|
archive_dataGet.m |
Archive retrieval abstraction
(one of many, recommend use "history" instead). |
|
|
|
archive_gui.fig |
Archive GUI (one of many). |
|
|
|
archive_gui.m |
Archive GUI (one of many). |
|
|
|
|
|
|
|
Beam
Based Alignment |
GUI to
minimize beam orbit variance through undulator. Gets a list of relevant devices, and their model, then
computes a BBA, by simulating a bad alignment. The BBA app also includes
basic orbit minimization (by SVD). Has its own simulation routine. You
specify an area of the accelerator then it determines what BPMs Quad and CORs
UNDs etc., then it gets a subset of the model that relates all of these.
Other functions can read the data structure populated and know what to do
with it. e.g. setting CORs to values found or setting BPM offsets. |
Alberto Lutman |
|
|
bba_bpmDataGet.m |
Get synchronous BPM data for
BBA. Also simulates orbits based on machine parameters and R-matrices
computed previously. |
|
|
|
bba_corrGet.m |
Gets corrector values for BBA. |
|
|
|
bba_corrIsXY.m |
Not released. |
|
|
|
bba_corrSet.m |
Set correctors for BBA. |
|
|
|
bba_fitOrbit.m |
Fit BBA measured orbit to
various lattice response matrix parameters. Large selection of fit choices.
Same function is used to calculate how much the girders have to move and what
the BPM offsets should be for the undulator. |
|
|
|
bba_girdMove.m |
Move girders for BBA. |
|
|
|
bba_gui.fig |
BBA GUI. |
|
|
|
bba_gui.m |
BBA GUI. Orbit correction,
measurement of effect of moving UNDs IN/OUT, measuring the effect of moving
Klystron phases. Sort of a mess. |
|
|
|
bba_init.m |
Initialize BBA data structure. |
|
|
|
bba_klysOrbitCorrection.m |
Not released. |
|
|
|
bba_orbitRepointing.m |
Not released. |
|
|
|
bba_plotCorr.m |
Plot fitted corrector strengths. |
|
|
|
bba_plotOffset.m |
Plot fitted BPM and quad
offsets. |
|
|
|
bba_plotOrbit.m |
Plot measured and fitted beam
orbits. |
|
|
|
bba_responseMatDesc.m |
Generate descriptor for BBA
response matrix properties. |
|
|
|
bba_responseMatGet.m |
Generate BBA response matrix
with various options. Response matrix relates beam position on BPM to various
parameters like corrector settings, quad offset, BPM offset and initial
launch positions. It can use which ever model type (matlab mad, XAL etc) you
select |
|
|
|
bba_setBPM.m |
Set BPM offsets for BBA. |
|
|
|
bba_setCorr.m |
Apply BBA quad offsets to
correctors instead. |
|
|
|
bba_simulInit.m |
Initialize BBA simulation
parameters. Can set all the machine parameters and QUAD/BPM offset noise on
readbacks etc |
|
|
|
bba_staticOrbitCorrection.m |
Not released. |
|
|
|
|
|
|
|
Beam
Image/Profile Analysis |
Fits beam
profiles with various Gussian and non-Guassian fitting functions. Image processing also in here. Decides area of interest to
exclude noise etc. Calculates beam moments from profile data using various
methods. Calculates order 0, 1st and 2nd moment of 2d distribution,
corr-coeff, and integrated signal. Also skewness and kurtosis. This function
is used by the emittance app for beam Emittance fit, and in turn used by
Correlation Plots. |
Dorian Bohler |
|
|
beamAnalysis_beamAverage.m |
Calculate average beam moments
from individual measurement data. |
|
|
|
beamAnalysis_beamParams.m |
Calculates beam moments from
profile data using various methods. Calculates the 0, 1st and second moments
of the 2d distribution 4th moment skewness and kurtosis |
|
|
|
beamAnalysis_convert2PV.m |
Makes PV like structure from
beam moment data for use in correlation plots. Fits to profile beam stats and
the integrated sigma. Propagated to all HLAs. 6 different fit methods. E.g.
corr plot uses the emittance gui. |
|
|
|
beamAnalysis_getEllipse.m |
Calculates/plots beam ellipse
from beam moments. |
|
|
|
beamAnalysis_imgCircleFit.m |
Find laser spot circle in image
and determine Zernike coefficients. Zernike stuff |
|
|
|
beamAnalysis_imgPlot.m |
Plot image, profiles, and
moments of beam image. |
|
|
|
beamAnalysis_imgProc.m |
Image processing for beam images
to obtain profiles. Takes image then determines where the beam is and what
area you should integrate (around the beam) to reduce noise. |
|
|
|
beamAnalysis_orbitFit.m |
Fit beam orbit. |
|
|
|
beamAnalysis_phaseFit.m |
Fit phase and amplitude for
phase scan data. |
|
|
|
beamAnalysis_profilePlot.m |
Plot muliple beam profiles and
stats. |
|
|
|
beamAnalysis_sigmaFit.m |
Fit beam sigma matrix to beam
sizes. Fits beam orbit based on R-matrix or second moment. Fits the phase
scan. Linear fit but assumes that the phase repeats after 360 degrees
(sin/cosine fit with fixed frequency). |
|
|
|
beamAnalysis_sigmaPlot.m |
Plot fit results for sigma
matrix fit to beam sizes. |
|
|
|
xy_traj_fit_setup.m |
Paul Emma function to get model
data for orbit fit. |
|
|
|
zernike.m |
Calculate Zernike polynomials. |
|
|
|
|
|
|
|
Bunch
Length Measurement |
GUI app to measure beam bunch
length. Systematically similar to emittance GUI but
instead of changing quads changes the TCAV phase and amplitude |
|
|
|
tcav_bunchLength.m |
Fit bunch length to measured
beam size data. |
|
|
|
tcav_bunch_length.m |
Original Paul Emma calculation. |
|
|
|
tcav_calibration.m |
Fit TCAV calibration slope to
measured beam position data. |
|
|
|
tcav_gui.fig |
TCAV bunch length GUI. |
|
|
|
tcav_gui.m |
TCAV bunch length GUI. |
|
|
|
tcav_run_calibration.m |
Legacy TCAV calibration
function. |
|
|
|
|
|
|
|
Control
System Interface |
API for
basic device Process Variable (PV) get and set value operations. Importantly, these methods can be used seamlessly by LCLS and
FACET. For FACET for instance magnet operations through QUAS etc (in sector
20) are handled intelligently and where SLC control is needed operations go
through AIDA. Includes the settle time of magnets. Name resolution of element
to device name provided by model_ functions below. RF handled intelligently
for amplitude and phase appropriate for klystrons and subboosters. Ie knows to read PACT from LLRF
feedback station and PHAS from klystron phase. All operations vectorized. |
Greg White / Mike Zelazny |
|
control_ampSet.m |
Set amplitude of amp
controllable RF sections (injector stations, L2, L3). |
|
|
|
control_bpmAidaGet.m |
Get synchronized BPM data from
SCP through Aida. Amplitude and phase things (mainly important for FACET) |
|
|
|
control_bpmGet.m |
Get synchronized or async BPM
data (with time stamp/error checking). SLC BPM Data through AIDA |
|
|
|
control_chargeGet.m |
Bunch charge abstraction for set
point and actual. |
|
|
|
control_chargeName.m |
Get PVs for bunch charge set
point and actual. |
|
|
|
control_chicaneWatcher.m |
Chicane abstraction process to
control chicane R56 for BCH through HXRSS. To be completed - not fully tested. Intention was that for self-seeding
chicanes you should be able to control through phase via R56 only, so that
you could set a PV and it would move the chicanes, but never fully
implemented. Should look like magent control. One part just looks at the
magnet settings and then calculates actual values and R56 and is integrated
into the LEM server. But never asked Kristi to make appropriate named
pvs. Main ctrl parameter is the
phase inters of what ever wavelength. In phase shifter mode (use trims to
make angstrom delays) and actual chicane mode (main supply on makes mm
offset) |
|
|
|
control_deviceGet.m |
Get PV values for list of
primary names and attributes. Nice function to help read PVs for multiple
devices and multiple properties. Can takes MAD name and property of interest
(aka "secondary") - don't need PV name. Everything is vectorized. |
|
|
|
control_deviceSet.m |
Set PV values for list of
primary names and attributes. As above for set. |
|
|
|
control_eLossGet.m |
Not released. |
|
|
|
control_emitGet.m |
Get emittance data from
respective screen/wire PVs. Interface functions to get values from the
emittance GUI. Results are put into PVs for the screen or wire scanner where
the measurement was taken. This functions is an interface to set/get those
values. Eg emittance GUI sets the PV and the matching GUI gets values etc |
|
|
|
control_emitSet.m |
Set emittance data for
respective screen/wire PVs. É to set values for emittance GUI. |
|
|
|
control_energyNames.m |
Determine PV names of magnet
beam energy (SLC and EPICS). Mostly obsolete following linac RF control
upgrade to EPICS. |
|
|
|
control_fbNames.m |
Get feedback PV names for
respective accelerator area. Useful when you want to disable feedbacks
downstream when changing energy upstream. Mostly obsolete following
replacement of Matlab feedbacks. |
|
|
|
control_klysName.m |
Get klystron name for
corresponding LLRF station (L0a through L1X). Hard codes the mapping between
the RF stations and associated klystron controls (eg which PVs to control
phase/amp, and which PV to use for turning on and off). Originally an AIDA
interface to activate /deactivate, with all the other stat PVs Also knows
about the TCAVs special treatment |
|
|
|
control_klysStatGet.m |
Get klystron trigger and status.
Originally the AIDA interface to activate and deact Klystrons, and handled
TCAVs properly w.r.t. macrs. Mostly obsolete following LINAC RF control
upgrade. |
|
|
|
control_klysStatSet.m |
Set klystron trigger. As above. |
|
|
|
control_launchFB.m |
Generic Matlab feedback based on
BBA engine. H.L's version of a matlab feedback using functions from BBA
software. We are using it for the self seeding chicane orbit feedback. On
operator dashboard. You can tell it to listen to a pv in order to control its
state |
|
|
|
control_launchGird16.m |
Feedback for self-seeding
chicane orbit. A feedback implemented in terms of launchFB above. Short
function which calls the generic function above. |
|
|
|
control_magnetGet.m |
Magnet abstraction get routine.
Gets BDES, BACT, etc. |
|
|
|
control_magnetIVBGet.m |
Retrieve magnet polynomials.
Always gives you one poly, even if there is an up and a down, whichever is
pertinent to operation |
|
|
|
control_magnetIs.m |
Not released. Intelligently
understands QUASes, knows which have >1 LGPS, sums to get fields. |
|
|
|
control_magnetLGPSGet.m |
Finds LGPS for magnet and gets
actual field. For FACET/SLC, to get actual field, this f disentangles the
list of power-supplies and magnets.The only way to find out the name of the
power supply is to look at the entire list and work backward. You can only go
up one level. Not needed for LCLS. |
|
|
|
control_magnetLGPSMap.m |
Finds all LGPS powering a
magnet. |
|
|
|
control_magnetNameLGPS.m |
Gets controlling LGPS from PSCP.
Obsolete |
|
|
|
control_magnetQtrimGet.m |
Obsolete for LI30 quad trims. |
|
|
|
control_magnetQtrimSet.m |
Obsolete for LI30 quad trims.
Obsolete |
|
|
|
control_magnetQuadTrimGet.m |
Get full quad field from main
and trim. |
|
|
|
control_magnetQuadTrimSet.m |
Set quad trim based on full
field set point. |
|
|
|
control_magnetSet.m |
Magnet abstraction set routine.
Sets BDES, by perturb or trim, stdz etc. |
|
|
|
control_phaseGet.m |
LLRF phase abstraction get
routine. Gets phase, amp etc. |
|
|
|
control_phaseGold.m |
Phase recalibration. Sets phase
and offset for klys and sbst. Returns a big list of PVs for the LLRF
functions. Nightmareish |
|
|
|
control_phaseNames.m |
Generate PV names for various
LLRF properties. Nightmarish. |
|
|
|
control_phaseSet.m |
LLRF phase abstraction set
routine. |
|
|
|
control_profDataSet.m |
Set screen/wire PVs with beam
moments data. Writes the meansurement results into the corresponding PVs. |
|
|
|
control_pulseSteal.m |
Set up 1 Hz TCAV pulse stealing
mode. Now rarely used. |
|
|
|
control_readSCORE.m |
Not released. |
|
|
|
control_tcav3eDef.m |
Set up TCAV3 event definition. |
Nate Lipkowitz |
|
|
control_tcavPAD.m |
Setup TCAV triggers. For FACET
and L3 TCAV. |
Nate Lipkowitz |
|
|
control_undCloseOsc.m |
Calculate closed undulator orbit
oscillation parameters for correctors. 3-bump, hard coded which corrs. Useful
If you want to suppress laising - makes oscillation in the undulator but
doesn't change the beam coming out. Dynamic choice of correctors. Works will
up to undulator 27 (runs out of space to close the orbit). Uses 1 corrector
specified and closes with 30 and 33. |
Nate Lipkowitz |
|
|
read_BPMs.m |
Old Paul Emma function, calls
control_bpmGet. |
|
|
|
|
|
|
|
Correlation Plots |
|
GUI application to help execute
simple ad hoc "scan and read" experiments on control system
variables. |
Greg White |
|
|
corrPlot_gui.fig |
Correlation Plots GUI. |
|
|
|
corrPlot_gui.m |
Correlation Plots GUI. |
|
|
|
|
|
|
|
Dispersion
Measurement |
GUI application to help measure
beam dispersion. Largely still Paul Emma's gui which
still uses LLRF control for L2/L3 rather than the abstraction layer. New code
exists but hasn't been cross checked with the old method. |
|
|
|
meas_dispersion_gui.fig |
Dispersion measurement GUI. |
|
|
|
meas_dispersion_gui.m |
Dispersion measurement GUI. |
|
|
|
|
|
|
|
|
|
|
|
|
Emittance
Measurement |
GUI application to help measure
electron beam size. |
Dorian / Greg |
|
|
emittance_beamEllipsePlot.m |
Plot beam ellipse for emittance
GUI. |
|
|
|
emittance_convert2PV.m |
Convert emittance results into
PV structure for correlation plots. |
|
|
|
emittance_gui.fig |
Emittance measurement GUI. |
|
|
|
emittance_gui.m |
Emittance measurement GUI. |
|
|
|
emittance_process.m |
Process beam size measurements
for emittance GUI. |
|
|
|
|
|
|
|
Energy
Change |
|
GUI
application to help change final electron beam energy. Now not used so much generically to change one wavelen to
another but may still be used by BBA. Goes through parts of the machine to
block and activate feedbacks. Does NOT help with mirror control. This f now
largely replaced by a new one from Chris Zimmer. Very first energy change GUI
with various method. |
Chris Zimmer |
|
|
energyChange_gui.fig |
Energy change GUI. |
|
|
|
energyChange_gui.m |
Energy change GUI. |
|
|
|
|
|
|
|
EPICS Simulation |
|
Fake control
system PV input/output API for safe software development. Ensures readback
PVs are in accordance with setpoint PVs. Eg, you put BDES - then BACT value
will be sensible. Offers a gobal variable to say whether you're in simulation
or not. Works by putting its own versions of lcaGet/Put at the head of the
MATLABPATH. Enables running simple applications when app cannot or must not
access the real control system. Provides channel access simulation |
Greg White |
|
|
epicsSimul_clear.m |
Clear simulation data. |
|
|
|
epicsSimul_init.m |
Initialize simulation data for
LCLS. Operates by filling cell array with several thousand pvs e.g. screen
sizes, statuses, rf phases, magnet BDES, initializes the design model of the
machine into respective pvs. This script does a few others things which
allows you to open the profile monitor GUI and ask for an image from OTR2 ,
eg it knows the screen size and calibration of OTR2 and it will use the model
to calculate the beam size on OTR2's screen then simulate an image. This will
allow you to run an entire emittance measurement in simulation. Design values come from the online
model (to calculate the magnet strengths). The magnet software looks at the
simulation status. Runs model to
calculate the beam size. Only calculates the model once at initialization. |
|
|
|
epicsSimul_initXTA.m |
Not released. |
|
|
|
epicsSimul_lcaGet.m |
lcaGet simulation. Finds where
the real lca functions reside and intercepts function handles to override
with simulation. In Henrik's local folder there versions of lcaput and lcaget
(which mustn't be released into the production path of course) which epicsSimul*
interposes in place of the real functions when epics simulation is on.
Simulation mode works by putting these fake ones at the head of the path. To
use epics simul, you must add this local directory to the path. To verify
simul mode, lcaget of an empty string; if it works then you are in simulation
mode. |
|
|
|
epicsSimul_lcaGetStatus.m |
lcaGetStatus simulation. |
|
|
|
epicsSimul_lcaHandlesInit.m |
Find which lca* to use (real one
or simulation). TODO: Get henrik's lcaWrapper file and put in VCS. |
|
|
|
epicsSimul_lcaPut.m |
lcaPut simulation. |
|
|
|
epicsSimul_lcaPutNoWait.m |
lcaPutNoWait simulation. |
|
|
|
epicsSimul_load.m |
Not released. |
|
|
|
epicsSimul_save.m |
Not released. |
|
|
|
epicsSimul_status.m |
Set and get status of EPICS
simulation. retrieve or set the simulation statuses. |
|
|
|
epics_edm.m |
Not released. Matlab implementation of EDM |
|
|
|
epics_handleRegister.m |
Not released. |
|
|
|
epics_handleUnRegister.m |
Not released. |
|
|
|
epics_handleUpdate.m |
Not released. |
|
|
|
epics_timer.m |
Not released. |
|
|
|
|
|
|
|
GUI Support |
|
Utilities for Graphical User
Interface (GUI) based applications. |
Greg White |
|
|
gui_BSAControl.m |
Initialize BSA (get unique
EDEF). mostly interfaces to the man UI widgets |
|
|
|
gui_acquireAbortAll.m |
Abort all data acquisition in
Matlab session. Works recurrsively on apps (eg corrPlot -> emittance ->
wire scan). Robust way to change the status of a GUI - prevents bad effects
from hitting the start button more than once. |
|
|
|
gui_acquireStatusGet.m |
Get acquisition status of GUI.
Eg, has someone pressed "abort". Has someone pressed
"start" multiple times. |
|
|
|
gui_acquireStatusSet.m |
Set acquisition status of GUI. |
|
|
|
gui_appLoad.m |
Load GUI settings and apply to
application. |
|
|
|
gui_appSave.m |
Save GUI settings. Saves all the
application data in a matlab file. Eg which PMT to use for a wire scan. |
|
|
|
gui_checkBoxControl.m |
Abstraction for checkbox widget. |
|
|
|
gui_dataRemove.m |
Clear acquired data and check
for saved status. If you change any parameter that changes the way the
measurement data will be structured, this function handles the structure
change. Issues a dialogue warning when you save, throwaway, cancel, etcÉ |
|
|
|
gui_editControl.m |
Abstraction for numerical/text
edit widget. |
|
|
|
gui_indexColor.m |
Define accelerator specific
color scheme. |
|
|
|
gui_indexControl.m |
Accelerator selector control
widget. Makes gui look different for various accelerator environments.
Several GUIs have accelerator ort area tabs. If GUI starts in diff
environment you see different options like LCLS, FACET, etc É |
|
|
|
gui_indexInit.m |
Initialize GUI for specific
accelerator. |
|
|
|
gui_modelSourceControl.m |
Abstraction for model source
selection widget. |
|
|
|
gui_objectRepeat.m |
Create multiple copies of widget
with unique labels and callbacks. |
|
|
|
gui_popupMenuControl.m |
Abstraction for popup menu
widget. |
|
|
|
gui_printLogInit.m |
Split logbook button into two
for ASTA for physics and MCC log. |
|
|
|
gui_radioBtnControl.m |
Abstraction for radio button
widget. |
|
|
|
gui_radioBtnInit.m |
Generate multiple radio or push
buttons from single widget. |
|
|
|
gui_rangeControl.m |
Abstraction for range setting
edit widgets. controls multiple text boxes or multiple ranges. |
|
|
|
gui_resize.m |
Resize GUI figure to fit into
screen, or to specified scale, rescales fonts etc. |
|
|
|
gui_sliderControl.m |
Abstraction for slider widget. |
|
|
|
gui_statusDisp.m |
Show string in standard GUI
status text, Matlab terminal, and CMLOG. |
|
|
|
gui_textControl.m |
Abstraction for multi-line edit
widget. |
|
|
|
gui_useBoxInit.m |
Not released. |
|
|
|
|
|
|
|
Image acquisition |
|
Utilities and GUIs for
transverse beam image acquisition, display, and beam characterization |
Dorian Bohler |
|
|
profmon_activate.m |
Screen actuator abstraction
(pneumatic/motor), trigger activation, limit switch check etc. This is the
basic state machine controller. Handles the different types of controlled
screens. |
|
|
|
profmon_bayer2RGB.m |
Convert raw color camera images
to RBG. |
|
|
|
profmon_coordTrans.m |
Apply various coordinate system
transformations (pixels,um,etc.). |
|
|
|
profmon_evrSet.m |
Camera trigger activation. Makes
sure the camera is triggered. Makes sure only 1 is triggered (so avoid
crashing the IOC!). Determine the particle properties of a camera based on
the pv name. FACET, CAMERA, FEE deeply hard coded. Sets flags which indicate
what type of IOC it is. Area Detector, Legacy IOC, LSLCS Photon System, etc.
Various properties are set |
|
|
|
profmon_grab.m |
Basic single image acquisition.
Populates data structure that has the image and metadata. Acquires a single
image using the property pvs to populate a data structure that has the image
and metadata. The structure then gets passed around to other functions |
|
|
|
profmon_grabBG.m |
Background image acquisition
(blocks/unblocks beam). Other functions that are related to image acquisition
system which control actuators. For example, screen insertion will occur if
it's not already in or they'll make sure no upstream cameras inserted. Can
control pneumatically controlled screens stepper motors controlled screens |
|
|
|
profmon_grabSeries.m |
Grab multiple images with
distinct time stamps. Tries to get images as fast a possible but verifies
that they are distinct (also checks the time stamps) |
|
|
|
profmon_grabSync.m |
Grab multiple images concurrent
with BSA data. |
|
|
|
profmon_gui.fig |
Image acquisition GUI. |
|
|
|
profmon_gui.m |
Image acquisition GUI. Oddly,
doesn't use the _measure.m API mainly only for historical reasons. Works at a
lower level than the othe apps, like for instance emittance. |
|
|
|
profmon_imgCrop.m |
Crop image in image data
structure to specified area. |
|
|
|
profmon_imgFlip.m |
Toggle image data struct between
raw image and image in beam coordinate view. Removes mirroring depending on
which screen you are looking at. |
|
|
|
profmon_imgHist.m |
Calculate and show image
intensity histogram. |
|
|
|
profmon_imgPlot.m |
Plot image from image data
struct with various options. |
|
|
|
profmon_lampSet.m |
Target/reticule controls
abstraction. |
|
|
|
profmon_measure.m |
Acquire set of beam image data
(grab and process multiple images). API for applications. Takes n images with
n backgrounds (function called by other HLAs) |
|
|
|
profmon_multi_gui.fig |
Multiple camera GUI. |
|
|
|
profmon_multi_gui.m |
Multiple camera GUI. |
|
|
|
profmon_names.m |
Camera type (IOC, facility)
switchyard, based on PV name. Quite deply hard coded. LCLS accel, photon
system, if it has filters. Various properties set. |
|
|
|
profmon_process.m |
Multiple image processing queue
(more historically relevant). Makes sure only one camera gets triggered at a
time to avoid crashing the IOC. |
|
|
|
profmon_propNames.m |
Generates PV list for specific
camera properties based on camera type. Generates various attribute PVs based
on the camera type to get the image, image size, etc. |
|
|
|
profmon_ROISet.m |
Camera ROI abstraction (set
specified ROI on camera IOC). Different camera types have different pvs |
|
|
|
profmon_setup.m |
Initialize LCLS cameras with
calibration and orientation data. |
|
|
|
profmon_setupNLCTA.m |
NLCTA camera initialization. |
|
|
|
profmon_simulCreate.m |
Render simulation image with
various options (beam spot, noise, rad damage, etc.). |
|
|
|
profmon_simulData.m |
Generate image based on camera
properties and accelerator model. |
|
|
|
|
|
|
|
Laser
Cross-Correlator |
GUI to help measure cathode
laser pulse intensity temporal profile |
|
|
|
xcor_scan.fig |
X-correlate GUI. |
|
|
|
xcor_scan.m |
X-correlator GUI. |
|
|
|
|
|
|
|
LiTrack |
|
GUI and library for fast
longitudinal phase space tracking. A single-bunch
tracking code, which includes RF acceleration, bunch compression to 3rd
order, geometric and resistive short-range wakefields, aperture limits,
synchrotron radiation, and plotting. Ref:
https://www.slac.stanford.edu/cgi-wrap/getdoc/slac-pub-11035.pdf |
Tim Maxwell / Greg
White. |
|
LiTrack.m |
Basic 2-D longitudinal phase
space tracking of many electrons through several kinds of accelerator
sections. May be run standalone. |
|
|
|
LiTrack_GUI.m |
GUI front end for LiTrack.m. |
|
|
|
LiTrack_struc2params.m |
Assembles parameters entered on
the GUI to a structure suitable for passing to standalone LiTrack.m |
|
|
|
fdbk_fun.m |
Function to be minimized by
fminsearch to find feedback phase |
|
|
|
long_wake.m |
Computes wakefield induced
energy profile vs. z for a given set of axial coordinates |
|
|
|
run_LiTrack_GUI.m |
Wrapper script for running the
LiTrack GUI |
|
|
|
|
|
|
|
Matching
Application |
GUI to align
measured optical (Twiss) parameters with their design values. Based on Cecile's matching GUI. How matching uses the model
is messy. Started with using the
Parmela file w/ an associated R-matrix computation. Runs off a beamline
conflig file - so when devices added will have to hand edit this file like a
model deck. Would be better to use MAD deck. |
|
|
|
matching_beamlineModify.m |
Split beamline elements into
multiples. |
|
|
|
matching_configCreate.m |
Not released. |
|
|
|
matching_gui.fig |
Matching GUI. |
|
|
|
matching_gui.m |
Matching GUI. |
|
|
|
matching_kickLinac.m |
Transport matrix for accelerator
structure. |
|
|
|
matching_opticsModel.m |
Get transport matrices from
model. |
|
|
|
matching_opticsRead.m |
Get beamline from configuration
file. |
|
|
|
matching_transport.m |
Calculate transport matrices. |
|
|
|
matching_twissParameters.m |
Get twiss from sigma matrix
elements. |
|
|
|
matching_twissPlot.m |
Plot beta, alpha, size for
matching. |
|
|
|
matching_twissfun.m |
Optimization function. |
|
|
|
matching_updateGoals.m |
Update GUI elements. |
|
|
|
matching_updateMagnets.m |
Update GUI elements. |
|
|
|
config_*_PROD.config |
Matching GUI config files for
various accelerators and areas '*'. |
|
|
|
|
|
|
|
Model Support |
|
Suite of functions and GUI for
beamline lattice definition and related optics computations. |
Greg White |
|
beamline
description |
model_beamLineA.m |
A-line model. These functions
give you the beam line description for various accelerators. Either hand
translated MAD files or automatically generated cell arrays. Cell arrays
represent of a MAD device output list (print andtape files), eg Device type,
length, strength etc. |
|
|
" |
model_beamLineASTA.m |
ASTA model. |
|
|
" |
model_beamLineDIAG0.m |
LCLS-II DIAG0 model. |
|
|
" |
model_beamLineDIAG1.m |
LCLS-II DIAG1 model. |
|
|
" |
model_beamLineFACET.m |
FACET model. |
|
|
" |
model_beamLineInj.m |
LCLS injector model. |
|
|
" |
model_beamLineL2.m |
LCLS L2 model. |
|
|
" |
model_beamLineL3.m |
LCLS L3 model. |
|
|
" |
model_beamLineLCLS.m |
All LCLS model. |
|
|
" |
model_beamLineLCLSII.m |
Old LCLS-II model. |
|
|
" |
model_beamLineNLCTA.m |
NLCTA model. |
|
|
" |
model_beamLineUnd.m |
LCLS undulator model. |
|
|
" |
model_beamLineXTA.m |
XTA model. |
|
|
" |
model_beamSize.m |
Get beam size from model. beam
size based on the model and the assumed emittance |
|
|
|
model_blPlot.m |
Plot model beam line. Plots
twiss parameters (beta functions, dispersion etc) by Z with beamline element
definition. Takes the name of an area as input. Loads the corresponding model
beam line cell array and gets model data for it. |
|
|
LEM |
model_energy.m |
Get energy for device from
model. Gives you the energies and areas |
|
|
" |
model_energyBLEMTrim.m |
Perform LEM, copy LEM PVs into
BDES/EDES PVs, trim magnets. The old version of the GUI based matlab LEM
takes the data within matlab to set the magnets to new values. Recall that
the LEM server writes what it calculates to EACT and ELEM pvs. This function
reads those pvs then copies the BLEM (the ideal magnet strength) into the
BDES and trims the magnet. Also has undo function. Also saves old BDES so you
can undo a previous LEM action. See the undo button on the EDM screen. Also
note that the LEM server is running all the time at ~1 second period. |
|
|
" |
model_energyBTrim.m |
Calculates required trim
strengths for chicane magnets. Looks at the polynomial differences of the
fudging magnets and calculates the required trim magnet currents to get the
same BACT. |
|
|
" |
model_energyBX3trim.m |
Legacy function to calculate BX3
trim strengths only. |
|
|
" |
model_energyCalc.m |
Not released. Code copied out of the energy change gui; calculates the
klystron complement to match a certain desired energy |
|
|
" |
model_energyDmpMatch.m |
Calculate predictive dump area
match. |
|
|
" |
model_energyFudge.m |
LEM fudge factor
calculation. |
|
|
" |
model_energyKlys.m |
Get klystron list for respective
LEM areas and calculate effective phases and amplitudes. Assigns a name list
for klystrons, knows which klystron is in which LEM area. Also gets all of
the RF info (activation status, etc) gives the effective phase and amplitude
of each klystron including sub-booster phases and etc. |
|
|
" |
model_energyMagCheck.m |
Check if magnets trimmed during
LEM and optionally try again. |
|
|
" |
model_energyMagProfile.m |
Get magnet list for area and
calculate actual (fudged) magnet energies. Applies energy profile with a z
interpolation to get the energy of each magnet based on the klystrons from
the accelerating structures |
|
|
" |
model_energyMagScale.m |
Calculates new magnet field
strengths, and implements special situations (matching quads, trims, etc.).
Does the actual scaling of the magnets with various options (design value, or
only scale the non matching quads). Takes care of the chicane trims. Can
implement the predictive match for the undulator (and dump area) and the BBA
mode for the last quad in the undulator. |
|
|
" |
model_energyMagTrim.m |
Apply new LEM magnet settings. |
|
|
" |
model_energyProfile.m |
Obtain device list and
respective design and actual (fudged) energy profile from model. Looks at all
the klystrons and tells you the design (and actual best estimate) energy
profile. |
|
|
" |
model_energyServer.m |
LEM server. |
|
|
" |
model_energySet.m |
Set LTU/undulator magnets and
beam energy in simulation mode. |
|
|
" |
model_energySetPoints.m |
Get/set interface to energy set
point PVs, provide LEM region names. |
|
|
" |
model_energyUndMatch.m |
Set hardcoded quad values for
undulator match for given energy. Called by the LEM Server to set the
undulator matching quads based on hardcoded values from the polynomial |
|
|
Undulator
feedback |
model_fbUndPoly.m |
Not released. Would be used by the fast feed back in the undulator to
calculate the feedback matrix. Every time you change the beam energy and
hence quad focusing (not settings) change, you then need to get a new
feedback matrix. This function could get the matrices from the model and
write them to PVs. There would be a button on the feedback configuration of
the undulator which calls this matlab function. Determines the quad settings
for different energies then fits polynomials. Includes a predictive match in
the undulator |
|
|
" |
model_fbUndSetup.m |
Get undulator feedback matrices
from model and write into FB PVs. |
|
|
|
model_gui.fig |
Model display GUI. |
|
|
|
model_gui.m |
Model display GUI. |
|
|
|
model_init.m |
Initialize model source for each
accelerator. Includes API for user to say from where to get the model data
(model_ or XAL etc). |
|
|
|
model_k1Get.m |
Get quad/bend strength for
model. |
|
|
|
model_magnetIsGeV.m |
Determine bend control type
(field or GeV). |
|
|
|
model_nameConvert.m |
Convert between MAD/EPICS/SLC
names. conversion which returns lists which match a pattern |
|
|
|
model_nameList.m |
List of LCLS/FACET/NLCTA/XTA
devices. |
|
|
|
model_nameListFACET.m |
FACET list of devices. |
|
|
|
model_nameRegion.m |
Get device lists by area and
type. Main handwritten directory which indicates what area (aka micro) name
and unit number range are associated with L1, L2, undulator section, etc |
|
|
|
model_nameSplit.m |
Plot EPICS name into
constituents. |
|
|
|
model_nameXAL.m |
Get XAL name of device. to get
the proper name that XAL knows about e.g. base pv name |
|
|
|
model_orbitAcq.m |
Acquires beam orbits in support
of model measurement. This is for the model GUI model measurement part. Makes
oscillations and samples the phase space in a grid pattern to calculate the
actual beam transport matrices. |
|
|
|
model_orbitPSPlot.m |
Model measurement support, plot
phase space. |
|
|
|
model_orbitPlot.m |
Model measurement support, plot
orbits. |
|
|
|
model_orbitProc.m |
Model measurement support,
process measurement. |
|
|
|
model_parseList.m |
MAD to Matlab conversion.
Converts MAD deck into a matlab file |
|
|
|
model_parseMAD.m |
MAD to Matlab conversion. |
|
|
|
model_parseMatlab.m |
MAD to Matlab conversion. |
|
|
|
model_plot.m |
Generic model data plot.
Different from model_blplot above; this one is like Z plot for model data.
You tell it what devices and what part of the accelerator. It uses the naming
software to get a list of devices then it asks the model to give it the twiss
parameters for each device and plots them. |
|
|
|
model_rMatElement.m |
Calculate single device
R-matrix. |
|
|
|
model_rMatElements.m |
Vectorized version to calculate
R-matrix for multiple devices. |
|
|
|
model_rMatGet.m |
Get R-matrix, twiss function,
energy, z, length from Matlab, XAL, or DIMAD. Uses Matlab model for rmatrix
calculation etc |
|
|
|
model_rMatModel.m |
Interface to Matlab model. |
|
|
|
model_sigma2Twiss.m |
Convert sigma matrix to twiss
parameters. |
|
|
|
model_sigmaTrans.m |
Transport sigma matrix. |
|
|
|
model_t6MatElement.m |
Not released. |
|
|
|
model_twiss2Sigma.m |
Convert twiss parameters to
sigma matrix. |
|
|
|
model_twissB.m |
Calculate the phase space
normalization 'B' matrix. |
|
|
|
model_twissBmag.m |
Calculate Bmag value and add to
twiss parameters. |
|
|
|
model_twissGet.m |
Get twiss parameters from model,
MATLAB, XAL, or DIMAD. |
|
|
|
model_twissPhase.m |
Calculate phase advance from
R-matrix. |
|
|
|
model_twissTrans.m |
Transport twiss parameters. |
|
|
|
model_undMatch.m |
Calculate undulator matching
twiss parameters for given beam energy. |
|
|
|
model_undMatchFind.m |
Calculate polynomials for get
undulator matching quad settings for all energies. |
|
|
|
R_gen6.m |
Paul Emma function to compute
R-matrix. |
|
|
|
R_linac.m |
Paul Emma function to compute
R-matrix for accel structure. |
|
|
|
|
|
|
|
Orbit Display |
|
GUI to acquire and display beam
position data. Includes some orbit fitting. |
Greg White |
|
|
bpms_vs_z_gui.fig |
Original LCLS orbit display GUI
of Paul Emma . |
|
|
|
bpms_vs_z_gui.m |
Original LCLS orbit display GUI
of Paul Emma . |
|
|
|
|
|
|
|
Orbit
Display (time-slot aware) |
Beam position offset display,
plotted by Z. |
Greg White |
|
|
orbitDisplay.m |
Fast time-slot aware orbit
display. |
|
|
|
|
|
|
|
PAU Control |
|
Pattern Aware Units (disentangle
things and reset) |
|
|
|
pau_offsetZero.m |
Zero all PAU offsets. |
|
|
|
pau_sync.m |
Resync PAUs. |
|
|
|
|
|
|
|
RF Phase Scans |
|
Beam based measurement of RF
phases. Combination of Joe Frisch script, Paul Emma's
GUI, and Henrik's' changes |
|
|
|
Phase_Scans.fig |
RF phase scan GUI. |
|
|
|
Phase_Scans.m |
RF phase scan GUI. |
|
|
|
phase_scan_analyse.m |
Analyse phase scan data. |
|
|
|
phase_scan_new.m |
Acquire phase scan data. |
|
|
|
schottky_scan_NLCTA.m |
Schottky scan for NLCTA. |
|
|
|
schottky_scan_new.m |
Not released. |
|
|
|
schottky_scan.m |
Schottky scan for Phase scans. |
|
|
|
|
|
|
|
Scheduled
Measurements |
GUI application to set up timer
controlled measurements. E.g. Use this app if you want to
schedule an emittance measuerment to recurr with some period like every 2
hours. |
|
|
|
launch_gui.fig |
|
|
|
|
launch_gui.m |
|
|
|
|
|
|
|
|
Smarter CA |
|
Wrapper utility for matlab API
of EPICS Channel Access. Mainly adds error handling and retry,
excluding vals outside high and low, connvertsion of NaN etc. |
Greg White / Mike
Zelazny. |
|
lcaGetSmart.m |
Smart version of lcaGet.
Prevents your code from crashing at lcaget/put operation. Essentiually lcaget
& put with error handling. Overcomes issues of simple lcaGet in that
depending on what list of pvs you give it, you may have to get N times (this
version tries up to 3 time); and it can crash w/ empty string. This version
also finds bad PVs in a list and
removes those. Defaults time out to 2 seconds. If you ask for many pvs this
timeout time is increased. Returns NAN or empty string where applicable. |
|
|
|
lcaPutSmart.m |
Smart version of lcaPut. |
|
|
|
|
|
|
|
Undulator
Segment Utilities |
Utilitiy library used by the BBA
gui |
Jim Welch |
|
|
segmentCorr2FieldInt.m |
Not released. |
|
|
|
segmentFieldInt2Corr.m |
Not released. |
|
|
|
segmentInOutOffsetApply.m |
Applies undulator IN/OUT BPM and
corrector coefficients to PVs after measurement. |
|
|
|
segmentMoveInOut.m |
Move undulator segment IN or
OUT. |
|
|
|
segmentMoveWait.m |
Wait for undulator segment move
to complete. |
|
|
|
segmentOrbitCorrection.m |
Legacy function to use Matlab to
apply automated undulator field integral compensation. |
|
|
|
segmentOrbitCorrectionAll.m |
Not released. |
|
|
|
|
|
|
|
Utility Functions |
|
General purpose utility library
used by applications and libraries of the SLAC Matlab high level apps
described here. |
Greg White |
|
|
errorbarh.m |
Plot horizontal error bars. |
|
|
|
util_appClose.m |
|
|
|
|
util_appFind.m |
|
|
|
|
util_appFonts.m |
|
|
|
|
util_appMenu.m |
|
|
|
|
util_appPrintLog.m |
|
|
|
|
util_bgLevel.m |
|
|
|
|
util_checkPV.m |
|
|
|
|
util_circleFit.m |
|
|
|
|
util_configLoad.m |
|
|
|
|
util_configSave.m |
|
|
|
|
util_copyAxes.m |
|
|
|
|
util_copyFields.m |
|
|
|
|
util_dataLoad.m |
|
|
|
|
util_dataSave.m |
|
|
|
|
util_diagSum.m |
|
|
|
|
util_eLogEntry.m |
|
|
|
|
util_erfFit.m |
|
|
|
|
util_errorBand.m |
|
|
|
|
util_expFit.m |
|
|
|
|
util_fitInit.m |
|
|
|
|
util_fourier.m |
Fourier Transform that knows
about time/frequency scale to do the normalization correctly |
|
|
|
util_fwhm.m |
|
|
|
|
util_gaussDoubleFit.m |
|
|
|
|
util_gaussFit.m |
|
|
|
|
util_hist2.m |
|
|
|
|
util_ifourier.m |
|
|
|
|
util_lssvd.m |
Linear least squares fit using
Singular Value Decomposition (SVD) |
|
|
|
util_marginRemove.m |
|
|
|
|
util_marginSet.m |
|
|
|
|
util_marquardt.m |
|
|
|
|
util_meanNan.m |
|
|
|
|
util_medfilt2.m |
|
|
|
|
util_moments.m |
|
|
|
|
util_parabFit.m |
|
|
|
|
util_parseOptions.m |
|
|
|
|
util_parseParams.m |
|
|
|
|
util_permute.m |
|
|
|
|
util_phaseBranch.m |
Re-aligns the phase within a
given amount |
|
|
|
util_plotInit.m |
|
|
|
|
util_polyFit.m |
|
|
|
|
util_printLog.m |
|
|
|
|
util_processFit.m |
|
|
|
|
util_quasiBSA.m |
BSA to get screen images with
the same time stamps (asynchronously get data and align the time stamps) |
|
|
|
util_readPV.m |
|
|
|
|
util_readPVHst.m |
|
|
|
|
util_sinc.m |
|
|
|
|
util_sineFit.m |
|
|
|
|
util_stdNan.m |
Std deviation excluding NANs |
|
|
|
util_subplot.m |
|
|
|
|
util_varNan.m |
Variance excluding NANs. |
|
|
|
|
|
|
|
Wire Scans |
|
GUI
application to help measure transverse beam profile using wire insertion
devices. Simulation
function applies beam jitter and gets the beam size from the model so you can
simulate emittance measurement using the wire scan as well |
|
|
|
wirescan_fitOrbit.m |
Legacy wire scan function, not
released. |
|
|
|
wirescan_gui.fig |
Wire scan GUI. |
|
|
|
wirescan_gui.m |
Wire scan GUI. |
|
|
|
wirescan_simulScan.m |
Calculate data for wire scan
simulation. |
|
|
|
|
|
|
|
Z-Plot |
|
General purpose device PV value
plot by Z. |
Greg White |
|
|
zPlot.m |
Plot device values vs. Z. |
|
|
|
|
|
|
|
|
BC1_adjust_new.m |
|
|
|
|
BC2_adjust_new.m |
|
|
|
|
BCH_adjust_new.m |
|
|
|
|
BCSS_adjust.m |
|
|
|
|
BC_adjust.m |
|
|
|
|
BC_chicane_control.fig |
|
|
|
|
BC_chicane_control.m |
|
|
|
|
BC_phase.m |
|
|
|
|
|
|
|
|
|
Linac_RF_summary.fig |
Klystron CUD Matlab version. |
|
|
|
Linac_RF_summary.m |
Klystron CUD Matlab version. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|