def qsub_cmd_gen(template, job_name, i, sid, fODF, im, data_path,
                 cmd_file_path=cmd_file_path, python_path=python_path,
                 bashcmd=bashcmd, mem=25):
    reload(template)
    template = sge.getsourcelines(template)[0]

    # Name the job and generate the parameters for each job
    if job_name[0:2] != "im":
        params_dict = dict(i=i, sid=sid, fODF=fODF, im=im,
                        data_path=data_path)
        name = '%s_%s_%s%s'%(job_name,fODF,shorthand_im,i)
    else:
        params_dict = dict(i=i, sid=sid, im=im,
                        data_path=data_path)
        name = '%s_%s%s'%(job_name,shorthand_im,i)

    code = sge.add_params(template,params_dict)
    cmd_file = os.path.join(cmd_file_path, '%s.py'%name)
    print("Generating: %s"%cmd_file)

    sge.py_cmd(ssh,
               code,
               file_name=cmd_file,
               python=python_path)

    cmd_file = os.path.join(cmd_file_path, '%s.py'%name)
    batch_sge.append(sge.qsub_cmd(
        '%s %s'%(bashcmd, cmd_file), name, mem_usage=mem))
"""

This is a wrapper for creating sge commands for parallel computation of model
parameters for SFM models from many subjects.

"""

import os
import nibabel as ni
import numpy as np
import osmosis.io as oio
from osmosis.parallel import sge

import osmosis.parallel.kfold_xval_precision_template as mb_template
reload(mb_template)
template = sge.getsourcelines(mb_template)[0]

ssh = sge.SSH(hostname='proclus.stanford.edu', username='******', port=22)

batch_sge = []
for i in np.arange(65):
    params_dict = dict(i=i)
    code = sge.add_params(template, params_dict)
    name = 'kfold_xval_sph_cc_m%s' % (i)
    cmd_file = '/home/klchan13/pycmd/%s.py' % name
    print("Generating: %s" % cmd_file)

    sge.py_cmd(ssh,
               code,
               file_name=cmd_file,
               python='/home/klchan13/anaconda/bin/python')
"""

This is a wrapper for creating sge commands for parallel computation of model
parameters for SFM models from many subjects.

"""

import os
import nibabel as ni
import numpy as np
import osmosis.io as oio
from osmosis.parallel import sge

import osmosis.parallel.mb_predict_template_smm as mb_template
reload(mb_template)
template = sge.getsourcelines(mb_template)[0]


ssh = sge.SSH(hostname='proclus.stanford.edu',username='******', port=22)

batch_sge = []
for i in range(65): 
    params_dict = dict(i=i)
    code = sge.add_params(template,params_dict)
    name = 'multi_bi_exp_rs%s'%(i)
    cmd_file = '/home/klchan13/pycmd/%s.py'%name
    print("Generating: %s"%cmd_file)
                        
    sge.py_cmd(ssh,
               code,
               file_name=cmd_file,
Example #4
0
7. Once that's done, you should be able to run:
   python ssd_reassmble
Which will generate the parameter files. Use these. 

"""

import os
import nibabel as ni
import numpy as np
import osmosis.io as oio
from osmosis.parallel import sge

import osmosis.parallel.ssd_template as ssd_template
reload(ssd_template)
template = sge.getsourcelines(ssd_template)[0]

alphas = [0.0001, 0.0005, 0.001, 0.0025, 0.005, 0.0075, 0.01, 0.025, 0.05]
l1_ratios = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]

data_path = '/hsgs/u/arokem/tmp/'

ssh = sge.SSH(hostname='proclus.stanford.edu', username='******', port=22)

batch_sge = []
for subject in ['FP']:  #,'HT']
    subject_path = os.path.join(oio.data_path, subject)
    wm_mask_file = os.path.join(subject_path, '%s_wm_mask.nii.gz' % subject)
    wm_nifti = ni.load(wm_mask_file)
    wm_data = wm_nifti.get_data()
    n_wm_vox = np.sum(wm_data)
Example #5
0
7. Once that's done, you should be able to run:
   python ssd_reassmble
Which will generate the parameter files. Use these. 

"""

import os
import nibabel as ni
import numpy as np
import osmosis.io as oio
from osmosis.parallel import sge

import osmosis.parallel.ssd_template as ssd_template
reload(ssd_template)
template = sge.getsourcelines(ssd_template)[0]

alphas = [0.0001, 0.0005, 0.001, 0.0025, 0.005, 0.0075, 0.01, 0.025, 0.05]
l1_ratios = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]

data_path = '/hsgs/u/arokem/tmp/'

ssh = sge.SSH(hostname='proclus.stanford.edu',username='******', port=22)

batch_sge = []
for subject in ['FP']: #,'HT']
    subject_path = os.path.join(oio.data_path, subject)
    wm_mask_file = os.path.join(subject_path, '%s_wm_mask.nii.gz'%subject)
    wm_nifti = ni.load(wm_mask_file)
    wm_data = wm_nifti.get_data()
    n_wm_vox = np.sum(wm_data)