diff hess_astro_tool.xml @ 1:593c4b45eda5 draft default tip

planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools commit 2f23ec010eab8d33d2760f061286756e17015af7
author astroteam
date Thu, 18 Apr 2024 09:26:15 +0000
parents 02e4bb4fa10c
children
line wrap: on
line diff
--- a/hess_astro_tool.xml	Mon Feb 19 10:56:44 2024 +0000
+++ b/hess_astro_tool.xml	Thu Apr 18 09:26:15 2024 +0000
@@ -1,102 +1,88 @@
-<tool id="hess_astro_tool" name="HESS" version="0.0.1+galaxy0" profile="23.0">
+<tool id="hess_astro_tool" name="HESS" version="0.0.2+galaxy0" profile="23.0">
   <requirements>
-    <requirement type="package" version="8.21.0">ipython</requirement>
+    <requirement type="package" version="8.22.2">ipython</requirement>
     <requirement type="package" version="5.3.4">astropy</requirement>
     <requirement type="package" version="1.11.4">scipy</requirement>
-    <requirement type="package" version="1.10.13">pydantic</requirement>
+    <requirement type="package" version="1.10.14">pydantic</requirement>
     <requirement type="package" version="4.66.2">tqdm</requirement>
     <requirement type="package" version="1.1">gammapy</requirement>
-    <requirement type="package" version="3.8.3">matplotlib</requirement>
-    <requirement type="package" version="1.2.12">oda-api</requirement>
+    <requirement type="package" version="3.8.4">matplotlib</requirement>
+    <requirement type="package" version="1.2.15">oda-api</requirement>
     <!--Requirements string 'nb2workflow[cwl,service,rdf,mmoda]>=1.3.30 
 ' can't be converted automatically. Please add the galaxy/conda requirement manually or modify the requirements file!-->
-    <requirement type="package" version="7.16.0">nbconvert</requirement>
-    <requirement type="package" version="1.20.3">wget</requirement>
+    <requirement type="package" version="7.16.3">nbconvert</requirement>
+    <requirement type="package" version="1.21.4">wget</requirement>
   </requirements>
   <command detect_errors="exit_code">ipython '$__tool_directory__/${_data_product._selector}.py'</command>
   <configfiles>
-    <inputs name="inputs" filename="inputs.json" />
+    <inputs name="inputs" filename="inputs.json" data_style="paths" />
   </configfiles>
   <inputs>
     <conditional name="_data_product">
       <param name="_selector" type="select" label="Data Product">
         <option value="Image" selected="true">Image</option>
         <option value="Spectrum" selected="false">Spectrum</option>
-        <option value="Spectrum_gammapy" selected="false">Spectrum_gammapy</option>
         <option value="Lightcurve" selected="false">Lightcurve</option>
       </param>
       <when value="Image">
         <param name="src_name" type="text" value="Crab" label="src_name" />
-        <param name="RA" type="float" value="83.6287" label="RA Units: deg" />
-        <param name="DEC" type="float" value="22.0147" label="DEC Units: deg" />
+        <param name="RA" type="float" value="83.6287" label="RA (unit: deg)" />
+        <param name="DEC" type="float" value="22.0147" label="DEC (unit: deg)" />
         <param name="T1" type="text" value="2000-10-09T13:16:00.0" label="T1" />
         <param name="T2" type="text" value="2022-10-10T13:16:00.0" label="T2" />
-        <param name="Radius" type="float" value="2.5" label="Radius Units: deg" />
-        <param name="pixsize" type="float" value="0.1" label="Pixel size Units: deg" />
-        <param name="Emin" type="float" value="100.0" label="Emin Units: GeV" />
-        <param name="Emax" type="float" value="10000.0" label="Emax Units: GeV" />
+        <param name="Radius" type="float" value="1.0" label="Radius (unit: deg)" />
+        <param name="pixsize" type="float" value="0.05" label="Pixel size (unit: deg)" />
+        <param name="Emin" type="integer" value="1" label="Emin (unit: TeV)" />
+        <param name="Emax" type="float" value="100.0" label="Emax (unit: TeV)" />
       </when>
       <when value="Spectrum">
         <param name="src_name" type="text" value="PKS 2155-304" label="src_name" />
-        <param name="RA" type="float" value="329.716938" label="RA Units: deg" />
-        <param name="DEC" type="float" value="-30.225588" label="DEC Units: deg" />
+        <param name="RA" type="float" value="329.716938" label="RA (unit: deg)" />
+        <param name="DEC" type="float" value="-30.225588" label="DEC (unit: deg)" />
         <param name="T1" type="text" value="2000-10-09T13:16:00.0" label="T1" />
         <param name="T2" type="text" value="2022-10-10T13:16:00.0" label="T2" />
-        <param name="Radius" type="float" value="2.5" label="Radius Units: deg" />
-        <param name="R_s" type="float" value="0.2" label="R_s Units: deg" />
-        <param name="Emin" type="float" value="100.0" label="Emin Units: GeV" />
-        <param name="Emax" type="float" value="10000.0" label="Emax Units: GeV" />
-        <param name="NEbins" type="integer" value="20" label="NEbins" />
-      </when>
-      <when value="Spectrum_gammapy">
-        <param name="src_name" type="text" value="PKS 2155-304" label="src_name" />
-        <param name="RA" type="float" value="329.716938" label="RA Units: deg" />
-        <param name="DEC" type="float" value="-30.225588" label="DEC Units: deg" />
-        <param name="T1" type="text" value="2000-10-09T13:16:00.0" label="T1" />
-        <param name="T2" type="text" value="2022-10-10T13:16:00.0" label="T2" />
-        <param name="Radius" type="float" value="2.5" label="Radius Units: deg" />
-        <param name="R_s" type="float" value="0.5" label="R_s Units: deg" />
-        <param name="Emin" type="float" value="100.0" label="Emin Units: GeV" />
-        <param name="Emax" type="float" value="10000.0" label="Emax Units: GeV" />
-        <param name="NEbins" type="integer" value="20" label="NEbins" />
+        <param name="Radius" type="float" value="2.5" label="Radius (unit: deg)" />
+        <param name="R_s" type="float" value="0.2" label="R_s (unit: deg)" />
+        <param name="Emin" type="float" value="0.1" label="Emin (unit: TeV)" />
+        <param name="Emax" type="float" value="100.0" label="Emax (unit: TeV)" />
+        <param name="NEbins" type="integer" value="30" label="NEbins" />
+        <param name="Efit_min" type="float" value="0.2" label="Efit_min (unit: TeV)" />
+        <param name="Efit_max" type="float" value="10.0" label="Efit_max (unit: TeV)" />
       </when>
       <when value="Lightcurve">
         <param name="src_name" type="text" value="Crab" label="src_name" />
-        <param name="RA" type="float" value="83.6287" label="RA Units: deg" />
-        <param name="DEC" type="float" value="22.0147" label="DEC Units: deg" />
-        <param name="T1" type="text" value="2003-10-09T13:16:00.0" label="T1" />
-        <param name="T2" type="text" value="2005-10-10T13:16:00.0" label="T2" />
-        <param name="Radius" type="float" value="2.5" label="Radius Units: deg" />
-        <param name="R_s" type="float" value="0.2" label="R_s Units: deg" />
-        <param name="Emin" type="float" value="100.0" label="Emin Units: GeV" />
-        <param name="Emax" type="float" value="10000.0" label="Emax Units: GeV" />
-        <param name="NTbins" type="integer" value="10" label="NTbins" />
+        <param name="RA" type="float" value="83.6287" label="RA (unit: deg)" />
+        <param name="DEC" type="float" value="22.0147" label="DEC (unit: deg)" />
+        <param name="T1" type="text" value="2004-11-20T13:16:00.0" label="T1" />
+        <param name="T2" type="text" value="2004-12-20T13:16:00.0" label="T2" />
+        <param name="Radius" type="float" value="2.5" label="Radius (unit: deg)" />
+        <param name="R_s" type="float" value="0.2" label="R_s (unit: deg)" />
+        <param name="Emin" type="integer" value="1" label="Emin (unit: TeV)" />
+        <param name="Emax" type="float" value="100.0" label="Emax (unit: TeV)" />
+        <param name="NTbins" type="integer" value="30" label="NTbins" />
       </when>
     </conditional>
   </inputs>
   <outputs>
-    <data label="${tool.name} -&gt; Image picture" name="out_Image_picture" format="auto" from_work_dir="picture_galaxy.output">
+    <data label="${tool.name} -&gt; Image png" name="out_Image_png" format="auto" from_work_dir="png_galaxy.output">
       <filter>_data_product['_selector'] == 'Image'</filter>
     </data>
-    <data label="${tool.name} -&gt; Image image" name="out_Image_image" format="auto" from_work_dir="image_galaxy.output">
+    <data label="${tool.name} -&gt; Image fits" name="out_Image_fits" format="auto" from_work_dir="fits_galaxy.output">
       <filter>_data_product['_selector'] == 'Image'</filter>
     </data>
-    <data label="${tool.name} -&gt; Spectrum picture_png" name="out_Spectrum_picture_png" format="auto" from_work_dir="picture_png_galaxy.output">
+    <data label="${tool.name} -&gt; Spectrum png" name="out_Spectrum_png" format="auto" from_work_dir="png_galaxy.output">
       <filter>_data_product['_selector'] == 'Spectrum'</filter>
     </data>
-    <data label="${tool.name} -&gt; Spectrum spectrum_astropy_table" name="out_Spectrum_spectrum_astropy_table" format="auto" from_work_dir="spectrum_astropy_table_galaxy.output">
+    <data label="${tool.name} -&gt; Spectrum table_confidence_contour" name="out_Spectrum_table_confidence_contour" format="auto" from_work_dir="table_confidence_contour_galaxy.output">
       <filter>_data_product['_selector'] == 'Spectrum'</filter>
     </data>
-    <data label="${tool.name} -&gt; Spectrum_gammapy picture_png" name="out_Spectrum_gammapy_picture_png" format="auto" from_work_dir="picture_png_galaxy.output">
-      <filter>_data_product['_selector'] == 'Spectrum_gammapy'</filter>
+    <data label="${tool.name} -&gt; Spectrum table_spectrum" name="out_Spectrum_table_spectrum" format="auto" from_work_dir="table_spectrum_galaxy.output">
+      <filter>_data_product['_selector'] == 'Spectrum'</filter>
     </data>
-    <data label="${tool.name} -&gt; Spectrum_gammapy spectrum_astropy_table" name="out_Spectrum_gammapy_spectrum_astropy_table" format="auto" from_work_dir="spectrum_astropy_table_galaxy.output">
-      <filter>_data_product['_selector'] == 'Spectrum_gammapy'</filter>
-    </data>
-    <data label="${tool.name} -&gt; Lightcurve picture" name="out_Lightcurve_picture" format="auto" from_work_dir="picture_galaxy.output">
+    <data label="${tool.name} -&gt; Lightcurve png" name="out_Lightcurve_png" format="auto" from_work_dir="png_galaxy.output">
       <filter>_data_product['_selector'] == 'Lightcurve'</filter>
     </data>
-    <data label="${tool.name} -&gt; Lightcurve lightcurve_astropy_table" name="out_Lightcurve_lightcurve_astropy_table" format="auto" from_work_dir="lightcurve_astropy_table_galaxy.output">
+    <data label="${tool.name} -&gt; Lightcurve table" name="out_Lightcurve_table" format="auto" from_work_dir="table_galaxy.output">
       <filter>_data_product['_selector'] == 'Lightcurve'</filter>
     </data>
   </outputs>
@@ -109,16 +95,16 @@
         <param name="DEC" value="22.0147" />
         <param name="T1" value="2000-10-09T13:16:00.0" />
         <param name="T2" value="2022-10-10T13:16:00.0" />
-        <param name="Radius" value="2.5" />
-        <param name="pixsize" value="0.1" />
-        <param name="Emin" value="100.0" />
-        <param name="Emax" value="10000.0" />
+        <param name="Radius" value="1.0" />
+        <param name="pixsize" value="0.05" />
+        <param name="Emin" value="1" />
+        <param name="Emax" value="100.0" />
       </conditional>
       <assert_stdout>
         <has_text text="*** Job finished successfully ***" />
       </assert_stdout>
     </test>
-    <test expect_num_outputs="2">
+    <test expect_num_outputs="3">
       <conditional name="_data_product">
         <param name="_selector" value="Spectrum" />
         <param name="src_name" value="PKS 2155-304" />
@@ -128,27 +114,11 @@
         <param name="T2" value="2022-10-10T13:16:00.0" />
         <param name="Radius" value="2.5" />
         <param name="R_s" value="0.2" />
-        <param name="Emin" value="100.0" />
-        <param name="Emax" value="10000.0" />
-        <param name="NEbins" value="20" />
-      </conditional>
-      <assert_stdout>
-        <has_text text="*** Job finished successfully ***" />
-      </assert_stdout>
-    </test>
-    <test expect_num_outputs="2">
-      <conditional name="_data_product">
-        <param name="_selector" value="Spectrum_gammapy" />
-        <param name="src_name" value="PKS 2155-304" />
-        <param name="RA" value="329.716938" />
-        <param name="DEC" value="-30.225588" />
-        <param name="T1" value="2000-10-09T13:16:00.0" />
-        <param name="T2" value="2022-10-10T13:16:00.0" />
-        <param name="Radius" value="2.5" />
-        <param name="R_s" value="0.5" />
-        <param name="Emin" value="100.0" />
-        <param name="Emax" value="10000.0" />
-        <param name="NEbins" value="20" />
+        <param name="Emin" value="0.1" />
+        <param name="Emax" value="100.0" />
+        <param name="NEbins" value="30" />
+        <param name="Efit_min" value="0.2" />
+        <param name="Efit_max" value="10.0" />
       </conditional>
       <assert_stdout>
         <has_text text="*** Job finished successfully ***" />
@@ -160,13 +130,13 @@
         <param name="src_name" value="Crab" />
         <param name="RA" value="83.6287" />
         <param name="DEC" value="22.0147" />
-        <param name="T1" value="2003-10-09T13:16:00.0" />
-        <param name="T2" value="2005-10-10T13:16:00.0" />
+        <param name="T1" value="2004-11-20T13:16:00.0" />
+        <param name="T2" value="2004-12-20T13:16:00.0" />
         <param name="Radius" value="2.5" />
         <param name="R_s" value="0.2" />
-        <param name="Emin" value="100.0" />
-        <param name="Emax" value="10000.0" />
-        <param name="NTbins" value="10" />
+        <param name="Emin" value="1" />
+        <param name="Emax" value="100.0" />
+        <param name="NTbins" value="30" />
       </conditional>
       <assert_stdout>
         <has_text text="*** Job finished successfully ***" />
@@ -185,31 +155,37 @@
 the time range that can be adjusted setting the ``T1`` (start time) and
 ``T2`` (stop time) parameters.
 
+For the spectra, the analysis performs histogramming of events in
+energy, in the number ``NEbins`` of energy bins homogeneously spaces in
+logarithm of energy, beterrn ``Emin`` and ``Emax``. Conversion of the
+counts to the physical flux units is done by dividing by the exposure
+time and effective area that is extracted from the Instrument Response
+Functions (IRF). The result is shown with black data points. This simple
+estimate of flux in energy bins does not take into account the event
+energy estimation errors.
+
+The source signal is extracted from a circular region of the radius
+``R_s``\ (adjustable parameter) around the source posiiton. The
+background estimate is done using the &#8220;wobble&#8221; method, from a position
+opposite with respect to the signal extraction region in the camera,
+with respect to the center of the telescope field-of-view.
+
+A powerlaw fit to the spectrum is done using forward folding method,
+properly taking into account the error of energy estimation. The results
+of the spectral fitting include the 68% confidence contour for the
+spectral parameters (slope and normalisaiton of the powerlaw spectrum).
+The first entry in the &#8220;contour&#8221; table is the best-fit value of the fit.
+The energy range of fitting can be adjusted with the ``Efit_min``,
+``Efit_max`` parameters.
+
 The lightcurves are produced by hystrogramming of the events in time, in
 the number ``NTbins`` of time intervals of equalt time width between
 ``T1`` (start time) and ``T2`` (stop time). The events are selected in a
-desired energy range between ``Emin`` and ``Emax`` from a circular
-region of the radius ``R_s`` (in degrees) around the source position
-``RA``,\ ``DEC``. Conversion of the counts to the physical flux units is
-done by dividing by the exposure time and effective area that is
-extracted from the Instrument Response Functions (IRF).
-
-For the spectra, two alternative tools are considered. The service
-``Spectrum`` performs histogramming of the events in energy, in the
-number ``NEbins`` of energy bins homogeneously spaces in logarithm of
-energy, beterrn ``Emin`` and ``Emax``. Conversion of the counts to the
-physical flux units is done by dividing by the exposure time and
-effective area that is extracted from the IRF. This method does not take
-into account the energy bias and can result in a wrong spectral shape at
-the low-energy threshold where the bias is strongest.
-
-An alternative spectral extraction is done using
-`Gammapy &lt;https://gammapy.org/&gt;`__, following the script `Spectrum
-Analysis &lt;https://docs.gammapy.org/0.18.2/tutorials/spectrum_analysis.html&gt;`__.
-It performs forward folding of the spectral model (a cut-off powerlaw by
-default) with the IRF and fits the folded model to the binned count data
-in the energy range between ``Emin`` and ``Emax`` in ``NEbins``
-logarithmically spaced energy bins.
+desired energy range between ``Emin`` and ``Emax``. The source and
+backgorund counts are computed in the same way as for the spectral
+fitting. Conversion of the counts to the physical flux units is done by
+dividing by the exposure time and effective area that is extracted from
+the IRF.
 </help>
   <citations>
     <citation type="doi">10.5281/zenodo.1421098</citation>