This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ipythonenv)unwarped:temp satra$ which ipython | |
| /software/pysoft/ipythonenv/bin/ipython | |
| (ipythonenv)unwarped:temp satra$ ipython | |
| Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) | |
| Type "copyright", "credits" or "license" for more information. | |
| IPython 0.10 -- An enhanced Interactive Python. | |
| ? -> Introduction and overview of IPython's features. | |
| %quickref -> Quick reference. | |
| help -> Python's own help system. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TraitedSpec2(traits.HasTraits): | |
| trigger = traits.Event | |
| hashval = traits.Property(depends_on='trigger') | |
| @traits.cached_property | |
| def _get_hashval(self): | |
| print "calc hash" | |
| import numpy as np | |
| return np.random.random() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| basedir=$1 | |
| mkdir -p $basedir | |
| mkdir -p installdir | |
| cd installdir | |
| # install python if it doesn't exist | |
| if [ ! -e $basedir/bin/python ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <XCEDE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.xcede.org/xcede-2" version="2.0"> | |
| <subject ID="ID_SUBJECT"> | |
| <subjectInfo> | |
| <sex>male</sex> | |
| </subjectInfo> | |
| </subject> | |
| <visit ID="ID_VISIT" subjectID="ID_SUBJECT"/> | |
| <data xsi:type="assessment_t" ID="ID_AGE" subjectID="ID_SUBJECT" visitID="ID_VISIT"> | |
| <name>age</name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In [127]: zm_samples.shape | |
| Out[127]: (22, 50) | |
| In [128]: grpinfo.shape | |
| Out[128]: (22,) | |
| In [129]: grpinfo[0] | |
| Out[129]: 'a' | |
| In [130]: ds = dataset_wizard(zm_samples, targets=grpinfo, chunks=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import mvpa.suite as ms | |
| # create xor dataset | |
| samples = np.random.rand(100,2)-0.5 | |
| targets = np.sign(samples) | |
| targets = targets[:,0] == targets[:,1] | |
| # display samples |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In [21]: class A(HasTraits): | |
| foo = Either(File(exists=True), List(File(exists=True))) | |
| In [23]: a.foo = '/software/temp/volumecompare.png' | |
| In [25]: a.foo = glob('/software/temp/*.png') | |
| ERROR: An unexpected error occurred while tokenizing input | |
| The following traceback may be corrupted or invalid | |
| The error message is: ('EOF in multi-line statement', (3, 0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In [13]: from enthought.traits.api import * | |
| In [14]: class A(HasTraits): | |
| ....: pass | |
| ....: | |
| In [16]: a = A() | |
| In [17]: a.add_trait('foo',MultiPath(File(exists=True))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| grp1_subjects = ['s1','s2'] | |
| grp2_subjects = ['s3','s4'] | |
| def pickfiles(files, subjects): | |
| outfiles = [] | |
| for s in subjects: | |
| outfiles.extend([f for f in files if s in f]) | |
| return outfiles | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import nipype.interfaces.io as nio | |
| import nipype.pipeline.engine as pe | |
| volsource = pe.Node(interface = nio.DataGrabber(outfields=["dw_imgs"]), name="volsource") | |
| project_dir = "/mindhive/gablab/sad/PY_STUDY_DIR/Block" | |
| volsource.inputs.base_directory = project_dir | |
| volsource.inputs.template = "diffusion/preproc/SAD_*/%s_warp.nii.gz" | |
| volsource.base_dir = '.' | |
| volsource.inputs.template_args = dict(dw_imgs=[[["fa", "ra", "adc"]]]) | |
| res = volsource.run() |
OlderNewer