multi-type rows extraction with sdds toolkit

Moderators: cyao, michael_borland

Post Reply
Faissal
Posts: 16
Joined: 11 Jan 2017, 14:53
Location: Diamond Light Source (UK)

multi-type rows extraction with sdds toolkit

Post by Faissal » 23 Jan 2018, 06:23

Dear all,

Apologies if this question might sound trivial for some of you. I have the following situation:

There is a twiss file with several columns, "s", "betax", "betay", "ElementType" etc

I first extract the lines of the file that correspon to quadrupole values, and it works. I do (in an elegant file)

Code: Select all

&subprocess
command = "sddsprocess run0_test.twi jan18.betaxTerms  -match=col,ElementType=KQUAD "
&end
However, if I want to extract the line KQUAD lines **and** the KSEXT ones in the final output, I try

Code: Select all

&subprocess
command = "sddsprocess run0_test.twi jan18.betaxTerms  -match=col,ElementType=KQUAD,ElementType= KSEXT, | "
&end
and it doesn't work. The notation I tried is inspired from the SDDStoolkit manual, p.136 . I don't really see what I am doing wrong.

PS: i am extracting the KQUAD and KSEXT values to have more point for the KQUAD optimization.

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

Re: multi-type rows extraction with sdds toolkit

Post by michael_borland » 23 Jan 2018, 09:32

Faissal,

The syntax is a bit off. Try removing the spaces, i.e., use

Code: Select all

&subprocess
command = "sddsprocess run0_test.twi jan18.betaxTerms  -match=col,ElementType=KQUAD,ElementType=KSEXT,| "
&end
instead of

Code: Select all

&subprocess
command = "sddsprocess run0_test.twi jan18.betaxTerms  -match=col,ElementType=KQUAD,ElementType= KSEXT, | "
&end
--Michael

Faissal
Posts: 16
Joined: 11 Jan 2017, 14:53
Location: Diamond Light Source (UK)

Re: multi-type rows extraction with sdds toolkit

Post by Faissal » 29 Jan 2018, 08:35

Dear Michael,

thank you for having pointed out the blank to my attention. I did some further trial and errors and managed to make things work, by writing:

(inside an *.ele file)

Code: Select all

&subprocess
command = " sddsprocess input.twi output.sdds  -match=col,ElementType=\"KQUAD,ElementType=KSEXT,|\"   "
&end
or, as a standalone command in the shell:

Code: Select all

sddsprocess inpit.twi output.sdds  -match=col,ElementType="KQUAD,ElementType=KSEXT,|"
I must thank you because without the step you provided I wouldn't have been able to find the error.

To be honest, I find my own final version a bit strange, because the apostrophes include the second "ElementType" and not the first, if you notice. But it clearly works, as I checked by converting the output sdds into a csv for easier browsing through. Could it be that the syntax in the SDDStoolkit manual correspond to an earlier version perhaps? Because the syntax of the manual was giving me "Invalid null command" until I implemented the above modification.

regards,

- Faissal

soliday
Posts: 403
Joined: 28 May 2008, 09:15

Re: multi-type rows extraction with sdds toolkit

Post by soliday » 29 Jan 2018, 10:36

If an option has special characters like | or spaces, I usually just quote the entire option:
"-match=col,ElementType=KQUAD,ElementType=KSEXT,|"

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

Re: multi-type rows extraction with sdds toolkit

Post by michael_borland » 29 Jan 2018, 12:12

I agree with Bob, it is best to quote the entire string.

--Michael

Faissal
Posts: 16
Joined: 11 Jan 2017, 14:53
Location: Diamond Light Source (UK)

Re: multi-type rows extraction with sdds toolkit

Post by Faissal » 31 Jan 2018, 05:37

Many thanks Michael and Bob !

regards,

- Faissal

Post Reply