Package iceprod :: Package modules :: Module dcorsika
[hide private]
[frames] | no frames]

Source Code for Module iceprod.modules.dcorsika

  1  #!/bin/env python 
  2  # 
  3  """ 
  4   Interface for configuring pre/post icetray scripts 
  5   
  6   copyright  (c) 2005 the icecube collaboration 
  7   
  8   @version: $Revision: $ 
  9   @date: $Date: $ 
 10   @author: Juan Carlos Diaz Velez <juancarlos@icecube.wisc.edu> 
 11  """ 
 12   
 13  import os 
 14  import re 
 15  import sys 
 16  import math 
 17  import glob 
 18  import dircache 
 19  import time 
 20  import string 
 21  import shutil 
 22  import cPickle 
 23  import ipmodule 
 24  from ipmodule import IPBaseClass 
 25  from os import system 
 26  from os.path import expandvars 
 27  import logging 
 28  import popen2 
 29  import getpass 
 30  from commands import getstatusoutput 
 31  from iceprod.core import exe 
 32  from iceprod.core.dataclasses import I3Tarball 
 33   
34 -def setbool(b):
35 if b: return 'T' 36 return 'F'
37
38 -class Corsika(IPBaseClass):
39 """ 40 This class provides an interface for preprocessing files in iceprod 41 """ 42
43 - def __init__(self):
44 IPBaseClass.__init__(self) 45 self.logger = logging.getLogger('iceprod::Corsika') 46 self.name = 'corsika' 47 self.parameters['arrang'] = -119. 48 49 self.AddParameter('version','Corsika version','v6900') 50 self.AddParameter('platform','compliler platform','') 51 self.AddParameter('cache','Should cache taball?',False) 52 self.AddParameter('cachedir','Cache directory', 53 '$system(cache)/%s_icesoft/%s'% (getpass.getuser(), self.name)) 54 self.AddParameter('URL','fetch tarball from URL',None) 55 self.AddParameter('runnum','Run number','') 56 self.AddParameter('seed','Random seed','1') 57 self.AddParameter('egs_seed_offset','value to be added to EGS seed (for debugging)','0') 58 self.AddParameter('nevents','Number of Events',0) 59 self.AddParameter('outfile','Output file',"DAT%(runnum)06d") 60 self.AddParameter('logfile','Log file','%(outfile)s.log') 61 self.AddParameter('outdir','Output directory','.') 62 self.AddParameter('topdir','Top directory','') 63 self.AddParameter('tmpdir','Temporary directory','%(outdir)s/dcors%(runnum)d') 64 self.AddParameter('model','Physics Model','SIBYLL') 65 self.AddParameter('lemodel','Low Energy Physics Model','gheisha') 66 self.AddParameter('donkg','Run NKG',0) # no NKG by default 67 self.AddParameter('doegs','Run EGS',0) # no EGS by default 68 self.AddParameter('eslope','CR spectral index (only if ranpri=0)',-2.7) 69 self.AddParameter('crtype','CR primary type',14) 70 self.AddParameter('cthmin','Min theta of injected cosmic rays',0.0) 71 self.AddParameter('cthmax','Max theta of injected cosmic rays',89.99) 72 self.AddParameter('cphmin','Min phi of injected cosmic rays',0.0) 73 self.AddParameter('cphmax','Max phi of injected cosmic rays',360.0) 74 self.AddParameter('emin','CR min energy',600.) 75 self.AddParameter('emax','CR max energy',1.e11) 76 self.AddParameter('ecuts','hadron/em energy cut (deprecated: instead use ecuts(i),i=1..4)',0) 77 self.AddParameter('ecuts1','hadron min energy (see corsika docs)',273) 78 self.AddParameter('ecuts2','muon min energy (see corsika docs)',273) 79 self.AddParameter('ecuts3','electron min energy (see corsika docs)',0.003) 80 self.AddParameter('ecuts4','photon min energy (see corsika docs)',0.003) 81 self.AddParameter('atmod','Atmosphere model (October=13)',13) 82 self.AddParameter('debug','boolean: enable disable debug mode',False)
83 84
85 - def stage(self):
86 """ 87 Stage files and executables 88 """ 89 90 par = self.parameters 91 par['tmpdir'] = self.GetParameter('tmpdir') % par; 92 93 self.logger.info('setting up working directory: %(tmpdir)s' % par) 94 if not os.path.exists(par['tmpdir']): 95 os.makedirs(par['tmpdir']); # create temporary directory 96 os.chdir(par['tmpdir']); # cd to temporary directory 97 98 self.logger.info('caching: %s' % self.GetParameter('cache')) 99 if self.GetParameter('cache'): 100 cachedir = self.parser.parse(self.GetParameter('cachedir')) 101 if not os.path.exists(cachedir): 102 os.makedirs(cachedir) 103 else: 104 cachedir = expandvars("$PWD") 105 baseurl = par['url'] 106 107 meta = I3Tarball() 108 meta.version = self.GetParameter('version') 109 meta.platform = self.GetParameter('platform') 110 meta.name = self.name 111 meta.suffix = ".tar.gz" 112 if meta.platform: 113 meta.filebase = "%s-%s.%s" % (meta.name, meta.version, meta.platform) 114 else: 115 meta.filebase = "%s-%s" % (meta.name, meta.version) 116 meta.md5sum = "%s.md5sum" % meta.filebase 117 meta.url = "%s/%s" % (baseurl,meta.filebase) 118 exe.fetch_tarball(meta,cachedir) 119 par['topdir'] = meta.path 120 121 # link data files for corsika 122 # Files necessary for QGSJET and QGSJET-II included 123 # DPMJET and VENUS files are *not* 124 os.symlink("%(topdir)s/bin/NUCNUCCS" % par, "NUCNUCCS"); 125 os.symlink("%(topdir)s/bin/QGSDAT01" % par, "QGSDAT01"); 126 os.symlink("%(topdir)s/bin/SECTNU" % par, "SECTNU"); 127 os.symlink("%(topdir)s/bin/qgsdat-II-03" % par, "qgsdat-II-03"); 128 os.symlink("%(topdir)s/bin/sectnu-II-03" % par, "sectnu-II-03"); 129 os.symlink("%(topdir)s/bin/GLAUBTAR.DAT" % par, "GLAUBTAR.DAT"); 130 os.symlink("%(topdir)s/bin/NUCLEAR.BIN" % par, "NUCLEAR.BIN"); 131 os.environ['LD_LIBRARY_PATH'] = expandvars("%(topdir)s/lib:$LD_LIBRARY_PATH" % par); 132 133 # If we have EGS files too, link those 134 egsfiles = glob.glob("%(topdir)s/bin/EGSDAT*" % par) 135 136 # If we have EPOS files too, link those 137 eposfiles = glob.glob("%(topdir)s/bin/epos.*" % par) 138 139 for file in egsfiles + eposfiles: 140 os.symlink(file, os.path.basename(file)); 141 142 # If FLUKA exists, use it 143 if os.path.exists("%(topdir)s/fluka" % par): 144 os.environ['FLUPRO'] = expandvars("%(topdir)s/fluka" % par); 145 146 return meta.path
147 148 149
150 - def Execute(self,stats):
151 """ 152 Run CORSIKA 153 corsika output is stdout: must create a temporary directory and cd there 154 """ 155 156 cwd = os.getcwd() 157 par = self.parameters 158 159 # Retrieve tarball and stage environment 160 self.stage() 161 self.configure() 162 self.write_steering() 163 164 # CORSIKA binary 165 # New standard binary name style 166 par['model'] = par['model'].upper() 167 par['versionnumber'] = par['version'].lstrip('v') 168 par['corsbinary'] = "%(topdir)s/bin/corsika%(versionnumber)sLinux_%(model)s_%(lemodel)s" % par; 169 if not os.path.exists(par['corsbinary']): 170 os.chdir(cwd); # cd back to original directory 171 print >> sys.stderr,"CORSIKA binary does not exist: corsika%(versionnumber)sLinux_%(model)s_%(lemodel)s\n" % par; 172 raise Exception,"CORSIKA binary does not exist: corsika%(versionnumber)sLinux_%(model)s_%(lemodel)s\n" % par; 173 # Old symlink style 174 #par['corsbinary'] = "%(topdir)s/bin/corsika.%(model)s.Linux" % par; 175 system("cp %(corsbinary)s corsika.%(runnum)s.Linux" % par); 176 177 # Corsika output file 178 par['outfile'] = os.path.join(expandvars(par['outdir']%par),expandvars(par['outfile']%par)) 179 par['corout'] = "DAT%(runnum)06d" % par; # Plain CORSIKA output 180 par['logfile'] = par['logfile'] % par 181 182 # Execution command 183 cors_cmd = "%(tmpdir)s/corsika.%(runnum)d.Linux < %(inputfile)s > %(logfile)s " % par; 184 self.logger.info(cors_cmd); 185 186 # Run CORSIKA 187 status, output = getstatusoutput(cors_cmd); 188 self.logger.info(output); 189 if status: 190 os.chdir(cwd); # cd back to original directory 191 raise Exception, "dCorsika python sucks! %s\n" % output; 192 193 # Check if dCORSIKA Output exists 194 if os.path.exists("%(tmpdir)s/%(corout)s.gz" % par): 195 system("cp %(tmpdir)s/%(corout)s.gz %(outfile)s" % par); 196 # Check if CORSIKA Output exists 197 elif os.path.exists("%(tmpdir)s/%(corout)s" % par): 198 system("cp %(tmpdir)s/%(corout)s %(outfile)s" % par); 199 # if neither output exists, quit 200 else: 201 os.chdir(cwd); # cd back to original directory 202 print >> sys.stderr,"CORSIKA Output does not exist: exit before UCR\n"; 203 raise Exception,"CORSIKA Output does not exist: exit before UCR\n"; 204 205 206 207 # check if the output is OK 208 nevcorsika = 0 209 try: 210 status,nevcorsika=getstatusoutput("cat %(logfile)s|grep \"GENERATED EVENTS\"|grep -v NEV|awk '{ print $6 }'" % par); 211 nevcorsika = int(nevcorsika.strip()); 212 stats['nevcorsika'] = nevcorsika 213 except Exception,e: 214 self.logger.error(e); 215 if nevcorsika == self.GetParameter('nevents'): 216 system('touch %(outdir)s/corsika.%(runnum)d.isok' % par) 217 self.logger.info("OK"); 218 print >> sys.stderr, "Corsika OK\n"; 219 else : 220 system('touch %(outdir)s/corsika.%(runnum)d.isnotok' % par) 221 print >> sys.stderr, "Corsika not OK\n"; 222 self.logger.error("NOT OK"); 223 #self.logger.error(exe.tail(self.GetParameter('logfile'))); 224 os.chdir(cwd); # cd back to original directory 225 return 1; 226 227 os.chdir(cwd); # cd back to original directory 228 return 0;
229
230 - def configure(self):
231 """ 232 Configure and write INPUTS steering file 233 """ 234 par = self.parameters 235 seed = self.GetParameter('seed') 236 egs_seed_offset = self.GetParameter('egs_seed_offset') 237 par['seed1'] = int(seed)+0; 238 par['seed2'] = int(seed)+1+int(egs_seed_offset); 239 par['seed3'] = int(seed)+2; 240 241 # NKG/EGS 242 NKGparams = ""; 243 nkg = 'F' 244 egs = 'F' 245 if par['donkg']: nkg = 'T' 246 if par['doegs']: egs = 'T' 247 NKGparams = "ELMFLG %s %s " % (nkg,egs) 248 NKGparams += " em. interaction flags (NKG,EGS)\n"; 249 if par['donkg']: # if NKG parameterizations ON 250 NKGparams += "RADNKG 2.E5 outer radius for NKG lat.dens.determ.\n"; 251 par['NKGparams'] = NKGparams 252 253 # Construct HE interaction model steering commands 254 modelStr = ""; 255 model = self.GetParameter('model') 256 if model in ("qgsjet","qgsii"): 257 modelStr += "QGSJET T 0 use qgsjet for high energy hadrons\n"; 258 modelStr += "QGSSIG T use qgsjet hadronic cross sections"; 259 elif model == "dpmjet": 260 modelStr += "DPMJET T 0 use dpmjet for high energy hadrons\n"; 261 modelStr += "DPJSIG T all hail Glaubtar!"; 262 elif model == "sibyll": 263 modelStr += "SIBYLL T 0 use sibyll for high energy hadrons\n"; 264 modelStr += "SIBSIG T use sibyll hadronic cross sections"; 265 elif model == "epos": 266 modelStr += "EPOS T 0 use epos for high energy hadrons\n"; 267 modelStr += "EPOSIG T use epos hadronic cross sections\n"; 268 modelStr += "EPOPAR input epos.param !initialization input file for epos\n"; 269 modelStr += "EPOPAR fname inics epos.inics !initialization input file for epos\n"; 270 modelStr += "EPOPAR fname iniev epos.iniev !initialization input file for epos\n"; 271 modelStr += "EPOPAR fname initl epos.initl !initialization input file for epos\n"; 272 modelStr += "EPOPAR fname inirj epos.inirj !initialization input file for epos\n"; 273 modelStr += "EPOPAR fname inihy epos.ini1b !initialization input file for epos\n"; 274 modelStr += "EPOPAR fname check none !dummy output file for epos\n"; 275 modelStr += "EPOPAR fname histo none !dummy output file for epos\n"; 276 modelStr += "EPOPAR fname data none !dummy output file for epos\n"; 277 modelStr += "EPOPAR fname copy none !dummy output file for epos"; 278 279 # Turn on/off dCORSIKA debugging 280 if self.GetParameter('debug'): 281 par['debug'] = "T"; 282 else: 283 par['debug'] = "F"; 284 285 # Check if old-style ecuts parameter is set 286 ecuts = self.GetParameter('ecuts') 287 if ecuts: 288 self.SetParameter('ecuts1',ecuts) 289 self.SetParameter('ecuts2',ecuts) 290 291 # Convert input phi from IceCube Coordinates to CORSIKA Coordinates 292 # CORSIKA will rotate the particles back to IceCube Coordinates in 293 # the output routine. Also, IceCube Zenith and Azimuth point to 294 # where the particle came from, while CORSIKA points to where it 295 # is going. Also CORSIKA measures zenith from -z. 296 par['cphmin_cc'] = par['cphmin'] + par['arrang'] + 180 297 par['cphmax_cc'] = par['cphmax'] + par['arrang'] + 180 298 299 # Check the domain of min and max phi and fix if needed 300 if par['cphmax_cc'] - par['cphmin_cc'] > 360.0: 301 self.logger.error('Phi range greater than 360deg') 302 while par['cphmin_cc'] < -360.0: 303 par['cphmin_cc'] += 360.0 304 par['cphmax_cc'] += 360.0 305 while par['cphmax_cc'] > 360.0: 306 par['cphmin_cc'] -= 360.0 307 par['cphmax_cc'] -= 360.0 308 309 310 # Write out the Corsika INPUTS steering file 311 input = "" 312 input += "RUNNR %(runnum)d number of run\n"; 313 input += "EVTNR 1 number of first shower event\n"; 314 input += "NSHOW %(nevents)d number of showers to generate\n"; 315 input += "PRMPAR %(crtype)d particle type of prim. particle\n"; 316 input += "ESLOPE %(eslope)f slope of primary energy spectrum\n"; 317 input += "ERANGE %(emin)f %(emax)f energy range of primary particle\n"; 318 input += "THETAP %(cthmin)f %(cthmax)f range of zenith angle (degree)\n"; 319 input += "PHIP %(cphmin_cc)f %(cphmax_cc)f range of azimuth angle (degree)\n"; 320 input += "SEED %(seed1)d 0 0 seed for 1. random number sequence\n"; 321 input += "SEED %(seed2)d 0 0 seed for 2. random number sequence\n"; 322 input += "SEED %(seed3)d 0 0 seed for 3. random number sequence\n"; 323 input += "OBSLEV 2834.E2 observation level (in cm)\n"; 324 input += "%(NKGparams)s"; 325 input += "ARRANG %(arrang)f rotation of array to north\n"; 326 input += "FIXHEI 0. 0 first interaction height & target\n"; 327 input += "FIXCHI 0. starting altitude (g/cm**2)\n"; 328 input += "MAGNET 16.4 -53.4 magnetic field south pole\n"; 329 input += "HADFLG 0 1 0 1 0 2 flags hadr.interact. & fragmentation\n"; 330 input += "%s \n" % modelStr; 331 input += "ECUTS %(ecuts1).04f %(ecuts2).04f %(ecuts3).04f %(ecuts4).04f energy cuts for particles\n"; 332 input += "MUADDI T additional info for muons\n"; 333 input += "MUMULT T muon multiple scattering angle\n"; 334 input += "LONGI F 20. F F longit.distr. & step size & fit\n"; 335 input += "MAXPRT 0 max. number of printed events\n"; 336 input += "ECTMAP 100 cut on gamma factor for printout\n"; 337 input += "STEPFC 1.0 mult. scattering step length fact.\n"; 338 input += "DEBUG %(debug)s 6 F 1000000 debug flag and log.unit for out\n"; 339 input += "DIRECT ./ output directory\n"; 340 input += "ATMOD %(atmod)s october atmosphere\n"; 341 self.steering = input
342 343
344 - def write_steering(self):
345 # terminate steering and write it to file 346 par = self.parameters 347 self.steering += "EXIT terminates input\n"; 348 349 tmpdir = par['tmpdir'] 350 inputfile = open(tmpdir+"/INPUTS",'w'); 351 inputfile.write(self.steering % par); 352 par['inputfile'] = inputfile.name; 353 inputfile.close();
354 355
356 -class dCorsika(Corsika):
357 """ 358 This class provides an interface for preprocessing files in iceprod 359 """ 360
361 - def __init__(self):
362 Corsika.__init__(self) 363 self.name = 'dcorsika' 364 self.logger = logging.getLogger('iceprod::dCorsika') 365 self.parameters['arrang'] = 0. 366 367 self.AddParameter('version','Corsika version','v6720') 368 369 # dcorsika specific 370 self.AddParameter('ranpri','CR spectrum: 0=individual nuclei, 1=Wiebel-Sooth, 2=Hoerandel, 3= 5-component',2) 371 self.AddParameter('dslope','CR spectral index modification (only if ranpri=1,2)',0.) 372 self.AddParameter('length','length of generation cylinder in m (for detcfg = length/2*radius calculation)',1400.) 373 self.AddParameter('radius','radius of generation cylinder in m (for detcfg = length/2*radius calculation)',700.) 374 self.AddParameter('depth','depth of the center of IceCube detector in m (for AMANDA it is 1730.)',1950.) 375 self.AddParameter('spric','separate primary energy cutoffs','T') 376 self.AddParameter('locut','Enables skew angle cutoff','T 1.58') 377 self.AddParameter('pnormH','proton 5-component relative contribution',1.0) 378 self.AddParameter('pnormHe','Helium 5-component relative contribution',0.1) 379 self.AddParameter('pnormN','Nitrogen 5-component relative contribution',2e-3) 380 self.AddParameter('pnormAl','Aluminium 5-component relative contribution',6e-4) 381 self.AddParameter('pnormFe','Iron 5-component relative contribution',1e-3) 382 self.AddParameter('pgamH','proton 5-component spectral index',2) 383 self.AddParameter('pgamHe','Helium 5-component spectral index',2) 384 self.AddParameter('pgamN','Nitrogen 5-component spectral index',2) 385 self.AddParameter('pgamAl','Aluminium 5-component spectral index',2) 386 self.AddParameter('pgamFe','Iron 5-component spectral index',2) 387 self.AddParameter('f2k','Write in F2K format','T')
388 389 390
391 - def configure(self):
392 Corsika.configure(self) 393 394 par = self.parameters 395 # dCorsika specific 396 inputd = "DETCFG %(detcfg)s detector information (l/d)\n"; 397 inputd += "F2000 %(f2k)s choses F2000 format\n"; 398 inputd += "LOCUT %(locut)s enables skew angle cutoff\n"; 399 inputd += "RANPRI %(ranpri)s random primary\n"; 400 inputd += "SPRIC %(spric)s separate primary energy cutoffs\n"; 401 inputd += "FSEED F enable random generator seed recovery\n"; 402 inputd += "DSLOPE %(dslope)s slope correction\n"; 403 inputd += "SCURV T 6.4E8 1.95E5 curved surf., radius of Earth, depth\n"; 404 inputd += "MFDECL -27.05 magnetic field declination (+E, -W)\n"; 405 406 if self.GetParameter('ranpri') == 3: 407 inputd += "PNORM %(pnormh)s %(pnormhe)s %(pnormn)s %(pnormal)s %(pnormfe)s 5-component relative contribution\n" 408 inputd += "PGAM %(pgamh)s %(pgamhe)s %(pgamn)s %(pgamal)s %(pgamfe)s 5-component spectral indices\n" 409 410 self.steering += inputd 411 412 # Write out DETPARAMS geometry file 413 tmpdir = par['tmpdir'] 414 detparams = open(tmpdir+"/DETPARAMS",'w'); 415 print >> detparams, "-LENGTH=%(length)s -RADIUS=%(radius)s -DEPTH=%(depth)s" % par 416 detparams.close(); 417 418 length = self.GetParameter('length') 419 radius = self.GetParameter('radius') 420 par['detcfg'] = length/(2.*radius);
421 422
423 -class ThinCorsika(Corsika):
424 """ 425 This class provides an interface for preprocessing files in iceprod 426 """ 427
428 - def __init__(self):
429 Corsika.__init__(self) 430 self.name = 'thincorsika' 431 self.logger = logging.getLogger('iceprod::ThinCorsika') 432 433 # ThinCorsika specific 434 self.AddParameter('thinem_e','Fraction of primary energy where thinning algorithm is used for electromagnetic particles.',1.0E-6) 435 self.AddParameter('thinem_wmax','maximum weight to be given to any thinned electromagnetic particle',10.0) 436 self.AddParameter('thinh_e','Energy(Gev) where thinning algorithm is used for hadrons',1.0) 437 self.AddParameter('thinh_wmax','Maximum weight to be given to any thinned hadronic particle',1.0)
438
439 - def configure(self):
440 Corsika.configure(self) 441 442 par = self.parameters 443 # Calculate parameters to be used for thinning 444 par['efrcthn'] = par['thinem_e'] 445 par['wmax'] = par['thinem_wmax'] 446 par['rmax'] = 0.0 447 par['thinrat'] = par['thinh_e']/par['thinem_e'] 448 par['weitrat'] = par['thinh_wmax']/par['thinem_wmax'] 449 450 inputd = "THIN %(efrcthn)f %(wmax)f %(rmax)f EM thinning level weightmax rmax\n"; 451 inputd += "THINH %(thinrat)f %(weitrat)f Ratios for Hadronic thinning\n"; 452 453 self.steering += inputd
454 455
456 -class AutoThinCorsika(Corsika):
457 """ 458 This class provides an interface for preprocessing files in iceprod 459 """ 460
461 - def __init__(self):
462 Corsika.__init__(self) 463 self.name = 'thincorsika' 464 self.logger = logging.getLogger('iceprod::AutoThinCorsika') 465 466 # ThinCorsika specific 467 self.AddParameter('thin_method','Method for calculating thinning parameters.','2009')
468
469 - def configure(self):
470 Corsika.configure(self) 471 472 par = self.parameters 473 if par['thin_method'] == '2009': 474 # Calculate parameters to be used for thinning 475 par['efrcthn'] = 1.0E-6 476 par['wmax'] = par['emin']*par['efrcthn'] # Calculate optimum weight from Alessio 477 if par['wmax'] < 1.0: # Ensure max weight is at least 1 478 par['wmax'] = 1.0 479 par['rmax'] = 0.0 480 par['thinrat'] = 10.0/par['efrcthn'] # Just to be safe 481 par['weitrat'] = 1.0/par['wmax'] 482 else: 483 self.logger.error('Specified thinning method not supported') 484 485 inputd = "THIN %(efrcthn)f %(wmax)f %(rmax)f EM thinning level weightmax rmax\n"; 486 inputd += "THINH %(thinrat)f %(weitrat)f Ratios for Hadronic thinning\n"; 487 488 self.steering += inputd
489 490
491 -class UCR(ipmodule.IPBaseClass):
492
493 - def __init__(self):
494 ipmodule.IPBaseClass.__init__(self) 495 self.logger = logging.getLogger('iceprod::UCR') 496 497 self.AddParameter('ucr-binary','UCR executable','$steering(ucr_binary)') 498 self.AddParameter('ucr-opts','UCR options','$steering(ucr_opts1)') 499 self.AddParameter('input','UCR input','$steering(ucr_opts1)') 500 self.AddParameter('output','UCR output','$steering(ucr_opts1)')
501 502
503 - def Execute(self,stats):
504 if not ipmodule.IPBaseClass.Execute(self,stats): return 0 505 506 from commands import getstatusoutput 507 508 ucr_bin = self.GetParameter('ucr-binary') 509 ucr_bin = self.parser.parse(ucr_bin) 510 511 ucr_opts = self.GetParameter('ucr-opts') 512 ucr_opts = self.parser.parse(ucr_opts) 513 514 ucr_in = self.GetParameter('input') 515 ucr_in = self.parser.parse(ucr_in) 516 517 ucr_out = self.GetParameter('output') 518 ucr_out = self.parser.parse(ucr_out) 519 520 ucr_cmd = " ".join([ucr_bin,'-out='+ucr_out, ucr_in, ucr_opts]) 521 522 os.system("touch %s" % ucr_out) # for some reason ucr gets upset if the file doesn't exits 523 # Run UCR 524 self.logger.info(ucr_cmd) 525 status, output = getstatusoutput(ucr_cmd); 526 527 self.logger.info(output) 528 if status: 529 self.logger.error(output) 530 531 return status
532