Skip to content

Inserting workspace with incorrect dimensions causes error and badly modified data

Jop Wolffs requested to merge github/fork/Famlam/patch-2 into develop

Created by: Famlam

  1. Have spectrum A of size 15000x12 and spectrum B of size 15000x1 (or any size, as long as A is a NxM matrix and B an Nx1 matrix; N,M>1)
  2. On spectrum A, use Combine -> Insert From Workspace. Select spectrum B in the dialog that pops up

The following error is shown. Note that, despite the error being shown and the appearance nothing happened, the data is modified (badly). Even worse, the undo action is not yet set when the error occurs.

Traceback (most recent call last): 
File "widgetClasses.py", line 407, in applyAndClose self.applyFunc() 
File "ssNake.py", line 5163, in applyFunc self.father.current.insert(self.father.father.workspaces[ws].masterData.getData(), pos) 
File "views.py", line 1772, in insert self.data.insert(data, pos, self.axes[-1]) 
File "spectrum.py", line 382, in insert self.addHistory("Inserted " + str(data.shape()[axis]) + " datapoints in dimension " + str(axis + 1) + " at position " + str(pos)) 
IndexError: tuple index out of range 

This PR throws a (human-understandable) error and prevents data from being modified if the dimensions are incorrect.

Merge request reports

Loading