Page 1 of 1

multi-type rows extraction with sdds toolkit

Posted: 23 Jan 2018, 06:23
by Faissal
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.

Re: multi-type rows extraction with sdds toolkit

Posted: 23 Jan 2018, 09:32
by michael_borland
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

Re: multi-type rows extraction with sdds toolkit

Posted: 29 Jan 2018, 08:35
by Faissal
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

Re: multi-type rows extraction with sdds toolkit

Posted: 29 Jan 2018, 10:36
by soliday
If an option has special characters like | or spaces, I usually just quote the entire option:
"-match=col,ElementType=KQUAD,ElementType=KSEXT,|"

Re: multi-type rows extraction with sdds toolkit

Posted: 29 Jan 2018, 12:12
by michael_borland
I agree with Bob, it is best to quote the entire string.

--Michael

Re: multi-type rows extraction with sdds toolkit

Posted: 31 Jan 2018, 05:37
by Faissal
Many thanks Michael and Bob !

regards,

- Faissal