diff --git a/.github/workflows/nestbuildmatrix.yml b/.github/workflows/nestbuildmatrix.yml index 0d98db8f1b..3990524259 100644 --- a/.github/workflows/nestbuildmatrix.yml +++ b/.github/workflows/nestbuildmatrix.yml @@ -49,6 +49,7 @@ jobs: cpp_compiler: "clang" steps: + - uses: actions/checkout@v2 # Steps represent a sequence of tasks that will be executed as part of the job - name: Checkout repo content @@ -137,3 +138,8 @@ jobs: python extras/parse_build_log.py gha_build.sh.log ${{ github.workspace }} env: xNEST_BUILD_TYPE: FULL + + - name: tmate + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + diff --git a/pynest/nest/tests/test_visualization.py b/pynest/nest/tests/test_visualization.py index b49538b245..e39ee1cdc2 100644 --- a/pynest/nest/tests/test_visualization.py +++ b/pynest/nest/tests/test_visualization.py @@ -49,6 +49,8 @@ except ImportError: HAVE_PANDAS = False +import nest.voltage_trace as nvtrace +import nest.raster_plot as nraster class VisualizationTestCase(unittest.TestCase): def nest_tmpdir(self): @@ -88,27 +90,36 @@ def voltage_trace_verify(self, device): x_data, y_data = line.get_data() # Check that times are correct self.assertEqual(list(x_data), list(np.unique(device.get('events', 'times')))) + print("times:") + print(x_data) + print(list(np.unique(device.get('events', 'times')))) # Check that voltmeter data corresponds to the lines in the plot self.assertTrue(all(np.isclose(ref_vm, y_data))) + print("v_m:") + print(ref_vm) + print(y_data) plt.close(ax.get_figure()) @unittest.skipIf(not PLOTTING_POSSIBLE, 'Plotting impossible because matplotlib or display missing') def test_voltage_trace_from_device(self): """Test voltage_trace from device""" - import nest.voltage_trace as nvtrace nest.ResetKernel() nodes = nest.Create('iaf_psc_alpha', 2) pg = nest.Create('poisson_generator', 1, {'rate': 1000.}) device = nest.Create('voltmeter') nest.Connect(pg, nodes) nest.Connect(device, nodes) + wfwf = nest.Create('spike_recorder') + nest.Connect(pg, wfwf) nest.Simulate(100) # Test with data from device + print("From device:--------------------------------------") + print("Recording times: " + str(device.get('events')['times'])) nest.voltage_trace.from_device(device) self.voltage_trace_verify(device) - # Test with fata from file + # Test with data from file vm = device.get('events') data = np.zeros([len(vm['senders']), 3]) data[:, 0] = vm['senders'] @@ -116,7 +127,10 @@ def test_voltage_trace_from_device(self): data[:, 2] = vm['V_m'] filename = os.path.join(self.nest_tmpdir(), 'voltage_trace.txt') self.filenames.append(filename) + print("FILENAME::::::::::::::::: " + str(filename)) np.savetxt(filename, data) + + print("From file:--------------------------------------") nest.voltage_trace.from_file(filename) self.voltage_trace_verify(device) @@ -150,7 +164,6 @@ def spike_recorder_raster_verify(self, sr_ref): @unittest.skipIf(not PLOTTING_POSSIBLE, 'Plotting impossible because matplotlib or display missing') def test_raster_plot(self): """Test raster_plot""" - import nest.raster_plot as nraster sr, sr_to_file = self.spike_recorder_data_setup(to_file=True) spikes = sr.get('events') diff --git a/pynest/nest/voltage_trace.py b/pynest/nest/voltage_trace.py index b466c6e219..ed067d787d 100644 --- a/pynest/nest/voltage_trace.py +++ b/pynest/nest/voltage_trace.py @@ -185,7 +185,10 @@ def from_device(detec, neurons=None, title=None, grayscale=False, plotids = [] for neuron in neurons: + print("times[neuron] = " + str(times[neuron])) + print("timefactor = " + str(timefactor)) time_values = numpy.array(times[neuron]) / timefactor + print("time_values = " + str(time_values)) if grayscale: line_style = "k" @@ -197,6 +200,9 @@ def from_device(detec, neurons=None, title=None, grayscale=False, plt.plot(time_values, voltages[neuron], line_style, label="Neuron %i" % neuron) ) + ax = plt.gca() + for line_idx, line in enumerate(ax.lines): + print("line " + str(line_idx) + " xdata = " + str(line.get_data()[0])) except KeyError: print("INFO: Wrong ID: {0}".format(neuron))