view hess_astro_tool.xml @ 0:02e4bb4fa10c draft

planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools commit 2991f65b25d4e6d1b69458603fce917adff40f94
author astroteam
date Mon, 19 Feb 2024 10:56:44 +0000
parents
children 593c4b45eda5
line wrap: on
line source

<tool id="hess_astro_tool" name="HESS" version="0.0.1+galaxy0" profile="23.0">
  <requirements>
    <requirement type="package" version="8.21.0">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="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>
    <!--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>
  </requirements>
  <command detect_errors="exit_code">ipython '$__tool_directory__/${_data_product._selector}.py'</command>
  <configfiles>
    <inputs name="inputs" filename="inputs.json" />
  </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="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" />
      </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="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" />
      </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" />
      </when>
    </conditional>
  </inputs>
  <outputs>
    <data label="${tool.name} -&gt; Image picture" name="out_Image_picture" format="auto" from_work_dir="picture_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">
      <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">
      <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">
      <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>
    <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">
      <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">
      <filter>_data_product['_selector'] == 'Lightcurve'</filter>
    </data>
  </outputs>
  <tests>
    <test expect_num_outputs="2">
      <conditional name="_data_product">
        <param name="_selector" value="Image" />
        <param name="src_name" value="Crab" />
        <param name="RA" value="83.6287" />
        <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" />
      </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" />
        <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.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" />
      </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="Lightcurve" />
        <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="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" />
      </conditional>
      <assert_stdout>
        <has_text text="*** Job finished successfully ***" />
      </assert_stdout>
    </test>
  </tests>
  <help>This service provides analysis of publicly available sample &#8220;Data Level
3&#8221; (DL3) data of HESS gamma-ray telescope, described by `Hess
Collaboration (2018) &lt;https://arxiv.org/abs/1810.04516&gt;`__. Three types
of data products are generated: sky images, source lightcurves and
spectra.

The sky images are count maps produced by histogramming of the events in
sky coordinates (Right Ascention and Declinaiton), in the energy range
that can be set by adjusting the ``Emin`` and ``Emax`` parameters and in
the time range that can be adjusted setting the ``T1`` (start time) and
``T2`` (stop time) 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.
</help>
  <citations>
    <citation type="doi">10.5281/zenodo.1421098</citation>
  </citations>
</tool>