[Swift-commit] r3109 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/permutations
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Mon Sep 21 12:04:09 CDT 2009
Author: andric
Date: 2009-09-21 12:04:09 -0500 (Mon, 21 Sep 2009)
New Revision: 3109
Added:
SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/permutations/ClstrMasstrPerm.py
Log:
orig python script to parse clst_table
Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/permutations/ClstrMasstrPerm.py
===================================================================
--- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/permutations/ClstrMasstrPerm.py (rev 0)
+++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/permutations/ClstrMasstrPerm.py 2009-09-21 17:04:09 UTC (rev 3109)
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+import sys
+
+class ClstrMasstr:
+
+ def __init__(self):
+ self.input = ""
+ self.outname = ""
+
+ def get_opts (self,allargstr):
+ print "length of argstr "+str(len(allargstr))
+ i = 0
+ for o in allargstr:
+ print "arg is "+o
+ if o == "--input":
+ self.input = allargstr[i+1]
+ elif o == "--outputname":
+ self.outname = allargstr[i+1]
+ print "input: "+self.input
+ print "outname: "+self.outname
+ i = i+1
+
+ def run_clstrmass(self):
+ cluster_file = open(self.input,"r").read().split("\n")
+ cluster_file_length = len(cluster_file)-1
+ clstrmasslist = ""
+
+ if len(cluster_file)-1 == 1:
+ clstrmasslist = cluster_file[0]+" \n"
+ else:
+ numNd = int(cluster_file[16].split()[1])
+ Mean = float(cluster_file[16].split()[3])
+ mass = numNd*Mean
+ massval = "%.3f" % mass
+ clstrmasslist += massval+" \n"
+
+ outfile = open(self.outname,"w")
+ outfile.write(clstrmasslist)
+ outfile.close()
+
+
+clstmass = ClstrMasstr()
+clstmass.get_opts(sys.argv)
+clstmass.run_clstrmass()
More information about the Swift-commit
mailing list