Re: data extraction question
- To: mathgroup at smc.vnet.net
 - Subject: [mg63796] Re: [mg63749] data extraction question
 - From: "David Annetts" <davidannetts at aapt.net.au>
 - Date: Sat, 14 Jan 2006 02:33:10 -0500 (EST)
 - Sender: owner-wri-mathgroup at wolfram.com
 
Hi Ross,
<snippage>
> 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
> ;
I have no idea what IRAF format is.  If you post an example, it may be
possible to read the polygons directly using a combination of ReadList &
RecordSeparators.
I've assumed that your first list lives in a file called Martin.txt, then
	lst = ReadList["c:/tmpfiles/Martin.txt", {Number, Number, Word}]
will return the data as a list of triples.
We can find the positions of each polygon in the list using the following
(longwinded) code
	Flatten[Position[lst, #] & /@ Select[lst, (#[[3]] == "*") &]];
	Prepend[%, 0]
	Transpose@Partition[%, 2, 1]
	% /. {x_, y_} -> {x + 1, y}
	Transpose[%]
And extract them using
	Take[lst, #] & /@ %
Thereafter, you can do what you want.  For example, we can plot them, after
transforming each triple to a pair, using
	Map[Most, %, 2]
	Map[Polygon, %]
	Show[Graphics[%], Frame -> True];
Regards,
Dave.