Example #1
0
#=========================================================================================
# Shared steps
#=========================================================================================

here = get_here(__file__)
base = os.path.abspath(join(here, os.pardir))
examplespath = join(base, 'examples')
modelspath = join(examplespath, 'models')
analysispath = join(examplespath, 'analysis')
paperpath = join(base, 'paper')
paperfigspath = join(paperpath, 'figs')
timespath = join(paperpath, 'times')

# Make paths
mkdir_p(paperfigspath)
mkdir_p(timespath)


def call(s):
    if simulate:
        print(3 * ' ' + s)
    else:
        rv = subprocess.call(s.split())
        if rv != 0:
            sys.stdout.flush()
            print("Something went wrong (return code {}).".format(rv) +
                  " We're probably out of memory.")
            sys.exit(1)

import os
import subprocess
import sys
from   os.path import join

from pycog.utils import get_here, mkdir_p

#=========================================================================================
# Shared steps
#=========================================================================================

here      = get_here(__file__)
base      = os.path.abspath(join(here, os.pardir))
paperpath = join(base, 'paper')

mkdir_p(join(paperpath, 'figs', 'plos'))

def call(s):
    rv = subprocess.call(s.split())
    if rv != 0:
        sys.stdout.flush()
        print("Something went wrong (return code {}).".format(rv)
              + " We're probably out of memory.")
        sys.exit(1)

def figure(fig, n):
    call('python ' + join(paperpath, fig + '.py'))
    call('mv {} {}'.format(join(paperpath, 'figs', fig + '.eps'),
                           join(paperpath, 'figs', 'plos', 'fig{}.eps'.format(n))))

#=========================================================================================
#=========================================================================================
# Shared steps
#=========================================================================================

here          = get_here(__file__)
base          = os.path.abspath(join(here, os.pardir))
examplespath  = join(base, 'examples')
modelspath    = join(examplespath, 'models')
analysispath  = join(examplespath, 'analysis')
paperpath     = join(base, 'paper')
paperfigspath = join(paperpath, 'figs')
timespath     = join(paperpath, 'times')

# Make paths
mkdir_p(paperfigspath)
mkdir_p(timespath)

def call(s):
    if simulate:
        print(3*' ' + s)
    else:
        rv = subprocess.call(s.split())
        if rv != 0:
            sys.stdout.flush()
            print("Something went wrong (return code {}).".format(rv)
                  + " We're probably out of memory.")
            sys.exit(1)

def clean(model):
    call("python {} {} clean"
Example #4
0
File: do.py Project: grahamas/pycog
# Scratch
scratchroot = os.environ.get('SCRATCH', join(os.path.expanduser('~'), 'scratch'))
scratchpath = join(scratchroot, 'work', prefix, name)

# Theano
theanopath = join(scratchpath, 'theano')

# Paths
workpath   = join(here, 'work')
datapath   = join(workpath, 'data', name)
figspath   = join(workpath, 'figs', name)
trialspath = join(scratchpath, 'trials')

# Create necessary directories
for path in [datapath, figspath, scratchpath, trialspath]:
    mkdir_p(path)

# File to store model in
savefile = join(datapath, name + suffix + '.pkl')

#=========================================================================================
# Check log file
#=========================================================================================

if action == 'check':
    try:
        action = args[0]
    except IndexError:
        action = 'train'

    jobname = name
Example #5
0
import os
import subprocess
import sys
from os.path import join

from pycog.utils import get_here, mkdir_p

#=========================================================================================
# Shared steps
#=========================================================================================

here = get_here(__file__)
base = os.path.abspath(join(here, os.pardir))
paperpath = join(base, 'paper')

mkdir_p(join(paperpath, 'figs', 'plos'))


def call(s):
    rv = subprocess.call(s.split())
    if rv != 0:
        sys.stdout.flush()
        print("Something went wrong (return code {}).".format(rv) +
              " We're probably out of memory.")
        sys.exit(1)


def figure(fig, n):
    call('python ' + join(paperpath, fig + '.py'))
    call('mv {} {}'.format(
        join(paperpath, 'figs', fig + '.eps'),
Example #6
0
scratchroot = os.environ.get('SCRATCH', join(os.path.expanduser('~'),
                                             'scratch'))
scratchpath = join(scratchroot, 'work', prefix, name)

# Theano
theanopath = join(scratchpath, 'theano')

# Paths
workpath = join(here, 'work')
datapath = join(workpath, 'data', name)
figspath = join(workpath, 'figs', name)
trialspath = join(scratchpath, 'trials')

# Create necessary directories
for path in [datapath, figspath, scratchpath, trialspath]:
    mkdir_p(path)

# File to store model in
savefile = join(datapath, name + suffix + '.pkl')

#=========================================================================================
# Check log file
#=========================================================================================

if action == 'check':
    try:
        action = args[0]
    except IndexError:
        action = 'train'

    jobname = name