From c0f77790c456151c8f7d428dc7eceeb9161ddfe3 Mon Sep 17 00:00:00 2001 From: Eduardo Blancas Reyes Date: Wed, 5 Sep 2018 22:24:13 -0400 Subject: [PATCH] merging files from master: travis, examples/pipeline, integration-test.sh, yass/util.py --- .travis.yml | 1 - examples/pipeline/cluster.py | 10 ++++++---- examples/pipeline/deconvolute.py | 10 ++++++---- examples/pipeline/detect.py | 8 ++++---- examples/pipeline/preprocess.py | 2 +- examples/pipeline/templates.py | 10 ++++++---- integration-test/integration-test.sh | 4 ++-- src/yass/util.py | 12 +++--------- 8 files changed, 28 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f240c95..933ca34a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ script: - pip install tensorflow - make download-test-data - make test - # this is still broken se we are not running integration tests # - make integration-test - make docs diff --git a/examples/pipeline/cluster.py b/examples/pipeline/cluster.py index 15e6fa25..dae794bb 100644 --- a/examples/pipeline/cluster.py +++ b/examples/pipeline/cluster.py @@ -1,3 +1,4 @@ +import numpy as np import logging import yass @@ -5,19 +6,20 @@ from yass import detect from yass import cluster +np.random.seed(0) + # configure logging module to get useful information logging.basicConfig(level=logging.INFO) # set yass configuration parameters -yass.set_config('config_sample.yaml') +yass.set_config('config_sample.yaml', 'preprocess-example/') standarized_path, standarized_params, whiten_filter = preprocess.run() -(score, spike_index_clear, +(spike_index_clear, spike_index_all) = detect.run(standarized_path, standarized_params, whiten_filter) -spike_train_clear, tmp_loc, vbParam = cluster.run( - score, spike_index_clear) +spike_train_clear, tmp_loc, vbParam = cluster.run(spike_index_clear) diff --git a/examples/pipeline/deconvolute.py b/examples/pipeline/deconvolute.py index b113eef3..1351b75f 100644 --- a/examples/pipeline/deconvolute.py +++ b/examples/pipeline/deconvolute.py @@ -1,4 +1,5 @@ import logging +import numpy as np import yass from yass import preprocess @@ -7,22 +8,23 @@ from yass import templates from yass import deconvolute +np.random.seed(0) + # configure logging module to get useful information logging.basicConfig(level=logging.INFO) # set yass configuration parameters -yass.set_config('config_sample.yaml') +yass.set_config('config_sample.yaml', 'deconv-example') standarized_path, standarized_params, whiten_filter = preprocess.run() -(score, spike_index_clear, +(spike_index_clear, spike_index_all) = detect.run(standarized_path, standarized_params, whiten_filter) -spike_train_clear, tmp_loc, vbParam = cluster.run( - score, spike_index_clear) +spike_train_clear, tmp_loc, vbParam = cluster.run(spike_index_clear) (templates_, spike_train, groups, idx_good_templates) = templates.run( diff --git a/examples/pipeline/detect.py b/examples/pipeline/detect.py index 1563a944..b962f031 100644 --- a/examples/pipeline/detect.py +++ b/examples/pipeline/detect.py @@ -12,12 +12,12 @@ logging.basicConfig(level=logging.INFO) # set yass configuration parameters -yass.set_config('config_sample.yaml') +yass.set_config('config_sample.yaml', 'detect-example') # run preprocessor standarized_path, standarized_params, whiten_filter = preprocess.run() # run detection -scores, clear, collision = detect.run(standarized_path, - standarized_params, - whiten_filter) +clear, collision = detect.run(standarized_path, + standarized_params, + whiten_filter) diff --git a/examples/pipeline/preprocess.py b/examples/pipeline/preprocess.py index 0ed8af5c..dd335c38 100644 --- a/examples/pipeline/preprocess.py +++ b/examples/pipeline/preprocess.py @@ -7,7 +7,7 @@ logging.basicConfig(level=logging.INFO) # set yass configuration parameters -yass.set_config('config_sample.yaml') +yass.set_config('config_sample.yaml', 'preprocess-example') # run preprocessor standarized_path, standarized_params, whiten_filter = preprocess.run() diff --git a/examples/pipeline/templates.py b/examples/pipeline/templates.py index 0e1d0040..18f16538 100644 --- a/examples/pipeline/templates.py +++ b/examples/pipeline/templates.py @@ -1,3 +1,4 @@ +import numpy as np import logging import yass @@ -6,22 +7,23 @@ from yass import cluster from yass import templates +np.random.seed(0) + # configure logging module to get useful information logging.basicConfig(level=logging.INFO) # set yass configuration parameters -yass.set_config('config_sample.yaml') +yass.set_config('config_sample.yaml', 'templates-example') standarized_path, standarized_params, whiten_filter = preprocess.run() -(score, spike_index_clear, +(spike_index_clear, spike_index_all) = detect.run(standarized_path, standarized_params, whiten_filter) -spike_train_clear, tmp_loc, vbParam = cluster.run( - score, spike_index_clear) +spike_train_clear, tmp_loc, vbParam = cluster.run(spike_index_clear) (templates_, spike_train, groups, idx_good_templates) = templates.run( diff --git a/integration-test/integration-test.sh b/integration-test/integration-test.sh index 383cd68b..6255aa2b 100755 --- a/integration-test/integration-test.sh +++ b/integration-test/integration-test.sh @@ -9,10 +9,10 @@ cd $DIR/../examples # run readme examples echo "Running config_sample.yaml example" -yass sort config_sample.yaml +yass sort config_sample.yaml --clean echo "Running config_sample_complete.yaml example" -yass sort config_sample_complete.yaml +yass sort config_sample_complete.yaml --clean # run examples in examples/pipeline diff --git a/src/yass/util.py b/src/yass/util.py index eb182b5f..36f92feb 100644 --- a/src/yass/util.py +++ b/src/yass/util.py @@ -506,12 +506,6 @@ def _check_for_files(func): def wrapper(*args, **kwargs): _kwargs = map_parameters_in_fn_call(args, kwargs, func) - # if not relative_path exists, just run the function - if _kwargs.get(relative_to) is None: - logging.debug('No output path was passed, running the ' - 'function without checking for files...') - return func(*args, **kwargs) - if_file_exists = _kwargs['if_file_exists'] if mode == 'extract': @@ -520,13 +514,13 @@ def wrapper(*args, **kwargs): else: names = filenames - if prepend_root_folder and not os.path.isabs(_kwargs[relative_to]): + if relative_to is None: CONFIG = yass.read_config() - root_path = Path(CONFIG.data.root_folder, _kwargs[relative_to]) + root_path = Path(CONFIG.path_to_output_directory) else: root_path = Path(_kwargs[relative_to]) - root_path.mkdir(parents=True, exist_ok=True) + root_path.mkdir(parents=True, exist_ok=True) # generate paths for files paths = [root_path / f.value for f in names]