[Swift-commit] r3432 - in SwiftApps/Montage: . example scripts
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Mon Jul 12 14:26:40 CDT 2010
Author: jonmon
Date: 2010-07-12 14:26:40 -0500 (Mon, 12 Jul 2010)
New Revision: 3432
Added:
SwiftApps/Montage/example/
SwiftApps/Montage/example/corr_dir/
SwiftApps/Montage/example/diff_dir/
SwiftApps/Montage/example/final/
SwiftApps/Montage/example/m101_montage.sh
SwiftApps/Montage/example/m101_montage.swift
SwiftApps/Montage/example/makefile
SwiftApps/Montage/example/proj_dir/
SwiftApps/Montage/example/raw_dir/
SwiftApps/Montage/example/template.hdr
SwiftApps/Montage/scripts/
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
Removed:
SwiftApps/Montage/Background_list.py
SwiftApps/Montage/Swift_Montage_Apps.swift
SwiftApps/Montage/Swift_Montage_Batch.swift
SwiftApps/Montage/Swift_Montage_Types.swift
SwiftApps/Montage/corr_dir/
SwiftApps/Montage/diff_dir/
SwiftApps/Montage/final/
SwiftApps/Montage/makefile
SwiftApps/Montage/montage.sh
SwiftApps/Montage/montage.swift
SwiftApps/Montage/proj_dir/
SwiftApps/Montage/raw_dir/
SwiftApps/Montage/template.hdr
Log:
Organization of file. Montage wrapper moved into scripts directory. The m101 tutorial using the Swift wrappers is in the example directory.
Deleted: SwiftApps/Montage/Background_list.py
===================================================================
--- SwiftApps/Montage/Background_list.py 2010-07-11 03:38:07 UTC (rev 3431)
+++ SwiftApps/Montage/Background_list.py 2010-07-12 19:26:40 UTC (rev 3432)
@@ -1,36 +0,0 @@
-#!/usr/bin/python
-
-import sys
-#import string
-
-args = sys.argv;
-
-file_tbl_1 = open( args[1], 'r' );
-file_tbl_o = open( args[3], 'w' );
-i = 0
-
-for line_tbl_1 in file_tbl_1:
-
- l1 = line_tbl_1.split();
-
- if l1[0] != "|" and l1[0] != "\\datatype":
-
- file_tbl_2 = open( args[2], 'r' );
-
- for line_tbl_2 in file_tbl_2:
-
- 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
-
- file_tbl_2.close();
-
-file_tbl_1.close();
-file_tbl_o.close();
Deleted: SwiftApps/Montage/Swift_Montage_Apps.swift
===================================================================
--- SwiftApps/Montage/Swift_Montage_Apps.swift 2010-07-11 03:38:07 UTC (rev 3431)
+++ SwiftApps/Montage/Swift_Montage_Apps.swift 2010-07-12 19:26:40 UTC (rev 3432)
@@ -1,148 +0,0 @@
-/*! \fn app Image mAdd( Image imgs[], Table img_tbl, MosaicData hdr )
- \brief Adds all images in imgs[] into one image file based off the information in img_tbl and hdr.
-
- \param imgs[] List of images to be added into one image. All images but reside in same directory.
- \param img_tbl Table containing information about images being added
- \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
- {
- mAdd "-p" @dirname( imgs[0] ) "-n" @img_tbl @hdr @mos;
- }
-}
-
-
-/*! \fn app Image mBackground( Image img, Table img_tbl, Table corr_tbl )
- \brief Generates a corrected image from imgs and the information from corr_tbl
-
- \param img Image to be corrected
- \param img_tbl Table containing information about images being added
- \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
- {
- mBackground "-n" @img @bg_img a b c;
- }
-}
-
-
-/*! \fn app Table mBgModel( Table img_tbl, Table fits_tbl )
- \brief Generates the corrected image table from the coefficeints data from fits_tbl and data from the projected image table
-
- \param img_tbl Table containing information about the projected images.
- \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
- {
- mBgModel @img_tbl @fits_tbl @corr_tbl;
- }
-}
-
-
-/*! \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.
-
- \param proj_img_1 The first image to calculate how much is overlapped
- \param proj_img_2 The second image to calculate how much is overlapped
- \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
- {
- mDiff "-n" @proj_img_1 @proj_img_2 @diff_img @hdr;
- }
-}
-
-
-/*! \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
- {
- mImgtbl @dirname( imgs[0] ) @img_tbl;
- }
-}
-
-
-/*! \fn app JPEG mJPEG( Image mos_img )
- \brief Creates a viewable jpeg image from the mosaic data image
-
- \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
- {
- mJPEG "-gray" @mos_img "20%" "99.98%" "loglog" "-out" @mos_img_jpg;
- }
-}
-
-
-/*! \fn app Table mOverlaps( Table img_tbl )
- \brief Calculates which images overlaps each other and creates a table out of.
-
- \param img_tbl Table of projected images.
- \return diff_tbl Table of which overlapped images
-*/
-( Table diff_tbl ) mOverlaps( Table img_tbl )
-{
- app
- {
- mOverlaps @img_tbl @diff_tbl;
- }
-}
-
-
-/*! \fn app Image mProjectPP( Image raw_img, MosaicData hdr )
- \brief Projects an image based off of the header file.
-
- \param raw_img Raw image to project.
- \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
- {
- mProjectPP "-X" @raw_img @proj_img @hdr;
- }
-}
-
-
-
-/*----------------------------------------------------------------------------------*/
-/* */
-/* Util Scripts */
-/* */
-/*----------------------------------------------------------------------------------*/
-/*! \fn app Table Background_list( Table imgs_tbl, Table corrs_tbl
- \brief Generates a list of coefficients that need to be applied and the files to apply them to.
-
- \param imgs_tbl Table generated by mImgtbl containing information on the set of images
- \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
- {
- Background_list @imgs_tbl @corrs_tbl @back_tbl;
- }
-}
Deleted: SwiftApps/Montage/Swift_Montage_Batch.swift
===================================================================
--- SwiftApps/Montage/Swift_Montage_Batch.swift 2010-07-11 03:38:07 UTC (rev 3431)
+++ SwiftApps/Montage/Swift_Montage_Batch.swift 2010-07-12 19:26:40 UTC (rev 3432)
@@ -1,97 +0,0 @@
-/*! \file Swift_Montage_Batch.swift
- \brief File containing Batch functions for the Swift Montage wrappers
-
- Each batch function allows basic Montage functions to be called on a list of
- images.
-*/
-
-
-/*! \fn Image mBgBatch( Image bg_imgs[], Table img_tbl, Table corr_tbl )
- \brief Runs the mBackground wrapper on a list of images in parallel.
-
- \param bg_imgs[] The list of images to run the mBackground wrapper on.
- \param img_tbl Table containing information on original images.
- \param corr_tbl Table containing correction coefficients to be applied to the images.
- \return corr_imgs[] List of the corrected images to be added to create image mosaic.
-*/
-( Image corr_imgs[] ) mBgBatch( Image bg_imgs[], Table img_tbl, Table corr_tbl )
-{
- Table tmp <"back_tmp.tbl">;
- tmp = Background_list( img_tbl, corr_tbl );
-
- BackgroundStruct back_struct[] = readData2( tmp );
-
- foreach background_entry, i in back_struct
- {
- Image proj_img <single_file_mapper; file = @strcat( @dirname( bg_imgs[0] )+"/", @background_entry.fname )>;
- 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, a, b, c );
-
- corr_imgs[ i ] = corr_img;
- }
-}
-
-
-/*! \fn Image mDiffBatch( Table diff_tbl, MosaicData hdr )
- \brief Runs the mDiff wrapper on a list of images in parallel.
-
- \param diff_tbl Table containing a list of images that overlap and must calculate by how much they overlap.
- \param hdr File containing information on how the final mosaic will be set up.
- \return diff_imgs[] List of the difference images that must have correction coefficients calculated.
-*/
-( Image diff_imgs[] ) mDiffBatch( Table diff_tbl, MosaicData hdr )
-{
- DiffStruct diffs[] <csv_mapper; file = diff_tbl, skip = 1, hdelim="| ">;
-
- foreach d_entry, i in diffs
- {
-// tracef("plus: %s \n", @d_entry.plus );
- Image proj_1 <single_file_mapper; file = @strcat( "proj_dir/", @d_entry.plus )>;
- Image proj_2 <single_file_mapper; file = @strcat( "proj_dir/", @d_entry.minus )>;
-
- Image diff_img <single_file_mapper; file = @strcat( "diff_dir/", @d_entry.diff )>;
- diff_img = mDiff( proj_1, proj_2, hdr );
-
- diff_imgs[ i ] = diff_img;
- }
-}
-
-
-/*! \fn app Table mFitBatch( Table diff_tbl, Image diff_imgs[] )
- \brief Generates a corrected image from imgs and the information from corr_tbl
-
- \param diff_tbl
- \param diff_imgs
- \return fits_tbl
-*/
-( Table fits_tbl ) mFitBatch( Table diff_tbl, Image diff_imgs[] )
-{
- app
- {
- mFitExec @diff_tbl @fits_tbl @dirname( diff_imgs[0] );
- }
-}
-
-
-/*! \fn Image mProjectPPBatch( Image raw_imgs[], MosaicData hdr )
- \brief Projects the raw images from raw_imgs to a new plane that was declared in hdr.
-
- \param raw_imgs[] List of raw images that need to be projected to new plane.
- \param hdr File containing information on how the final mosaic will be set up.
- \return proj_imgs[] List of newly reprojected images.
-*/
-( Image proj_imgs[] ) mProjectPPBatch( Image raw_imgs[], MosaicData hdr )
-{
- foreach img, i in raw_imgs
- {
- Image proj_img <regexp_mapper; source = @img, match = ".*\\/(.*)", transform = "proj_dir/proj_\\1">;
-
- proj_img = mProjectPP( img, hdr );
-
- proj_imgs[ i ] = proj_img;
- }
-}
Deleted: SwiftApps/Montage/Swift_Montage_Types.swift
===================================================================
--- SwiftApps/Montage/Swift_Montage_Types.swift 2010-07-11 03:38:07 UTC (rev 3431)
+++ SwiftApps/Montage/Swift_Montage_Types.swift 2010-07-12 19:26:40 UTC (rev 3432)
@@ -1,50 +0,0 @@
-/*! \file Swift_Montage_Types.swift
- \brief File containing declared Swift types for the Swift Montage wrappers
-*/
-
-/*! \typdef type Image
- \brief Declared Image Swift type.
-*/
-type Image;
-
-
-/*! \typdef type MosaicData
- \brief Declared MosaicData Swift type.
-*/
-type MosaicData;
-
-
-/*! \typdef type Table
- \brief Declared Table Swift type.
-*/
-type Table;
-
-
-/*! \typdef type JPEG
- \brief Declared JPEG Swift type.
-*/
-type JPEG;
-
-/*! \struct BackgroundStruct
- \brief Stuct to hold data found in the tables generated my mImgtbl and mBgModel
-*/
-type BackgroundStruct
-{
- string fname;
- float a;
- float b;
- float c;
-};
-
-
-/*! \struct DiffStruct
- \brief Stuct to hold data found in the table that is generated from the mOverlaps wrapper.
-*/
-type DiffStruct
-{
- int cntr1;
- int cntr2;
- Image plus;
- Image minus;
- Image diff;
-};
Copied: SwiftApps/Montage/example/corr_dir (from rev 3428, SwiftApps/Montage/corr_dir)
Copied: SwiftApps/Montage/example/diff_dir (from rev 3428, SwiftApps/Montage/diff_dir)
Copied: SwiftApps/Montage/example/final (from rev 3428, SwiftApps/Montage/final)
Copied: SwiftApps/Montage/example/m101_montage.sh (from rev 3430, SwiftApps/Montage/montage.sh)
===================================================================
--- SwiftApps/Montage/example/m101_montage.sh (rev 0)
+++ SwiftApps/Montage/example/m101_montage.sh 2010-07-12 19:26:40 UTC (rev 3432)
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+mImgtbl raw_dir images-rawdir.tbl
+
+START=$(date +%s)
+
+mProjExec -p raw_dir images-rawdir.tbl template.hdr proj_dir stats.tbl
+rm -f proj_dir/*area*
+mImgtbl proj_dir images.tbl
+# mAdd -p pro_jdir -n images.tbl template.hdr final/uncorrected.fits
+# mJPEG -gray final/uncorrected.fits 20% 99.98% loglog -out final/uncorrected.jpg
+mOverlaps images.tbl diffs.tbl
+mDiffExec -p proj_dir -n diffs.tbl template.hdr diff_dir
+mFitExec diffs.tbl fits.tbl diff_dir
+mBgModel images.tbl fits.tbl corrections.tbl
+mBgExec -p proj_dir -n images.tbl corrections.tbl corr_dir
+mAdd -p corr_dir -n images.tbl template.hdr final/mosaic.fits
+mJPEG -gray final/mosaic.fits 20% 99.98% loglog -out final/mosaic.jpg
+
+END=$(date +%s)
+DIFF=$(( $END - $START ))
+echo "It took $DIFF seconds"
Copied: SwiftApps/Montage/example/m101_montage.swift (from rev 3430, SwiftApps/Montage/montage.swift)
===================================================================
--- SwiftApps/Montage/example/m101_montage.swift (rev 0)
+++ SwiftApps/Montage/example/m101_montage.swift 2010-07-12 19:26:40 UTC (rev 3432)
@@ -0,0 +1,29 @@
+import "../scripts/Swift_Montage_Types";
+import "../scripts/Swift_Montage_Apps";
+import "../scripts/Swift_Montage_Batch";
+
+MosaicData template <"template.hdr">;
+Table images_tbl <"images.tbl">;
+Table difference_tbl <"diffs.tbl">;
+Table fits_images_tbl <"fits.tbl">;
+Table corrections_tbl <"corrections.tbl">;
+/* Image uncorrected_mos <"final/uncorrected.fits">; */
+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[];
+Image difference_images[];
+Image corrected_images[];
+
+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 ); */
+difference_tbl = mOverlaps( images_tbl );
+difference_images = mDiffBatch( difference_tbl, template );
+fits_images_tbl = mFitBatch( difference_tbl, difference_images );
+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 );
+corrected_jpg_img = mJPEG( corrected_mos );
Copied: SwiftApps/Montage/example/makefile (from rev 3430, SwiftApps/Montage/makefile)
===================================================================
--- SwiftApps/Montage/example/makefile (rev 0)
+++ SwiftApps/Montage/example/makefile 2010-07-12 19:26:40 UTC (rev 3432)
@@ -0,0 +1,13 @@
+.PHONY: shell swift DAG
+
+shell:
+ ./m101_montage.sh
+
+swift:
+ swiftrun m101_montage.swift
+
+DAG:
+ swiftrun -pgraph Montage_DAT.dot 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
Copied: SwiftApps/Montage/example/proj_dir (from rev 3428, SwiftApps/Montage/proj_dir)
Copied: SwiftApps/Montage/example/raw_dir (from rev 3428, SwiftApps/Montage/raw_dir)
Copied: SwiftApps/Montage/example/template.hdr (from rev 3428, SwiftApps/Montage/template.hdr)
===================================================================
--- SwiftApps/Montage/example/template.hdr (rev 0)
+++ SwiftApps/Montage/example/template.hdr 2010-07-12 19:26:40 UTC (rev 3432)
@@ -0,0 +1,16 @@
+SIMPLE = T
+BITPIX = -64
+NAXIS = 2
+NAXIS1 = 2259
+NAXIS2 = 2199
+CTYPE1 = 'RA---TAN'
+CTYPE2 = 'DEC--TAN'
+CRVAL1 = 210.835222357
+CRVAL2 = 54.367562188
+CDELT1 = -0.000277780
+CDELT2 = 0.000277780
+CRPIX1 = 1130.0000
+CRPIX2 = 1100.0000
+CROTA2 = -0.052834592
+HISTORY = MONTAGE TUTORIAL
+END
Deleted: SwiftApps/Montage/makefile
===================================================================
--- SwiftApps/Montage/makefile 2010-07-11 03:38:07 UTC (rev 3431)
+++ SwiftApps/Montage/makefile 2010-07-12 19:26:40 UTC (rev 3432)
@@ -1,10 +0,0 @@
-.PHONY: shell swift
-
-shell:
- ./montage.sh
-
-swift:
- swiftrun montage.swift
-
-clean:
- @rm -rvf proj_dir/* diff_dir/* final/* corr_dir/* debug diffs.tbl images-rawdir.tbl images.tbl corrections.tbl fits.tbl stats.tbl back_tmp.tbl *.txt
Deleted: SwiftApps/Montage/montage.sh
===================================================================
--- SwiftApps/Montage/montage.sh 2010-07-11 03:38:07 UTC (rev 3431)
+++ SwiftApps/Montage/montage.sh 2010-07-12 19:26:40 UTC (rev 3432)
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-mImgtbl raw_dir images-rawdir.tbl
-
-START=$(date +%s)
-
-mProjExec -p raw_dir images-rawdir.tbl template.hdr proj_dir stats.tbl
-rm -f proj_dir/*area*
-mImgtbl proj_dir images.tbl
-# mAdd -p pro_jdir -n images.tbl template.hdr final/uncorrected.fits
-# mJPEG -gray final/uncorrected.fits 20% 99.98% loglog -out final/uncorrected.jpg
-mOverlaps images.tbl diffs.tbl
-mDiffExec -p proj_dir -n diffs.tbl template.hdr diff_dir
-mFitExec diffs.tbl fits.tbl diff_dir
-mBgModel images.tbl fits.tbl corrections.tbl
-mBgExec -p proj_dir -n images.tbl corrections.tbl corr_dir
-mAdd -p corr_dir -n images.tbl template.hdr final/mosaic.fits
-mJPEG -gray final/mosaic.fits 20% 99.98% loglog -out final/mosaic.jpg
-
-END=$(date +%s)
-DIFF=$(( $END - $START ))
-echo "It took $DIFF seconds"
Deleted: SwiftApps/Montage/montage.swift
===================================================================
--- SwiftApps/Montage/montage.swift 2010-07-11 03:38:07 UTC (rev 3431)
+++ SwiftApps/Montage/montage.swift 2010-07-12 19:26:40 UTC (rev 3432)
@@ -1,29 +0,0 @@
-import Swift_Montage_Types;
-import Swift_Montage_Apps;
-import Swift_Montage_Batch;
-
-MosaicData template <"template.hdr">;
-Table images_tbl <"images.tbl">;
-Table difference_tbl <"diffs.tbl">;
-Table fits_images_tbl <"fits.tbl">;
-Table corrections_tbl <"corrections.tbl">;
-/* Image uncorrected_mos <"final/uncorrected.fits">; */
-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[];
-Image difference_images[];
-Image corrected_images[];
-
-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 ); */
-difference_tbl = mOverlaps( images_tbl );
-difference_images = mDiffBatch( difference_tbl, template );
-fits_images_tbl = mFitBatch( difference_tbl, difference_images );
-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 );
-corrected_jpg_img = mJPEG( corrected_mos );
Copied: SwiftApps/Montage/scripts/Background_list.py (from rev 3430, SwiftApps/Montage/Background_list.py)
===================================================================
--- SwiftApps/Montage/scripts/Background_list.py (rev 0)
+++ SwiftApps/Montage/scripts/Background_list.py 2010-07-12 19:26:40 UTC (rev 3432)
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+
+import sys
+#import string
+
+args = sys.argv;
+
+file_tbl_1 = open( args[1], 'r' );
+file_tbl_o = open( args[3], 'w' );
+i = 0
+
+for line_tbl_1 in file_tbl_1:
+
+ l1 = line_tbl_1.split();
+
+ if l1[0] != "|" and l1[0] != "\\datatype":
+
+ file_tbl_2 = open( args[2], 'r' );
+
+ for line_tbl_2 in file_tbl_2:
+
+ 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
+
+ file_tbl_2.close();
+
+file_tbl_1.close();
+file_tbl_o.close();
Copied: SwiftApps/Montage/scripts/Swift_Montage_Apps.swift (from rev 3430, SwiftApps/Montage/Swift_Montage_Apps.swift)
===================================================================
--- SwiftApps/Montage/scripts/Swift_Montage_Apps.swift (rev 0)
+++ SwiftApps/Montage/scripts/Swift_Montage_Apps.swift 2010-07-12 19:26:40 UTC (rev 3432)
@@ -0,0 +1,148 @@
+/*! \fn app Image mAdd( Image imgs[], Table img_tbl, MosaicData hdr )
+ \brief Adds all images in imgs[] into one image file based off the information in img_tbl and hdr.
+
+ \param imgs[] List of images to be added into one image. All images but reside in same directory.
+ \param img_tbl Table containing information about images being added
+ \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
+ {
+ mAdd "-p" @dirname( imgs[0] ) "-n" @img_tbl @hdr @mos;
+ }
+}
+
+
+/*! \fn app Image mBackground( Image img, Table img_tbl, Table corr_tbl )
+ \brief Generates a corrected image from imgs and the information from corr_tbl
+
+ \param img Image to be corrected
+ \param img_tbl Table containing information about images being added
+ \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
+ {
+ mBackground "-n" @img @bg_img a b c;
+ }
+}
+
+
+/*! \fn app Table mBgModel( Table img_tbl, Table fits_tbl )
+ \brief Generates the corrected image table from the coefficeints data from fits_tbl and data from the projected image table
+
+ \param img_tbl Table containing information about the projected images.
+ \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
+ {
+ mBgModel @img_tbl @fits_tbl @corr_tbl;
+ }
+}
+
+
+/*! \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.
+
+ \param proj_img_1 The first image to calculate how much is overlapped
+ \param proj_img_2 The second image to calculate how much is overlapped
+ \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
+ {
+ mDiff "-n" @proj_img_1 @proj_img_2 @diff_img @hdr;
+ }
+}
+
+
+/*! \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
+ {
+ mImgtbl @dirname( imgs[0] ) @img_tbl;
+ }
+}
+
+
+/*! \fn app JPEG mJPEG( Image mos_img )
+ \brief Creates a viewable jpeg image from the mosaic data image
+
+ \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
+ {
+ mJPEG "-gray" @mos_img "20%" "99.98%" "loglog" "-out" @mos_img_jpg;
+ }
+}
+
+
+/*! \fn app Table mOverlaps( Table img_tbl )
+ \brief Calculates which images overlaps each other and creates a table out of.
+
+ \param img_tbl Table of projected images.
+ \return diff_tbl Table of which overlapped images
+*/
+( Table diff_tbl ) mOverlaps( Table img_tbl )
+{
+ app
+ {
+ mOverlaps @img_tbl @diff_tbl;
+ }
+}
+
+
+/*! \fn app Image mProjectPP( Image raw_img, MosaicData hdr )
+ \brief Projects an image based off of the header file.
+
+ \param raw_img Raw image to project.
+ \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
+ {
+ mProjectPP "-X" @raw_img @proj_img @hdr;
+ }
+}
+
+
+
+/*----------------------------------------------------------------------------------*/
+/* */
+/* Util Scripts */
+/* */
+/*----------------------------------------------------------------------------------*/
+/*! \fn app Table Background_list( Table imgs_tbl, Table corrs_tbl
+ \brief Generates a list of coefficients that need to be applied and the files to apply them to.
+
+ \param imgs_tbl Table generated by mImgtbl containing information on the set of images
+ \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
+ {
+ Background_list @imgs_tbl @corrs_tbl @back_tbl;
+ }
+}
Copied: SwiftApps/Montage/scripts/Swift_Montage_Batch.swift (from rev 3430, SwiftApps/Montage/Swift_Montage_Batch.swift)
===================================================================
--- SwiftApps/Montage/scripts/Swift_Montage_Batch.swift (rev 0)
+++ SwiftApps/Montage/scripts/Swift_Montage_Batch.swift 2010-07-12 19:26:40 UTC (rev 3432)
@@ -0,0 +1,98 @@
+/*! \file Swift_Montage_Batch.swift
+ \brief File containing Batch functions for the Swift Montage wrappers
+
+ Each batch function allows basic Montage functions to be called on a list of
+ images.
+*/
+
+
+/*! \fn Image mBgBatch( Image bg_imgs[], Table img_tbl, Table corr_tbl )
+ \brief Runs the mBackground wrapper on a list of images in parallel.
+
+ \param bg_imgs[] The list of images to run the mBackground wrapper on.
+ \param img_tbl Table containing information on original images.
+ \param corr_tbl Table containing correction coefficients to be applied to the images.
+ \return corr_imgs[] List of the corrected images to be added to create image mosaic.
+*/
+( Image corr_imgs[] ) mBgBatch( Image bg_imgs[], Table img_tbl, Table corr_tbl )
+{
+ Table tmp <"back_tmp.tbl">;
+ tmp = Background_list( img_tbl, corr_tbl );
+
+ BackgroundStruct back_struct[] = readData2( tmp );
+
+ foreach background_entry, i in back_struct
+ {
+ Image proj_img <single_file_mapper; file = @strcat( @dirname( bg_imgs[0] )+"/", @background_entry.fname )>;
+ 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, a, b, c );
+
+ corr_imgs[ i ] = corr_img;
+ }
+}
+
+
+/*! \fn Image mDiffBatch( Table diff_tbl, MosaicData hdr )
+ \brief Runs the mDiff wrapper on a list of images in parallel.
+
+ \param diff_tbl Table containing a list of images that overlap and must calculate by how much they overlap.
+ \param hdr File containing information on how the final mosaic will be set up.
+ \return diff_imgs[] List of the difference images that must have correction coefficients calculated.
+*/
+( Image diff_imgs[] ) mDiffBatch( Table diff_tbl, MosaicData hdr )
+{
+ DiffStruct diffs[] <csv_mapper; file = diff_tbl, skip = 1, hdelim="| ">;
+
+ foreach d_entry, i in diffs
+ {
+ /* Not always going to be in proj_dir. Maybe read diff_tbl for directory. */
+ /* Not sure if the information is there. */
+ Image proj_1 <single_file_mapper; file = @strcat( "proj_dir/", @d_entry.plus )>;
+ Image proj_2 <single_file_mapper; file = @strcat( "proj_dir/", @d_entry.minus )>;
+
+ Image diff_img <single_file_mapper; file = @strcat( "diff_dir/", @d_entry.diff )>;
+ diff_img = mDiff( proj_1, proj_2, hdr );
+
+ diff_imgs[ i ] = diff_img;
+ }
+}
+
+
+/*! \fn app Table mFitBatch( Table diff_tbl, Image diff_imgs[] )
+ \brief Generates a corrected image from imgs and the information from corr_tbl
+
+ \param diff_tbl
+ \param diff_imgs
+ \return fits_tbl
+*/
+( Table fits_tbl ) mFitBatch( Table diff_tbl, Image diff_imgs[] )
+{
+ app
+ {
+ mFitExec @diff_tbl @fits_tbl @dirname( diff_imgs[0] );
+ }
+}
+
+
+/*! \fn Image mProjectPPBatch( Image raw_imgs[], MosaicData hdr )
+ \brief Projects the raw images from raw_imgs to a new plane that was declared in hdr.
+
+ \param raw_imgs[] List of raw images that need to be projected to new plane.
+ \param hdr File containing information on how the final mosaic will be set up.
+ \return proj_imgs[] List of newly reprojected images.
+*/
+( Image proj_imgs[] ) mProjectPPBatch( Image raw_imgs[], MosaicData hdr )
+{
+ foreach img, i in raw_imgs
+ {
+ Image proj_img <regexp_mapper; source = @img, match = ".*\\/(.*)", transform = "proj_dir/proj_\\1">;
+
+ proj_img = mProjectPP( img, hdr );
+
+ proj_imgs[ i ] = proj_img;
+ }
+}
Copied: SwiftApps/Montage/scripts/Swift_Montage_Types.swift (from rev 3430, SwiftApps/Montage/Swift_Montage_Types.swift)
===================================================================
--- SwiftApps/Montage/scripts/Swift_Montage_Types.swift (rev 0)
+++ SwiftApps/Montage/scripts/Swift_Montage_Types.swift 2010-07-12 19:26:40 UTC (rev 3432)
@@ -0,0 +1,50 @@
+/*! \file Swift_Montage_Types.swift
+ \brief File containing declared Swift types for the Swift Montage wrappers
+*/
+
+/*! \typdef type Image
+ \brief Declared Image Swift type.
+*/
+type Image;
+
+
+/*! \typdef type MosaicData
+ \brief Declared MosaicData Swift type.
+*/
+type MosaicData;
+
+
+/*! \typdef type Table
+ \brief Declared Table Swift type.
+*/
+type Table;
+
+
+/*! \typdef type JPEG
+ \brief Declared JPEG Swift type.
+*/
+type JPEG;
+
+/*! \struct BackgroundStruct
+ \brief Stuct to hold data found in the tables generated my mImgtbl and mBgModel
+*/
+type BackgroundStruct
+{
+ string fname;
+ float a;
+ float b;
+ float c;
+};
+
+
+/*! \struct DiffStruct
+ \brief Stuct to hold data found in the table that is generated from the mOverlaps wrapper.
+*/
+type DiffStruct
+{
+ int cntr1;
+ int cntr2;
+ Image plus;
+ Image minus;
+ Image diff;
+};
Deleted: SwiftApps/Montage/template.hdr
===================================================================
--- SwiftApps/Montage/template.hdr 2010-07-11 03:38:07 UTC (rev 3431)
+++ SwiftApps/Montage/template.hdr 2010-07-12 19:26:40 UTC (rev 3432)
@@ -1,16 +0,0 @@
-SIMPLE = T
-BITPIX = -64
-NAXIS = 2
-NAXIS1 = 2259
-NAXIS2 = 2199
-CTYPE1 = 'RA---TAN'
-CTYPE2 = 'DEC--TAN'
-CRVAL1 = 210.835222357
-CRVAL2 = 54.367562188
-CDELT1 = -0.000277780
-CDELT2 = 0.000277780
-CRPIX1 = 1130.0000
-CRPIX2 = 1100.0000
-CROTA2 = -0.052834592
-HISTORY = MONTAGE TUTORIAL
-END
More information about the Swift-commit
mailing list