Page 1 of 1
Sdds question
Posted: 17 Jun 2008, 12:49
by wguo
Can one of the gurus tell me how to concatenate two columns in an sdds file into one column? I use list to do it but I think it is very awkward.
The question comes from the attempt to make a response matrix. If a quadrupole strength changes, both betax and betay change and I had to connect two columns into one column.
Weiming
Re: Sdds question
Posted: 17 Jun 2008, 13:00
by michael_borland
Weiming,
Here's how I'd do it:
sddsconvert input.twi input-x.twi -rename=column,betax=beta
sddsconvert input.twi input-y.twi -rename=column,betay=beta
sddscombine input-x.twi input-y.twi new.twi -merge -delete=col,betax,betay
rm input-x.twi input-y.twi
--Michael
Re: Sdds question
Posted: 17 Jun 2008, 13:17
by wguo
Michael,
Thanks! That was quick.
I found another way to do it:
sddsprocess aps.twi -pipe=out -delete=col,* -retain=col,betax,betay \
| sddstranspose -pipe \
| sddsbreak -pipe -rowlimit=1 \
| sddstranspose -pipe \
| sddscombine -pipe -merge \
| sddsconvert -pipe=in oneColumn.twi -rename=col,betax=dbeta001
In this way I don't have to create new files. Is it faster? Also I can concatenate many columns.
Weiming
Re: Sdds question
Posted: 17 Jun 2008, 17:21
by michael_borland
Weiming,
A very guru-like solution. It doesn't keep data like ElementName and s with the beta values, which might be a problem for some applications.
I suspect that if the intermediate files are put on /tmp (or a local disk rather than a networked disk), then the speed of the two methods will be quite similar.
--Michael