Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wei recon demo #68

Merged
merged 11 commits into from
Oct 14, 2015
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ before_install:
install:
- export GIT_FULL_HASH=`git rev-parse HEAD`
- conda update conda --yes
- conda create -n testenv --yes pip nose python=$TRAVIS_PYTHON_VERSION lmfit numpy scipy six
- conda config --set always_yes true
- conda create -n testenv pip nose python=$TRAVIS_PYTHON_VERSION lmfit numpy scipy six numpydoc pyyaml
- source activate testenv
- conda install numpydoc --yes
# - conda install vistrails --yes
- cd ../
- git clone https://github.com/Nikea/NSLS2.git
- cd NSLS2
- git clone https://github.com/Nikea/scikit-xray.git
- cd scikit-xray
- python setup.py install
- cd ../
- git clone https://github.com/vistrails/vistrails.git
Expand Down
10 changes: 10 additions & 0 deletions vt_config/NSLS-II/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
from vttools import wrap_lib, scrape
from vttools.vtmods.import_lists import load_config

# unrelated so commented out
#from vttools.to_wrap import image
logger = logging.getLogger(__name__)

# get modules to import
Expand Down Expand Up @@ -113,6 +115,14 @@ def get_modules():
'skxray.io.gsas_file_reader',
'skxray.diffraction',
'vttools.to_wrap.fitting',
#'vttools.to_wrap.image.filtering',
#'vttools.to_wrap.image.histogram',
#'vttools.to_wrap.image.logic',
#'vttools.to_wrap.image.math',
#'vttools.to_wrap.image.morphology',
#'vttools.to_wrap.image.registration',
#'vttools.to_wrap.image.thresholding',
#'vttools.to_wrap.image.transformation',
'tomopy',
]

Expand Down
38 changes: 37 additions & 1 deletion vttools/vtmods/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
from tifffile import imread
from skxray.io.binary import read_binary
import numpy as np
import os
import glob

import logging
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -82,6 +84,40 @@ def compute(self):
data_list.append(imread(file))
self.set_output("data", data_list)

class FindData(Module):
_settings = ModuleSettings(namespace="io")

_input_ports = [
IPort(name="file name", label="file name and extension to search for",
signature="basic:String"),
IPort(name="seed path", label="path corresponding to the "
"search starting point. Defaults to "
"the user's home directory.",
default="~", signature="basic:String"),
]

_output_ports = [
OPort(name="file path", signature="basic:String")
]

def compute(self):
seed_path = self.get_input("seed path")
file_name = self.get_input("file name")
print file_name
existing_files = []

for dir_tree in os.walk(os.path.expanduser(seed_path)):
if file_name in dir_tree[2]:
existing_files.append(os.path.join(dir_tree[0], file_name))
print existing_files

for path in existing_files:
if 'Demos' in path:
file_path = path

self.set_output("file path", file_path)



def vistrails_modules():
return [ReadTiff, ReadNumpy]
return [ReadTiff, ReadNumpy, FindData]