From 19ce15816035855358d6d896f7c2c9f8aa487cc0 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Thu, 4 Apr 2019 15:35:15 +0200 Subject: [PATCH] Update second section of How Tos --- cscripts/cstsmapsplit.py | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------- doc/source/users/tutorials/howto/howto_display.rst | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------- doc/source/users/tutorials/howto/howto_display_butterfly.png | Bin 33989 -> 0 bytes doc/source/users/tutorials/howto/howto_display_irf.png | Bin 150400 -> 0 bytes doc/source/users/tutorials/howto/howto_display_obs.png | Bin 73814 -> 0 bytes doc/source/users/tutorials/howto/howto_display_pha.png | Bin 0 -> 45913 bytes doc/source/users/tutorials/howto/howto_display_phases.png | Bin 18403 -> 0 bytes doc/source/users/tutorials/howto/howto_display_pointings.png | Bin 27281 -> 0 bytes doc/source/users/tutorials/howto/howto_display_residuals.png | Bin 36286 -> 0 bytes doc/source/users/tutorials/howto/howto_display_rmf.png | Bin 0 -> 62282 bytes doc/source/users/tutorials/howto/howto_display_rsp_aeff.png | Bin 0 -> 82176 bytes doc/source/users/tutorials/howto/howto_display_rsp_bkg.png | Bin 0 -> 96296 bytes doc/source/users/tutorials/howto/howto_display_rsp_sens.png | Bin 0 -> 87646 bytes doc/source/users/tutorials/howto/howto_display_significance.png | Bin 0 -> 87780 bytes doc/source/users/tutorials/howto/howto_display_spectrum.png | Bin 23006 -> 0 bytes doc/source/users/tutorials/howto/howto_extent.rst | 42 +++++++++++++++++++++--------------------- doc/source/users/tutorials/howto/howto_lightcurve.png | Bin 26668 -> 0 bytes doc/source/users/tutorials/howto/howto_lightcurve.rst | 8 ++++---- doc/source/users/tutorials/howto/howto_phasecurve.rst | 46 +++++++++++++++++++++++++++++++++------------- doc/source/users/tutorials/howto/howto_phasecurve_mcid.png | Bin 18699 -> 0 bytes doc/source/users/tutorials/howto/howto_phasecurve_phases.png | Bin 15363 -> 0 bytes doc/source/users/tutorials/howto/howto_phasecurve_probphases.png | Bin 18730 -> 0 bytes doc/source/users/tutorials/howto/howto_prepare_1dc.ipynb | 10 +++++----- doc/source/users/tutorials/howto/howto_roi_selection.jpg | Bin 0 -> 85260 bytes doc/source/users/tutorials/howto/howto_ts.rst | 4 ++-- doc/source/users/tutorials/howto/howto_tsmap.png | Bin 24540 -> 0 bytes doc/source/users/tutorials/howto/howto_tsmap.rst | 28 ++++++++++++++-------------- doc/source/users/tutorials/howto/howto_ulimit.rst | 12 ++++++------ doc/source/users/tutorials/howto/howto_vo.rst | 18 +++++++++--------- examples/show_obs.py | 5 ++++- src/cttsmap/cttsmap.cpp | 17 +++++++++++------ src/support/ctobservation.cpp | 5 ++++- 32 files changed, 255 insertions(+), 164 deletions(-) create mode 100644 doc/source/users/tutorials/howto/howto_display_pha.png create mode 100644 doc/source/users/tutorials/howto/howto_display_rmf.png create mode 100644 doc/source/users/tutorials/howto/howto_display_rsp_aeff.png create mode 100644 doc/source/users/tutorials/howto/howto_display_rsp_bkg.png create mode 100644 doc/source/users/tutorials/howto/howto_display_rsp_sens.png create mode 100644 doc/source/users/tutorials/howto/howto_display_significance.png create mode 100644 doc/source/users/tutorials/howto/howto_roi_selection.jpg mode change 100755 => 100644 doc/source/users/tutorials/howto/howto_tsmap.png diff --git a/cscripts/cstsmapsplit.py b/cscripts/cstsmapsplit.py index 961710f..8d01b5b 100755 --- a/cscripts/cstsmapsplit.py +++ b/cscripts/cstsmapsplit.py @@ -2,7 +2,7 @@ # ========================================================================== # Create commands to split TS map computation # -# Copyright (C) 2016-2017 Michael Mayer +# Copyright (C) 2016-2019 Michael Mayer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,14 +31,14 @@ import ctools class cstsmapsplit(ctools.cslikelihood): """ Generates commands to split TS map computation - + This class implements the creation of file containing commands to split the computation of a TS map into several machines. It derives from the ctools.cscript class which provides support for parameter files, command line arguments, and logging. In that way the Python script behaves just as a regular ctool. """ - + # Consructor def __init__(self, *argv): """ @@ -58,8 +58,8 @@ class cstsmapsplit(ctools.cslikelihood): # Return return - - + + # Private methods def _get_parameters(self): """ @@ -68,31 +68,31 @@ class cstsmapsplit(ctools.cslikelihood): # If there are no observations in container then get some ... if self.obs().size() == 0: self.obs(self._get_observations()) - + # Set models if we have none if self.obs().models().size() == 0: self.obs().models(self['inmodel'].filename()) - + # Get TS map paramters self._map = self._create_map(self.obs()) self._srcname = self['srcname'].string() self._outmap = self['outmap'].filename() - + # Get additional parameters self._bins_per_job = self['bins_per_job'].integer() self._compute_null = self['compute_null'].boolean() self._outfile = self['outfile'].filename() - + # Write input parameters into logger self._log_parameters(gammalib.TERSE) - + # Return return def _compute_null_hypothesis(self): """ Compute null hypothesis - + Returns ------- logl : float @@ -100,29 +100,26 @@ class cstsmapsplit(ctools.cslikelihood): """ # Store original models models_orig = self.obs().models() - + # Get models instance models0 = self.obs().models() - + # Remove test source models0.remove(self._srcname) - - # Initialise optimizer - #opt = gammalib.GOptimizerLM() - + # Set models for null hypothesis self.obs().models(models0) - + # Optimise observation container self.obs().optimize(self.opt()) - + # Set original models to container self.obs().models(models_orig) - + # Return optimised log-likelihood of null hypothesis return -(self.opt().value()) - - + + # Public methods def run(self): """ @@ -131,89 +128,87 @@ class cstsmapsplit(ctools.cslikelihood): # Switch screen logging on in debug mode if self._logDebug(): self._log.cout(True) - + # Get parameters self._get_parameters() - + # Write information into logger self._log_header1(gammalib.TERSE, 'Test source') self._log_string(gammalib.TERSE, str(self.obs().models()[self._srcname])) - + # Set log-likelihood to zero logL0 = 0.0 - + # Pre-compute null hypothesis if requested if self._compute_null: - + # Write information into logger self._log_header1(gammalib.TERSE, 'Compute null hypothesis') - + # Compute null hypothesis logL0 = self._compute_null_hypothesis() - + # Write likelihood into logger self._log_value(gammalib.TERSE, 'Source removed', self._srcname) self._log_value(gammalib.TERSE, 'Log-likelihood', repr(logL0)) - + # Get parameters of TS map ctool pars = gammalib.GApplicationPars('cttsmap.par') - + # Compute total number of jobs nbins = self._map.npix() njobs = int(math.ceil(float(nbins) / float(self._bins_per_job)) + 0.1) - + # Set parameters to be skipped now, we will deal with them later skip_pars = ['binmin', 'binmax', 'logL0', 'outmap', 'logfile'] - + # Set tool name for computation base_command = 'cttsmap' - + # Write information into logger self._log_header1(gammalib.TERSE, 'Create commands') self._log_value(gammalib.TERSE, 'Number of cttsmap calls', njobs) - + # Loop over TS map parameters for par in pars: - + # Skip if we deal with them later if par.name() in skip_pars: continue - - # Skip if they need to be queried - # This way we ensure we pass only parameters - # that were queried before - if self[par.name()].is_query(): + + # Skip if parameter was not queried + if not self[par.name()].was_queried(): continue # Set TS map parameter according to input from # this script par.value(self[par.name()].value()) - + # Append command to set parameter base_command += ' ' + par.name() + '=' + par.value() - + # Append null hypothesis parameter base_command += ' logL0=' + repr(logL0) - + # Set binning to start from zero binmin = 0 binmax = 0 - + # Clear command sequence self._cmd = [] - + # Loop over jobs and create commands for job in range(njobs): - + # Set specific outmap file name outmap = self._outmap.url().replace('.fits', '_'+str(job)+'.fits') - + # Set bin numbers to be computed in this job binmin = binmax binmax = binmin + self._bins_per_job if binmax > nbins: - binmax = nbins - + binmax = nbins + # Setup sliced command sliced_command = '%s binmin=%s binmax=%s outmap=%s logfile=%s' % \ (base_command, str(binmin), str(binmax), @@ -225,7 +220,7 @@ class cstsmapsplit(ctools.cslikelihood): # Append command to list of commands self._cmd.append(sliced_command) - + # Write information into logger if self._logExplicit(): self._log('\n') @@ -237,7 +232,7 @@ class cstsmapsplit(ctools.cslikelihood): # Return return - + def save(self): """ Save commands to ASCII file @@ -247,11 +242,11 @@ class cstsmapsplit(ctools.cslikelihood): # Open file f = open(filename, 'w') - + # Write commands to file for cmd in self._cmd: f.write(cmd + '\n') - + # Close file f.close() @@ -266,9 +261,9 @@ class cstsmapsplit(ctools.cslikelihood): # Main routine entry point # # ======================== # if __name__ == '__main__': - + # Create instance of application app = cstsmapsplit(sys.argv) - + # Execute application app.execute() diff --git a/doc/source/users/tutorials/howto/howto_display.rst b/doc/source/users/tutorials/howto/howto_display.rst index 490c406..fea7583 100755 --- a/doc/source/users/tutorials/howto/howto_display.rst +++ b/doc/source/users/tutorials/howto/howto_display.rst @@ -21,25 +21,33 @@ included in the ctools package that rely on the Python module. You can find these scripts in the ``$CTOOLS/share/examples/python`` folder. The following scripts are available: - +------------------------+--------------------------------------+ - | Script | Usage | - +========================+======================================+ - | ``show_butterfly.py`` | Display a butterfly diagram | - +------------------------+--------------------------------------+ - | ``show_irf.py`` | Display Instrument Response Function | - +------------------------+--------------------------------------+ - | ``show_lightcurve.py`` | Display a light curve | - +------------------------+--------------------------------------+ - | ``show_obs.py`` | Display observation summary | - +------------------------+--------------------------------------+ - | ``show_phases.py`` | Display event phases | - +------------------------+--------------------------------------+ - | ``show_pointings.py`` | Display pointing directions | - +------------------------+--------------------------------------+ - | ``show_residuals.py`` | Display spectral residuals | - +------------------------+--------------------------------------+ - | ``show_spectrum.py`` | Display a spectrum | - +------------------------+--------------------------------------+ + +---------------------------------------+--------------------------------------+ + | Script | Usage | + +=======================================+======================================+ + | ``show_butterfly.py`` | Display butterfly diagram | + +---------------------------------------+--------------------------------------+ + | ``show_irf.py`` | Display Instrument Response Function | + +---------------------------------------+--------------------------------------+ + | ``show_lightcurve.py`` | Display light curve | + +---------------------------------------+--------------------------------------+ + | ``show_obs.py`` | Display observation summary | + +---------------------------------------+--------------------------------------+ + | ``show_pha.py`` | Display Pulse High Analyser File | + +---------------------------------------+--------------------------------------+ + | ``show_phases.py`` | Display event phases | + +---------------------------------------+--------------------------------------+ + | ``show_pointings.py`` | Display pointing directions | + +---------------------------------------+--------------------------------------+ + | ``show_residuals.py`` | Display spectral residuals | + +---------------------------------------+--------------------------------------+ + | ``show_response.py`` | Display response components | + +---------------------------------------+--------------------------------------+ + | ``show_rmf.py`` | Display Redistribution Matrix File | + +---------------------------------------+--------------------------------------+ + | ``show_significance_distribution.py`` | Display significance distribution | + +---------------------------------------+--------------------------------------+ + | ``show_spectrum.py`` | Display spectrum | + +---------------------------------------+--------------------------------------+ **Do not hesitate to copy and adapt these scripts to your needs.** @@ -53,7 +61,7 @@ show_butterfly.py $ $CTOOLS/share/examples/python/show_butterfly.py butterfly.txt .. figure:: howto_display_butterfly.png - :width: 600px + :width: 500px :align: center *Butterfly diagram displayed with show_butterfly.py* @@ -67,7 +75,7 @@ show_irf.py $ $CTOOLS/share/examples/python/show_irf.py prod2 South_50h .. figure:: howto_display_irf.png - :width: 800px + :width: 600px :align: center *Instrument Response Function displayed with show_irf.py* @@ -81,7 +89,7 @@ show_lightcurve.py $ $CTOOLS/share/examples/python/show_lightcurve.py lightcurve.fits .. figure:: howto_lightcurve.png - :width: 600px + :width: 500px :align: center *Light curve displayed with show_lightcurve.py* @@ -101,6 +109,20 @@ show_obs.py *Observation summary displayed with show_obs.py* +show_pha.py +^^^^^^^^^^^ + +.. code-block:: bash + + $ $CTOOLS/share/examples/python/show_pha.py pha.fits + +.. figure:: howto_display_pha.png + :width: 500px + :align: center + + *Pulse Hight Analyser File displayed with show_pha.py* + + show_phases.py ^^^^^^^^^^^^^^ @@ -109,7 +131,7 @@ show_phases.py $ $CTOOLS/share/examples/python/show_phases.py -n 50 events_phased.fits .. figure:: howto_display_phases.png - :width: 600px + :width: 500px :align: center *Event phases displayed with show_phases.py* @@ -123,7 +145,7 @@ show_pointings.py $ $CTOOLS/share/examples/python/show_pointings.py obs.xml .. figure:: howto_display_pointings.png - :width: 600px + :width: 500px :align: center *Pointings displayed with show_pointings.py (zoomed in)* @@ -137,12 +159,55 @@ show_residuals.py $ $CTOOLS/share/examples/python/show_residuals.py residual.fits .. figure:: howto_display_residuals.png - :width: 600px + :width: 500px :align: center *Spectral residuals displayed with show_residuals.py* +show_response.py +^^^^^^^^^^^^^^^^ + +.. code-block:: bash + + $ $CTOOLS/share/examples/python/show_response.py + +.. image:: howto_display_rsp_aeff.png + :width: 32% +.. image:: howto_display_rsp_bkg.png + :width: 32% +.. image:: howto_display_rsp_sens.png + :width: 32% + + +show_rmf.py +^^^^^^^^^^^ + +.. code-block:: bash + + $ $CTOOLS/share/examples/python/show_rmf.py rmf.fits + +.. figure:: howto_display_rmf.png + :width: 500px + :align: center + + *Redistribution Matrix File displayed with show_rmf.py* + + +show_significance_distribution.py +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: bash + + $ $CTOOLS/share/examples/python/show_significance_distribution.py skymap.fits --exclude skymap.fits[EXCLUSION] + +.. figure:: howto_display_significance.png + :width: 500px + :align: center + + *Significance distribution displayed with show_significance_distribution.py* + + show_spectrum.py ^^^^^^^^^^^^^^^^ @@ -151,7 +216,7 @@ show_spectrum.py $ $CTOOLS/share/examples/python/show_spectrum.py spectrum.fits .. figure:: howto_display_spectrum.png - :width: 600px + :width: 500px :align: center *Spectrum displayed with show_spectrum.py* diff --git a/doc/source/users/tutorials/howto/howto_display_butterfly.png b/doc/source/users/tutorials/howto/howto_display_butterfly.png index ed36522..dc16170 100755 Binary files a/doc/source/users/tutorials/howto/howto_display_butterfly.png and b/doc/source/users/tutorials/howto/howto_display_butterfly.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_irf.png b/doc/source/users/tutorials/howto/howto_display_irf.png index 25d9720..be69b4f 100644 Binary files a/doc/source/users/tutorials/howto/howto_display_irf.png and b/doc/source/users/tutorials/howto/howto_display_irf.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_obs.png b/doc/source/users/tutorials/howto/howto_display_obs.png index bec5639..ae08cae 100755 Binary files a/doc/source/users/tutorials/howto/howto_display_obs.png and b/doc/source/users/tutorials/howto/howto_display_obs.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_pha.png b/doc/source/users/tutorials/howto/howto_display_pha.png new file mode 100644 index 0000000..5e8ddc9 Binary files /dev/null and b/doc/source/users/tutorials/howto/howto_display_pha.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_phases.png b/doc/source/users/tutorials/howto/howto_display_phases.png index d893ad0..82eb0a8 100755 Binary files a/doc/source/users/tutorials/howto/howto_display_phases.png and b/doc/source/users/tutorials/howto/howto_display_phases.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_pointings.png b/doc/source/users/tutorials/howto/howto_display_pointings.png index 938c51c..1625fd6 100755 Binary files a/doc/source/users/tutorials/howto/howto_display_pointings.png and b/doc/source/users/tutorials/howto/howto_display_pointings.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_residuals.png b/doc/source/users/tutorials/howto/howto_display_residuals.png index 8b8c06e..8f70601 100644 Binary files a/doc/source/users/tutorials/howto/howto_display_residuals.png and b/doc/source/users/tutorials/howto/howto_display_residuals.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_rmf.png b/doc/source/users/tutorials/howto/howto_display_rmf.png new file mode 100644 index 0000000..f27cfd3 Binary files /dev/null and b/doc/source/users/tutorials/howto/howto_display_rmf.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_rsp_aeff.png b/doc/source/users/tutorials/howto/howto_display_rsp_aeff.png new file mode 100644 index 0000000..88fe59a Binary files /dev/null and b/doc/source/users/tutorials/howto/howto_display_rsp_aeff.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_rsp_bkg.png b/doc/source/users/tutorials/howto/howto_display_rsp_bkg.png new file mode 100644 index 0000000..adf6e63 Binary files /dev/null and b/doc/source/users/tutorials/howto/howto_display_rsp_bkg.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_rsp_sens.png b/doc/source/users/tutorials/howto/howto_display_rsp_sens.png new file mode 100644 index 0000000..ecedbfb Binary files /dev/null and b/doc/source/users/tutorials/howto/howto_display_rsp_sens.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_significance.png b/doc/source/users/tutorials/howto/howto_display_significance.png new file mode 100644 index 0000000..208e735 Binary files /dev/null and b/doc/source/users/tutorials/howto/howto_display_significance.png differ diff --git a/doc/source/users/tutorials/howto/howto_display_spectrum.png b/doc/source/users/tutorials/howto/howto_display_spectrum.png index 6621fd2..ab4d254 100755 Binary files a/doc/source/users/tutorials/howto/howto_display_spectrum.png and b/doc/source/users/tutorials/howto/howto_display_spectrum.png differ diff --git a/doc/source/users/tutorials/howto/howto_extent.rst b/doc/source/users/tutorials/howto/howto_extent.rst index a1577e1..0cf05ec 100755 --- a/doc/source/users/tutorials/howto/howto_extent.rst +++ b/doc/source/users/tutorials/howto/howto_extent.rst @@ -67,29 +67,29 @@ The results can be seen in the log file and will also be written into the output :ref:`model definition file `. For illustration, an excerpt of the :ref:`ctlike` log file is shown below. The disk with of ``Src003`` has been fitted to 0.326 +/- 0.005 degrees. -The source is detected with a TS value of 960.6. +The source is detected with a TS value of 960.3. .. code-block:: none - 2018-01-25T13:18:26: === GModelSky === - 2018-01-25T13:18:26: Name ......................: Src003 - 2018-01-25T13:18:26: Instruments ...............: all - 2018-01-25T13:18:26: Test Statistic ............: 960.648581179907 - 2018-01-25T13:18:26: Instrument scale factors ..: unity - 2018-01-25T13:18:26: Observation identifiers ...: all - 2018-01-25T13:18:26: Model type ................: ExtendedSource - 2018-01-25T13:18:26: Model components ..........: "RadialDisk" * "PowerLaw" * "Constant" - 2018-01-25T13:18:26: Number of parameters ......: 7 - 2018-01-25T13:18:26: Number of spatial par's ...: 3 - 2018-01-25T13:18:26: RA .......................: 266.317413730996 +/- 0.00715229434136355 [-360,360] deg (free,scale=1) - 2018-01-25T13:18:26: DEC ......................: -30.1850885371228 +/- 0.00616374863033401 [-90,90] deg (free,scale=1) - 2018-01-25T13:18:26: Radius ...................: 0.325758937003301 +/- 0.00480357697494016 [0.001,10] deg (free,scale=1) - 2018-01-25T13:18:26: Number of spectral par's ..: 3 - 2018-01-25T13:18:26: Prefactor ................: 5.64206343830812e-17 +/- 6.90009393020621e-18 [0,5.7e-15] ph/cm2/s/MeV (free,scale=5.7e-18,gradient) - 2018-01-25T13:18:26: Index ....................: -2.70498667660106 +/- 0.0560039729118815 [9.92,-9.92] (free,scale=-2.48,gradient) - 2018-01-25T13:18:26: PivotEnergy ..............: 300000 MeV (fixed,scale=300000,gradient) - 2018-01-25T13:18:26: Number of temporal par's ..: 1 - 2018-01-25T13:18:26: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + 2019-04-04T10:02:58: === GModelSky === + 2019-04-04T10:02:58: Name ......................: Src003 + 2019-04-04T10:02:58: Instruments ...............: all + 2019-04-04T10:02:58: Test Statistic ............: 960.322220887407 + 2019-04-04T10:02:58: Instrument scale factors ..: unity + 2019-04-04T10:02:58: Observation identifiers ...: all + 2019-04-04T10:02:58: Model type ................: ExtendedSource + 2019-04-04T10:02:58: Model components ..........: "RadialDisk" * "PowerLaw" * "Constant" + 2019-04-04T10:02:58: Number of parameters ......: 7 + 2019-04-04T10:02:58: Number of spatial par's ...: 3 + 2019-04-04T10:02:58: RA .......................: 266.317422676847 +/- 0.00715320609048925 [-360,360] deg (free,scale=1) + 2019-04-04T10:02:58: DEC ......................: -30.1850853839605 +/- 0.00616458713967605 [-90,90] deg (free,scale=1) + 2019-04-04T10:02:58: Radius ...................: 0.325736814893164 +/- 0.00480422517891009 [0.001,10] deg (free,scale=1) + 2019-04-04T10:02:58: Number of spectral par's ..: 3 + 2019-04-04T10:02:58: Prefactor ................: 5.63906592494167e-17 +/- 6.89890876156083e-18 [0,5.7e-15] ph/cm2/s/MeV (free,scale=5.7e-18,gradient) + 2019-04-04T10:02:58: Index ....................: -2.7048301145616 +/- 0.0560202225832113 [9.92,-9.92] (free,scale=-2.48,gradient) + 2019-04-04T10:02:58: PivotEnergy ..............: 300000 MeV (fixed,scale=300000,gradient) + 2019-04-04T10:02:58: Number of temporal par's ..: 1 + 2019-04-04T10:02:58: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) .. warning:: The parameter errors returned by :ref:`ctlike` are purely statistical. In @@ -102,7 +102,7 @@ Now generate a residual map using :ref:`csresmap` to check the fit quality .. code-block:: bash $ csresmap - Input event list, counts cube, or observation definition XML file [cntmap.fits] cntcube.fits + Input event list, counts cube, or observation definition XML file [events.fits] cntcube.fits Input model cube file (generated with ctmodel) [NONE] Input exposure cube file [NONE] expcube.fits Input PSF cube file [NONE] psfcube.fits diff --git a/doc/source/users/tutorials/howto/howto_lightcurve.png b/doc/source/users/tutorials/howto/howto_lightcurve.png index 69a0e94..11f65b8 100755 Binary files a/doc/source/users/tutorials/howto/howto_lightcurve.png and b/doc/source/users/tutorials/howto/howto_lightcurve.png differ diff --git a/doc/source/users/tutorials/howto/howto_lightcurve.rst b/doc/source/users/tutorials/howto/howto_lightcurve.rst index 106835e..d4d767a 100755 --- a/doc/source/users/tutorials/howto/howto_lightcurve.rst +++ b/doc/source/users/tutorials/howto/howto_lightcurve.rst @@ -32,16 +32,16 @@ The time interval is linearly divided into 5 time bins. $ cslightcrv Input event list or observation definition XML file [events.fits] obs_selected.xml Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/1dc_howto_unbinned.xml - Source name [Crab] Src002 Algorithm for defining time bins (FILE|LIN|GTI) [GTI] LIN Lightcurve start time (UTC string, JD, MJD or MET in seconds) [MJD 51544.5] MJD 59235.5 Lightcurve stop time (UTC string, JD, MJD or MET in seconds) [MJD 51544.6] MJD 59236.0 Number of time bins (1-10000) [5] Analysis method (3D|ONOFF) [3D] - Lower energy limit of events (TeV) [0.1] 1.0 - Upper energy limit of events (TeV) [100.0] 100.0 + Source name [Crab] Src002 + Lower energy limit of events (TeV) [0.1] + Upper energy limit of events (TeV) [100.0] Number of energy bins for binned (0=unbinned for 3D analysis only) (0-100) [0] - Output light curve file [lightcurve.fits] + Output light curve file [lightcurve.fits] The resulting light curve is shown in the figure below. diff --git a/doc/source/users/tutorials/howto/howto_phasecurve.rst b/doc/source/users/tutorials/howto/howto_phasecurve.rst index b83fb8d..c988c08 100755 --- a/doc/source/users/tutorials/howto/howto_phasecurve.rst +++ b/doc/source/users/tutorials/howto/howto_phasecurve.rst @@ -86,7 +86,7 @@ has now an associated phase value that was computed from the trigger time of the event. .. figure:: howto_phasecurve_events.png - :width: 700px + :width: 800px :align: center *Event list file with phase information for the Vela pulsar* @@ -98,21 +98,26 @@ the following: .. code-block:: bash - $ ctselect + $ ctselect usepnt=no Input event list or observation definition XML file [events.fits] obs_vela_phased.xml RA for ROI centre (degrees) (0-360) [83.63] 128.838 Dec for ROI centre (degrees) (-90-90) [22.51] -45.178 - Radius of ROI (degrees) (0-180) [3.0] 0.2 + Radius of ROI around pointing or specified RA/DEC (degrees) (0-180) [3.0] 0.2 Start time (UTC string, JD, MJD or MET in seconds) [NONE] Lower energy limit (TeV) [0.1] 0.03 Upper energy limit (TeV) [100.0] 160.0 Output event list or observation definition XML file [selected_events.fits] obs_vela_phased_selected.xml +.. note:: + By default :ref:`ctselect` selects events around the pointing direction. + To select the events around a different sky direction, the hidden ``usepnt=no`` + has to be passed to the tool. + The selected events as a function of phase are displayed below. There is a clear indication for a phase dependence of the event rate. .. figure:: howto_phasecurve_phases.png - :width: 600px + :width: 500px :align: center *Phase histogram for events selected within 0.2 degrees of the Vela pulsar* @@ -184,22 +189,37 @@ probability threshold to >10% by adding the attribute .. code-block:: bash - $ ctselect expr="PROB_VelaPulsar>0.1" + $ ctselect expr="PROB_VelaPulsar>0.1" usepnt=no forcesel=yes Input event list or observation definition XML file [obs_vela_phased.xml] obs_vela_phased_prob.xml RA for ROI centre (degrees) (0-360) [128.838] Dec for ROI centre (degrees) (-90-90) [-45.178] - Radius of ROI (degrees) (0-180) [0.2] 5.0 + Radius of ROI around pointing or specified RA/DEC (degrees) (0-180) [0.2] 5.0 Start time (UTC string, JD, MJD or MET in seconds) [NONE] Lower energy limit (TeV) [0.03] Upper energy limit (TeV) [160.0] Output event list or observation definition XML file [obs_vela_phased_selected.xml] obs_vela_phased_prob_selected.xml +.. warning:: + The ``forcesel=yes`` option is required to accomodate for non-overlapping + regions of interests (ROIs). The situation is illustrated in the figure + below. Due to the large radius of 5 degrees, the ROI selection (red) does + not fully overlap with the field of view of the observations (blue), leading + to a non-circular selection region (grey). Such data cannot be used for an + unbinned maximum likelihood analysis which always requires circular selection + regions. However, for data display, as intended here, such a selection may + make sense. But you should **never** try fitting such data using :ref:`ctlike` + or any other maximum likelihood tool. + + .. figure:: howto_roi_selection.jpg + :width: 30% + :align: center + The selected events as a function of phase are displayed below. The background is considerably reduced with respect to the simple radius cut that was used before, and the pulsations of the Vela pulsar are now clearly visible. .. figure:: howto_phasecurve_probphases.png - :width: 600px + :width: 500px :align: center *Phase histogram of events for events having a probability of >10% in originating from the Vela pulsar* @@ -216,11 +236,11 @@ after the :ref:`ctselect` command: .. code-block:: bash - $ ctselect expr="MC_ID==91" + $ ctselect expr="MC_ID==91" usepnt=no forcesel=yes Input event list or observation definition XML file [obs_vela_phased_prob.xml] obs_vela_phased.xml RA for ROI centre (degrees) (0-360) [128.838] Dec for ROI centre (degrees) (-90-90) [-45.178] - Radius of ROI (degrees) (0-180) [5.0] + Radius of ROI around pointing or specified RA/DEC (degrees) (0-180) [5.0] Start time (UTC string, JD, MJD or MET in seconds) [NONE] Lower energy limit (TeV) [0.03] Upper energy limit (TeV) [160.0] @@ -228,12 +248,12 @@ after the :ref:`ctselect` command: The resulting phase histogram is shown below. It confirms that the peaks seen in the event histogram do indeed correspond to the expected peaks from the Vela -pulsar. Note that the peak has an amplitude of about 460 events, while the peak -in the figures above is about 250 events, indicating that almost half of the -events have been surpressed by the radius or probability cuts. +pulsar. Note that the peak has an amplitude of about 440 events, while the peak +above background in the figures above is about 250 events, indicating that almost +half of the events were surpressed by the radius or probability cuts. .. figure:: howto_phasecurve_mcid.png - :width: 700px + :width: 500px :align: center *Distribution of Vela pulsar events as function of event phase* diff --git a/doc/source/users/tutorials/howto/howto_phasecurve_mcid.png b/doc/source/users/tutorials/howto/howto_phasecurve_mcid.png index fd8e064..d1d5388 100755 Binary files a/doc/source/users/tutorials/howto/howto_phasecurve_mcid.png and b/doc/source/users/tutorials/howto/howto_phasecurve_mcid.png differ diff --git a/doc/source/users/tutorials/howto/howto_phasecurve_phases.png b/doc/source/users/tutorials/howto/howto_phasecurve_phases.png index 8547ba6..b227245 100755 Binary files a/doc/source/users/tutorials/howto/howto_phasecurve_phases.png and b/doc/source/users/tutorials/howto/howto_phasecurve_phases.png differ diff --git a/doc/source/users/tutorials/howto/howto_phasecurve_probphases.png b/doc/source/users/tutorials/howto/howto_phasecurve_probphases.png index bde1c9e..be536ee 100755 Binary files a/doc/source/users/tutorials/howto/howto_phasecurve_probphases.png and b/doc/source/users/tutorials/howto/howto_phasecurve_probphases.png differ diff --git a/doc/source/users/tutorials/howto/howto_prepare_1dc.ipynb b/doc/source/users/tutorials/howto/howto_prepare_1dc.ipynb index 7f5027f..2fcf26f 100644 --- a/doc/source/users/tutorials/howto/howto_prepare_1dc.ipynb +++ b/doc/source/users/tutorials/howto/howto_prepare_1dc.ipynb @@ -50,14 +50,14 @@ "name": "stdout", "output_type": "stream", "text": [ - "env: CTADATA=/Users/jurgen/1dc\n", - "env: CALDB=/Users/jurgen/1dc/caldb\n" + "env: CTADATA=/project-data/cta/data/1dc\n", + "env: CALDB=/project-data/cta/data/1dc/caldb\n" ] } ], "source": [ - "%env CTADATA=/Users/jurgen/1dc\n", - "%env CALDB=/Users/jurgen/1dc/caldb" + "%env CTADATA=/project-data/cta/data/1dc\n", + "%env CALDB=/project-data/cta/data/1dc/caldb" ] }, { @@ -138,7 +138,7 @@ "binning['emin'] = 1.0\n", "binning['emax'] = 100.0\n", "binning['enumbins'] = 20\n", - "binning['outcube'] = 'cntcube.fits'\n", + "binning['outobs'] = 'cntcube.fits'\n", "binning.execute()" ] }, diff --git a/doc/source/users/tutorials/howto/howto_roi_selection.jpg b/doc/source/users/tutorials/howto/howto_roi_selection.jpg new file mode 100644 index 0000000..fe4b34e Binary files /dev/null and b/doc/source/users/tutorials/howto/howto_roi_selection.jpg differ diff --git a/doc/source/users/tutorials/howto/howto_ts.rst b/doc/source/users/tutorials/howto/howto_ts.rst index b3d545d..2af73b6 100755 --- a/doc/source/users/tutorials/howto/howto_ts.rst +++ b/doc/source/users/tutorials/howto/howto_ts.rst @@ -67,7 +67,7 @@ An excerpt of the :ref:`ctlike` log file is shown below 2018-01-25T12:46:12: === GModelSky === 2018-01-25T12:46:12: Name ......................: Src001 2018-01-25T12:46:12: Instruments ...............: all - 2018-01-25T12:46:12: Test Statistic ............: 7659.64342272468 + 2018-01-25T12:46:12: Test Statistic ............: 7659.72844228207 The Test Statistic values are also written into the :ref:`model definition file ` @@ -77,7 +77,7 @@ created by :ref:`ctlike`: - + ... ... diff --git a/doc/source/users/tutorials/howto/howto_tsmap.png b/doc/source/users/tutorials/howto/howto_tsmap.png old mode 100755 new mode 100644 index 2b8fc30..9b92c86 Binary files a/doc/source/users/tutorials/howto/howto_tsmap.png and b/doc/source/users/tutorials/howto/howto_tsmap.png differ diff --git a/doc/source/users/tutorials/howto/howto_tsmap.rst b/doc/source/users/tutorials/howto/howto_tsmap.rst index 1f8dc5c..71c6eca 100755 --- a/doc/source/users/tutorials/howto/howto_tsmap.rst +++ b/doc/source/users/tutorials/howto/howto_tsmap.rst @@ -26,10 +26,10 @@ map of size 0.5 x 0.5 degrees, centred on the Galactic Centre. Input background cube file [NONE] bkgcube.fits Test source name [Crab] Test Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/test_cube.xml + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 - Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] - Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL Image scale (in degrees/pixel) [0.02] 0.05 Size of the X axis in pixels [200] 10 Size of the Y axis in pixels [200] 10 @@ -73,10 +73,10 @@ The figure below shows the resulting Test Statistic map. Input PSF cube file [NONE] psfcube.fits Input background cube file [NONE] bkgcube.fits Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/test_cube.xml + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 - Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] - Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL Image scale (in degrees/pixel) [0.02] 0.05 Size of the X axis in pixels [200] 10 Size of the Y axis in pixels [200] 10 @@ -90,16 +90,16 @@ The figure below shows the resulting Test Statistic map. .. code-block:: bash - cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=0 binmax=10 outmap=tsmap_split_0.fits logfile=tsmap_split_0.log & - cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=10 binmax=20 outmap=tsmap_split_1.fits logfile=tsmap_split_1.log & - cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=20 binmax=30 outmap=tsmap_split_2.fits logfile=tsmap_split_2.log & - cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=30 binmax=40 outmap=tsmap_split_3.fits logfile=tsmap_split_3.log & - cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=40 binmax=50 outmap=tsmap_split_4.fits logfile=tsmap_split_4.log & - cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=50 binmax=60 outmap=tsmap_split_5.fits logfile=tsmap_split_5.log & - cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=60 binmax=70 outmap=tsmap_split_6.fits logfile=tsmap_split_6.log & - cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=70 binmax=80 outmap=tsmap_split_7.fits logfile=tsmap_split_7.log & - cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=80 binmax=90 outmap=tsmap_split_8.fits logfile=tsmap_split_8.log & - cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits edisp=no errors=no statistic=DEFAULT usepnt=no nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 publish=no chatter=2 clobber=yes debug=no mode=ql logL0=-447796.4353529836 binmin=90 binmax=100 outmap=tsmap_split_9.fits logfile=tsmap_split_9.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 binmin=0 binmax=10 outmap=tsmap_split_0.fits logfile=tsmap_split_0.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 binmin=10 binmax=20 outmap=tsmap_split_1.fits logfile=tsmap_split_1.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 binmin=20 binmax=30 outmap=tsmap_split_2.fits logfile=tsmap_split_2.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 binmin=30 binmax=40 outmap=tsmap_split_3.fits logfile=tsmap_split_3.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 binmin=40 binmax=50 outmap=tsmap_split_4.fits logfile=tsmap_split_4.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 binmin=50 binmax=60 outmap=tsmap_split_5.fits logfile=tsmap_split_5.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 binmin=60 binmax=70 outmap=tsmap_split_6.fits logfile=tsmap_split_6.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 binmin=70 binmax=80 outmap=tsmap_split_7.fits logfile=tsmap_split_7.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 binmin=80 binmax=90 outmap=tsmap_split_8.fits logfile=tsmap_split_8.log & + cttsmap inobs=cntcube.fits inmodel=$CTOOLS/share/models/test_cube.xml srcname=Test expcube=expcube.fits psfcube=psfcube.fits bkgcube=bkgcube.fits nxpix=10 nypix=10 binsz=0.05 coordsys=GAL proj=CAR xref=0.0 yref=0.0 logL0=-447785.5939102234 binmin=90 binmax=100 outmap=tsmap_split_9.fits logfile=tsmap_split_9.log & Now run the ASCII file by typing diff --git a/doc/source/users/tutorials/howto/howto_ulimit.rst b/doc/source/users/tutorials/howto/howto_ulimit.rst index 6e26c3f..a397cd7 100755 --- a/doc/source/users/tutorials/howto/howto_ulimit.rst +++ b/doc/source/users/tutorials/howto/howto_ulimit.rst @@ -55,12 +55,12 @@ extracted from the :ref:`ctulimit` log file: .. code-block:: bash - 2018-01-25T13:57:23: +=====================+ - 2018-01-25T13:57:23: | Upper limit results | - 2018-01-25T13:57:23: +=====================+ - 2018-01-25T13:57:23: Differential flux limit ...: 1.39791304697722e-20 ph/cm2/s/MeV at 1 TeV - 2018-01-25T13:57:23: Integral flux limit .......: 9.43500179595339e-15 ph/cm2/s within [1-100] TeV - 2018-01-25T13:57:23: Energy flux limit .........: 4.1544267393937e-14 erg/cm2/s within [1-100] TeV + 2019-04-04T10:31:20: +=====================+ + 2019-04-04T10:31:20: | Upper limit results | + 2019-04-04T10:31:20: +=====================+ + 2019-04-04T10:31:20: Differential flux limit ...: 1.3961626479978e-20 ph/cm2/s/MeV at 1 TeV + 2019-04-04T10:31:20: Integral flux limit .......: 9.42318774389192e-15 ph/cm2/s within [1-100] TeV + 2019-04-04T10:31:20: Energy flux limit .........: 4.14922476753972e-14 erg/cm2/s within [1-100] TeV .. warning:: It is important to fix the spectral index of the test source in the diff --git a/doc/source/users/tutorials/howto/howto_vo.rst b/doc/source/users/tutorials/howto/howto_vo.rst index af4d0f4..fae8e5a 100755 --- a/doc/source/users/tutorials/howto/howto_vo.rst +++ b/doc/source/users/tutorials/howto/howto_vo.rst @@ -34,16 +34,16 @@ as argument after the tool name: $ ctskymap publish=yes Input event list or observation definition XML file [events.fits] obs_selected.xml + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0 Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0 - Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] - Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL Image scale (in degrees/pixel) [0.02] Size of the X axis in pixels [200] 400 Size of the Y axis in pixels [200] 400 Lower energy limit (TeV) [0.1] Upper energy limit (TeV) [100.0] - Background subtraction method (NONE|IRF) [NONE] + Background subtraction method (NONE|IRF|RING) [NONE] Output skymap file [skymap.fits] Once :ref:`ctskymap` has terminated, the resulting sky map will automatically @@ -88,12 +88,12 @@ argument after the tool name: .. code-block:: bash $ ctselect publish=yes - Input event list or observation definition XML file [selected_gps_baseline_120380.fits] - RA for ROI centre (degrees) (0-360) [UNDEFINED] - Start time (CTA MET in seconds) [UNDEFINED] - Lower energy limit (TeV) [0.2] - Upper energy limit (TeV) [50.0] - Output event list or observation definition XML file [selected_gps_baseline_120380_0.2-50TeV.fits] + Input event list or observation definition XML file [events.fits] selected_gps_baseline_110380.fits + Radius of ROI around pointing or specified RA/DEC (degrees) (0-180) [3.0] NONE + Start time (UTC string, JD, MJD or MET in seconds) [NONE] + Lower energy limit (TeV) [0.1] 0.2 + Upper energy limit (TeV) [100.0] 50.0 + Output event list or observation definition XML file [selected_events.fits] Once :ref:`ctselect` has terminated, the resulting event list will automatically appear in the diff --git a/examples/show_obs.py b/examples/show_obs.py index 1cb6de7..2f1daff 100755 --- a/examples/show_obs.py +++ b/examples/show_obs.py @@ -108,7 +108,7 @@ def plot_information(info, ra, dec, plotfile): if info['offset'].boolean() and ebounds.size() > 0: ncols += 1 iplot = 1 - plt.figure() + plt.figure(figsize=(10,6)) plt.subplot(nrows, ncols, iplot) # Plot zenith angle histogram @@ -168,6 +168,9 @@ def plot_information(info, ra, dec, plotfile): plt.ylabel('Zenith Angle (deg)') plt.title('Observation time') + # Adjust + plt.tight_layout() + # Show plots or save it into file if len(plotfile) > 0: plt.savefig(plotfile) diff --git a/src/cttsmap/cttsmap.cpp b/src/cttsmap/cttsmap.cpp index 06b6e5d..85783fa 100755 --- a/src/cttsmap/cttsmap.cpp +++ b/src/cttsmap/cttsmap.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * cttsmap - TS map calculation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2018 by Michael Mayer * + * copyright (C) 2014-2019 by Michael Mayer * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -274,9 +274,14 @@ void cttsmap::run(void) log_header2(EXPLICIT, "Computing TS for bin number "+gammalib::str(i)+ " at "+bincentre.print()); + // Sets unique test source name. This avoids caching of response + // values + std::string srcname = m_srcname + "_" + gammalib::str(i); + // Add test source at current bin position (*m_testsource)["RA"].value(bincentre.ra_deg()); (*m_testsource)["DEC"].value(bincentre.dec_deg()); + m_testsource->name(srcname); models.append(*m_testsource); // Assign models to observations @@ -310,7 +315,7 @@ void cttsmap::run(void) // Get test source model instance GModels best_fit_model = m_obs.models(); - GModel* testsource = best_fit_model[m_srcname]; + GModel* testsource = best_fit_model[srcname]; // Assign values to the maps m_tsmap(i) = ts; @@ -340,7 +345,7 @@ void cttsmap::run(void) m_statusmap(i) = status; // Remove model from container - models.remove(m_srcname); + models.remove(srcname); } // endfor: looped over grid positions @@ -375,7 +380,7 @@ void cttsmap::save(void) // Get TS map filename m_outmap = (*this)["outmap"].filename(); - + // Create fits file GFits fits; @@ -564,7 +569,7 @@ void cttsmap::get_parameters(void) GSkyMap map = create_map(m_obs); // Check if errors should be computed - m_errors = (*this)["errors"].boolean(); + m_errors = (*this)["errors"].boolean(); // Initialise maps from user parameters init_maps(map); @@ -638,7 +643,7 @@ void cttsmap::init_maps(const GSkyMap& map) m_mapnames.push_back("e_" + (*m_testsource)[i].name()); } // endif: error calculation was requested - + } // endfor: looped over all model parameters // Return diff --git a/src/support/ctobservation.cpp b/src/support/ctobservation.cpp index 9b7b201..e05f312 100755 --- a/src/support/ctobservation.cpp +++ b/src/support/ctobservation.cpp @@ -551,11 +551,14 @@ void ctobservation::set_obs_bounds(void) (*this)["dec"].real()); } + // Get instrument direction + GCTAInstDir instdir(dir); + // Get radius double rad = (*this)["rad"].real(); // Set ROI - GCTARoi roi(GCTAInstDir(dir), rad); + GCTARoi roi(instdir, rad); // Set ROI of list list->roi(roi); -- libgit2 0.21.4