Mercurial > repos > muon-spectroscopy-computational-project > larch_athena
diff larch_athena.xml @ 1:2b3115342fef draft
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
author | muon-spectroscopy-computational-project |
---|---|
date | Wed, 06 Dec 2023 13:03:55 +0000 |
parents | ae2f265ecf8e |
children | a1e26990131c |
line wrap: on
line diff
--- a/larch_athena.xml Tue Nov 14 15:34:40 2023 +0000 +++ b/larch_athena.xml Wed Dec 06 13:03:55 2023 +0000 @@ -4,7 +4,7 @@ <!-- version of underlying tool (PEP 440) --> <token name="@TOOL_VERSION@">0.9.71</token> <!-- version of this tool wrapper (integer) --> - <token name="@WRAPPER_VERSION@">0</token> + <token name="@WRAPPER_VERSION@">1</token> <!-- citation should be updated with every underlying tool version --> <!-- typical fields to update are version, month, year, and doi --> <token name="@TOOL_CITATION@">10.1088/1742-6596/430/1/012007</token> @@ -15,11 +15,26 @@ </param> </xml> <xml name="extract_group"> - <param name="extract_group" type="text" optional="true" label="Extract group" help="Which group to extract and process from the Athena project (will use first group in file if unset)"/> + <conditional name="extract_group"> + <param name="extract_group" type="select" label="Group extraction" help="Method of handling group extraction. Extracting all or multiple named groups will result in multiple outputs, unless merging groups is also true."> + <option value="single" selected="true">Extract single</option> + <option value="multiple">Extract multiple</option> + <option value="all">Extract all</option> + </param> + <when value="single"> + <param name="group_name" type="text" optional="true" label="Group label" help="Which group to extract and process from the Athena project (will use first group in file if unset)"/> + </when> + <when value="multiple"> + <repeat name="multiple" min="1" default="1" title="Groups"> + <param name="group_name" type="text" label="Group label" help="Which group to extract and process from the Athena project (will use first group in file if unset)"/> + </repeat> + </when> + <when value="all"/> + </conditional> </xml> <xml name="columns"> - <param name="energy_column" type="text" optional="true" label="Energy column" help="If set, this column we be used as 'energy'. Otherwise, will identify columns ending with 'energy' or labelled 'col1'."/> - <param name="mu_column" type="text" optional="true" label="μ column" help="If set, this column we be used as 'mu'. Otherwise, will identify the first column labelled as either 'col2', 'xmu', 'lni0it' or 'FFI0'."/> + <param name="energy_column" type="text" optional="true" label="Energy column" help="If set, this column we be used as 'energy'. Otherwise, will identify the first column ending with 'energy' or labelled 'col1' 'Ef'."/> + <param name="mu_column" type="text" optional="true" label="μ column" help="If set, this column we be used as 'mu'. Otherwise, will identify the first column labelled as either 'col2', 'xmu', 'lni0it', 'FFI0' or 'FF/I1'."/> </xml> <xml name="is_zipped"> <param name="is_zipped" type="select" display="radio" label="Inputs Zipped" help="Whether plaintext input files are zipped together into one directory, or not."> @@ -40,6 +55,7 @@ </requirements> <required_files> <include type="literal" path="larch_athena.py"/> + <include type="literal" path="common.py"/> </required_files> <command detect_errors="exit_code"><![CDATA[ mkdir prj edge flat derivative @@ -111,16 +127,55 @@ </when> </conditional> <param name="annotation" type="text" label="Annotation" optional="true" help="If set, will annotate the output project(s) with this string. This will be used to generate legends when plotting data."/> - <section name="variables" title="Processing Options"> - <param name="energy_0" type="float" label="Edge energy (eV)" optional="true" help="If set, data will be calibrated so that the edge occurs at this energy (after merging, if relevant)."/> - <expand macro="energy_limits"/> - <param name="pre1" type="float" label="Pre-edge fit lower energy (eV)" optional="true" help="The lower edge of the region used for the pre-edge fitting, if unset will either use existing value or a default based on the data."/> - <param name="pre2" type="float" label="Pre-edge fit upper energy (eV)" optional="true" help="The upper edge of the region used for the pre-edge fitting, if unset will either use existing value or a default based on the data."/> - <section name="xftf" title="XFTF"> - <expand macro="xftf_params"/> - </section> + <section name="processing" expanded="true" title="Processing Options" help="By default, the following processing steps will be performed either with default values, or those contained in the input Athena project (if used). If specified here, these values will be used instead for process in sequence."> + <conditional name="calibrate"> + <param name="calibrate" type="select" label="Calibrate energy" help="If set, will shift the spectrum so that its (automatically determined) edge occurs at the specified value, and any values outside the range will be discarded."> + <option value="" selected="true">False</option> + <option value="true">True</option> + </param> + <when value=""/> + <when value="true"> + <param name="calibration_e0" type="float" label="Calibration energy (eV)" optional="true" help="If set, data will be calibrated so that the edge occurs at this energy (after merging, if relevant). Note that this is different from specifying E0 in the pre-edge normalization, as this will the x-axis of the data (so that the Nth x point will no longer align with the Nth y point)."/> + <param name="energy_min" type="float" label="Minimum energy (eV)" optional="true" help="If set, data will be cropped below this value in electron volts (after re-calibrating)."/> + <param name="energy_max" type="float" label="Maximum energy (eV)" optional="true" help="If set, data will be cropped above this value in electron volts (after re-calibrating)."/> + </when> + </conditional> + <param name="rebin" type="boolean" label="Re-bin data" help="Whether to re-bin along the energy axis to automatically ensure appropriate levels of precision in the pre-edge, near-edge and extended region of the spectrum."/> + <conditional name="pre_edge"> + <param name="pre_edge" type="select" label="Pre-edge normalization" help="If set, will (re)perform forward pre-edge normalization using provided values."> + <option value="" selected="true">False</option> + <option value="true">True</option> + </param> + <when value=""/> + <when value="true"> + <param argument="e0" type="float" label="Edge energy (eV)" optional="true" help="If set, normalization will use this as the location of the edge rather than automatically determining it."/> + <param argument="pre1" type="float" max="0" label="Pre-edge fit lower energy (eV)" optional="true" help="The lower end of the region used for the pre-edge fitting, relative to the edge energy (and therefore negative)."/> + <param argument="pre2" type="float" max="0" label="Pre-edge fit upper energy (eV)" optional="true" help="The upper end of the region used for the pre-edge fitting, relative to the edge energy (and therefore negative)."/> + <param argument="nvict" type="integer" label="Energy exponent" optional="true" help="Edge fitting will be performed against μ*E**n where n is defined here. This is 0 by default."/> + </when> + </conditional> + <conditional name="xftf"> + <param name="xftf" type="select" label="XFTF" help="If set, will (re)perform forward Fourier Transform using provided values."> + <option value="" selected="true">False</option> + <option value="true">True</option> + </param> + <when value=""/> + <when value="true"> + <param argument="kmin" type="float" optional="true" min="0.0" help="Minimum k value."/> + <param argument="kmax" type="float" optional="true" min="0.0" help="Maximum k value."/> + <param argument="kweight" type="float" optional="true" help="Exponent for weighting spectra by raising k to this power."/> + <param argument="dk" type="float" optional="true" help="Tapering parameter for Fourier Transform window."/> + <param argument="window" type="select" optional="true" help="Fourier Transform window type."> + <option value="hanning">Hanning (cosine-squared taper)</option> + <option value="parzen">Parzen (linear taper)</option> + <option value="welch">Welch (quadratic taper)</option> + <option value="gaussian">Gaussian function window</option> + <option value="sine">Sine function window</option> + <option value="kaiser">Kaiser-Bessel function-derived window</option> + </param> + </when> + </conditional> </section> - <param name="rebin" type="boolean" label="Re-bin data" help="Whether to re-bin along the energy axis to ensure appropriate levels of precision in the pre-edge, near-edge and extended region of the spectrum."/> <param name="plot_graph" type="boolean" label="Plot graph" help="Whether to plot the pre/post edge fitting and the normalised xμ data."/> <param name="zip_outputs" type="boolean" label="Zip outputs" help="Whether to zip all outputs into one dataset."/> </inputs> @@ -129,53 +184,53 @@ <data name="out_zip" format="zip" from_work_dir="out_zip.zip" label="Zipped Athena project(s) ${annotation} ${on_string}"> <filter>zip_outputs</filter> </data> - <!-- Single outputs of differnt types if merging, or not using a zip --> + <!-- Single outputs of different types if merging, or not using a zip --> <data name="athena_project_file" format="prj" from_work_dir="prj/out.prj" label="Athena project ${annotation} ${on_string}"> <filter>not zip_outputs</filter> - <filter>merge_inputs["merge_inputs"] or (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"] == "")</filter> + <filter>not (merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))</filter> </data> <data name="edge_plot" format="png" from_work_dir="edge/out.png" label="Edge fitting ${annotation} ${on_string}"> <filter>plot_graph</filter> <filter>not zip_outputs</filter> - <filter>merge_inputs["merge_inputs"] or (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"] == "")</filter> + <filter>not (merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))</filter> </data> <data name="flat_plot" format="png" from_work_dir="flat/out.png" label="Flattened plot ${annotation} ${on_string}"> <filter>plot_graph</filter> <filter>not zip_outputs</filter> - <filter>merge_inputs["merge_inputs"] or (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"] == "")</filter> + <filter>not (merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))</filter> </data> <data name="derivative_plot" format="png" from_work_dir="derivative/out.png" label="Derivative plot ${annotation} ${on_string}"> <filter>plot_graph</filter> <filter>not zip_outputs</filter> - <filter>merge_inputs["merge_inputs"] or merge_inputs["format"]["dat_file"].extension != "zip"</filter> - <filter>merge_inputs["merge_inputs"] or (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"] == "")</filter> + <filter>not (merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))</filter> </data> - <!-- Directories of outputs if using single, non-merged zip as input --> + <!-- Directories of outputs if using single, non-merged zip as input or extracting multiple/all Athena groups --> <collection name="athena_project_file_collection" format="prj" type="list" label="Athena projects ${annotation} ${on_string}"> <discover_datasets pattern="__name_and_ext__" directory="prj"/> <filter>not zip_outputs</filter> - <filter>merge_inputs["merge_inputs"] == "" and merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]</filter> + <filter>merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")</filter> </collection> <collection name="edge_plot_collection" format="png" type="list" label="Edge fittings ${annotation} ${on_string}"> <discover_datasets pattern="__name_and_ext__" directory="edge"/> <filter>plot_graph</filter> <filter>not zip_outputs</filter> - <filter>merge_inputs["merge_inputs"] == "" and merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]</filter> + <filter>merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")</filter> </collection> <collection name="flat_plot_collection" format="png" type="list" label="Flattened plots ${annotation} ${on_string}"> <discover_datasets pattern="__name_and_ext__" directory="flat"/> <filter>plot_graph</filter> <filter>not zip_outputs</filter> - <filter>merge_inputs["merge_inputs"] == "" and merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]</filter> + <filter>merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")</filter> </collection> <collection name="derivative_plot_collection" format="png" type="list" label="Derivative plots ${annotation} ${on_string}"> <discover_datasets pattern="__name_and_ext__" directory="derivative"/> <filter>plot_graph</filter> <filter>not zip_outputs</filter> - <filter>merge_inputs["merge_inputs"] == "" and merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]</filter> + <filter>merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")</filter> </collection> </outputs> <tests> + <!-- 1 --> <test expect_num_outputs="1"> <param name="dat_file" value="test.xmu"/> <output name="athena_project_file"> @@ -184,6 +239,7 @@ </assert_contents> </output> </test> + <!-- 2 --> <test expect_num_outputs="1"> <param name="dat_file" value="ffi0.tabular"/> <output name="athena_project_file"> @@ -192,12 +248,22 @@ </assert_contents> </output> </test> + <!-- 3 --> + <test expect_num_outputs="1"> + <param name="dat_file" value="ffi1.tabular"/> + <output name="athena_project_file"> + <assert_contents> + <has_size value="4400" delta="100"/> + </assert_contents> + </output> + </test> + <!-- 4 --> <test expect_num_outputs="4"> <param name="dat_file" value="test.xmu"/> <param name="plot_graph" value="true"/> <output name="athena_project_file"> <assert_contents> - <has_size value="5405" delta="10"/> + <has_size value="5400" delta="100"/> </assert_contents> </output> <output name="edge_plot"> @@ -216,6 +282,7 @@ </assert_contents> </output> </test> + <!-- 5 --> <test expect_num_outputs="4"> <param name="is_zipped" value="true"/> <param name="dat_file" value="test.zip"/> @@ -225,6 +292,7 @@ <output_collection name="flat_plot_collection" type="list" count="2"/> <output_collection name="derivative_plot_collection" type="list" count="2"/> </test> + <!-- 6 --> <test expect_num_outputs="1"> <param name="is_zipped" value="true"/> <param name="dat_file" value="h5.zip"/> @@ -236,9 +304,10 @@ </assert_contents> </output> </test> + <!-- 7 --> <test expect_num_outputs="1"> <param name="dat_file" value="test.xmu"/> - <param name="energy_format" value="absolute"/> + <param name="calibrate" value="true"/> <param name="energy_min" value="7000"/> <output name="athena_project_file"> <assert_contents> @@ -246,9 +315,10 @@ </assert_contents> </output> </test> + <!-- 8 --> <test expect_num_outputs="4"> <param name="dat_file" value="test.xmu"/> - <param name="energy_format" value="absolute"/> + <param name="calibrate" value="true"/> <param name="energy_min" value="7000"/> <param name="energy_max" value="7200"/> <param name="plot_graph" value="true"/> @@ -259,32 +329,34 @@ </output> <output name="edge_plot"> <assert_contents> - <has_size value="44430" delta="10"/> + <has_size value="44900" delta="100"/> </assert_contents> </output> <output name="flat_plot"> <assert_contents> - <has_size value="37310" delta="10"/> + <has_size value="39400" delta="100"/> </assert_contents> </output> <output name="derivative_plot"> <assert_contents> - <has_size value="46390" delta="10"/> + <has_size value="45900" delta="100"/> </assert_contents> </output> </test> + <!-- 9 --> <test expect_num_outputs="1"> <param name="dat_file" value="test.xmu"/> - <param name="energy_format" value="absolute"/> - <param name="energy_0" value="7050"/> + <param name="calibrate" value="true"/> + <param name="calibration_e0" value="7050"/> <param name="energy_min" value="7000"/> <param name="energy_max" value="7200"/> <output name="athena_project_file"> <assert_contents> - <has_size value="3300" delta="50"/> + <has_size value="3600" delta="100"/> </assert_contents> </output> </test> + <!-- 10 --> <test expect_num_outputs="1"> <param name="dat_file" value="test.xmu"/> <param name="rebin" value="true"/> @@ -294,6 +366,7 @@ </assert_contents> </output> </test> + <!-- 11 --> <test expect_num_outputs="1"> <param name="merge_inputs" value="true"/> <param name="dat_file" value="262875_PtSn_OCO_Abu_1.nxs,262876_PtSn_OCO_Abu_2.nxs"/> @@ -303,6 +376,7 @@ </assert_contents> </output> </test> + <!-- 12 --> <test expect_num_outputs="1"> <param name="merge_inputs" value="true"/> <param name="is_zipped" value="true"/> @@ -313,6 +387,7 @@ </assert_contents> </output> </test> + <!-- 13 --> <test expect_num_outputs="1"> <param name="format" value="athena"/> <param name="dat_file" value="test.prj"/> @@ -322,6 +397,22 @@ </assert_contents> </output> </test> + <!-- 14: Extract multiple groups from Athena .prj --> + <test expect_num_outputs="1"> + <param name="format" value="athena"/> + <param name="extract_group" value="multiple"/> + <param name="group_name" value="merge"/> + <param name="group_name" value="d__Ref_PtSn_OC_MERGE_CALIBRATE"/> + <param name="dat_file" value="multiple.prj"/> + <output_collection name="athena_project_file_collection" type="list" count="2"/> + </test> + <!-- 15: Extract all groups from Athena .prj --> + <test expect_num_outputs="1"> + <param name="format" value="athena"/> + <param name="extract_group" value="all"/> + <param name="dat_file" value="multiple.prj"/> + <output_collection name="athena_project_file_collection" type="list" count="9"/> + </test> </tests> <help><![CDATA[ Using Larch, create an Athena project file from the input X-ray Absorption Fine Structure (XAFS) data file.