[Swift-commit] r3481 - in SwiftApps/Montage: example scripts
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Wed Jul 28 13:51:24 CDT 2010
Author: jonmon
Date: 2010-07-28 13:51:23 -0500 (Wed, 28 Jul 2010)
New Revision: 3481
Added:
SwiftApps/Montage/example/README.txt
SwiftApps/Montage/example/sites.xml
SwiftApps/Montage/example/stat_dir/
SwiftApps/Montage/example/tc.data
SwiftApps/Montage/scripts/create_status_table.py
Modified:
SwiftApps/Montage/example/m101_montage.swift
SwiftApps/Montage/example/makefile
SwiftApps/Montage/scripts/Background_list.py
SwiftApps/Montage/scripts/Swift_Montage_Apps.swift
SwiftApps/Montage/scripts/Swift_Montage_Batch.swift
SwiftApps/Montage/scripts/Swift_Montage_Types.swift
Log:
o apps/Montage/scripts/Swift_Montage_Batch.swift
o apps/Montage/scripts/Swift_Montage_Apps.swift
o apps/Montage/scripts/Swift_Montage_Types.swift
o apps/Montage/example/stat_dir
o apps/Montage/example/m101_montage.swift
-- Parallelized the mFitBatch function. Now it does not use mFitExec app.
-- Fix to the mBgBatch fucntion.
o apps/Montage/scripts/Background_list.py
o apps/Montage/scripts/create_status_table.py
-- Utility files used in some functions.
o apps/Montage/example/sites.xml
o apps/Montage/example/tc.data
o apps/Montage/example/makefile
-- Updates to run the m101 Montage example using Swift.
o apps/Montage/example/README.txt
-- README explaining how to set up the example and how to run the example.
Added: SwiftApps/Montage/example/README.txt
===================================================================
--- SwiftApps/Montage/example/README.txt (rev 0)
+++ SwiftApps/Montage/example/README.txt 2010-07-28 18:51:23 UTC (rev 3481)
@@ -0,0 +1,14 @@
+Swift Montage Wrappers README
+Runs the the m101 Montage tutorial using the Swift.
+
+1) Modify the tc.data entries for the Montage functions.
+
+2) Modify sites.xml to use your Swift work directory on localhost
+
+3) Run make:
+ make swift -> Runs the Swift Montage wrappers on localhost
+ make shell -> Runs the m101_montage.sh file.
+ make DAG -> Runs the Swift Montage wrappers and generates a DAG plot.
+
+4) make clean -> Removes all files generated by the Montage wrappers.
+ Except the log files and other files created by Swift.
Modified: SwiftApps/Montage/example/m101_montage.swift
===================================================================
--- SwiftApps/Montage/example/m101_montage.swift 2010-07-28 02:56:41 UTC (rev 3480)
+++ SwiftApps/Montage/example/m101_montage.swift 2010-07-28 18:51:23 UTC (rev 3481)
@@ -7,9 +7,10 @@
Table difference_tbl <"diffs.tbl">;
Table fits_images_tbl <"fits.tbl">;
Table corrections_tbl <"corrections.tbl">;
-/* Image uncorrected_mos <"final/uncorrected.fits">; */
+Table stat_tbl <"stats.tbl">;
+Image uncorrected_mos <"final/uncorrected.fits">;
+JPEG uncorrected_jpg_img <"final/uncorrected.jpg">;
Image corrected_mos <"final/corrected.fits">;
-/* JPEG uncorrected_jpg_img <"final/uncorrected.jpg">; */
JPEG corrected_jpg_img <"final/corrected.jpg">;
Image raw_image_files[] <filesys_mapper; location = "raw_dir", suffix = ".fits">;
Image projected_images[];
@@ -18,11 +19,11 @@
projected_images = mProjectPPBatch( raw_image_files, template );
images_tbl = mImgtbl( projected_images );
-/* uncorrected_mos = mAdd( projected_images, images_tbl, template ); */
-/* uncorrected_jpg_img = mJPEG( uncorrected_mos ); */
+uncorrected_mos = mAdd( projected_images, images_tbl, template );
+uncorrected_jpg_img = mJPEG( uncorrected_mos );
difference_tbl = mOverlaps( images_tbl );
difference_images = mDiffBatch( difference_tbl, template );
-fits_images_tbl = mFitBatch( difference_tbl, difference_images );
+fits_images_tbl = mFitBatch( difference_images, difference_tbl );
corrections_tbl = mBgModel( images_tbl, fits_images_tbl );
corrected_images = mBgBatch( projected_images, images_tbl, corrections_tbl );
corrected_mos = mAdd( corrected_images, images_tbl, template );
Modified: SwiftApps/Montage/example/makefile
===================================================================
--- SwiftApps/Montage/example/makefile 2010-07-28 02:56:41 UTC (rev 3480)
+++ SwiftApps/Montage/example/makefile 2010-07-28 18:51:23 UTC (rev 3481)
@@ -1,13 +1,10 @@
-.PHONY: shell swift DAG
+.PHONY: swift DAG
-shell:
- ./m101_montage.sh
-
swift:
- swiftrun m101_montage.swift
+ @swift -tc.file tc.data -sites.file sites.xml m101_montage.swift
DAG:
- swiftrun -pgraph Montage_DAT.dot montage.swift
+ @swift -tc.file tc.data -sites.file sites.xml -pgraph m101_DAG.dot m101_montage.swift
clean:
- @rm -rvf proj_dir/* diff_dir/* final/* corr_dir/* debug scripts/*.xml diffs.tbl images-rawdir.tbl images.tbl corrections.tbl fits.tbl stats.tbl back_tmp.tbl *.txt
+ @rm -rvf *~ proj_dir/* diff_dir/* final/* corr_dir/* stat_dir/* diffs.tbl images-rawdir.tbl images.tbl corrections.tbl fits.tbl stats.tbl back_tmp.tbl
Added: SwiftApps/Montage/example/sites.xml
===================================================================
--- SwiftApps/Montage/example/sites.xml (rev 0)
+++ SwiftApps/Montage/example/sites.xml 2010-07-28 18:51:23 UTC (rev 3481)
@@ -0,0 +1,10 @@
+<config>
+
+ <pool handle="localhost">
+ <filesystem provider="local" />
+ <execution provider="local" />
+ <workdirectory >/Users/jonmon/Library/Swift/work/local</workdirectory>
+ <profile namespace="karajan" key="jobThrottle">.05</profile>
+ </pool>
+
+</config>
Added: SwiftApps/Montage/example/tc.data
===================================================================
--- SwiftApps/Montage/example/tc.data (rev 0)
+++ SwiftApps/Montage/example/tc.data 2010-07-28 18:51:23 UTC (rev 3481)
@@ -0,0 +1,14 @@
+# sitename transformation path INSTALLED platform profiles
+localhost mProjectPP /Users/jonmon/Library/Montage/bin/mProjectPP INSTALLED INTEL32::LINUX null
+localhost mProject /Users/jonmon/Library/Montage/bin/mProject INSTALLED INTEL32::LINUX null
+localhost mImgtbl /Users/jonmon/Library/Montage/bin/mImgtbl INSTALLED INTEL32::LINUX null
+localhost mAdd /Users/jonmon/Library/Montage/bin/mAdd INSTALLED INTEL32::LINUX null
+localhost mJPEG /Users/jonmon/Library/Montage/bin/mJPEG INSTALLED INTEL32::LINUX null
+localhost mOverlaps /Users/jonmon/Library/Montage/bin/mOverlaps INSTALLED INTEL32::LINUX null
+localhost mDiff /Users/jonmon/Library/Montage/bin/mDiff INSTALLED INTEL32::LINUX null
+localhost mConcatFit /Users/jonmon/Library/Montage/bin/mConcatFit INSTALLED INTEL32::LINUX null
+localhost mFitplane /Users/jonmon/Library/Montage/bin/mFitplane INSTALLED INTEL32::LINUX null
+localhost mBgModel /Users/jonmon/Library/Montage/bin/mBgModel INSTALLED INTEL32::LINUX null
+localhost mBackground /Users/jonmon/Library/Montage/bin/mBackground INSTALLED INTEL32::LINUX null
+localhost Background_list /Users/jonmon/Library/Swift/apps/Montage/scripts/Background_list.py INSTALLED INTEL32::LINUX null
+localhost create_status_table /Users/jonmon/Library/Swift/apps/Montage/scripts/create_status_table.py INSTALLED INTEL32::LINUX null
Modified: SwiftApps/Montage/scripts/Background_list.py
===================================================================
--- SwiftApps/Montage/scripts/Background_list.py 2010-07-28 02:56:41 UTC (rev 3480)
+++ SwiftApps/Montage/scripts/Background_list.py 2010-07-28 18:51:23 UTC (rev 3481)
@@ -1,7 +1,6 @@
#!/usr/bin/python
import sys
-#import string
args = sys.argv;
@@ -22,13 +21,13 @@
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
+ 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;
file_tbl_2.close();
Modified: SwiftApps/Montage/scripts/Swift_Montage_Apps.swift
===================================================================
--- SwiftApps/Montage/scripts/Swift_Montage_Apps.swift 2010-07-28 02:56:41 UTC (rev 3480)
+++ SwiftApps/Montage/scripts/Swift_Montage_Apps.swift 2010-07-28 18:51:23 UTC (rev 3481)
@@ -6,12 +6,9 @@
\param hdr MosaicData file containing information about how mosaic will look.
\return mos Image file containing data about mosaic.
*/
-( Image mos ) mAdd( Image imgs[], Table img_tbl, MosaicData hdr )
+app ( Image mos ) mAdd( Image imgs[], Table img_tbl, MosaicData hdr )
{
- app
- {
- mAdd "-p" @dirname( imgs[0] ) "-n" @img_tbl @hdr @mos;
- }
+ mAdd "-p" @dirname( imgs[0] ) "-n" @img_tbl @hdr @mos;
}
@@ -23,12 +20,9 @@
\param corr_tbl Correction table containing correction coefficients to be applied
\return mos bg_img corrected image
*/
-( Image bg_img ) mBackground( Image img, float a, float b, float c )
+app ( Image bg_img ) mBackground( Image img, float a, float b, float c )
{
- app
- {
- mBackground "-n" @img @bg_img a b c;
- }
+ mBackground "-n" @img @bg_img a b c;
}
@@ -39,15 +33,25 @@
\param fits_tbl Table containing information about how to correct an image
\return corr_tbl Correction table containing correction coefficients to be applied
*/
-( Table corr_tbl ) mBgModel( Table img_tbl, Table fits_tbl )
+app ( Table corr_tbl ) mBgModel( Table img_tbl, Table fits_tbl )
{
- app
- {
- mBgModel @img_tbl @fits_tbl @corr_tbl;
- }
+ mBgModel @img_tbl @fits_tbl @corr_tbl;
}
+/*! \fn app Table mConcatFit( Table status_tbl, Status stats[] )
+ \brief Takes all the status files created by mFitplane and creates the fits table.
+
+ \param status_tbl Table containing the file names for the status files
+ \param stats[] Array of all the status files
+ \return fits_tbl Table contianing information about how to correct and image.
+*/
+app ( Table fits_tbl ) mConcatFit( Table status_tbl, Status stats[] )
+{
+ mConcatFit @status_tbl @fits_tbl @dirname( stats[0] );
+}
+
+
/*! \fn app Image mDiff( Image proj_img_1, Image proj_img_2, MosaicData hdr )
\brief Calculates the difference image from the two projected images and the header file.
@@ -56,27 +60,33 @@
\param hdr MosaicData file that tells how the mosaic is set up
\return diff_img Difference image that contains overlapped information
*/
-( Image diff_img ) mDiff( Image proj_img_1, Image proj_img_2, MosaicData hdr )
+app ( Image diff_img ) mDiff( Image proj_img_1, Image proj_img_2, MosaicData hdr )
{
- app
- {
- mDiff "-n" @proj_img_1 @proj_img_2 @diff_img @hdr;
- }
+ mDiff "-n" @proj_img_1 @proj_img_2 @diff_img @hdr;
}
+/*! \fn app Status mFitplane( Image diff_img )
+ \brief Creates a file with all the information on how to fit the particular difference image
+
+ \param diff_img The image to calculate best fit for.
+ \return stat File containing coefficents and mosaic data on how to fit diff_img.
+*/
+app ( Status stat ) mFitplane( Image diff_img )
+{
+ mFitplane "-s" @stat @diff_img;
+}
+
+
/*! \fn app Table mImgtbl( Image imgs[] )
\brief Take a list of of images and create a table out of them. All images in the list must be located in the same directory.
\param imgs[] List of files to create an table out of.
\return img_tbl Table of information of the list of images.
*/
-( Table img_tbl ) mImgtbl( Image imgs[] )
+app ( Table img_tbl ) mImgtbl( Image imgs[] )
{
- app
- {
- mImgtbl @dirname( imgs[0] ) @img_tbl;
- }
+ mImgtbl @dirname( imgs[0] ) @img_tbl;
}
@@ -86,12 +96,9 @@
\param mos_img Image file to create a jpeg out of.
\return mos_img_jpg Jpeg picture.
*/
-( JPEG mos_img_jpg ) mJPEG( Image mos_img )
+app ( JPEG mos_img_jpg ) mJPEG( Image mos_img )
{
- app
- {
- mJPEG "-gray" @mos_img "20%" "99.98%" "loglog" "-out" @mos_img_jpg;
- }
+ mJPEG "-gray" @mos_img "20%" "99.98%" "loglog" "-out" @mos_img_jpg;
}
@@ -101,12 +108,9 @@
\param img_tbl Table of projected images.
\return diff_tbl Table of which overlapped images
*/
-( Table diff_tbl ) mOverlaps( Table img_tbl )
+app ( Table diff_tbl ) mOverlaps( Table img_tbl )
{
- app
- {
- mOverlaps @img_tbl @diff_tbl;
- }
+ mOverlaps @img_tbl @diff_tbl;
}
@@ -117,12 +121,9 @@
\param hdr MosaicData file telling how the mosaic will be set up in the end.
\return proj_img Projected image.
*/
-( Image proj_img ) mProjectPP( Image raw_img, MosaicData hdr )
+app ( Image proj_img ) mProjectPP( Image raw_img, MosaicData hdr )
{
- app
- {
- mProjectPP "-X" @raw_img @proj_img @hdr;
- }
+ mProjectPP "-X" @raw_img @proj_img @hdr;
}
@@ -139,10 +140,19 @@
\param corrs_tbl Table containing the coefficients and the id of the image to apply them to
\return back_tbl Table containing the Image file name and the coefficients that need to be applied to the image. Data is set up so readDatat2 can read the data.
*/
-( Table back_tbl ) Background_list( Table imgs_tbl, Table corrs_tbl )
+app ( Table back_tbl ) Background_list( Table imgs_tbl, Table corrs_tbl )
{
- app
- {
- Background_list @imgs_tbl @corrs_tbl @back_tbl;
- }
+ Background_list @imgs_tbl @corrs_tbl @back_tbl;
}
+
+
+/*! \fn app Table create_status_table( Table diff_tbl )
+ \brief Generates a Table of the status files created by mFitplane
+
+ \param diff_tbl Difference table of the files that mFitplane will run on.
+ \return stat_tbl Table that contains the information of the status files that will be generated using mFitplane.
+*/
+app ( Table stat_tbl ) create_status_table( Table diff_tbl )
+{
+ create_status_table @diff_tbl @stat_tbl;
+}
Modified: SwiftApps/Montage/scripts/Swift_Montage_Batch.swift
===================================================================
--- SwiftApps/Montage/scripts/Swift_Montage_Batch.swift 2010-07-28 02:56:41 UTC (rev 3480)
+++ SwiftApps/Montage/scripts/Swift_Montage_Batch.swift 2010-07-28 18:51:23 UTC (rev 3481)
@@ -23,7 +23,7 @@
foreach background_entry, i in back_struct
{
- Image proj_img <single_file_mapper; file = @strcat( @dirname( bg_imgs[0] )+"/", @background_entry.fname )>;
+ Image proj_img <single_file_mapper; file = @strcat( @dirname( bg_imgs[i] )+"/", @background_entry.fname )>;
Image corr_img <regexp_mapper; source = @proj_img, match = ".*\\/(.*)", transform = "corr_dir/\\1">;
float a = background_entry.a;
@@ -69,12 +69,19 @@
\param diff_imgs
\return fits_tbl
*/
-( Table fits_tbl ) mFitBatch( Table diff_tbl, Image diff_imgs[] )
+( Table fits_tbl ) mFitBatch( Image diff_imgs[], Table diff_tbl )
{
- app
+ Status stats[] <structured_regexp_mapper; source = diff_imgs, match = ".*\\/(.*)", transform = "stat_dir/stat.\\1">;
+
+ Table status_tbl <"stats.tbl">;
+ status_tbl = create_status_table( diff_tbl );
+
+ foreach img, i in stats
{
- mFitExec @diff_tbl @fits_tbl @dirname( diff_imgs[0] );
+ stats[i] = mFitplane ( diff_imgs[i] );
}
+
+ fits_tbl = mConcatFit( status_tbl, stats );
}
Modified: SwiftApps/Montage/scripts/Swift_Montage_Types.swift
===================================================================
--- SwiftApps/Montage/scripts/Swift_Montage_Types.swift 2010-07-28 02:56:41 UTC (rev 3480)
+++ SwiftApps/Montage/scripts/Swift_Montage_Types.swift 2010-07-28 18:51:23 UTC (rev 3481)
@@ -25,6 +25,12 @@
*/
type JPEG;
+/*! \typdef type Status
+ \brief Declared Status Swift type.
+*/
+type Status;
+
+
/*! \struct BackgroundStruct
\brief Stuct to hold data found in the tables generated my mImgtbl and mBgModel
*/
Added: SwiftApps/Montage/scripts/create_status_table.py
===================================================================
--- SwiftApps/Montage/scripts/create_status_table.py (rev 0)
+++ SwiftApps/Montage/scripts/create_status_table.py 2010-07-28 18:51:23 UTC (rev 3481)
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+# Input diff_tbl; Output Stat_tbl
+
+def space( num ):
+ spc = "";
+
+ for i in range( 7 - num + 1 ):
+ spc += " ";
+
+ return spc
+
+
+
+import sys
+
+args = sys.argv;
+
+diff_tbl = open( args[1], 'r' );
+stat_tbl = open( args[2], 'w' );
+
+stat_tbl.write( "| cntr1 | cntr2 | stat |\n" );
+stat_tbl.write( "| int | int | char |\n" );
+
+for diff_line in diff_tbl:
+
+ line = diff_line.split();
+
+ if line[0] != "|":
+ str_out = " " + line[0] + space(len(line[0])) + line[1] + space(len(line[0])) + "stat." + line[4] + "\n";
+ stat_tbl.write( str_out );
+
+diff_tbl.close();
+stat_tbl.close();
+
+
+
Property changes on: SwiftApps/Montage/scripts/create_status_table.py
___________________________________________________________________
Name: svn:executable
+ *
More information about the Swift-commit
mailing list