Skip to content

Commit

Permalink
merging files from master: travis, examples/pipeline, integration-tes…
Browse files Browse the repository at this point in the history
…t.sh, yass/util.py
  • Loading branch information
Eduardo Blancas Reyes committed Sep 6, 2018
1 parent 0a847f5 commit c0f7779
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 29 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions examples/pipeline/cluster.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import numpy as np
import logging

import yass
from yass import preprocess
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)
10 changes: 6 additions & 4 deletions examples/pipeline/deconvolute.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import numpy as np

import yass
from yass import preprocess
Expand All @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions examples/pipeline/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion examples/pipeline/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
10 changes: 6 additions & 4 deletions examples/pipeline/templates.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import numpy as np
import logging

import yass
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions integration-test/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions src/yass/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand All @@ -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]
Expand Down

0 comments on commit c0f7779

Please sign in to comment.