comparison larch_athena.xml @ 3:82e9dd980916 draft

planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
author muon-spectroscopy-computational-project
date Fri, 22 Mar 2024 14:23:27 +0000
parents a1e26990131c
children a0d3b0fe0fa3
comparison
equal deleted inserted replaced
2:a1e26990131c 3:82e9dd980916
2 <description>generate Athena projects from XAFS data</description> 2 <description>generate Athena projects from XAFS data</description>
3 <macros> 3 <macros>
4 <!-- version of underlying tool (PEP 440) --> 4 <!-- version of underlying tool (PEP 440) -->
5 <token name="@TOOL_VERSION@">0.9.74</token> 5 <token name="@TOOL_VERSION@">0.9.74</token>
6 <!-- version of this tool wrapper (integer) --> 6 <!-- version of this tool wrapper (integer) -->
7 <token name="@WRAPPER_VERSION@">0</token> 7 <token name="@WRAPPER_VERSION@">1</token>
8 <!-- citation should be updated with every underlying tool version --> 8 <!-- citation should be updated with every underlying tool version -->
9 <!-- typical fields to update are version, month, year, and doi --> 9 <!-- typical fields to update are version, month, year, and doi -->
10 <token name="@TOOL_CITATION@">10.1088/1742-6596/430/1/012007</token> 10 <token name="@TOOL_CITATION@">10.1088/1742-6596/430/1/012007</token>
11 <xml name="format"> 11 <xml name="format">
12 <param name="format" type="select" display="radio" label="Input format" help="Whether data is in plaintext or already saved as an Athena project"> 12 <param name="format" type="select" display="radio" label="Input format" help="Whether data is in plaintext or already saved as an Athena project">
56 <required_files> 56 <required_files>
57 <include type="literal" path="larch_athena.py"/> 57 <include type="literal" path="larch_athena.py"/>
58 <include type="literal" path="common.py"/> 58 <include type="literal" path="common.py"/>
59 </required_files> 59 </required_files>
60 <command detect_errors="exit_code"><![CDATA[ 60 <command detect_errors="exit_code"><![CDATA[
61 mkdir prj edge flat derivative 61 mkdir prj plot
62 #if $merge_inputs.format.format=="plaintext": 62 #if $merge_inputs.format.format=="plaintext":
63 #if $merge_inputs.format.is_zipped.is_zipped=="true": 63 #if $merge_inputs.format.is_zipped.is_zipped=="true":
64 && echo Unzipping '$merge_inputs.format.is_zipped.dat_file.name' 64 && echo Unzipping '$merge_inputs.format.is_zipped.dat_file.name'
65 && unzip '$merge_inputs.format.is_zipped.dat_file' -d dat_files 65 && unzip '$merge_inputs.format.is_zipped.dat_file' -d dat_files
66 && python '${__tool_directory__}/larch_athena.py' dat_files '$inputs' 66 && python '${__tool_directory__}/larch_athena.py' dat_files '$inputs'
88 <expand macro="format"/> 88 <expand macro="format"/>
89 <when value="plaintext"> 89 <when value="plaintext">
90 <conditional name="is_zipped" > 90 <conditional name="is_zipped" >
91 <expand macro="is_zipped"/> 91 <expand macro="is_zipped"/>
92 <when value=""> 92 <when value="">
93 <param name="dat_file" type="data" format="h5,txt" label="XAFS data file" help="X-ray Absorption Fine Structure (XAFS) data, either in h5 or plaintext."/> 93 <param name="dat_file" type="data" format="h5,tabular" label="XAFS data file" help="X-ray Absorption Fine Structure (XAFS) data, either in h5 or plaintext."/>
94 </when> 94 </when>
95 <when value="true"> 95 <when value="true">
96 <param name="dat_file" type="data" format="zip" label="Zipped XAFS data files" help="Zipped X-ray Absorption Fine Structure (XAFS) data, either in h5 or plaintext."/> 96 <param name="dat_file" type="data" format="zip" label="Zipped XAFS data files" help="Zipped X-ray Absorption Fine Structure (XAFS) data, either in h5 or plaintext."/>
97 </when> 97 </when>
98 </conditional> 98 </conditional>
178 <option value="kaiser">Kaiser-Bessel function-derived window</option> 178 <option value="kaiser">Kaiser-Bessel function-derived window</option>
179 </param> 179 </param>
180 </when> 180 </when>
181 </conditional> 181 </conditional>
182 </section> 182 </section>
183 <param name="plot_graph" type="boolean" label="Plot graph" help="Whether to plot the pre/post edge fitting and the normalised xμ data."/> 183 <param name="plot_graph" type="select" multiple="true" display="checkboxes" label="Plot graphs">
184 <option value="edge">Pre/post edge fitting</option>
185 <option value="flat">Flattened xμ</option>
186 <option value="dmude">Derivative of xμ</option>
187 </param>
184 <param name="zip_outputs" type="boolean" label="Zip outputs" help="Whether to zip all outputs into one dataset."/> 188 <param name="zip_outputs" type="boolean" label="Zip outputs" help="Whether to zip all outputs into one dataset."/>
185 </inputs> 189 </inputs>
186 <outputs> 190 <outputs>
187 <!-- Single output if zipping outputs --> 191 <!-- Single output if zipping outputs -->
188 <data name="out_zip" format="zip" from_work_dir="out_zip.zip" label="Zipped Athena project(s) ${annotation} ${on_string}"> 192 <data name="out_zip" format="zip" from_work_dir="out_zip.zip" label="Zipped Athena project(s) ${annotation} ${on_string}">
191 <!-- Single outputs of different types if merging, or not using a zip --> 195 <!-- Single outputs of different types if merging, or not using a zip -->
192 <data name="athena_project_file" format="prj" from_work_dir="prj/out.prj" label="Athena project ${annotation} ${on_string}"> 196 <data name="athena_project_file" format="prj" from_work_dir="prj/out.prj" label="Athena project ${annotation} ${on_string}">
193 <filter>not zip_outputs</filter> 197 <filter>not zip_outputs</filter>
194 <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> 198 <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>
195 </data> 199 </data>
196 <data name="edge_plot" format="png" from_work_dir="edge/out.png" label="Edge fitting ${annotation} ${on_string}"> 200 <data name="plot" format="png" from_work_dir="plot/out.png" label="Plot of ${annotation} ${on_string}">
197 <filter>plot_graph</filter>
198 <filter>not zip_outputs</filter>
199 <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>
200 </data>
201 <data name="flat_plot" format="png" from_work_dir="flat/out.png" label="Flattened plot ${annotation} ${on_string}">
202 <filter>plot_graph</filter>
203 <filter>not zip_outputs</filter>
204 <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>
205 </data>
206 <data name="derivative_plot" format="png" from_work_dir="derivative/out.png" label="Derivative plot ${annotation} ${on_string}">
207 <filter>plot_graph</filter> 201 <filter>plot_graph</filter>
208 <filter>not zip_outputs</filter> 202 <filter>not zip_outputs</filter>
209 <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> 203 <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>
210 </data> 204 </data>
211 <!-- Directories of outputs if using single, non-merged zip as input or extracting multiple/all Athena groups --> 205 <!-- Directories of outputs if using single, non-merged zip as input or extracting multiple/all Athena groups -->
212 <collection name="athena_project_file_collection" format="prj" type="list" label="Athena projects ${annotation} ${on_string}"> 206 <collection name="athena_project_file_collection" format="prj" type="list" label="Athena projects ${annotation} ${on_string}">
213 <discover_datasets pattern="__name_and_ext__" directory="prj"/> 207 <discover_datasets pattern="__name_and_ext__" directory="prj"/>
214 <filter>not zip_outputs</filter> 208 <filter>not zip_outputs</filter>
215 <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> 209 <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>
216 </collection> 210 </collection>
217 <collection name="edge_plot_collection" format="png" type="list" label="Edge fittings ${annotation} ${on_string}"> 211 <collection name="plot_collection" format="png" type="list" label="Plots of ${annotation} ${on_string}">
218 <discover_datasets pattern="__name_and_ext__" directory="edge"/> 212 <discover_datasets pattern="__name_and_ext__" directory="plot"/>
219 <filter>plot_graph</filter>
220 <filter>not zip_outputs</filter>
221 <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>
222 </collection>
223 <collection name="flat_plot_collection" format="png" type="list" label="Flattened plots ${annotation} ${on_string}">
224 <discover_datasets pattern="__name_and_ext__" directory="flat"/>
225 <filter>plot_graph</filter>
226 <filter>not zip_outputs</filter>
227 <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>
228 </collection>
229 <collection name="derivative_plot_collection" format="png" type="list" label="Derivative plots ${annotation} ${on_string}">
230 <discover_datasets pattern="__name_and_ext__" directory="derivative"/>
231 <filter>plot_graph</filter> 213 <filter>plot_graph</filter>
232 <filter>not zip_outputs</filter> 214 <filter>not zip_outputs</filter>
233 <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> 215 <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>
234 </collection> 216 </collection>
235 </outputs> 217 </outputs>
260 <has_size value="4400" delta="100"/> 242 <has_size value="4400" delta="100"/>
261 </assert_contents> 243 </assert_contents>
262 </output> 244 </output>
263 </test> 245 </test>
264 <!-- 4 --> 246 <!-- 4 -->
265 <test expect_num_outputs="4"> 247 <test expect_num_outputs="2">
266 <param name="dat_file" value="test.xmu"/> 248 <param name="dat_file" value="test.xmu"/>
267 <param name="plot_graph" value="true"/> 249 <param name="plot_graph" value="edge,flat,dmude"/>
268 <output name="athena_project_file"> 250 <output name="athena_project_file">
269 <assert_contents> 251 <assert_contents>
270 <has_size value="5400" delta="100"/> 252 <has_size value="5400" delta="100"/>
271 </assert_contents> 253 </assert_contents>
272 </output> 254 </output>
273 <output name="edge_plot"> 255 <output name="plot">
274 <assert_contents> 256 <assert_contents>
275 <has_size value="54036" delta="20"/> 257 <has_size value="134972" delta="20"/>
276 </assert_contents>
277 </output>
278 <output name="flat_plot">
279 <assert_contents>
280 <has_size value="39266" delta="20"/>
281 </assert_contents>
282 </output>
283 <output name="derivative_plot">
284 <assert_contents>
285 <has_size value="42435" delta="20"/>
286 </assert_contents> 258 </assert_contents>
287 </output> 259 </output>
288 </test> 260 </test>
289 <!-- 5 --> 261 <!-- 5 -->
290 <test expect_num_outputs="4"> 262 <test expect_num_outputs="2">
291 <param name="is_zipped" value="true"/> 263 <param name="is_zipped" value="true"/>
292 <param name="dat_file" value="test.zip"/> 264 <param name="dat_file" value="test.zip"/>
293 <param name="plot_graph" value="true"/> 265 <param name="plot_graph" value="edge,flat,dmude"/>
294 <output_collection name="athena_project_file_collection" type="list" count="2"/> 266 <output_collection name="athena_project_file_collection" type="list" count="2"/>
295 <output_collection name="edge_plot_collection" type="list" count="2"/> 267 <output_collection name="plot_collection" type="list" count="2"/>
296 <output_collection name="flat_plot_collection" type="list" count="2"/>
297 <output_collection name="derivative_plot_collection" type="list" count="2"/>
298 </test> 268 </test>
299 <!-- 6 --> 269 <!-- 6 -->
300 <test expect_num_outputs="1"> 270 <test expect_num_outputs="1">
301 <param name="is_zipped" value="true"/> 271 <param name="is_zipped" value="true"/>
302 <param name="dat_file" value="h5.zip"/> 272 <param name="dat_file" value="h5.zip"/>
303 <param name="plot_graph" value="true"/> 273 <param name="plot_graph" value="edge,flat,dmude"/>
304 <param name="zip_outputs" value="true"/> 274 <param name="zip_outputs" value="true"/>
305 <output name="out_zip"> 275 <output name="out_zip">
306 <assert_contents> 276 <assert_contents>
307 <has_size value="312000" delta="500"/> 277 <has_size value="75500" delta="500"/>
308 </assert_contents> 278 </assert_contents>
309 </output> 279 </output>
310 </test> 280 </test>
311 <!-- 7 --> 281 <!-- 7 -->
312 <test expect_num_outputs="1"> 282 <test expect_num_outputs="1">
318 <has_size value="5300" delta="100"/> 288 <has_size value="5300" delta="100"/>
319 </assert_contents> 289 </assert_contents>
320 </output> 290 </output>
321 </test> 291 </test>
322 <!-- 8 --> 292 <!-- 8 -->
323 <test expect_num_outputs="4"> 293 <test expect_num_outputs="2">
324 <param name="dat_file" value="test.xmu"/> 294 <param name="dat_file" value="test.xmu"/>
325 <param name="calibrate" value="true"/> 295 <param name="calibrate" value="true"/>
326 <param name="energy_min" value="7000"/> 296 <param name="energy_min" value="7000"/>
327 <param name="energy_max" value="7200"/> 297 <param name="energy_max" value="7200"/>
328 <param name="plot_graph" value="true"/> 298 <param name="plot_graph" value="edge,flat,dmude"/>
329 <output name="athena_project_file"> 299 <output name="athena_project_file">
330 <assert_contents> 300 <assert_contents>
331 <has_size value="3300" delta="50"/> 301 <has_size value="3300" delta="50"/>
332 </assert_contents> 302 </assert_contents>
333 </output> 303 </output>
334 <output name="edge_plot"> 304 <output name="plot">
335 <assert_contents> 305 <assert_contents>
336 <has_size value="44900" delta="100"/> 306 <has_size value="134700" delta="100"/>
337 </assert_contents>
338 </output>
339 <output name="flat_plot">
340 <assert_contents>
341 <has_size value="39400" delta="100"/>
342 </assert_contents>
343 </output>
344 <output name="derivative_plot">
345 <assert_contents>
346 <has_size value="45900" delta="100"/>
347 </assert_contents> 307 </assert_contents>
348 </output> 308 </output>
349 </test> 309 </test>
350 <!-- 9 --> 310 <!-- 9 -->
351 <test expect_num_outputs="1"> 311 <test expect_num_outputs="1">
390 <has_size value="18000" delta="50"/> 350 <has_size value="18000" delta="50"/>
391 </assert_contents> 351 </assert_contents>
392 </output> 352 </output>
393 </test> 353 </test>
394 <!-- 13: Test merging and plotting multiple prj inputs --> 354 <!-- 13: Test merging and plotting multiple prj inputs -->
395 <test expect_num_outputs="4"> 355 <test expect_num_outputs="2">
396 <param name="merge_inputs" value="true"/> 356 <param name="merge_inputs" value="true"/>
397 <param name="format" value="athena"/> 357 <param name="format" value="athena"/>
398 <param name="dat_file" value="test.prj,test.prj"/> 358 <param name="dat_file" value="test.prj,test.prj"/>
399 <param name="plot_graph" value="true"/> 359 <param name="plot_graph" value="edge,flat,dmude"/>
400 <output name="athena_project_file"> 360 <output name="athena_project_file">
401 <assert_contents> 361 <assert_contents>
402 <has_size value="4500" delta="100"/> 362 <has_size value="4500" delta="100"/>
403 </assert_contents> 363 </assert_contents>
404 </output> 364 </output>
405 <output name="edge_plot"> 365 <output name="plot">
406 <assert_contents> 366 <assert_contents>
407 <has_size value="54200" delta="100"/> 367 <has_size value="135000" delta="100"/>
408 </assert_contents>
409 </output>
410 <output name="flat_plot">
411 <assert_contents>
412 <has_size value="39400" delta="100"/>
413 </assert_contents>
414 </output>
415 <output name="derivative_plot">
416 <assert_contents>
417 <has_size value="41800" delta="100"/>
418 </assert_contents> 368 </assert_contents>
419 </output> 369 </output>
420 </test> 370 </test>
421 <!-- 14 --> 371 <!-- 14 -->
422 <test expect_num_outputs="1"> 372 <test expect_num_outputs="1">