From ba765cb45e15c220ade25abcbf7fb8c1fd709e4d Mon Sep 17 00:00:00 2001 From: "Zhang, Chen" <zhangc@ornl.gov> Date: Fri, 26 Mar 2021 12:19:02 -0400 Subject: [PATCH] update doctest --- .../algorithms/CreatePeaksWorkspace-v1.rst | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/docs/source/algorithms/CreatePeaksWorkspace-v1.rst b/docs/source/algorithms/CreatePeaksWorkspace-v1.rst index a78790ddbd5..394437e3b9f 100644 --- a/docs/source/algorithms/CreatePeaksWorkspace-v1.rst +++ b/docs/source/algorithms/CreatePeaksWorkspace-v1.rst @@ -9,8 +9,12 @@ Description ----------- -Create an empty :ref:`PeaksWorkspace <PeaksWorkspace>`. Use -:ref:`algm-LoadIsawPeaks` or :ref:`algm-FindPeaksMD` to +This algorithm can be used to create a: + +- :ref:`PeaksWorkspace <PeaksWorkspace>` (Default, or when `OutputType` is set to `Peak`.) +- :ref:`LeanElasticPeaksWorkspace <LeanElasticPeaksWorkspace>` (when `OutputType` is set to `LeanElasticPeak`) + +Use :ref:`algm-LoadIsawPeaks` or :ref:`algm-FindPeaksMD` to create a peaks workspace with peaks. This workspace can serve as a starting point for modifying the @@ -20,23 +24,32 @@ for example. If the input workspace is a MDWorkspace then the instrument from the first experiment info is used. -If the `InstrumentWorkspace` is not provided then a -:ref:`LeanElasticPeaksWorkspace <LeanElasticPeaksWorkspace>` is -created instead of a :ref:`PeaksWorkspace <PeaksWorkspace>` - Usage ----- +**Example: An empty table, not tied to an instrument** + +.. testcode:: ExEmptyPeaksworkspaceTable + + ws = CreatePeaksWorkspace() + print("Created a {} with {} rows".format(ws.id(), ws.rowCount())) + +Output: + +.. testoutput:: ExEmptyPeaksworkspaceTable + + Created a PeaksWorkspace with 0 rows + **Example: Create an empty LeanElasticPeaksWorkspace, not tied to an instrument** -.. testcode:: ExEmptyTable +.. testcode:: ExEmptyLeanElasticPeaksworkspaceTable - ws = CreatePeaksWorkspace(NumberOfPeaks=0) + ws = CreatePeaksWorkspace(NumberOfPeaks=0, OutputType="LeanElasticPeak") print("Created a {} with {} rows".format(ws.id(), ws.rowCount())) Output: -.. testoutput:: ExEmptyTable +.. testoutput:: ExEmptyLeanElasticPeaksworkspaceTable Created a LeanElasticPeaksWorkspace with 0 rows -- GitLab