A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
import os | |
import argparse | |
import nibabel as nib | |
from nibabel.streamlines import Field | |
from nibabel.orientations import aff2axcodes | |
def build_argparser(): | |
DESCRIPTION = "Convert tractograms (TCK -> TRK)." |
import os | |
import argparse | |
import nibabel as nib | |
def build_argparser(): | |
DESCRIPTION = "Convert tractograms (TRK -> TCK)." | |
p = argparse.ArgumentParser(description=DESCRIPTION) | |
p.add_argument('tractograms', metavar='bundle', nargs="+", help='list of tractograms.') | |
p.add_argument('-f', '--force', action="store_true", help='overwrite existing output files.') |
from dipy.reconst.shore import ShoreModel | |
from dipy.reconst.forecast import ForecastModel | |
from dipy.data import (fetch_cenir_multib, read_cenir_multib, get_sphere, | |
fetch_isbi2013_2shell, read_isbi2013_2shell, | |
fetch_cfin_multib, read_cfin_dwi) | |
import time | |
import multiprocessing | |
import numpy as np | |
import math |
import QtQuick 2.3 | |
import Renderer 1.0 | |
Item { | |
width: 500 | |
height: 600 | |
FBORenderer{ | |
id: fboRenderItem | |
anchors.fill: parent |
#!/usr/bin/env python | |
import argparse | |
import sys | |
import jinja2 | |
import markdown | |
TEMPLATE = """<!DOCTYPE html> | |
<html> |
Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.
cherry-pick
does support a range of commits, but if you have merge commits in that range, it gets really complicated
git checkout branch-B
git cherry-pick X
git cherry-pick Y
#!/usr/bin/env python | |
""" | |
===================================== | |
PEP 20 (The Zen of Python) by example | |
===================================== | |
Usage: %prog | |
:Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com |
import numpy as np | |
from dipy.sims.voxel import multi_tensor_odf | |
from dipy.data import get_sphere | |
from dipy.reconst.shm import sf_to_sh | |
mevals = np.array([[0.0015, 0.0003, 0.0003], | |
[0.0015, 0.0003, 0.0003]]) | |
angles = [(0, 0), (60, 0)] | |
fractions = [50, 50] |
""" | |
========================================== | |
Motion correction of DWI data | |
========================================== | |
""" | |
import numpy as np | |
from dipy.viz import regtools | |
from dipy.data import fetch_stanford_hardi, read_stanford_hardi | |
from dipy.data.fetcher import fetch_syn_data, read_syn_data |