[Swift-commit] r3047 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Aug 5 16:11:51 CDT 2009


Author: andric
Date: 2009-08-05 16:11:51 -0500 (Wed, 05 Aug 2009)
New Revision: 3047

Added:
   SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py
Log:
code to build brain images for each lag taking from the enormous output dir

Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py
===================================================================
--- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py	                        (rev 0)
+++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py	2009-08-05 21:11:51 UTC (rev 3047)
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+
+import os
+import fnmatch
+import shutil
+import time
+
+
+def finder(L,value):
+    listsubset = []
+    for ff in thefiles:
+        if fnmatch.fnmatch(ff,value):
+            listsubset += [ff]
+        
+    return listsubset
+
+
+h = "lh"
+baseDir = os.getenv("cnari")+"/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis"
+outputDir = baseDir+"/turning_out"+h
+viewDir = baseDir+"/views"
+
+os.chdir(outputDir)
+print os.getcwd()
+
+thefiles = os.listdir(os.getcwd())
+print "Number of files in this dir: "+`len(thefiles)`
+
+for i in range(2,7):
+    onewayBrain = h+"_lag"+`i`+".oneway.1D"
+    print onewayBrain+" starting: "+time.ctime()
+    onewayfiles = finder(thefiles,"pa_vs_noise*.lag"+`i`+".oneway.chisqresult")
+    print "Found all files in this subset, now building brain "+time.ctime()
+    brainUNO = ''
+    for pa in onewayfiles:
+        brainUNO += open(pa,"r").read()
+    
+    onewayResult = open(onewayBrain,"w")
+    print "Now WRITING "+onewayBrain+" -- "+time.ctime()
+    onewayResult.write(brainUNO)
+    onewayResult.close()
+    print "Now COPYING "+onewayBrain
+    shutil.copy2(onewayBrain,viewDir)
+
+
+    twowayBrain = h+"_lag"+`i`+".twoway.1D"
+    print twowayBrain+" starting: "+time.ctime()
+    twowayfiles = finder(thefiles,"pa_vs_noise*.lag"+`i`+".twoway.chisqresult")
+    print "Found all files in this subset, now building brain "+time.ctime()
+    brainDOS = ''
+    for pa in twowayfiles:
+        brainDOS += open(pa,"r").read()
+    
+    twowayResult = open(twowayBrain,"w")
+    print "Now WRITING "+twowayBrain+" -- "+time.ctime()
+    twowayResult.write(brainDOS)
+    twowayResult.close()
+    print "Now COPYING "+twowayBrain
+    shutil.copy2(twowayBrain,viewDir)




More information about the Swift-commit mailing list