AllenInstitute / ipfx

computes intrinsic cell features from intracellular electrophysiology data
https://ipfx.readthedocs.io/en/latest/
Other
24 stars 36 forks source link

Tests fail in master #188

Closed t-b closed 5 years ago

t-b commented 5 years ago
============================= test session starts =============================
platform win32 -- Python 2.7.15, pytest-4.1.1, py-1.5.3, pluggy-0.8.1 -- c:\anaconda2\python.exe
cachedir: .pytest_cache
rootdir: E:\projekte\allensdk.ipfx, inifile: setup.cfg
plugins: xdist-1.24.1, forked-0.2, cov-2.6.0
collecting ... collected 109 items

test_data_set_features.py::test_select_subthreshold_min_amplitude PASSED [  0%]
test_ephys_data_set.py::test_get_sweep_number_by_stimulus_name_invalid_sweep PASSED [  1%]
test_ephys_data_set.py::test_get_sweep_number_by_stimulus_name_works_1 PASSED [  2%]
test_ephys_data_set.py::test_get_sweep_number_by_stimulus_name_works_and_returns_only_the_last PASSED [  3%]
test_ephys_data_set.py::test_filtered_sweep_table_works PASSED           [  4%]
test_ephys_data_set.py::test_filtered_sweep_table_works_with_sweep_number PASSED [  5%]
test_ephys_data_set.py::test_get_sweep_meta_data PASSED                  [  6%]
test_ephys_data_set.py::test_sweep_raises PASSED                         [  7%]
test_ephys_data_set.py::test_set_sweep_raises_int PASSED                 [  8%]
test_ephys_data_set.py::test_set_sweep_raises_list PASSED                [  9%]
test_ephys_data_set.py::test_aligned_sweeps_raises PASSED                [ 10%]
test_ephys_data_set.py::test_extract_sweep_meta_data_raises PASSED       [ 11%]
test_ephys_data_set.py::test_modify_api_sweep_info PASSED                [ 11%]
test_ephys_data_set.py::test_get_stimulus_name PASSED                    [ 12%]
test_ephys_data_set.py::test_get_stimulus_name_works PASSED              [ 13%]
test_ephys_data_set.py::test_get_sweep_data PASSED                       [ 14%]
test_ephys_extractor.py::test_extractors_no_values PASSED                [ 15%]
test_ephys_extractor.py::test_extractor_wrong_inputs PASSED              [ 16%]
test_ephys_extractor.py::test_extractor_on_sample_data PASSED            [ 17%]
test_ephys_extractor.py::test_extractor_on_sample_data_with_i PASSED     [ 18%]
test_ephys_extractor.py::test_extractor_on_zero_voltage PASSED           [ 19%]
test_ephys_extractor.py::test_extractor_on_variable_time_step PASSED     [ 20%]
test_ephys_extractor.py::test_extractor_with_high_init_dvdt PASSED       [ 21%]
test_epochs.py::test_find_stim_window PASSED                             [ 22%]
test_epochs.py::test_get_experiment_epoch[i0-4-expt_epoch0] PASSED       [ 22%]
test_epochs.py::test_get_experiment_epoch[i1-4-expt_epoch1] PASSED       [ 23%]
test_epochs.py::test_get_experiment_epoch[i2-4-expt_epoch2] PASSED       [ 24%]
test_epochs.py::test_get_experiment_epoch[i3-4-expt_epoch3] PASSED       [ 25%]
test_epochs.py::test_get_stim_epoch[i0-stim_epoch0] PASSED               [ 26%]
test_epochs.py::test_get_stim_epoch[i1-stim_epoch1] PASSED               [ 27%]
test_epochs.py::test_get_stim_epoch[i2-stim_epoch2] PASSED               [ 28%]
test_epochs.py::test_get_stim_epoch[i3-stim_epoch3] PASSED               [ 29%]
test_epochs.py::test_get_stim_epoch_error PASSED                         [ 30%]
test_feature_record.py::test_nan_get PASSED                              [ 31%]
test_feature_record.py::test_add_features_to_record PASSED               [ 32%]
test_hbg_dataset.py::test_main_abf[None-2018_03_20_0005.nwb] PASSED      [ 33%]
test_hbg_dataset.py::test_main_dat[None-H18.28.015.11.14.nwb] PASSED     [ 33%]
test_ipfx.py::test_example PASSED                                        [ 34%]
test_nwb_reader.py::test_raises_on_missing_file PASSED                   [ 35%]
test_nwb_reader.py::test_raises_on_empty_h5_file PASSED                  [ 36%]
test_nwb_reader.py::test_valid_v1_but_unknown_sweep_naming PASSED        [ 37%]
test_nwb_reader.py::test_valid_v1_skeleton_MIES PASSED                   [ 38%]
test_nwb_reader.py::test_valid_v1_skeleton_Pipeline PASSED               [ 39%]
test_nwb_reader.py::test_valid_v1_skeleton_X_NWB PASSED                  [ 40%]
test_nwb_reader.py::test_assumed_sweep_number_fallback[500844779.nwb] PASSED [ 41%]
test_nwb_reader.py::test_assumed_sweep_number_fallback[509604657.nwb] PASSED [ 42%]
test_nwb_reader.py::test_valid_v1_full_Pipeline[595570553] PASSED        [ 43%]
test_nwb_reader.py::test_valid_v1_full_MIES_1[UntitledExperiment-2018_12_03_234957-compressed.nwb] PASSED [ 44%]
test_nwb_reader.py::test_valid_v1_full_MIES_2[H18.03.315.11.11.01.05.nwb] PASSED [ 44%]
test_nwb_reader.py::test_valid_v1_full_MIES_3[Sst-IRES-CreAi14-395722.01.01.01.nwb] PASSED [ 45%]
test_nwb_reader.py::test_valid_v2_full_ABF[2018_03_20_0005.nwb] PASSED   [ 46%]
test_nwb_reader.py::test_valid_v2_full_DAT[H18.28.015.11.14.nwb] PASSED  [ 47%]
test_ontology.py::test_load_default_ontology PASSED                      [ 48%]
test_ontology.py::test_find PASSED                                       [ 49%]
test_ontology.py::test_find_one PASSED                                   [ 50%]
test_ontology.py::test_has PASSED                                        [ 51%]
test_pipeline_output.py::test_pipeline_output[\allen\aibs\informatics\module_test_data\ipfx\test_specimens\500844783\pipeline_input.json-\allen\aibs\informatics\module_test_data\ipfx\test_specimens\500844783\pipeline_output.json] FAILED [ 52%]
test_pipeline_output.py::test_pipeline_output[\allen\aibs\informatics\module_test_data\ipfx\test_specimens\Npr3-IRES2-CreSst-IRES-FlpOAi65-401243.04.01.01\pipeline_input.json-\allen\aibs\informatics\module_test_data\ipfx\test_specimens\Npr3-IRES2-CreSst-IRES-FlpOAi65-401243.04.01.01\pipeline_output.json] FAILED [ 53%]
test_pipeline_output.py::test_pipeline_output[\allen\aibs\informatics\module_test_data\ipfx\test_specimens\Sst-IRES-CreAi14-395722.01.01.01\pipeline_input.json-\allen\aibs\informatics\module_test_data\ipfx\test_specimens\Sst-IRES-CreAi14-395722.01.01.01\pipeline_output.json] FAILED [ 54%]
test_pipeline_output.py::test_pipeline_output[\allen\aibs\informatics\module_test_data\ipfx\test_specimens\509604672\pipeline_input.json-\allen\aibs\informatics\module_test_data\ipfx\test_specimens\509604672\pipeline_output.json] FAILED [ 55%]
test_pipeline_output.py::test_pipeline_output[\allen\aibs\informatics\module_test_data\ipfx\test_specimens\H18.03.315.11.11.01.05\pipeline_input.json-\allen\aibs\informatics\module_test_data\ipfx\test_specimens\H18.03.315.11.11.01.05\pipeline_output.json] FAILED [ 55%]
test_qc_features.py::test_measure_blowout PASSED                         [ 56%]
test_qc_features.py::test_measure_electrode_0 PASSED                     [ 57%]
test_qc_features.py::test_measure_seal PASSED                            [ 58%]
test_qc_features.py::test_measure_input_resistance PASSED                [ 59%]
test_spike_detector.py::test_v_and_t_are_arrays PASSED                   [ 60%]
test_spike_detector.py::test_size_mismatch PASSED                        [ 61%]
test_spike_detector.py::test_detect_one_spike PASSED                     [ 62%]
test_spike_detector.py::test_detect_two_spikes PASSED                    [ 63%]
test_spike_detector.py::test_detect_no_spikes PASSED                     [ 64%]
test_spike_detector.py::test_detect_no_spike_peaks PASSED                [ 65%]
test_spike_detector.py::test_detect_two_spike_peaks PASSED               [ 66%]
test_spike_detector.py::test_filter_problem_spikes PASSED                [ 66%]
test_spike_detector.py::test_filter_no_spikes PASSED                     [ 67%]
test_spike_detector.py::test_find_clipped_spikes PASSED                  [ 68%]
test_spike_detector.py::test_downstrokes PASSED                          [ 69%]
test_spike_detector.py::test_downstrokes_too_many_troughs PASSED         [ 70%]
test_spike_detector.py::test_troughs PASSED                              [ 71%]
test_spike_detector.py::test_troughs_with_peak_at_end PASSED             [ 72%]
test_spike_detector.py::test_check_spikes_and_peaks PASSED               [ 73%]
test_spike_detector.py::test_thresholds PASSED                           [ 74%]
test_spike_detector.py::test_thresholds_cannot_find_target PASSED        [ 75%]
test_spike_detector.py::test_upstrokes PASSED                            [ 76%]
test_spike_features.py::test_width_calculation PASSED                    [ 77%]
test_spike_features.py::test_width_calculation_too_many_troughs PASSED   [ 77%]
test_spike_features.py::test_width_calculation_with_burst SKIPPED        [ 78%]
test_stim_features.py::test_get_stimuli_characteristics[i0-False-stim_characteristics0] PASSED [ 79%]
test_stim_features.py::test_get_stimuli_characteristics[i1-True-stim_characteristics1] PASSED [ 80%]
test_stim_features.py::test_get_stimuli_characteristics[i2-True-stim_characteristics2] PASSED [ 81%]
test_stim_features.py::test_get_stimuli_characteristics[i3-False-stim_characteristics3] PASSED [ 82%]
test_stim_features.py::test_get_stimuli_characteristics[i4-True-stim_characteristics4] PASSED [ 83%]
test_stim_features.py::test_get_stimuli_characteristics[i5-True-stim_characteristics5] PASSED [ 84%]
test_stim_features.py::test_get_stimuli_characteristics[i6-True-stim_characteristics6] PASSED [ 85%]
test_stim_features.py::test_get_stimuli_characteristics[i7-False-stim_characteristics7] PASSED [ 86%]
test_stim_features.py::test_none_get_stimuli_characteristics PASSED      [ 87%]
test_stim_features.py::test_find_stim_interval PASSED                    [ 88%]
test_stimulus_protocol_analysis.py::test_find_rheobase_sweep PASSED      [ 88%]
test_stimulus_protocol_analysis.py::test_find_hero_sweep PASSED          [ 89%]
test_subthresh_features.py::test_input_resistance FAILED                 [ 90%]
test_subthresh_features.py::test_time_constant PASSED                    [ 91%]
test_subthresh_features.py::test_time_constant_noise_rejection PASSED    [ 92%]
test_subthresh_features.py::test_time_constant_noise_acceptance PASSED   [ 93%]
test_sweep.py::test_select_epoch ERROR                                   [ 94%]
test_sweep.py::test_set_time_zero_to_index ERROR                         [ 95%]
test_sweep_extraction.py::test_extractor_on_variable_time_step PASSED    [ 96%]
test_sweep_props.py::test_count_sweep_states PASSED                      [ 97%]
test_time_series_utils.py::test_find_time_out_of_bounds PASSED           [ 98%]
test_time_series_utils.py::test_dvdt_no_filter PASSED                    [ 99%]
test_time_series_utils.py::test_fixed_dt PASSED                          [100%]

=================================== ERRORS ====================================
_____________________ ERROR at setup of test_select_epoch _____________________

    @pytest.fixture()
    def sweep():

        i = [0,0,1,1,0,0,0,2,2,2,2,2,0,0,0,0]
        v = [0,0,1,2,1,0,0,1,2,3,1,0,0,0,0,0]
        sampling_rate = 2
        dt = 1./sampling_rate
        t = np.arange(0,len(v))*dt

>       return Sweep(t, v, i, sampling_rate=sampling_rate, clamp_mode="CurrentClamp")

test_sweep.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\ipfx\sweep.py:28: in __init__
    self.detect_epochs()
..\ipfx\sweep.py:66: in detect_epochs
    start_idx, end_idx = epoch_detector()
..\ipfx\sweep.py:87: in detect_recording_epoch
    return 0, np.flatnonzero(self.response)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

a = [0, 0, 1, 2, 1, 0, ...]

    def flatnonzero(a):
        """
        Return indices that are non-zero in the flattened version of a.

        This is equivalent to a.ravel().nonzero()[0].

        Parameters
        ----------
        a : ndarray
            Input array.

        Returns
        -------
        res : ndarray
            Output array, containing the indices of the elements of `a.ravel()`
            that are non-zero.

        See Also
        --------
        nonzero : Return the indices of the non-zero elements of the input array.
        ravel : Return a 1-D array containing the elements of the input array.

        Examples
        --------
        >>> x = np.arange(-2, 3)
        >>> x
        array([-2, -1,  0,  1,  2])
        >>> np.flatnonzero(x)
        array([0, 1, 3, 4])

        Use the indices of the non-zero elements as an index array to extract
        these elements:

        >>> x.ravel()[np.flatnonzero(x)]
        array([-2, -1,  1,  2])

        """
>       return a.ravel().nonzero()[0]
E       AttributeError: 'list' object has no attribute 'ravel'

c:\anaconda2\lib\site-packages\numpy\core\numeric.py:896: AttributeError
________________ ERROR at setup of test_set_time_zero_to_index ________________

    @pytest.fixture()
    def sweep():

        i = [0,0,1,1,0,0,0,2,2,2,2,2,0,0,0,0]
        v = [0,0,1,2,1,0,0,1,2,3,1,0,0,0,0,0]
        sampling_rate = 2
        dt = 1./sampling_rate
        t = np.arange(0,len(v))*dt

>       return Sweep(t, v, i, sampling_rate=sampling_rate, clamp_mode="CurrentClamp")

test_sweep.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\ipfx\sweep.py:28: in __init__
    self.detect_epochs()
..\ipfx\sweep.py:66: in detect_epochs
    start_idx, end_idx = epoch_detector()
..\ipfx\sweep.py:87: in detect_recording_epoch
    return 0, np.flatnonzero(self.response)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

a = [0, 0, 1, 2, 1, 0, ...]

    def flatnonzero(a):
        """
        Return indices that are non-zero in the flattened version of a.

        This is equivalent to a.ravel().nonzero()[0].

        Parameters
        ----------
        a : ndarray
            Input array.

        Returns
        -------
        res : ndarray
            Output array, containing the indices of the elements of `a.ravel()`
            that are non-zero.

        See Also
        --------
        nonzero : Return the indices of the non-zero elements of the input array.
        ravel : Return a 1-D array containing the elements of the input array.

        Examples
        --------
        >>> x = np.arange(-2, 3)
        >>> x
        array([-2, -1,  0,  1,  2])
        >>> np.flatnonzero(x)
        array([0, 1, 3, 4])

        Use the indices of the non-zero elements as an index array to extract
        these elements:

        >>> x.ravel()[np.flatnonzero(x)]
        array([-2, -1,  1,  2])

        """
>       return a.ravel().nonzero()[0]
E       AttributeError: 'list' object has no attribute 'ravel'

c:\anaconda2\lib\site-packages\numpy\core\numeric.py:896: AttributeError
================================== FAILURES ===================================
 test_pipeline_output[/allen/aibs/informatics/module_test_data/ipfx/test_specimens/500844783/pipeline_input.json-/allen/aibs/informatics/module_test_data/ipfx/test_specimens/500844783/pipeline_output.json] 

input_json = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/500844783/pipeline_input.json'
output_json = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/500844783/pipeline_output.json'
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x00000000041DD860>, _basetemp=None))

    @pytest.mark.parametrize('input_json,output_json', test_specimens_params)
    def test_pipeline_output(input_json, output_json, tmpdir_factory):
        """
        Runs pipeline, saves to a json file and compares to the existing pipeline output.
        Raises assertion error if test output is different from the benchmark.

        Parameters
        ----------
        input_json: string json file name of input
        output_json: string json file name of benchmark output
        tmpdir_factory: pytest fixture

        Returns
        -------

        """
        print(input_json, output_json)

>       pipeline_input = ju.read(input_json)

test_pipeline_output.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

file_name = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/500844783/pipeline_input.json'

    def read(file_name):
        """ Shortcut reading JSON from a file. """
>       with open(file_name, 'rb') as f:
E       IOError: [Errno 2] No such file or directory: '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/500844783/pipeline_input.json'

c:\anaconda2\lib\site-packages\allensdk\core\json_utilities.py:56: IOError
---------------------------- Captured stdout call -----------------------------
('/allen/aibs/informatics/module_test_data/ipfx/test_specimens/500844783/pipeline_input.json', '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/500844783/pipeline_output.json')
 test_pipeline_output[/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Npr3-IRES2-CreSst-IRES-FlpOAi65-401243.04.01.01/pipeline_input.json-/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Npr3-IRES2-CreSst-IRES-FlpOAi65-401243.04.01.01/pipeline_output.json] 

input_json = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Npr3-IRES2-CreSst-IRES-FlpOAi65-401243.04.01.01/pipeline_input.json'
output_json = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Npr3-IRES2-CreSst-IRES-FlpOAi65-401243.04.01.01/pipeline_output.json'
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x00000000041DD860>, _basetemp=None))

    @pytest.mark.parametrize('input_json,output_json', test_specimens_params)
    def test_pipeline_output(input_json, output_json, tmpdir_factory):
        """
        Runs pipeline, saves to a json file and compares to the existing pipeline output.
        Raises assertion error if test output is different from the benchmark.

        Parameters
        ----------
        input_json: string json file name of input
        output_json: string json file name of benchmark output
        tmpdir_factory: pytest fixture

        Returns
        -------

        """
        print(input_json, output_json)

>       pipeline_input = ju.read(input_json)

test_pipeline_output.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

file_name = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Npr3-IRES2-CreSst-IRES-FlpOAi65-401243.04.01.01/pipeline_input.json'

    def read(file_name):
        """ Shortcut reading JSON from a file. """
>       with open(file_name, 'rb') as f:
E       IOError: [Errno 2] No such file or directory: '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Npr3-IRES2-CreSst-IRES-FlpOAi65-401243.04.01.01/pipeline_input.json'

c:\anaconda2\lib\site-packages\allensdk\core\json_utilities.py:56: IOError
---------------------------- Captured stdout call -----------------------------
('/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Npr3-IRES2-CreSst-IRES-FlpOAi65-401243.04.01.01/pipeline_input.json', '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Npr3-IRES2-CreSst-IRES-FlpOAi65-401243.04.01.01/pipeline_output.json')
 test_pipeline_output[/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Sst-IRES-CreAi14-395722.01.01.01/pipeline_input.json-/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Sst-IRES-CreAi14-395722.01.01.01/pipeline_output.json] 

input_json = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Sst-IRES-CreAi14-395722.01.01.01/pipeline_input.json'
output_json = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Sst-IRES-CreAi14-395722.01.01.01/pipeline_output.json'
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x00000000041DD860>, _basetemp=None))

    @pytest.mark.parametrize('input_json,output_json', test_specimens_params)
    def test_pipeline_output(input_json, output_json, tmpdir_factory):
        """
        Runs pipeline, saves to a json file and compares to the existing pipeline output.
        Raises assertion error if test output is different from the benchmark.

        Parameters
        ----------
        input_json: string json file name of input
        output_json: string json file name of benchmark output
        tmpdir_factory: pytest fixture

        Returns
        -------

        """
        print(input_json, output_json)

>       pipeline_input = ju.read(input_json)

test_pipeline_output.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

file_name = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Sst-IRES-CreAi14-395722.01.01.01/pipeline_input.json'

    def read(file_name):
        """ Shortcut reading JSON from a file. """
>       with open(file_name, 'rb') as f:
E       IOError: [Errno 2] No such file or directory: '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Sst-IRES-CreAi14-395722.01.01.01/pipeline_input.json'

c:\anaconda2\lib\site-packages\allensdk\core\json_utilities.py:56: IOError
---------------------------- Captured stdout call -----------------------------
('/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Sst-IRES-CreAi14-395722.01.01.01/pipeline_input.json', '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/Sst-IRES-CreAi14-395722.01.01.01/pipeline_output.json')
 test_pipeline_output[/allen/aibs/informatics/module_test_data/ipfx/test_specimens/509604672/pipeline_input.json-/allen/aibs/informatics/module_test_data/ipfx/test_specimens/509604672/pipeline_output.json] 

input_json = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/509604672/pipeline_input.json'
output_json = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/509604672/pipeline_output.json'
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x00000000041DD860>, _basetemp=None))

    @pytest.mark.parametrize('input_json,output_json', test_specimens_params)
    def test_pipeline_output(input_json, output_json, tmpdir_factory):
        """
        Runs pipeline, saves to a json file and compares to the existing pipeline output.
        Raises assertion error if test output is different from the benchmark.

        Parameters
        ----------
        input_json: string json file name of input
        output_json: string json file name of benchmark output
        tmpdir_factory: pytest fixture

        Returns
        -------

        """
        print(input_json, output_json)

>       pipeline_input = ju.read(input_json)

test_pipeline_output.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

file_name = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/509604672/pipeline_input.json'

    def read(file_name):
        """ Shortcut reading JSON from a file. """
>       with open(file_name, 'rb') as f:
E       IOError: [Errno 2] No such file or directory: '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/509604672/pipeline_input.json'

c:\anaconda2\lib\site-packages\allensdk\core\json_utilities.py:56: IOError
---------------------------- Captured stdout call -----------------------------
('/allen/aibs/informatics/module_test_data/ipfx/test_specimens/509604672/pipeline_input.json', '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/509604672/pipeline_output.json')
 test_pipeline_output[/allen/aibs/informatics/module_test_data/ipfx/test_specimens/H18.03.315.11.11.01.05/pipeline_input.json-/allen/aibs/informatics/module_test_data/ipfx/test_specimens/H18.03.315.11.11.01.05/pipeline_output.json] 

input_json = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/H18.03.315.11.11.01.05/pipeline_input.json'
output_json = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/H18.03.315.11.11.01.05/pipeline_output.json'
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x00000000041DD860>, _basetemp=None))

    @pytest.mark.parametrize('input_json,output_json', test_specimens_params)
    def test_pipeline_output(input_json, output_json, tmpdir_factory):
        """
        Runs pipeline, saves to a json file and compares to the existing pipeline output.
        Raises assertion error if test output is different from the benchmark.

        Parameters
        ----------
        input_json: string json file name of input
        output_json: string json file name of benchmark output
        tmpdir_factory: pytest fixture

        Returns
        -------

        """
        print(input_json, output_json)

>       pipeline_input = ju.read(input_json)

test_pipeline_output.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

file_name = '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/H18.03.315.11.11.01.05/pipeline_input.json'

    def read(file_name):
        """ Shortcut reading JSON from a file. """
>       with open(file_name, 'rb') as f:
E       IOError: [Errno 2] No such file or directory: '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/H18.03.315.11.11.01.05/pipeline_input.json'

c:\anaconda2\lib\site-packages\allensdk\core\json_utilities.py:56: IOError
---------------------------- Captured stdout call -----------------------------
('/allen/aibs/informatics/module_test_data/ipfx/test_specimens/H18.03.315.11.11.01.05/pipeline_input.json', '/allen/aibs/informatics/module_test_data/ipfx/test_specimens/H18.03.315.11.11.01.05/pipeline_output.json')
____________________________ test_input_resistance ____________________________

    def test_input_resistance():
        t = np.arange(0, 1.0, 5e-6)
        v1 = np.ones_like(t) * -5.
        v2 = np.ones_like(t) * -10.
        i1 = np.ones_like(t) * -50.
        i2 = np.ones_like(t) * -100.

>       ri = subf.input_resistance([t, t], [i1, i2], [v1, v2], 0, t[-1])

test_subthresh_features.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\ipfx\subthresh_features.py:173: in input_resistance
    m, c = np.linalg.lstsq(A, v,rcond=None)[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

a = array([[ -50., -100.],
       [   1.,    1.]])
b = array([[ -5.],
       [-10.]]), rcond = None

    def lstsq(a, b, rcond=-1):
        """
        Return the least-squares solution to a linear matrix equation.

        Solves the equation `a x = b` by computing a vector `x` that
        minimizes the Euclidean 2-norm `|| b - a x ||^2`.  The equation may
        be under-, well-, or over- determined (i.e., the number of
        linearly independent rows of `a` can be less than, equal to, or
        greater than its number of linearly independent columns).  If `a`
        is square and of full rank, then `x` (but for round-off error) is
        the "exact" solution of the equation.

        Parameters
        ----------
        a : (M, N) array_like
            "Coefficient" matrix.
        b : {(M,), (M, K)} array_like
            Ordinate or "dependent variable" values. If `b` is two-dimensional,
            the least-squares solution is calculated for each of the `K` columns
            of `b`.
        rcond : float, optional
            Cut-off ratio for small singular values of `a`.
            For the purposes of rank determination, singular values are treated
            as zero if they are smaller than `rcond` times the largest singular
            value of `a`.

        Returns
        -------
        x : {(N,), (N, K)} ndarray
            Least-squares solution. If `b` is two-dimensional,
            the solutions are in the `K` columns of `x`.
        residuals : {(), (1,), (K,)} ndarray
            Sums of residuals; squared Euclidean 2-norm for each column in
            ``b - a*x``.
            If the rank of `a` is < N or M <= N, this is an empty array.
            If `b` is 1-dimensional, this is a (1,) shape array.
            Otherwise the shape is (K,).
        rank : int
            Rank of matrix `a`.
        s : (min(M, N),) ndarray
            Singular values of `a`.

        Raises
        ------
        LinAlgError
            If computation does not converge.

        Notes
        -----
        If `b` is a matrix, then all array results are returned as matrices.

        Examples
        --------
        Fit a line, ``y = mx + c``, through some noisy data-points:

        >>> x = np.array([0, 1, 2, 3])
        >>> y = np.array([-1, 0.2, 0.9, 2.1])

        By examining the coefficients, we see that the line should have a
        gradient of roughly 1 and cut the y-axis at, more or less, -1.

        We can rewrite the line equation as ``y = Ap``, where ``A = [[x 1]]``
        and ``p = [[m], [c]]``.  Now use `lstsq` to solve for `p`:

        >>> A = np.vstack([x, np.ones(len(x))]).T
        >>> A
        array([[ 0.,  1.],
               [ 1.,  1.],
               [ 2.,  1.],
               [ 3.,  1.]])

        >>> m, c = np.linalg.lstsq(A, y)[0]
        >>> print(m, c)
        1.0 -0.95

        Plot the data along with the fitted line:

        >>> import matplotlib.pyplot as plt
        >>> plt.plot(x, y, 'o', label='Original data', markersize=10)
        >>> plt.plot(x, m*x + c, 'r', label='Fitted line')
        >>> plt.legend()
        >>> plt.show()

        """
        import math
        a, _ = _makearray(a)
        b, wrap = _makearray(b)
        is_1d = b.ndim == 1
        if is_1d:
            b = b[:, newaxis]
        _assertRank2(a, b)
        _assertNoEmpty2d(a, b)  # TODO: relax this constraint
        m  = a.shape[0]
        n  = a.shape[1]
        n_rhs = b.shape[1]
        ldb = max(n, m)
        if m != b.shape[0]:
            raise LinAlgError('Incompatible dimensions')
        t, result_t = _commonType(a, b)
        result_real_t = _realType(result_t)
        real_t = _linalgRealType(t)
        bstar = zeros((ldb, n_rhs), t)
        bstar[:b.shape[0], :n_rhs] = b.copy()
        a, bstar = _fastCopyAndTranspose(t, a, bstar)
        a, bstar = _to_native_byte_order(a, bstar)
        s = zeros((min(m, n),), real_t)
        # This line:
        #  * is incorrect, according to the LAPACK documentation
        #  * raises a ValueError if min(m,n) == 0
        #  * should not be calculated here anyway, as LAPACK should calculate
        #    `liwork` for us. But that only works if our version of lapack does
        #    not have this bug:
        #      http://icl.cs.utk.edu/lapack-forum/archives/lapack/msg00899.html
        #    Lapack_lite does have that bug...
        nlvl = max( 0, int( math.log( float(min(m, n))/2. ) ) + 1 )
        iwork = zeros((3*min(m, n)*nlvl+11*min(m, n),), fortran_int)
        if isComplexType(t):
            lapack_routine = lapack_lite.zgelsd
            lwork = 1
            rwork = zeros((lwork,), real_t)
            work = zeros((lwork,), t)
            results = lapack_routine(m, n, n_rhs, a, m, bstar, ldb, s, rcond,
                                     0, work, -1, rwork, iwork, 0)
            lwork = int(abs(work[0]))
            rwork = zeros((lwork,), real_t)
            a_real = zeros((m, n), real_t)
            bstar_real = zeros((ldb, n_rhs,), real_t)
            results = lapack_lite.dgelsd(m, n, n_rhs, a_real, m,
                                         bstar_real, ldb, s, rcond,
                                         0, rwork, -1, iwork, 0)
            lrwork = int(rwork[0])
            work = zeros((lwork,), t)
            rwork = zeros((lrwork,), real_t)
            results = lapack_routine(m, n, n_rhs, a, m, bstar, ldb, s, rcond,
                                     0, work, lwork, rwork, iwork, 0)
        else:
            lapack_routine = lapack_lite.dgelsd
            lwork = 1
            work = zeros((lwork,), t)
            results = lapack_routine(m, n, n_rhs, a, m, bstar, ldb, s, rcond,
>                                    0, work, -1, iwork, 0)
E           TypeError: a float is required

c:\anaconda2\lib\site-packages\numpy\linalg\linalg.py:1953: TypeError
============================== warnings summary ===============================
tests/test_qc_features.py::test_measure_electrode_0
  Mean of empty slice.

-- Docs: https://docs.pytest.org/en/latest/warnings.html
-- generated xml file: E:\projekte\allensdk.ipfx\tests\test-reports\test.xml --
==== 6 failed, 100 passed, 1 skipped, 1 warnings, 2 error in 13.67 seconds ====
t-b commented 5 years ago

@sgratiy Here is the link https://blog.buildo.io/github-bamboo-ci-6f681b00d310 I was talking about.

NileGraddis commented 5 years ago

working; no change