Ticket #8031 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Include ws name in extracted log tables

Reported by: Nick Draper Owned by: Keith Brown
Priority: major Milestone: Release 3.1
Component: GUI Keywords:
Cc: Blocked By:
Blocking: Tester: Karl Palmen

Description

A suggestion for improvement really:

When you do "Sample Logs" on a workspace and extract one to a table, the table is named something like "Temp-Sample (2013-Sep-12 19:46:03)1" and this name also appears in the legend of the plot. There isn't an easy way to match up the "Temp-Sample" log plots to spectrum or reduced data plots from an experiment, unless I'd been careful and renamed them all immediately after extracting. The log table doesn't have any History since it's a QTI table rather than a Mantid TableWorkspace, and to get the start time from a Workspace means re-opening its Sample Log dialog and looking for run_start.

Could the log table include the workspace name in its own name? The time might still be there as well since it's sometimes useful to see exactly when the unexpected spike happened. Clearly the log value itself still needs to be identified. So a format "HIFI00056789-Temp-Sample (2013-Sep-12 19:46:03)" would cover all the options.

James Lord.

Change History

comment:1 Changed 7 years ago by Nick Draper

I think we can also drop the timestamp from the name

comment:2 Changed 7 years ago by Keith Brown

  • Status changed from new to inprogress

Made the title bar captions more descriptive

The title bar cations are no all prepended with the workspace name.

They are also no longer truncated to the first hyphen. If there was a reason for that please tell me, but i couldn't see any reason why they were, especailly as the logs use underscores as spaces which are then converted to hyphens (for a reason that is explained in a comment) so it previously meant that multi-worded log names were truncated.

To Tester:

Make sure that the title bar captions show the workspace name, log name and a number which should be a fallback inidivitual identifier.

Be aware that this ticket was done while #7968 was awaiting merging into master thus the bug fixed there reared its head; it should only cause debug assertions on windows but this should be kept in mind.

Refs #8031

Changeset: 8557da27854b141ed2d4215632c395f5cc15d936

comment:3 Changed 7 years ago by Keith Brown

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:4 Changed 7 years ago by Martyn Gigg

  • Status changed from verify to verifying
  • Tester set to Martyn Gigg

comment:5 Changed 7 years ago by Martyn Gigg

  • Status changed from verifying to reopened
  • Resolution fixed deleted

So the workspace name appears but if it has an underscore in the name then the underscore gets converted to a hyphen. This is not correct, the workspace name needs to be preserved exactly as it is. Transformation of the other underscores is okay.

For my test I used the CSP78173.raw in the AutoTestData directory which produces a multi-period dataset where each workspace is suffixed with _n

comment:6 Changed 7 years ago by Keith Brown

  • Status changed from reopened to inprogress

workspace name underscores are no longer converted

I found that the caption settign method was converting hyphens to underscores as well as the QString::replace that was already in there.

There was a comment note that underscores may cause problems for the legendwidget, so that may need looking at

Refs #8031

Changeset: 4a7cdd1a2afd77c80159467f668758ef853a0699

comment:7 Changed 7 years ago by Keith Brown

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:8 Changed 7 years ago by Karl Palmen

  • Status changed from verify to verifying
  • Tester changed from Martyn Gigg to Karl Palmen

comment:9 Changed 7 years ago by Karl Palmen

It works as desired for wokspace ARGUS0031800 in AutoTest, which is a group of two workspaces.

But code review shows a piece of code that has been commented out, but not removed. It is line 3046 of ApplicationWindow.cpp.

comment:10 Changed 7 years ago by Karl Palmen

  • Status changed from verifying to reopened
  • Resolution fixed deleted

comment:11 Changed 7 years ago by Keith Brown

  • Status changed from reopened to inprogress

Removed commetned out code

Karl mentioned some leftover commented code, it's now been removed

Refs #8031

Changeset: 47203eb3f2c02b94c350d0ac9f76583944f15b9a

comment:12 Changed 7 years ago by Keith Brown

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:13 Changed 7 years ago by Peter Parker

  • Status changed from verify to verifying
  • Tester changed from Karl Palmen to Peter Parker

comment:14 Changed 7 years ago by Peter Parker

  • Status changed from verifying to reopened
  • Resolution fixed deleted

As discussed, there are still two issues here. The first is a merge conflict:

---------------- Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp ----------------
index ebc3a79,c19c8df..0000000
@@@ -2289,34 -2289,38 +2289,69 @@@ MultiLayer* MantidUI::plotInstrumentSpe
  MultiLayer* MantidUI::plotBin(const QString& wsName, const QList<int> & binsList, bool errors, Graph::CurveType style)
  {
    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
++<<<<<<< HEAD
 +   MantidMatrix* m = getMantidMatrix(wsName);
 +   if( !m )
 +   {
 +     m = importMatrixWorkspace(wsName, -1, -1, false, false);
 +   }
 +   MatrixWorkspace_sptr ws;
 +   if (AnalysisDataService::Instance().doesExist(wsName.toStdString()))
 +   {
 +     ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(wsName.toStdString());
 +   }
 +   if( !ws.get() )
 +   {
 +     QApplication::restoreOverrideCursor();
 +     return NULL;
 +   }
 +
 +   Table *t = createTableFromBins(wsName, ws, binsList, errors);
 +   if(!t) return NULL;
 +   t->confirmClose(false);
 +   t->setAttribute(Qt::WA_QuitOnClose);
 +
 +   // TODO: Use the default style instead of a line if nothing is passed into this method
 +   MultiLayer *ml = appWindow()->multilayerPlot(t,t->colNames(),style);
 +   if(!ml) return NULL;
 +   m->setBinGraph(ml,t);
 +   ml->confirmClose(false);
 +   QApplication::restoreOverrideCursor();
 +   return ml;
++=======
+   MantidMatrix* m = getMantidMatrix(wsName);
+   if( !m )
+   {
+     m = importMatrixWorkspace(wsName, -1, -1, false, false);
+   }
+   MatrixWorkspace_sptr ws;
+   if (AnalysisDataService::Instance().doesExist(wsName.toStdString()))
+   {
+     ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(wsName.toStdString());
+   }
+   if( !ws.get() )
+   {
+     QApplication::restoreOverrideCursor();
+     return NULL;
+   }
+ 
+   Table *t = createTableFromBins(wsName, ws, binsList, errors);
+   t->confirmClose(false);
+   t->setAttribute(Qt::WA_QuitOnClose);
+   MultiLayer* ml(NULL);
+   if( !t )
+   {
+     QApplication::restoreOverrideCursor();
+     return ml;
+   }
+ 
+   // TODO: Use the default style instead of a line if nothing is passed into this method
+   ml = appWindow()->multilayerPlot(t,t->colNames(),style);
+   m->setBinGraph(ml,t);
+   ml->confirmClose(false);
+   QApplication::restoreOverrideCursor();
+   return ml;
++>>>>>>> origin/feature/8031_workspace_in_sample_log_name
  }
  
  /**

We also have the following at 2432, 2475 and 2553 in MantidUI.cpp:

if (wsName.isEmpty())
{
  label = logName;
  label.replace("_","-");
}
else
{
  label = logName;
  label.replace("_","-");
  label = wsName + "-" + label;
}

Which is obviously equivalent to:

label = logName;
label.replace("_","-");
if (!wsName.isEmpty())
  label = wsName + "-" + label;

May as well change it now we have a merge conflict to fix.

comment:15 Changed 7 years ago by Keith Brown

  • Status changed from reopened to inprogress

Merge branch 'feature/8031_workspace_in_sample_log_name' into develop

Conflicts:

Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp

Refs #8031

Changeset: d4bc9819371fd4c958a43d017e3f520be7e719e5

comment:16 Changed 7 years ago by Keith Brown

Correcting indent to stop it complaining on a push to develop

Still correcting merge confilct, this is more preventative as i just resolved this conflict between my branch and develop, on develop.

The problem still exisited here so jsut fixing it now

Refs #8031

Changeset: 290475e7ed0b24f1017a3825f00bc9cbc72fca91

comment:17 Changed 7 years ago by Keith Brown

Refactored some repeated code

I introduced some repeated code, so i've condensed and refactored it into it's own method.

Refs #8031

Changeset: ca8f768b0d11e218aa33f18410d8ccadf739b578

comment:18 Changed 7 years ago by Keith Brown

  • Status changed from inprogress to verify
  • Resolution set to fixed

Merge conflicts and repeated code should now be sorted

comment:19 Changed 7 years ago by Keith Brown

removed some commented code

When having a quick look at the changes i'd made, i noticed a few lines of commented code, some mine, some not. I've removed them.

Refs #8031

Changeset: 178fe0bf7e141b0ea1f4ea31ab5214afc35198c7

comment:20 Changed 7 years ago by Martyn Gigg

  • Status changed from verify to verifying
  • Tester changed from Peter Parker to Martyn Gigg

comment:21 Changed 7 years ago by Martyn Gigg

  • Status changed from verifying to reopened
  • Resolution fixed deleted

I'm seeing a crash when trying to import certain log types. To reproduce

  • open MantidPlot
  • load MUSR00015189.nxs from AutoTestData
  • right-click workspace and view sample logs
  • double click on one of type num. series
  • crash!

This looks like the underscore handling. The tables use them as separators for various things. This patch fixes things for me

diff --git a/Code/Mantid/MantidPlot/src/Table.cpp b/Code/Mantid/MantidPlot/src/Table.cpp
index b3d4a55..0a62b41 100644
--- a/Code/Mantid/MantidPlot/src/Table.cpp
+++ b/Code/Mantid/MantidPlot/src/Table.cpp
@@ -2219,7 +2219,7 @@ void Table::setHeader(QStringList header)
 int Table::colIndex(const QString& name)
 {
 //  std::cout << "Col " << name.toStdString() << std::endl;
-  int pos = name.find("_",false);
+  int pos = name.lastIndexOf("_");
   QString label = name.right(name.length()-pos-1);
   return col_label.findIndex(label);
 //  return col_label.findIndex(name);

It searches from the right for the underscore rather than the left as, by-construction, the table appends _label to the end of the table name.

comment:22 Changed 7 years ago by Keith Brown

  • Status changed from reopened to inprogress
  • Milestone changed from Release 3.0 to Release 3.1

Fixed the issue Martyn highlighted, but another crashing bug has come to light relating to filtering. The bug is caused by the fix on this branch as it's not on master, but it's unclear how what I've done is causing this crash. It's not clear what is causing this issue and it'll need time to investigate, so this ticket has been moved to the next release.

To reproduce:

  • Load CSP85423.nxs from systemtests\Data
  • Open the sample logs.
  • Try and load any log of type "num. series"
  • Crash (seems to occur in TimeSeriesProperty.cpp)

Changeset 4847c3eca317bb920d8b094db6d54b34951c068e

Last edited 7 years ago by Keith Brown (previous) (diff)

comment:23 Changed 7 years ago by Keith Brown

Noticed when loading that file i get the following warning:

IXseblock entry 'Field_Units' gave an error when loading a time series:'Invalid value entry for time series'. Skipping entry

So this may be the reason I'm getting this error now.

comment:24 Changed 7 years ago by Keith Brown

Refs #8031 fixes various crashes and improves graph titles

Graph titles are now the workspace + log name rather than the secion of the log name before the first underscore.

Fixed an out of bounds check that was revealed after fixing the issure Martyn highlighted.

Changeset: 32bbfa072fdabff66a87e6877cfa11ba97d7b135

comment:25 Changed 7 years ago by Keith Brown

Refs #8031 Removeign debugging console commands

Removing some instances where i was writing to the console so i could see the QStrings i was working with.

Corrected a spelling in a similar command i haddn't added.

Changeset: 99a4cad3a73f56683da3cd68a96dfcc8f8f4bd47

comment:26 Changed 7 years ago by Keith Brown

Refs #8031 fixes various crashes and improves graph titles

Graph titles are now the workspace + log name rather than the secion of the log name before the first underscore.

Fixed an out of bounds check that was revealed after fixing the issure Martyn highlighted.

Changeset: 04b56127cd9964c228b4205de338511d0e3cdef0

comment:27 Changed 7 years ago by Keith Brown

Refs #8031 Removeign debugging console commands

Removing some instances where i was writing to the console so i could see the QStrings i was working with.

Corrected a spelling in a similar command i haddn't added.

Changeset: 918472a9f235cddb29639467dc65e27683b78618

comment:28 Changed 7 years ago by Keith Brown

Refs #8031 Dealing with a rather large merge conflict

When goign to checkbuild i had a merge conflict, just used kdiff3 to help sort it out.

Changeset: 4051bd30d982d6fc540b2f94e76c5e3b9e389407

comment:29 Changed 7 years ago by Keith Brown

The previous commit was when I was merging master into my branch after it wouldn't let me checkbuild. The commit takes a long time to load on github.

comment:30 Changed 7 years ago by Keith Brown

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:31 Changed 7 years ago by Karl Palmen

  • Status changed from verify to verifying
  • Tester changed from Martyn Gigg to Karl Palmen

comment:32 Changed 7 years ago by Karl Palmen

Works fine with files ARGUS0031800, CSP85423 and MUSR00015189 previously mentioned.

comment:33 Changed 7 years ago by Karl Palmen

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/8031_workspace_in_sample_log_name'

Full changeset: 5bc0be5da6782bdfb3cb7f8aa6bf5c6c2764a7fd

comment:34 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8876

Note: See TracTickets for help on using tickets.