Welcome to iraf.net Sunday, April 28 2024 @ 02:12 AM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 to create the table I want (new question!, now)
   
acard
 06/22/2007 03:27PM (Read 3796 times)  
++---
Junior

Status: offline


Registered: 01/18/2007
Posts: 27
Hi, just a simple question:
I have to create a table (and I use tcreate) from an ASCII file, but in that file there are 4 columns, and I want only to create the table with 3 of these.How can I do, in a script, without editing by hand the table?
Thanks.

 
Profile Email
 Quote
fitz
 06/22/2007 03:27PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Use the FIELDS task to extract only columns you need, i.e.[code:1:e6be3c3ca6]cl> fields myfile.in "1,2,4" > myfile.out[/code:1:e6be3c3ca6]would extract columns 1, 2 and 4 -- you'd run tcreate on the output.-Mike

 
Profile Email
 Quote
acard
 06/22/2007 03:27PM  
++---
Junior

Status: offline


Registered: 01/18/2007
Posts: 27
ok, but now I have a little problem:
I have to run rimcursor, and I use several key to identify different things in a spectrum.
I have to identify more then 10 different things (I mean keys!!) so I have to use not only the numbers (0..9) but also letters.
The problem is that I need to create a table (and you expalined to me how to) and to compute several operation with an 'if' condition on the keys I used before.
For example, if the key was '1' than compute this operation, if 'a' than compute this other, and so on.
But with tcalc I cannot use string parameter in the 'if' condition, I should use numbers. So I should change every letter-key with a number-key (starting with 10, becouse I have already used 0...9) and then I can use tcalc.Does exist a way to do this automatically (without editing by hand the output of rimcursor), or can I compute something with an 'if' condition on a string key??
Thank you!

 
Profile Email
 Quote
fitz
 06/22/2007 03:27PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
I'm not quite sure I understand exactly what you're doing but maybe the following will help. First, TCALC can't use strings within an expression so you can't really trigger off of that column directly, although I'm not sure what you gain by having the cursor file in a table anyway. Normally what you would do is process the cursor file by either passing it in to a task 'cursor' parameter so you can run the task in batch mode, or process it as a list (e.g. the commands you typed mean something to you but wouldn't to another task). For example,[code:1:d23222c7f6]
rimcur (> "cur.txt") # create cursor file
list = "cur.txt"
while (fscan (list, x, y, z, s1) != EOF) { # read the list
if (s1 == "a") {
....do something
} else if (s1 == "4") {
....do something else
}
....and so on
}
[/code:1:d23222c7f6]Here you use the built-in CL x/y/z parameters to read the position an WCS, and store the command in the 's1' string. Does this help?Cheers,
-Mike

 
Profile Email
 Quote
   
Content generated in: 0.14 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login