I have some values in multiple cells in an Excel spreadsheet, which I’d like to select, copy and paste on an existing table workspace in Mantid. Specifically, I’m trying to replace some of deadtime parameters generated by a Muon Algorithm (CalMuonDeadtime) with values from a deadtime table analysed with my code. A simple copy and paste (like you normally do between spreadsheets) doesn’t work because Mantid doesn’t have a “paste” option (I think). Is there any ways you can do this on the Mantid UI, please? Thanks!
Hello,
Yes I can confirm that the table workspace view doesn’t have paste functionality. You can either double click on the values and change them, or use the python interface to set the data.
table_workspace.setCell(<x>, <y>, <value>)
will set the value of the cell in position x,y. You could use this within two loops to set values over a particular area in the table workspace.
Hello,
Thank you for your answer. Yes, in the end, I wrote a short script to import a csv file to Mantid and change values in it with Excel. Thanks anyway.
xdata, ydata, err = np.loadtxt(filepath + filename, delimiter=“,”, unpack=True)
imported_table = CreateEmptyTableWorkspace()
imported_table.addColumn(“int”, “spectrum”)
imported_table.addColumn(“double”, “dead-time”)
for i in range(len(xdata)):
imported_table.addRow([int(xdata[i]), ydata[i]])