Ticket #9493 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Usage example for Load algorithms

Reported by: Anders Markvardsen Owned by: Anders Markvardsen
Priority: major Milestone: Release 3.2
Component: Documentation Keywords:
Cc: Blocked By:
Blocking: #8919 Tester: Owen Arnold

Description (last modified by Anders Markvardsen) (diff)

A full example of usage example for a number of Load algorithms

Attachments

Capture.PNG (37.1 KB) - added by Anders Markvardsen 6 years ago.
Load.PNG (48.7 KB) - added by Anders Markvardsen 6 years ago.
LoadNexus.PNG (38.5 KB) - added by Anders Markvardsen 6 years ago.
LoadISISNexus.PNG (37.1 KB) - added by Anders Markvardsen 6 years ago.

Change History

comment:1 Changed 6 years ago by Anders Markvardsen

  • Status changed from new to assigned

comment:2 Changed 6 years ago by Anders Markvardsen

For this exercise, data are taken from the http://download.mantidproject.org/download.psp?f=/SampleData/TrainingCourseData.zip . doctest conf.py was updated with

doctest_path = """
r'C:\Backup\Backup_folder1\work\code\Mantid\TrainingCourseData'
"""

hence doctest_path may be used on Jenkins.

In general a broader agreement has to be made about was dataset we should use. My thought on this is that a separate download .zip should be made available for this, since the content of TrainingCourseData is not carved in stone and cover a different use case.

comment:3 Changed 6 years ago by Anders Markvardsen

As usage examples for Load I suggest that we don't try to go into any detail about individual options for individual loads, but rather provide a link to more details documentation (and usage) sections.

Hence a first cut on Load usage is

Usage
-----

To run these usage example please first download the 
`TrainingCourseData <http://download.mantidproject.org/download.psp?f=/SampleData/TrainingCourseData.zip>`_, 
and add these to your path. In MantidPlot this is done using `Manage User Directories <http://www.mantidproject.org/ManageUserDirectories>`_.

Example - Load ISIS histogram Nexus file, see `LoadNexus <http://www.mantidproject.org/LoadNexus>`_ for more options:   

.. testcode:: ExLoadISISnexusHist

   # Load ISIS LOQ histogram dataset
   ws = Load('LOQ49886.nxs') 
   
   # print out the first x-value of the first spectrum 
   print ws.readX(0)[0]   

.. testcleanup:: ExLoadISISnexusHist

   DeleteWorkspace(ws)
   
.. testoutput:: ExLoadISISnexusHist
   :hide:
   
   5.0

Example - Load SNS/ISIS event Nexus file, see `LoadEventNexus <http://www.mantidproject.org/LoadEventNexus>`_ for more options:   

.. testcode:: ExLoadEventNexus

   # Load SNS CNCS event dataset
   ws = Load('CNCS_7860_event.nxs') 
   
   # print out number of histograms (spectra)
   print ws.getNumberHistograms() 

.. testcleanup:: ExLoadEventNexus

   DeleteWorkspace(ws)
   
.. testoutput:: ExLoadEventNexus
   :hide:
   
   51200     
   
Example - Load ISIS Muon file, see `LoadMuonNexus <http://www.mantidproject.org/LoadMuonNexus>`_ for more options:   

.. testcode:: ExLoadISISMuon

   # Load ISIS muon MUSR dataset
   ws = Load('MUSR00015189.nxs') 
   
   # print out number of histograms (spectra)
   print ws[0].getNumberOfEntries() 

.. testcleanup:: ExLoadISISMuon

   DeleteWorkspace(ws[0])
   
.. testoutput:: ExLoadISISMuon
   :hide:
   
   2

which html output is shown in attached Capture.PNG

Changed 6 years ago by Anders Markvardsen

comment:4 Changed 6 years ago by Anders Markvardsen

  • type changed from enhancement to task

comment:5 Changed 6 years ago by Anders Markvardsen

  • Blocking 9496 added

comment:6 Changed 6 years ago by Anders Markvardsen

  • Description modified (diff)
  • Summary changed from Usage example for Load algorithm to Usage example for Load algorithms

comment:7 Changed 6 years ago by Anders Markvardsen

  • Blocking 9496 removed

comment:8 Changed 6 years ago by Anders Markvardsen

Since the previous comment, temporary repository, ​https://github.com/Anders-Markvardsen/sphinxDocTest has been added for testing of this ticket beyond what is mentioned in comments. In fact the comments in this ticket are now somewhat out of date.

Hence for tester:

Check if you agree with usage examples for Load, LoadNexus and LoadISISNenux.

Note the suggestion here is that Load and LoadNexus themselves do not demonstrated optional algorithm arguments, this is left to invidual loaders like LoadISISNexus.

These usage examples uses data from recently added UsageData repository, https://github.com/mantidproject/usagedata

The advance option for testing:

Download above mentioned repository and run make html. Note for this also need to download UsageData repository

The simpler option for testing:

Look at the .rst files for Load, LoadNexus and LoadISISNenux at https://github.com/Anders-Markvardsen/sphinxDocTest/tree/master/source/Algorithms/doc

Attached as Load.PNG, LoadNexus.PNG and LoadISISNenux.PNG showing these usage examples in HTML.

Optional briefly look at wiki page http://www.mantidproject.org/Algorithm_Usage_Examples which explains how Usage example fits in with the general documentation of algorithms and the last example on this page is current for Load

Changed 6 years ago by Anders Markvardsen

Changed 6 years ago by Anders Markvardsen

Changed 6 years ago by Anders Markvardsen

comment:9 Changed 6 years ago by Anders Markvardsen

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

comment:10 Changed 6 years ago by Owen Arnold

  • Status changed from verify to verifying
  • Tester set to Owen Arnold

comment:11 Changed 6 years ago by Owen Arnold

  • Status changed from verifying to closed

comment:12 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 10336

Note: See TracTickets for help on using tickets.