Sdds question

Moderators: cyao, michael_borland

Post Reply
wguo
Posts: 41
Joined: 13 Jun 2008, 12:54

Sdds question

Post by wguo » 17 Jun 2008, 12:49

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

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

Re: Sdds question

Post by michael_borland » 17 Jun 2008, 13:00

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

wguo
Posts: 41
Joined: 13 Jun 2008, 12:54

Re: Sdds question

Post by wguo » 17 Jun 2008, 13:17

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

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

Re: Sdds question

Post by michael_borland » 17 Jun 2008, 17:21

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

Post Reply