combining files with SDDS

Moderators: cyao, michael_borland

Post Reply
marlibgin
Posts: 54
Joined: 15 Mar 2011, 12:43

combining files with SDDS

Post by marlibgin » 16 Jan 2014, 04:41

Hi all
surely the way I deal with sdds is not particularly advanced and this is a trivial problem for many of you. I have two files:

1) VMX-twi.twi contains the Twiss parameters, in particular columns with s, betax, betay ... ElementName,ElementType, ElementGroup. It does NOT have the ParameterElement .
2) optVMX_v10-002198.param describes (mostly) magnets and bpms in the machine, it contains ElementName, ElementType, ParameterElement, ElementGroup. It does NOT have the 's' position for the elements

Eventually I wish to plot the quadrupole strengths vs position-s along the ring.
I have tried my way (end of the message) but I end up with a file (out.twi) whose sddsprintout for s, ParameterElement(K1) looks like

s ParameterValue
m
-------------------------------
6.074700e+00 0.000000e+00
7.359650e+00 0.000000e+00

... 220 rows == number of selected quadrupoles

5.559317e+02 0.000000e+00
s ParameterValue
m
-------------------------------
0.000000e+00 -7.223595e-01
0.000000e+00 1.253374e+00

... 220 rows again

0.000000e+00 -7.223595e-01

In other words, the last sddscombine concatenate the files rather then put positions and quad strenghts on the same row

This is the sequence of commands I use. I hope some can tip me a solution, thanks very much indeed.

#
# pick initial twiss file and extract only the qaudrupoles
# according to the quadlist.sdds list
#
sddsselect VMX-twi.twi quadlist.sdds selQuads.twi -match=ElementName -reuse


#
# pick the file of parameters and select the quadrupole parameters
# using quadlist.sdds
#

sddsselect optVMX_v10-002198.param quadlist.sdds selQuadsValues.param -match=ElementName -reuse
#
#
#

#
# filter only quadrupole parameters
#
sddsprocess selQuadsValues.param -match=column,ElementParameter=K1


sddscombine selQuads.twi selQuadsValues.param out.twi



sddscombine selQuads.twi selQuadsValues.param out.twi
Attachments
optVMX_v10-002198.param
(770.56 KiB) Downloaded 123 times
quadlist.sdds
list of quads to be selected
(764 Bytes) Downloaded 121 times
VMX-twi.twi
twiss parameters file
(353.85 KiB) Downloaded 118 times

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: combining files with SDDS

Post by michael_borland » 21 Mar 2014, 12:02

Sorry for the late response. The forum is not sending me notifications on new topics. You need to use sddsxref (SDDS cross-reference) for this operation:

sddsxref optVMX_v10-002198.param VMX-twi.twi -pipe=out -match=ElementName -take=s -reuse=row \
| sddsprocess -pipe=in output.sdds -match=col,ElementParameter=K1 -match=col,ElementType=*QUAD*

In words, we take the 's' data for each element from the twiss output file into the parameter file. The "-reuse=row" option is needed because there are multipole rows in the parameter file for each element, and by default sddsxref only uses each row from the second file to match a single row in the first file. The sddsprocess command gets rid of data that doesn't pertain to K1 values for quadrupoles.

--Michael

Post Reply