Ticket #3203 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

Implement a Spectra class with an ISpectra interface

Reported by: Martyn Gigg Owned by: Janik Zikovsky
Priority: major Milestone: Iteration 30
Component: Mantid Keywords:
Cc: Blocked By: #3300
Blocking: Tester: Roman Tolchenov

Description

In algorithms we frequently use the workspace index to access many things about a spectra and reuse the index a lot. A cleaner approach would be to have a spectra promoted to a class-level concept so that ws->getSpectrum(i) would return an object that has a reference to the workspace and the current index and could then access everything without the need for remembering the index.

It should have an interface so that the EventList can implement it as this is a broadly similar concept.

Change History

comment:1 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 29 to Iteration 30

"New" tickets moved at the code freeze of iteration 29

comment:2 Changed 9 years ago by Janik Zikovsky

  • Status changed from new to accepted
  • Owner set to Janik Zikovsky

comment:3 Changed 9 years ago by Janik Zikovsky

  • Blocked By 3300 added

comment:4 Changed 9 years ago by Janik Zikovsky

(In [13047]) - Refs #3203: Implemented ISpectrum. It is the base class of EventList and Histogram and contains the spectrum number and list of detector IDs for a given spectrum.

  • ISpectrum return X/Y/E vectors. EventList, e.g. calculates the histogram on the fly.
  • Moved the EventWorkspace MRU list of histograms to be contained within the EventList; better code separation. Made a EventWorkspaceMRU class to encapsulate this more easily.
  • Workspaces must implement getSpectrum (const/not const) to return a ISpectrum object. dataX(i), etc. methods on MatrixWorkspaces no longer need to be overridden since they call getSpectrum()
  • Got rid of EventWorkspace::getEventListatPixelID() and doneLoadingData()
  • replaceSpectraMap() methods offers backwards-compatibility with SpectraDetectorMaps by setting the specNo and detector list when called. Must be called AFTER creating all the spectra in a workspace.
  • Refs #3318: maskWorkspaceIndex() implemented as part of ISpectrum.

comment:5 Changed 9 years ago by Janik Zikovsky

(In [13051]) Fixes #3321: deprecated DiffractionFocussing1. Fix tests in release version (refs #3203). Fix a few warnings Refs #3302.

comment:6 Changed 9 years ago by Janik Zikovsky

(In [13052]) Refs #3203: Fix occasional segfault in ConvertToMatrixWorkspaceTest due to a little error in CRITICAL block names for OpenMP thread safety. One character fix :)

comment:7 Changed 9 years ago by Janik Zikovsky

(In [13065]) Refs #3203: Test fix attempts.

comment:8 Changed 9 years ago by Janik Zikovsky

(In [13067]) Refs #3203: Temporarily disable test

comment:9 Changed 9 years ago by Martyn Gigg

In [13077]:

Fix the two system tests. The Aziz one just has a new reference result as the internal order of the grouped detectors has changed but this should not matter since we don't ungroup afterward. The TOSCA test failed because ExtractSingleSpectrum was pulling out the incorrect spectrum after the ISpectra changes. The blame here is due to a bad unit test, it only tested the data and not the underlying spectra/detector links. This test has been improved. Refs #3203

comment:10 Changed 9 years ago by Russell Taylor

Janik - please can you find a way to eliminate the following Intel compiler warnings, which (because of the classes they come from) appear many times in the Mac build:

EventList.h:67, Intel, Priority: Normal

overloaded virtual function "Mantid::API::ISpectrum::dataX" is only partially overridden in class "Mantid::DataObjects::EventList"

EventList.h:67, Intel, Priority: Normal

overloaded virtual function "Mantid::API::ISpectrum::setX" is only partially overridden in class "Mantid::DataObjects::EventList"

EventWorkspace.h:47, Intel, Priority: Normal

overloaded virtual function "Mantid::API::MatrixWorkspace::setX" is only partially overridden in class "Mantid::DataObjects::EventWorkspace"

comment:11 Changed 9 years ago by Janik Zikovsky

In [13129]:

Refs #3203: Hopefully reduce Intel compiler warnings.

comment:12 Changed 9 years ago by Janik Zikovsky

In [13245]:

Refs #3203: Continuing to deprecate SpectraDetectorMap

comment:13 Changed 9 years ago by Janik Zikovsky

In [13247]:

Refs #3203: Deprecating away

comment:14 Changed 9 years ago by Janik Zikovsky

In [13251]:

Refs #3203: Replaced calls to getIndicesFromSpectra() where possible.

comment:15 Changed 9 years ago by Janik Zikovsky

In [13252]:

Refs #3203: Updated a few more algos.

comment:16 Changed 9 years ago by Janik Zikovsky

In [13253]:

Refs #3203: More spectraMap uses going away

comment:17 Changed 9 years ago by Janik Zikovsky

In [13254]:

Refs #3203: Fix.

comment:18 Changed 9 years ago by Janik Zikovsky

In [13255]:

Refs #3203: More updates.

comment:19 Changed 9 years ago by Janik Zikovsky

In [13256]:

Refs #3203: Build fix

comment:20 Changed 9 years ago by Janik Zikovsky

In [13257]:

Refs #3203.

comment:21 Changed 9 years ago by Janik Zikovsky

In [13414]:

Refs #3203: Performance test comparing ISpectrum and SpectraDetectorMap

comment:22 Changed 9 years ago by Mathieu Doucet

In [13435]:

Removed confusing message. Users don't need to see this. This type of messages is only useful when a solution is also given. Re #3203

comment:23 Changed 9 years ago by Janik Zikovsky

In [13534]:

Refs #3400, Refs #3203. Fix for ManagedWorkspace2D and its variants. Workspace2D now holds a vector of pointers that should keep things consistent between it and its managed variants. ManagedHistogram1D is now the replacement in the managed cases.

comment:12 Changed 9 years ago by Janik Zikovsky

In [13536]:

Refs #3203. Refs #3380: Removing more calls to spectraMap()

comment:13 Changed 9 years ago by Janik Zikovsky

In [13555]:

Refs #3203: Removed a few more calls to spectraMap().

comment:14 Changed 9 years ago by Janik Zikovsky

In [13558]:

Refs #3203: Nearly all calls to spectraMap() are gone.

comment:15 Changed 9 years ago by Janik Zikovsky

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

spectraMap() is very nearly gone. Nick says he wants to leave it for a little while, but it is called exactly twice in all the code.

comment:16 Changed 9 years ago by Russell Taylor

In [13584]:

Revert last change for now because the new way is far too slow (~100 times) in the case of a large number of detectors. Re #3203.

comment:17 Changed 9 years ago by Russell Taylor

In [13598]:

MaskDetectorsInShape performance test. Re #3203.

comment:18 Changed 9 years ago by Janik Zikovsky

In [13677]:

Refs #3203: Spectrum fix for CrossCorrelate

comment:19 Changed 9 years ago by Martyn Gigg

In [13678]:

Refs #3203 Change from adding specNo to the detectorIDs in the EventLists. For SNS this makes no difference as they are always 1:1, for ISIS it fixes the file loading.

comment:20 Changed 9 years ago by Vickie Lynch

In [13679]:

Refs #3203: Spectrum fix for CrossCorrelate

comment:21 Changed 9 years ago by Roman Tolchenov

  • Status changed from verify to verifying
  • Tester set to Roman Tolchenov

comment:22 Changed 9 years ago by Roman Tolchenov

  • Status changed from verifying to closed

Confirm implementation of ISpectra

comment:23 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 4050

Note: See TracTickets for help on using tickets.