Index: /trunk/tools/heather/magic_region.pl
===================================================================
--- /trunk/tools/heather/magic_region.pl	(revision 30369)
+++ /trunk/tools/heather/magic_region.pl	(revision 30369)
@@ -0,0 +1,31 @@
+#!/usr/bin/perl -w
+
+# Dumb little utility to create ds9 region files (for magic investigations)
+
+# takes as input *skycell.xxxx.xxx.streaks and creates a ds9 region file for them (as stdout)
+
+
+
+
+print "\n";
+print "# Region file format: DS9 version 4.1\n";
+print "global color=green dashlist=8 3 width=1 font=\"helvetica 10 normal\" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1\n";
+print "fk5\n";
+print "\n";
+
+foreach $item  (<>) {
+    chomp($item);
+my @npiece = split / /,$item;
+    
+    if ($#npiece > 1){
+	my $ra1= $npiece[0]*180.0/3.141527;
+	my $ra2= $npiece[2]*180.0/3.141527;
+	my $dec1= $npiece[1]*180.0/3.141527;
+	my $dec2= $npiece[3]*180.0/3.141527;
+#	print "polygon($ra1, $dec1, $ra1, $dec2, $ra2, $dec2, $ra2, $dec1)\n"; 
+
+	print "line($ra1, $dec1, $ra2, $dec2)\n";
+    }
+
+   
+}
Index: /trunk/tools/heather/smf_by_exp_name.pl
===================================================================
--- /trunk/tools/heather/smf_by_exp_name.pl	(revision 30369)
+++ /trunk/tools/heather/smf_by_exp_name.pl	(revision 30369)
@@ -0,0 +1,57 @@
+#!/usr/bin/env perl 
+
+# this script takes a list of exp_names and copies the destreaked smfs to the current directory.
+# if given a o____g____o## type of name, it chops off the ## to create a valid exp_name 
+
+
+use DBI;
+use constant DB_SOCKET => '/var/run/mysqld/mysql.sock';
+
+my $dbname = 'gpc1';
+my $dbserver = 'ippdb01';
+my $dbuser = 'ipp';
+my $dbpass = 'ipp';
+
+my $db = DBI->connect(
+    "DBI:mysql:database=${dbname};host=${dbserver};mysql_socket=" .
+    DB_SOCKET(),${dbuser},${dbpass},
+    {
+        RaiseError =>, AutoCommit => 1}
+    ) or die "Unable to connect to database $DBI::errstr\n";
+
+
+
+
+while (<>) {
+    chomp $_;
+    $exp_name = $_;
+    $exp_name=~s/\d\d$//;
+    print $exp_name;
+    my $qy = "select exp_name, chipRun.state, camRun.state, path_base  from rawExp left join chipRun using (exp_id) left join camRun using (chip_id) left join camProcessedExp using (cam_id)  where exp_name = '$exp_name';";
+    my $query = $db->selectall_arrayref($qy) || 
+    die "Unable to execute SQL: $DBI::errstr\n";
+
+    foreach my $item (@{$query}) {
+	print "${$item}[0]xx${$item}[3]yy\n";
+    $path=  ${$item}[3];
+	
+
+
+    chomp $path;
+	$name = $path . '.smf';
+
+	$path =~ s/o\d+g\d+o\.\d+\.cm\.\d+$//;
+	print "$path\n";
+	$count = `neb-ls $path | grep smf | wc -l`;
+	    if ($count == 2) {
+		print "good to copy\n";
+		$nebpath= `neb-locate --path $name`;
+		chomp $nebpath;
+		print "cp $nebpath $exp_name.smf\n";
+		`cp $nebpath $exp_name.smf`;
+	}
+
+
+    }
+
+}
