def create_dir(name): '''Creates a directory relative to the MIIND_ROOT/build/jobs.''' sep = os.path.sep directories.initialize_global_variables() miind_root = directories.miind_root() abspath = os.path.join(miind_root,'build', 'jobs', name) return abspath
def create_dir(name): '''Creates a directory relative to the MIIND_ROOT/build/jobs.''' sep = os.path.sep directories.initialize_global_variables() miind_root = directories.miind_root() abspath = os.path.join(miind_root, 'build', 'jobs', name) return abspath
def write_out_jobs(base_name, job_names): ''' A directory with job names will be added.''' abspath=create_dir(base_name) try: os.makedirs(abspath) except OSError as exception: if exception.errno != errno.EEXIST: raise joblistname = os.path.join(abspath,'joblist') with open(joblistname,'w') as f: for name in job_names: name = directories.check_and_strip_name(name) path = os.path.join(directories.miind_root(), 'build' ,'apps', base_name, name, name) f.write(path + '\n') return abspath
def write_out_jobs(base_name, job_names): ''' A directory with job names will be added.''' abspath = create_dir(base_name) try: os.makedirs(abspath) except OSError as exception: if exception.errno != errno.EEXIST: raise joblistname = os.path.join(abspath, 'joblist') with open(joblistname, 'w') as f: for name in job_names: name = directories.check_and_strip_name(name) path = os.path.join(directories.miind_root(), 'build', 'apps', base_name, name, name) f.write(path + '\n') return abspath
def write_out_job(job_name): ''' Just a single job needs to be added.''' dirname=job_name[:-4] if job_name[-4:] != '.xml': raise NameError abspath=create_dir(dirname) try: os.makedirs(abspath) except OSError as exception: if exception.errno != errno.EEXIST: raise joblistname = os.path.join(abspath,'joblist') with open(joblistname,'w') as f: path = os.path.join(directories.miind_root(), 'build' ,'apps', job_name) f.write(path + '\n') return
def write_out_job(job_name): ''' Just a single job needs to be added.''' dirname = job_name[:-4] if job_name[-4:] != '.xml': raise NameError abspath = create_dir(dirname) try: os.makedirs(abspath) except OSError as exception: if exception.errno != errno.EEXIST: raise joblistname = os.path.join(abspath, 'joblist') with open(joblistname, 'w') as f: path = os.path.join(directories.miind_root(), 'build', 'apps', job_name) f.write(path + '\n') return
#!/usr/bin/env python import subprocess import submit import sys import os import directories dir = sys.argv[1] build = os.path.join(directories.miind_root(), 'build') path = os.path.join(build, 'jobs', dir) with submit.cd(os.path.join(directories.miind_root(), 'python')): subprocess.call(["cp", "sub.sh", path]) with submit.cd(build): subprocess.call(['make']) with submit.cd(path): f = open('joblist') lines = f.readlines() for line in lines: name = line.strip() subprocess.call(['qsub', './sub.sh', name])
import ROOT import sys import os import directories import numpy as np '''Analyse the response curve data.''' # Don't want flashing canvasses. ROOT.gROOT.SetBatch(True) ROOT.gStyle.SetOptStat(0) jobpath = os.path.join(directories.miind_root(),'build','jobs','single','joblist') def nodecay(): filepath = os.path.split(jobpath)[0] path = os.path.join(filepath,'no_decay_0.root') f=ROOT.TFile(path) c=ROOT.TCanvas('c') c.SetGrayscale() h = ROOT.TH2F("h","No leakage",500,0.01,1.,500,0.,40.) h.SetXTitle('V') h.SetYTitle('#rho') h.GetYaxis().SetLabelOffset(0.02) h.Draw() g2=f.Get('grid_0_1.1513041e-05') g2.SetLineColor(ROOT.kYellow+4) g2.SetFillColor(ROOT.kYellow+4) g2.SetFillStyle(1001)
import ROOT import sys import os import directories '''Analyse the response curve data.''' # Don't want flashing canvasses. ROOT.gROOT.SetBatch(True) jobpath = os.path.join(directories.miind_root(),'build','jobs','response','joblist') f = open(jobpath) lines = f.readlines() for line in lines: path = os.path.split(line.strip()) print path[-1] f=ROOT.TFile(os.path.join(os.path.split(jobpath)[0] , path[-1] + '_0.root')) # Get the firing rate response of the LIF population g=f.Get('rate_0') # Fit and write out fun=ROOT.TF1('func1','pol1',0.8,1.0) g.Fit('func1','R') p = fun.GetParameters() with open('response.dat','a') as f: items= path[-1].split('_') print items[2], items[1]
def __init__(self, newPath): self.newPath = os.path.expanduser(newPath) def __enter__(self): self.savedPath = os.getcwd() os.chdir(self.newPath) def __exit__(self, etype, value, traceback): os.chdir(self.savedPath) if __name__ == "__main__": if len(sys.argv) != 2: print 'submit requirs exactly one argument: the subdirectory under which the jobs are organized.' sys.exit() dir = sys.argv[1] build = os.path.join(directories.miind_root(), 'build') path = os.path.join(build, 'jobs', dir) with cd(build): subprocess.call(['make']) with open(os.path.join(path, 'joblist')) as f: lines = f.readlines() with cd(path): for line in lines: name = line.split()[0] subprocess.call([name, '>&log&'])
import numpy as np import ROOT import sys import os import directories """Analyse the response curve data.""" # Don't want flashing canvasses. ANALYTIC_DATAFILE = "analytic.dat" POPULATION_DATAFILE = "pop.dat" ROOT.gROOT.SetBatch(True) jobpath = os.path.join(directories.miind_root(), "build", "jobs", "rate", "joblist") f = open(jobpath) lines = f.readlines() def ExtractPopulationResults(): with open(POPULATION_DATAFILE, "w") as fpop: fpop.close() for line in lines: path = os.path.split(line.strip()) print path[-1] f = ROOT.TFile(os.path.join(os.path.split(jobpath)[0], path[-1] + "_0.root")) # Get the firing rate response of the LIF population
import imp import os import directories libmiindwc = imp.load_dynamic( "libmiindwc", os.path.join(directories.miind_root(), 'build', 'apps', 'TvbModels', 'wilsoncowan', 'libmiindwc.so'))
import ROOT import sys import os import directories '''Analyse the response curve data.''' # Don't want flashing canvasses. ROOT.gROOT.SetBatch(True) jobpath = os.path.join(directories.miind_root(), 'build', 'jobs', 'response', 'joblist') f = open(jobpath) lines = f.readlines() for line in lines: path = os.path.split(line.strip()) print path[-1] f = ROOT.TFile( os.path.join(os.path.split(jobpath)[0], path[-1] + '_0.root')) # Get the firing rate response of the LIF population g = f.Get('rate_0') # Fit and write out fun = ROOT.TF1('func1', 'pol1', 0.8, 1.0) g.Fit('func1', 'R') p = fun.GetParameters() with open('response.dat', 'a') as f:
self.newPath = os.path.expanduser(newPath) def __enter__(self): self.savedPath = os.getcwd() os.chdir(self.newPath) def __exit__(self, etype, value, traceback): os.chdir(self.savedPath) if __name__ == "__main__": if len(sys.argv) != 2: print 'submit requirs exactly one argument: the subdirectory under which the jobs are organized.' sys.exit() dir=sys.argv[1] build = os.path.join(directories.miind_root(),'build') path = os.path.join(build,'jobs',dir) with cd(build): subprocess.call(['make']) with open(os.path.join(path,'joblist')) as f: lines = f.readlines() with cd(path): for line in lines: name = line.split()[0] subprocess.call([name, '>&log&'])
#!/usr/bin/env python import subprocess import submit import sys import os import directories dir=sys.argv[1] build = os.path.join(directories.miind_root(),'build') path = os.path.join(build,'jobs',dir) with submit.cd(os.path.join(directories.miind_root(),'python')): subprocess.call(["cp","sub.sh",path]) with submit.cd(build): subprocess.call(['make']) with submit.cd(path): f=open('joblist') lines=f.readlines() for line in lines: name=line.strip() subprocess.call(['qsub','./sub.sh',name])