data extraction question
- To: mathgroup at smc.vnet.net
- Subject: [mg63749] data extraction question
- From: martinro at carleton.edu
- Date: Fri, 13 Jan 2006 04:48:29 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hello, I am working on a problem that requires I extract a certain part of a long, very messy test file. It is part of a astrophysics special project, so I promise this isn't some homework question. It was written in IRAF and so uses placement of its charachters on the page to identify the meaning of the values. I noticed that the data I wanted was essentially in ordered pair form, and that the only thing I had left on the line was a *\ symbol, and at the end of each group, was a *. My code to get thus far has been: data1=FindList["HAtemp.imh.ply.1","*"] In[6]:= Head[data1] Out[6]=List In[7]:=merge[list_List]:= StringJoin[ Map[StringJoin[#,""]&,list] ] In[12]:=okay=merge[data1] In[9]:=Head[okay] Out[9]=String In[13]:=new=StringDrop[okay,1] (This was because for some reason the first line was offset) then I get what was below these are coordinate values of polygons, and the * represents the end of that polygon, so what I want to do is change: 599.50 3557.00 *\ 607.50 3561.50 *\ 616.00 3566.00 *\ 618.00 3573.50 *\ 625.00 3579.50 *\ 629.50 3586.50 *\ 631.00 3592.50 *\ 631.50 3599.50 *\ 641.50 3604.00 * 778.00 3842.00 *\ 783.00 3837.50 *\ 787.50 3828.00 *\ 790.00 3819.50 *\ 800.50 3809.00 *\ 803.00 3795.00 * into; 599.50 3557.00 607.50 3561.50 616.00 3566.00 618.00 3573.50 625.00 3579.50 629.50 3586.50 631.00 3592.50 631.50 3599.50 641.50 3604.00 ; 778.00 3842.00 783.00 3837.50 787.50 3828.00 790.00 3819.50 800.50 3809.00 803.00 3795.00 ; where i assume I could use an IF statement to print the semi-colon if it runs into a * only, or keep checking. The problem is that I don't know how to have mathematica check by line. I have these charachters now set up as a string, but i also have it in the form where they are a List, with an element being a line. Anybody have any ideas? Sorry if this is really basic, but I'm a physics student, and haven't really used mathematica for much besides modeling, or graphing, or matrix equations. If anybody has any ideas I would be grateful. Ross Martin Carleton College