Skip to content

Commit

Permalink
'mipy' to 'dmipy' replace
Browse files Browse the repository at this point in the history
  • Loading branch information
rutgerfick committed Jan 31, 2018
1 parent 2648086 commit 3c1d944
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 37 deletions.
4 changes: 2 additions & 2 deletions dmipy/core/modeling_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
from pathos.helpers import cpu_count

GRADIENT_TABLES_PATH = pkg_resources.resource_filename(
'mipy', 'data/gradient_tables'
'dmipy', 'data/gradient_tables'
)
SIGNAL_MODELS_PATH = pkg_resources.resource_filename(
'mipy', 'signal_models'
'dmipy', 'signal_models'
)


Expand Down
4 changes: 2 additions & 2 deletions dmipy/data/saved_acquisition_schemes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
acquisition_scheme_from_gradient_strengths)

_GRADIENT_TABLES_PATH = pkg_resources.resource_filename(
'mipy', 'data/gradient_tables'
'dmipy', 'data/gradient_tables'
)
DATA_PATH = pkg_resources.resource_filename(
'mipy', 'data/'
'dmipy', 'data/'
)


Expand Down
2 changes: 1 addition & 1 deletion dmipy/data/saved_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import matplotlib.pyplot as plt
from . import saved_acquisition_schemes
DATA_PATH = pkg_resources.resource_filename(
'mipy', 'data/'
'dmipy', 'data/'
)


Expand Down
6 changes: 3 additions & 3 deletions dmipy/distributions/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@

SPHERICAL_INTEGRATOR = utils.SphericalIntegrator()
GRADIENT_TABLES_PATH = pkg_resources.resource_filename(
'mipy', 'data/gradient_tables'
'dmipy', 'data/gradient_tables'
)
SIGNAL_MODELS_PATH = pkg_resources.resource_filename(
'mipy', 'signal_models'
'dmipy', 'signal_models'
)
DATA_PATH = pkg_resources.resource_filename(
'mipy', 'data'
'dmipy', 'data'
)
SPHERE_CARTESIAN = np.loadtxt(
join(GRADIENT_TABLES_PATH, 'sphere_with_cap.txt')
Expand Down
42 changes: 15 additions & 27 deletions dmipy/hcp_interface/downloader_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import boto
import pkg_resources
import os
import nibabel as nib


HCP_DATA_PATH = pkg_resources.resource_filename(
'mipy', 'data/hcp/'
'dmipy', 'data/hcp/'
)


Expand Down Expand Up @@ -48,6 +50,9 @@ def download_and_prepare_dmipy_example_dataset(self):
if not os.path.exists(directory):
os.makedirs(directory)

print ('Downloading data to {}'.format(directory))

counter = 0
for key in self.s3_bucket.list("HCP_1200"):
path = pathlib.Path(key.name)
if (
Expand All @@ -61,34 +66,17 @@ def download_and_prepare_dmipy_example_dataset(self):
'data' in path.parts[-1] or
'nodif' in path.parts[-1]
):
print ('Downloading {}'.format(path.parts[-1]))
filepath = os.path.join(directory, path.parts[-1])
with open(filepath, 'wb') as f:
key.get_contents_to_file(f)
counter += 1
if counter == 4:
break

def download_hcp_dataset(self, subject):
"""
Parameters
----------
subject: integer
the identification number of the HCP subject to download
"""


def download(aws_key, aws_secret, subject=100307):

for key in s3_bucket.list("HCP_1200"):
path = pathlib.Path(key.name)
if (
len(path.parts) == 5 and
subject == int(path.parts[1]) and
path.parts[-2] == "Diffusion"
):
if (
'bval' in path.parts[-1] or
'bvec' in path.parts[-1] or
'data' in path.parts[-1] or
'nodif' in path.parts[-1]
):
folder_name = "example_slice"
example_directory = os.path.join(HCP_DATA_PATH, folder_name)
if not os.path.exists(example_directory):
os.makedirs(example_directory)

with open(path.parts[-1], 'wb') as f:
key.get_contents_to_file(f)
data = nib.load(os.path.join(directory, 'data.nii.gz')).get_data()
2 changes: 1 addition & 1 deletion dmipy/optimizers/brute2fine.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
numba, have_numba, _ = optional_package("numba")

SPHERES_PATH = pkg_resources.resource_filename(
'mipy', 'data/spheres'
'dmipy', 'data/spheres'
)


Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def setup(app):
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'mipy', 'dmipy Documentation',
('index', 'dmipy', 'dmipy Documentation',
'Rutger Fick, Demian Wassermann', 'dmipy', 'One line description of project.',
'Miscellaneous'),
]
Expand Down

0 comments on commit 3c1d944

Please sign in to comment.