[Swift-commit] r4862 - SwiftApps/SwiftMontage/scripts

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Wed Jul 27 20:07:30 CDT 2011


Author: jonmon
Date: 2011-07-27 20:07:30 -0500 (Wed, 27 Jul 2011)
New Revision: 4862

Added:
   SwiftApps/SwiftMontage/scripts/mBackground_wrap.py
   SwiftApps/SwiftMontage/scripts/mDiffFit_wrap.py
   SwiftApps/SwiftMontage/scripts/mProjectPP_wrap.py
   SwiftApps/SwiftMontage/scripts/mProject_wrap.py
Removed:
   SwiftApps/SwiftMontage/scripts/mDiffFit_wrap.sh
Modified:
   SwiftApps/SwiftMontage/scripts/SwiftMontage_Apps.swift
   SwiftApps/SwiftMontage/scripts/SwiftMontage_Batch.swift
Log:
o added wrapper scripts to some Montage apps to check if I am writing to a symlink. If so write to the path that the symlink points to and not the symlink itself. This came about when using CDM.
o removed mDiffFit_wrap.sh
o modified SwiftMontage_Apps.swift to use the wrapper scripts I created
o modified SwiftMontage_Batch.swift to always use the fast projection. Need to have it choose between the two projections. Maybe choose in my python wrapper script.


Modified: SwiftApps/SwiftMontage/scripts/SwiftMontage_Apps.swift
===================================================================
--- SwiftApps/SwiftMontage/scripts/SwiftMontage_Apps.swift	2011-07-26 22:38:52 UTC (rev 4861)
+++ SwiftApps/SwiftMontage/scripts/SwiftMontage_Apps.swift	2011-07-28 01:07:30 UTC (rev 4862)
@@ -6,7 +6,7 @@
 
 app ( Image rc_img ) mBackground( Image img, float a, float b, float c )
 {
-    mBackground "-n" @img @rc_img a b c;
+    mBackground_wrap "-n" @img @rc_img a b c;
 }
 
 
@@ -66,7 +66,8 @@
 
 app ( Image proj_img ) mProjectPP( Image raw_img, Header hdr )
 {
-    mProjectPP "-X" @raw_img @proj_img @hdr;
+    mProjectPP_wrap "-X" @raw_img @proj_img @hdr;
+//    mProjectPP "-X" @raw_img @proj_img @hdr;
 }
 
 

Modified: SwiftApps/SwiftMontage/scripts/SwiftMontage_Batch.swift
===================================================================
--- SwiftApps/SwiftMontage/scripts/SwiftMontage_Batch.swift	2011-07-26 22:38:52 UTC (rev 4861)
+++ SwiftApps/SwiftMontage/scripts/SwiftMontage_Batch.swift	2011-07-28 01:07:30 UTC (rev 4862)
@@ -80,8 +80,8 @@
     foreach img, i in raw_imgs
     {
         Image proj_img <regexp_mapper; source = @img, match = ".*\\/(.*)", transform = dest + "/proj_\\1">;
-        proj_img = mProject( img, hdr );
-//        proj_img = mProjectPP( img, hdr );
+//        proj_img = mProject( img, hdr );
+        proj_img = mProjectPP( img, hdr );
 
         proj_imgs[ i ] = proj_img;
     }

Added: SwiftApps/SwiftMontage/scripts/mBackground_wrap.py
===================================================================
--- SwiftApps/SwiftMontage/scripts/mBackground_wrap.py	                        (rev 0)
+++ SwiftApps/SwiftMontage/scripts/mBackground_wrap.py	2011-07-28 01:07:30 UTC (rev 4862)
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+import sys
+import os
+import subprocess
+
+# args[0] = -n(o-areas)
+# args[1] = in.fits
+# args[2] = out.fits(could be symlink, script checks for that)
+# args[3] = coefficient a
+# args[4] = coefficient b
+# args[5] = coefficient c
+
+args = sys.argv[1:]
+back = args[2]
+
+if os.path.islink(back):
+    back = os.readlink(args[2])
+
+cmd = "mBackground "+args[0]+" "+args[1]+" "+back+" "+args[3]+" "+args[4]+" "+args[5]
+
+ret = subprocess.call(cmd, close_fds=True,
+                      shell=True, cwd=os.getcwd())
+
+sys.exit(ret)


Property changes on: SwiftApps/SwiftMontage/scripts/mBackground_wrap.py
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftApps/SwiftMontage/scripts/mDiffFit_wrap.py
===================================================================
--- SwiftApps/SwiftMontage/scripts/mDiffFit_wrap.py	                        (rev 0)
+++ SwiftApps/SwiftMontage/scripts/mDiffFit_wrap.py	2011-07-28 01:07:30 UTC (rev 4862)
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+
+import sys
+import os
+import subprocess
+
+# args[0] = "-n(o-areas)"
+# args[1] = -s
+# args[2] = status.file(could be symlink, script checks for that)
+# args[3] = in1.fits
+# args[4] = in2.fits
+# args[5] = out.fits(could be symlink, script checks for that)
+# args[6] = header.file
+
+args = sys.argv[1:]
+stat = args[2]
+diff = args[5]
+
+if os.path.islink(stat):
+    stat = os.readlink(args[2])
+
+if os.path.islink(diff):
+    diff = os.readlink(args[5])
+
+cmd = "mDiffFit "+args[0]+" "+args[1]+" "+stat+" "+args[3]+" "+args[4]+" "+diff+" "+args[6]
+
+ret = subprocess.call(cmd, close_fds=True,
+                      shell=True, cwd=os.getcwd())
+
+if not os.access( os.path.dirname(stat), os.F_OK ):
+    os.mkdir(os.path.dirname(stat))
+
+if not os.access( os.path.dirname(diff), os.F_OK ):
+    os.mkdir(os.path.dirname(diff))
+
+open(stat, "a").close()
+open(diff, "a").close()
+
+#try:
+#    os.mkdir(os.path.dirname(stat))
+#    os.mkdir(os.path.dirname(diff))
+#finally:
+#    open(stat, "a").close()
+#    open(diff, "a").close()
+    
+sys.exit(0)


Property changes on: SwiftApps/SwiftMontage/scripts/mDiffFit_wrap.py
___________________________________________________________________
Added: svn:executable
   + *

Deleted: SwiftApps/SwiftMontage/scripts/mDiffFit_wrap.sh
===================================================================
--- SwiftApps/SwiftMontage/scripts/mDiffFit_wrap.sh	2011-07-26 22:38:52 UTC (rev 4861)
+++ SwiftApps/SwiftMontage/scripts/mDiffFit_wrap.sh	2011-07-28 01:07:30 UTC (rev 4862)
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-mDiffFit $1 $2 $3 $4 $5 $6 $7
-
-mkdir -p `dirname $3`
-touch $3
-
-mkdir -p `dirname $6`
-touch $6
-
-exit 0

Added: SwiftApps/SwiftMontage/scripts/mProjectPP_wrap.py
===================================================================
--- SwiftApps/SwiftMontage/scripts/mProjectPP_wrap.py	                        (rev 0)
+++ SwiftApps/SwiftMontage/scripts/mProjectPP_wrap.py	2011-07-28 01:07:30 UTC (rev 4862)
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+# args[0] = -X
+# args[1] = in.fits
+# args[2] = out.fits(could be symlink, script checks for that)
+# args[3] = header.file
+
+import sys
+import os
+import subprocess
+
+args = sys.argv[1:]
+proj = args[2]
+
+if os.path.islink(proj):
+    proj = os.readlink(args[2])
+
+cmd = "mProjectPP "+args[0]+" "+args[1]+" "+proj+" "+args[3]
+
+ret = subprocess.call(cmd, close_fds=True,
+                      shell=True, cwd=os.getcwd())
+
+sys.exit(ret)


Property changes on: SwiftApps/SwiftMontage/scripts/mProjectPP_wrap.py
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftApps/SwiftMontage/scripts/mProject_wrap.py
===================================================================
--- SwiftApps/SwiftMontage/scripts/mProject_wrap.py	                        (rev 0)
+++ SwiftApps/SwiftMontage/scripts/mProject_wrap.py	2011-07-28 01:07:30 UTC (rev 4862)
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+# args[0] = -X
+# args[1] = in.fits
+# args[2] = out.fits(could be symlink, script checks for that)
+# args[3] = header.file
+
+import sys
+import os
+import subprocess
+
+args = sys.argv[1:]
+proj = args[2]
+
+if os.path.islink(proj):
+    proj = os.readlink(args[2])
+
+cmd = "mProject "+args[0]+" "+args[1]+" "+proj+" "+args[3]
+
+ret = subprocess.call(cmd, close_fds=True,
+                      shell=True, cwd=os.getcwd())
+
+sys.exit(ret)


Property changes on: SwiftApps/SwiftMontage/scripts/mProject_wrap.py
___________________________________________________________________
Added: svn:executable
   + *




More information about the Swift-commit mailing list