[Swift-commit] r4598 - SwiftApps/Montage/scripts

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Fri Jun 10 17:54:17 CDT 2011


Author: jonmon
Date: 2011-06-10 17:54:17 -0500 (Fri, 10 Jun 2011)
New Revision: 4598

Added:
   SwiftApps/Montage/scripts/copy_image.sh
   SwiftApps/Montage/scripts/mDiffFit_wrap.sh
Modified:
   SwiftApps/Montage/scripts/Background_list.py
   SwiftApps/Montage/scripts/Swift_Montage_Apps.swift
   SwiftApps/Montage/scripts/Swift_Montage_Batch.swift
   SwiftApps/Montage/scripts/montage.swift
Log:
reverted back to not staging out the area files and calling mOverlaps on the projected images. For some reason when calling mOverlaps on the raw data the image became really distorted. Not sure why.  Added mDiffFit_wrap.sh to allow this to run


Modified: SwiftApps/Montage/scripts/Background_list.py
===================================================================
--- SwiftApps/Montage/scripts/Background_list.py	2011-06-09 21:36:04 UTC (rev 4597)
+++ SwiftApps/Montage/scripts/Background_list.py	2011-06-10 22:54:17 UTC (rev 4598)
@@ -6,7 +6,8 @@
 
 file_tbl_1 = open( args[1], 'r' );
 file_tbl_o = open( args[3], 'w' );
-i = 0
+i = 0;
+not_broke = True;
 
 for line_tbl_1 in file_tbl_1:
 
@@ -20,15 +21,27 @@
 
             l2 = line_tbl_2.split();
 
-            if l2[0] == l1[0]:
-                str_out = "["+str(i)+"].fname = "+l1[len(l1) - 1]+"\n";
-                str_out += "["+str(i)+"].a = "+l2[1]+"\n";
-                str_out += "["+str(i)+"].b = "+l2[2]+"\n";
-                str_out += "["+str(i)+"].c = "+l2[3]+"\n";
-                file_tbl_o.write( str_out );
-                i+=1;
-                break;
+            if l2[0] != "|" and l2[0] != "\\datatype":         
 
+                if int(l2[0]) == int(l1[0]):
+                    str_out = "["+str(i)+"].fname = "+l1[len(l1) - 1]+"\n";
+                    str_out += "["+str(i)+"].a = "+l2[1]+"\n";
+                    str_out += "["+str(i)+"].b = "+l2[2]+"\n";
+                    str_out += "["+str(i)+"].c = "+l2[3]+"\n";
+                    file_tbl_o.write( str_out );
+                    i = int(i);
+                    i+=1;
+                    not_broke=False;
+                    break;
+
+        if not_broke:
+            str_out = "["+str(i)+"].fname = "+l1[len(l1) - 1]+"\n";
+            str_out += "["+str(i)+"].a = 0\n";
+            str_out += "["+str(i)+"].b = 0\n";
+            str_out += "["+str(i)+"].c = 0\n";
+            file_tbl_o.write( str_out );
+            i = int(i);
+            i+=1;
         file_tbl_2.close();
 
 file_tbl_1.close();

Modified: SwiftApps/Montage/scripts/Swift_Montage_Apps.swift
===================================================================
--- SwiftApps/Montage/scripts/Swift_Montage_Apps.swift	2011-06-09 21:36:04 UTC (rev 4597)
+++ SwiftApps/Montage/scripts/Swift_Montage_Apps.swift	2011-06-10 22:54:17 UTC (rev 4598)
@@ -4,9 +4,9 @@
 }
 
 
-app ( Image bg_img ) mBackground( Image img, Image area_img, float a, float b, float c )
+app ( Image bg_img ) mBackground( Image img, float a, float b, float c )
 {
-    mBackground @img @bg_img a b c;
+    mBackground "-n" @img @bg_img a b c;
 }
 
 
@@ -22,21 +22,24 @@
 }
 
 
-app ( Image diff_img ) mDiff( Image proj_img_1, Image area_img_1, Image proj_img_2, Image area_img_2, MosaicData hdr )
+app ( Image diff_img ) mDiff( Image proj_img_1, Image proj_img_2, MosaicData hdr )
 {
-    mDiff at proj_img_1 @proj_img_2 @diff_img @hdr;
+//    mDiff "-n" @proj_img_1 @proj_img_2 @diff_img @hdr;
+    mDiff_wrap "-n" @proj_img_1 @proj_img_2 @diff_img @hdr;
 }
 
 
-app ( Image diff_img, Status stat ) mDiffFit( Image img_1, Image area_img_1, Image img_2, Image area_img_2, MosaicData hdr )
+app ( Image diff_img, Status stat ) mDiffFit( Image img_1, Image img_2, MosaicData hdr )
 {
-    mDiffFit "-s" @stat @img_1 @img_2 @diff_img @hdr;
+//    mDiffFit "-n" "-s" @stat @img_1 @img_2 @diff_img @hdr;
+    mDiffFit_wrap "-n" "-s" @stat @img_1 @img_2 @diff_img @hdr;
 }
 
 
 app ( Status stat ) mFitplane( Image diff_img )
 {
-    mFitplane"-s" @stat @diff_img;
+//    mFitplane "-s" @stat @diff_img;
+    mFitplane_wrap "-s" @stat @diff_img;
 }
 
 
@@ -70,7 +73,7 @@
 }
 
 
-app ( Image proj_img, Image area_img ) mProject( Image raw_img, MosaicData hdr )
+app ( Image proj_img ) mProject( Image raw_img, MosaicData hdr )
 {
     mProject "-X" @raw_img @proj_img @hdr;
 }

Modified: SwiftApps/Montage/scripts/Swift_Montage_Batch.swift
===================================================================
--- SwiftApps/Montage/scripts/Swift_Montage_Batch.swift	2011-06-09 21:36:04 UTC (rev 4597)
+++ SwiftApps/Montage/scripts/Swift_Montage_Batch.swift	2011-06-10 22:54:17 UTC (rev 4598)
@@ -7,13 +7,12 @@
     foreach background_entry, i in back_struct
     {
         Image proj_img <single_file_mapper; file = @strcat( @dirname( bg_imgs[i] )+"/", @background_entry.fname )>;
-	Image area_img <regexp_mapper; source = @proj_img, match = "(.*)\\.(.*)", transform = "\\1_area.\\2">;
         Image corr_img <regexp_mapper; source = @proj_img, match = ".*\\/(.*)", transform = "corr_dir/\\1">;
 
         float a = background_entry.a;
         float b = background_entry.b;
         float c = background_entry.c;
-        corr_img = mBackground( proj_img, area_img, a, b, c );
+        corr_img = mBackground( proj_img, a, b, c );
 
         corr_imgs[ i ] = corr_img;
     }
@@ -28,11 +27,9 @@
     {
         Image img_1 <single_file_mapper; file = @strcat( src_dir+"/", @d_entry.plus )>;
         Image img_2 <single_file_mapper; file = @strcat( src_dir+"/", @d_entry.minus )>;
-	Image area_img_1 <regexp_mapper; source = @img_1, match = "(.*)\\.(.*)", transform = "\\1_area.\\2">;
-	Image area_img_2 <regexp_mapper; source = @img_2, match = "(.*)\\.(.*)", transform = "\\1_area.\\2">;
 
         Image diff_img <single_file_mapper; file = @strcat( dest_dir+"/", @d_entry.diff )>;
-        diff_img = mDiff( img_1, area_img_1, img_2, area_img_2, hdr );
+        diff_img = mDiff( img_1, img_2, hdr );
 
         diff_imgs[ i ] = diff_img;
     }
@@ -40,26 +37,23 @@
 
 
 ( Image diff_imgs[], Table fits_tbl ) mDiffFitBatch( string src_dir, string dest_dir, string files[], Table diff_tbl, MosaicData hdr )
-//( Image diff_imgs[], Table fits_tbl ) mDiffFitBatch( string src_dir, string dest_dir, Table diff_tbl, MosaicData hdr )
 {
     DiffStruct diffs[] <csv_mapper; file = diff_tbl, skip = 1, hdelim="| ">;
     Status stats[];
 
     Table status_tbl = create_status_table( diff_tbl );
-
+    
     foreach d_entry, i in diffs
     {
-        Image img_1 <single_file_mapper; file = @strcat( src_dir+"/proj_", @d_entry.plus )>;
-        Image img_2 <single_file_mapper; file = @strcat( src_dir+"/proj_", @d_entry.minus )>;
-	Image area_img_1 <regexp_mapper; source = @img_1, match = "(.*)\\.(.*)", transform = "\\1_area.\\2">;
-	Image area_img_2 <regexp_mapper; source = @img_2, match = "(.*)\\.(.*)", transform = "\\1_area.\\2">;
+        Image img_1 <single_file_mapper; file = @strcat( src_dir+"/", @d_entry.plus )>;
+        Image img_2 <single_file_mapper; file = @strcat( src_dir+"/", @d_entry.minus )>;
 
         Image diff_img <single_file_mapper; file = @strcat( dest_dir+"/", @d_entry.diff )>;
-        Status stat <single_file_mapper; file = @strcat( "stat_dir/stat.", @d_entry.diff)>;
+	Status stat <single_file_mapper; file = @strcat( "stat_dir/stat.", @d_entry.diff)>;
+        
+        ( diff_img, stat ) = mDiffFit( img_1, img_2, hdr );
 
-        ( diff_img, stat ) = mDiffFit( img_1, area_img_1, img_2, area_img_2, hdr );
-
-        diff_imgs[ i ] = diff_img;
+	diff_imgs[ i ] = diff_img;
         stats[ i ] = stat;
     }
     fits_tbl = mConcatFit( status_tbl, stats );
@@ -81,17 +75,14 @@
 }
 
 
-( Image proj_imgs[], Image area_imgs[] ) mProjectBatch( Image raw_imgs[], MosaicData hdr )
+( Image proj_imgs[] ) mProjectBatch( Image raw_imgs[], MosaicData hdr )
 {
     foreach img, i in raw_imgs
     {
         Image proj_img <regexp_mapper; source = @img, match = ".*\\/(.*)", transform = "proj_dir/proj_\\1">;
-        Image area_img <regexp_mapper; source = @proj_img, match = "(.*)\\.(.*)", transform = "\\1_area.\\2">;
-//        proj_img = mProject( img, hdr );
+        proj_img = mProject( img, hdr );
 //        proj_img = mProjectPP( img, hdr );
-        ( proj_img, area_img ) = mProject( img, hdr );
 
         proj_imgs[ i ] = proj_img;
-        area_imgs[ i ] = area_img;
     }
 }

Added: SwiftApps/Montage/scripts/copy_image.sh
===================================================================
--- SwiftApps/Montage/scripts/copy_image.sh	                        (rev 0)
+++ SwiftApps/Montage/scripts/copy_image.sh	2011-06-10 22:54:17 UTC (rev 4598)
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+cp $2 $1
\ No newline at end of file


Property changes on: SwiftApps/Montage/scripts/copy_image.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftApps/Montage/scripts/mDiffFit_wrap.sh
===================================================================
--- SwiftApps/Montage/scripts/mDiffFit_wrap.sh	                        (rev 0)
+++ SwiftApps/Montage/scripts/mDiffFit_wrap.sh	2011-06-10 22:54:17 UTC (rev 4598)
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+mDiffFit $1 $2 $3 $4 $5 $6 $7
+
+mkdir -p `dirname $3`
+touch $3
+
+mkdir -p `dirname $6`
+touch $6
+
+exit 0


Property changes on: SwiftApps/Montage/scripts/mDiffFit_wrap.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: SwiftApps/Montage/scripts/montage.swift
===================================================================
--- SwiftApps/Montage/scripts/montage.swift	2011-06-09 21:36:04 UTC (rev 4597)
+++ SwiftApps/Montage/scripts/montage.swift	2011-06-10 22:54:17 UTC (rev 4598)
@@ -12,18 +12,19 @@
 Image corrected_mos <"final/corrected.fits">;
 JPEG corrected_jpg_img <"final/corrected.jpg">;
 Image projected_images[];
-Image projected_areas[];
 Image difference_images[];
 Image corrected_images[];
 
 Image raw_image_files[] <filesys_mapper; location = "raw_dir", suffix = ".fits">;
 
-difference_tbl = mOverlaps( raw_images_tbl );
+//difference_tbl = mOverlaps( raw_images_tbl );
 
-( projected_images, projected_areas ) = mProjectBatch( raw_image_files, header );
+projected_images = mProjectBatch( raw_image_files, header );
 
 images_tbl = mImgtbl( projected_images );
 
+difference_tbl = mOverlaps( images_tbl );
+
 ( difference_images, fits_images_tbl ) = mDiffFitBatch( "proj_dir", "diff_dir", @filenames(projected_images), difference_tbl, header );
 
 corrections_tbl = mBgModel( images_tbl, fits_images_tbl );




More information about the Swift-commit mailing list