From 3e80f4637d56996b08fdcc83a3370e177a779a8c Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Thu, 25 Jan 2018 22:59:06 +0100 Subject: [PATCH] Update Fermi-LAT How-tos --- doc/source/users/tutorials/howto/fermi/howto_fermi_errors.rst | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------- doc/source/users/tutorials/howto/fermi/howto_fermi_fitting.rst | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------ doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.png | Bin 27171 -> 0 bytes doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.rst | 91 +++++++++++++++++++++++++++++-------------------------------------------------------------- doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.png | Bin 0 -> 24579 bytes doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.rst | 42 ++++++++++++++++++++++++++++++++++++++++++ doc/source/users/tutorials/howto/fermi/howto_fermi_ulimit.rst | 18 +++++++++--------- doc/source/users/tutorials/howto/fermi/index.rst | 1 + 8 files changed, 257 insertions(+), 219 deletions(-) create mode 100644 doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.png create mode 100644 doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.rst diff --git a/doc/source/users/tutorials/howto/fermi/howto_fermi_errors.rst b/doc/source/users/tutorials/howto/fermi/howto_fermi_errors.rst index 79dadd4..f24b0d1 100644 --- a/doc/source/users/tutorials/howto/fermi/howto_fermi_errors.rst +++ b/doc/source/users/tutorials/howto/fermi/howto_fermi_errors.rst @@ -31,56 +31,82 @@ that was created by :ref:`cterror`. As you will see, the parameter errors are essentially symmetric and very close to the values determined using the covariance matrix. -.. code-block:: bash +.. code-block:: none - 2017-08-26T14:16:00: +=======================================================+ - 2017-08-26T14:16:00: | Compute error for source "Vela" parameter "Prefactor" | - 2017-08-26T14:16:00: +=======================================================+ - 2017-08-26T14:16:00: Confidence level ..........: 68 % - 2017-08-26T14:16:00: Log-likelihood difference .: 0.494473 - 2017-08-26T14:16:00: Initial factor range ......: [1e-07, 9.10916268820218] - 2017-08-26T14:16:20: Lower parameter factor ....: 3.93549 - 2017-08-26T14:16:20: Upper parameter factor ....: 4.89285 - 2017-08-26T14:16:20: Error from curvature ......: 4.75365104151534e-10 ph/cm2/s/MeV - 2017-08-26T14:16:20: Error from profile ........: 4.78682555317737e-10 ph/cm2/s/MeV - 2017-08-26T14:16:20: Negative profile error ....: 4.20026137925122e-10 ph/cm2/s/MeV - 2017-08-26T14:16:20: Positive profile error ....: 5.37338972710351e-10 ph/cm2/s/MeV - 2017-08-26T14:16:20: - 2017-08-26T14:16:20: +====================================================+ - 2017-08-26T14:16:20: | Compute error for source "Vela" parameter "Index1" | - 2017-08-26T14:16:20: +====================================================+ - 2017-08-26T14:16:20: Confidence level ..........: 68 % - 2017-08-26T14:16:20: Log-likelihood difference .: 0.494473 - 2017-08-26T14:16:20: Initial factor range ......: [1.03221907174349, 1.65479046234989] - 2017-08-26T14:16:42: Lower parameter factor ....: 1.31121 - 2017-08-26T14:16:42: Upper parameter factor ....: 1.37307 - 2017-08-26T14:16:42: Error from curvature ......: 0.03112856953032 - 2017-08-26T14:16:42: Error from profile ........: 0.0309309760713872 - 2017-08-26T14:16:42: Negative profile error ....: 0.0322989307870749 - 2017-08-26T14:16:42: Positive profile error ....: 0.0295630213556994 - 2017-08-26T14:16:42: - 2017-08-26T14:16:42: +==========================================================+ - 2017-08-26T14:16:42: | Compute error for source "Vela" parameter "CutoffEnergy" | - 2017-08-26T14:16:42: +==========================================================+ - 2017-08-26T14:16:42: Confidence level ..........: 68 % - 2017-08-26T14:16:42: Log-likelihood difference .: 0.494473 - 2017-08-26T14:16:42: Initial factor range ......: [0.001, 2.8071605417966] - 2017-08-26T14:17:02: Lower parameter factor ....: 0.813181 - 2017-08-26T14:17:02: Upper parameter factor ....: 1.17404 - 2017-08-26T14:17:02: Error from curvature ......: 181.871842544747 MeV - 2017-08-26T14:17:02: Error from profile ........: 180.431484426618 MeV - 2017-08-26T14:17:02: Negative profile error ....: 175.261332662553 MeV - 2017-08-26T14:17:02: Positive profile error ....: 185.601636190684 MeV - 2017-08-26T14:17:02: - 2017-08-26T14:17:02: +====================================================+ - 2017-08-26T14:17:02: | Compute error for source "Vela" parameter "Index2" | - 2017-08-26T14:17:02: +====================================================+ - 2017-08-26T14:17:02: Confidence level ..........: 68 % - 2017-08-26T14:17:02: Log-likelihood difference .: 0.494473 - 2017-08-26T14:17:02: Initial factor range ......: [0.307804018748382, 0.866425033775455] - 2017-08-26T14:17:24: Lower parameter factor ....: 0.559156 - 2017-08-26T14:17:24: Upper parameter factor ....: 0.615141 - 2017-08-26T14:17:24: Error from curvature ......: 0.0279310507513537 - 2017-08-26T14:17:24: Error from profile ........: 0.0279924226890397 - 2017-08-26T14:17:24: Negative profile error ....: 0.027958327168103 - 2017-08-26T14:17:24: Positive profile error ....: 0.0280265182099764 + 2018-01-25T20:45:22: +================================================+ + 2018-01-25T20:45:22: | Compute error for source "Vela" parameter "RA" | + 2018-01-25T20:45:22: +================================================+ + 2018-01-25T20:45:22: Confidence level ..........: 68 % + 2018-01-25T20:45:22: Log-likelihood difference .: 0.494473 + 2018-01-25T20:45:22: Initial factor range ......: [128.819554251926, 128.851989886434] + 2018-01-25T20:45:41: Lower parameter factor ....: 128.834 + 2018-01-25T20:45:41: Upper parameter factor ....: 128.837 + 2018-01-25T20:45:41: Error from curvature ......: 0.00162178172537938 deg + 2018-01-25T20:45:41: Error from profile ........: 0.00169067577327553 deg + 2018-01-25T20:45:41: Negative profile error ....: 0.00165900034895117 deg + 2018-01-25T20:45:41: Positive profile error ....: 0.00172235119759989 deg + 2018-01-25T20:45:41: + 2018-01-25T20:45:41: +=================================================+ + 2018-01-25T20:45:41: | Compute error for source "Vela" parameter "DEC" | + 2018-01-25T20:45:41: +=================================================+ + 2018-01-25T20:45:41: Confidence level ..........: 68 % + 2018-01-25T20:45:41: Log-likelihood difference .: 0.494473 + 2018-01-25T20:45:41: Initial factor range ......: [-45.1949881923928, -45.1721741961801] + 2018-01-25T20:46:01: Lower parameter factor ....: -45.1847 + 2018-01-25T20:46:01: Upper parameter factor ....: -45.1824 + 2018-01-25T20:46:01: Error from curvature ......: 0.00114069981063169 deg + 2018-01-25T20:46:01: Error from profile ........: 0.00116548552428952 deg + 2018-01-25T20:46:01: Negative profile error ....: 0.00115852324517363 deg + 2018-01-25T20:46:01: Positive profile error ....: 0.00117244780340542 deg + 2018-01-25T20:46:01: + 2018-01-25T20:46:01: +=======================================================+ + 2018-01-25T20:46:01: | Compute error for source "Vela" parameter "Prefactor" | + 2018-01-25T20:46:01: +=======================================================+ + 2018-01-25T20:46:01: Confidence level ..........: 68 % + 2018-01-25T20:46:01: Log-likelihood difference .: 0.494473 + 2018-01-25T20:46:01: Initial factor range ......: [1e-07, 9.09784331905335] + 2018-01-25T20:46:45: Lower parameter factor ....: 3.93674 + 2018-01-25T20:46:45: Upper parameter factor ....: 4.89558 + 2018-01-25T20:46:45: Error from curvature ......: 4.74564602380296e-10 ph/cm2/s/MeV + 2018-01-25T20:46:45: Error from profile ........: 4.79421031311828e-10 ph/cm2/s/MeV + 2018-01-25T20:46:45: Negative profile error ....: 4.15456324058327e-10 ph/cm2/s/MeV + 2018-01-25T20:46:45: Positive profile error ....: 5.4338573856533e-10 ph/cm2/s/MeV + 2018-01-25T20:46:45: + 2018-01-25T20:46:45: +====================================================+ + 2018-01-25T20:46:45: | Compute error for source "Vela" parameter "Index1" | + 2018-01-25T20:46:45: +====================================================+ + 2018-01-25T20:46:45: Confidence level ..........: 68 % + 2018-01-25T20:46:45: Log-likelihood difference .: 0.494473 + 2018-01-25T20:46:45: Initial factor range ......: [1.0323933217421, 1.65461803910864] + 2018-01-25T20:47:31: Lower parameter factor ....: 1.31084 + 2018-01-25T20:47:31: Upper parameter factor ....: 1.37275 + 2018-01-25T20:47:31: Error from curvature ......: 0.0311112358683271 + 2018-01-25T20:47:31: Error from profile ........: 0.0309517300203693 + 2018-01-25T20:47:31: Negative profile error ....: 0.032660721248488 + 2018-01-25T20:47:31: Positive profile error ....: 0.0292427387922507 + 2018-01-25T20:47:31: + 2018-01-25T20:47:31: +==========================================================+ + 2018-01-25T20:47:31: | Compute error for source "Vela" parameter "CutoffEnergy" | + 2018-01-25T20:47:31: +==========================================================+ + 2018-01-25T20:47:31: Confidence level ..........: 68 % + 2018-01-25T20:47:31: Log-likelihood difference .: 0.494473 + 2018-01-25T20:47:31: Initial factor range ......: [0.001, 2.80853448949703] + 2018-01-25T20:48:14: Lower parameter factor ....: 0.81239 + 2018-01-25T20:48:14: Upper parameter factor ....: 1.17294 + 2018-01-25T20:48:14: Error from curvature ......: 181.899981380157 MeV + 2018-01-25T20:48:14: Error from profile ........: 180.277267463442 MeV + 2018-01-25T20:48:14: Negative profile error ....: 177.144641591912 MeV + 2018-01-25T20:48:14: Positive profile error ....: 183.409893334972 MeV + 2018-01-25T20:48:14: + 2018-01-25T20:48:14: +====================================================+ + 2018-01-25T20:48:14: | Compute error for source "Vela" parameter "Index2" | + 2018-01-25T20:48:14: +====================================================+ + 2018-01-25T20:48:14: Confidence level ..........: 68 % + 2018-01-25T20:48:14: Log-likelihood difference .: 0.494473 + 2018-01-25T20:48:14: Initial factor range ......: [0.308028525758507, 0.866644263529458] + 2018-01-25T20:49:01: Lower parameter factor ....: 0.559037 + 2018-01-25T20:49:01: Upper parameter factor ....: 0.615056 + 2018-01-25T20:49:01: Error from curvature ......: 0.0279307868885475 + 2018-01-25T20:49:01: Error from profile ........: 0.0280092058458762 + 2018-01-25T20:49:01: Negative profile error ....: 0.028299015036004 + 2018-01-25T20:49:01: Positive profile error ....: 0.0277193966557485 diff --git a/doc/source/users/tutorials/howto/fermi/howto_fermi_fitting.rst b/doc/source/users/tutorials/howto/fermi/howto_fermi_fitting.rst index a3278d0..f8abbc1 100644 --- a/doc/source/users/tutorials/howto/fermi/howto_fermi_fitting.rst +++ b/doc/source/users/tutorials/howto/fermi/howto_fermi_fitting.rst @@ -47,8 +47,8 @@ extragalactic isotropic source component. - - + + @@ -92,96 +92,95 @@ log file ``ctlike.log`` that was also created by :ref:`ctlike`: .. code-block:: none - 2017-08-26T10:35:10: +=================================+ - 2017-08-26T10:35:10: | Maximum likelihood optimisation | - 2017-08-26T10:35:10: +=================================+ - 2017-08-26T10:35:12: >Iteration 0: -logL=-177232.327, Lambda=1.0e-03 - 2017-08-26T10:35:12: >Iteration 1: -logL=-198931.081, Lambda=1.0e-03, delta=21698.754, step=1.0e+00, max(|grad|)=-22713.401202 [CutoffEnergy:4] - 2017-08-26T10:35:12: >Iteration 2: -logL=-200263.519, Lambda=1.0e-04, delta=1332.438, step=1.0e+00, max(|grad|)=-67648.133552 [CutoffEnergy:4] - 2017-08-26T10:35:12: >Iteration 3: -logL=-212350.035, Lambda=1.0e-05, delta=12086.515, step=1.0e+00, max(|grad|)=23036.151920 [Index2:6] - 2017-08-26T10:35:12: >Iteration 4: -logL=-213951.781, Lambda=1.0e-06, delta=1601.746, step=1.0e+00, max(|grad|)=-8297.648633 [CutoffEnergy:4] - 2017-08-26T10:35:13: >Iteration 5: -logL=-215341.362, Lambda=1.0e-07, delta=1389.581, step=1.0e+00, max(|grad|)=2747.034517 [Index2:6] - 2017-08-26T10:35:13: >Iteration 6: -logL=-215490.429, Lambda=1.0e-08, delta=149.067, step=1.0e+00, max(|grad|)=697.301361 [Index2:6] - 2017-08-26T10:35:13: Iteration 7: -logL=-215490.429, Lambda=1.0e-09, delta=-14.065, step=1.0e+00, max(|grad|)=-1205.683279 [Index1:3] (stalled) - 2017-08-26T10:35:13: Iteration 8: -logL=-215490.429, Lambda=1.0e-08, delta=-14.064, step=1.0e+00, max(|grad|)=-1205.659884 [Index1:3] (stalled) - 2017-08-26T10:35:14: Iteration 9: -logL=-215490.429, Lambda=1.0e-07, delta=-14.055, step=1.0e+00, max(|grad|)=-1205.425967 [Index1:3] (stalled) - 2017-08-26T10:35:14: Iteration 10: -logL=-215490.429, Lambda=1.0e-06, delta=-13.963, step=1.0e+00, max(|grad|)=-1203.090620 [Index1:3] (stalled) - 2017-08-26T10:35:14: Iteration 11: -logL=-215490.429, Lambda=1.0e-05, delta=-13.066, step=1.0e+00, max(|grad|)=-1180.113526 [Index1:3] (stalled) - 2017-08-26T10:35:14: Iteration 12: -logL=-215490.429, Lambda=1.0e-04, delta=-6.263, step=1.0e+00, max(|grad|)=-983.079153 [Index1:3] (stalled) - 2017-08-26T10:35:14: >Iteration 13: -logL=-215496.367, Lambda=1.0e-03, delta=5.937, step=1.0e+00, max(|grad|)=-285.734284 [Index1:3] - 2017-08-26T10:35:15: Iteration 14: -logL=-215496.367, Lambda=1.0e-04, delta=-8.812, step=1.0e+00, max(|grad|)=-731.894749 [Index1:3] (stalled) - 2017-08-26T10:35:15: >Iteration 15: -logL=-215497.536, Lambda=1.0e-03, delta=1.169, step=1.0e+00, max(|grad|)=-153.668138 [Index1:3] - 2017-08-26T10:35:15: Iteration 16: -logL=-215496.136, Lambda=1.0e-04, delta=-1.400, step=1.0e+00, max(|grad|)=-328.522942 [Index1:3] (stalled) - 2017-08-26T10:35:15: >Iteration 17: -logL=-215498.376, Lambda=1.0e-03, delta=2.240, step=1.0e+00, max(|grad|)=3.257091 [Index2:6] - 2017-08-26T10:35:16: >Iteration 18: -logL=-215498.383, Lambda=1.0e-04, delta=0.007, step=1.0e+00, max(|grad|)=-8.270351 [CutoffEnergy:4] - 2017-08-26T10:35:16: >Iteration 19: -logL=-215498.384, Lambda=1.0e-05, delta=0.002, step=1.0e+00, max(|grad|)=0.637485 [Index2:6] - 2017-08-26T10:35:16: - 2017-08-26T10:35:16: +=========================================+ - 2017-08-26T10:35:16: | Maximum likelihood optimisation results | - 2017-08-26T10:35:16: +=========================================+ - 2017-08-26T10:35:16: === GOptimizerLM === - 2017-08-26T10:35:16: Optimized function value ..: -215498.384 - 2017-08-26T10:35:16: Absolute precision ........: 0.005 - 2017-08-26T10:35:16: Acceptable value decrease .: 2 - 2017-08-26T10:35:16: Optimization status .......: converged - 2017-08-26T10:35:16: Number of parameters ......: 14 - 2017-08-26T10:35:16: Number of free parameters .: 5 - 2017-08-26T10:35:16: Number of iterations ......: 19 - 2017-08-26T10:35:16: Lambda ....................: 1e-06 - 2017-08-26T10:35:16: Maximum log likelihood ....: 215498.384 - 2017-08-26T10:35:16: Observed events (Nobs) ...: 202330.000 - 2017-08-26T10:35:16: Predicted events (Npred) ..: 202318.082 (Nobs - Npred = 11.9178772509331) - 2017-08-26T10:35:16: === GModels === - 2017-08-26T10:35:16: Number of models ..........: 3 - 2017-08-26T10:35:16: Number of parameters ......: 14 - 2017-08-26T10:35:16: === GModelSky === - 2017-08-26T10:35:16: Name ......................: Vela - 2017-08-26T10:35:16: Instruments ...............: all - 2017-08-26T10:35:16: Instrument scale factors ..: unity - 2017-08-26T10:35:16: Observation identifiers ...: all - 2017-08-26T10:35:16: Model type ................: PointSource - 2017-08-26T10:35:16: Model components ..........: "PointSource" * "SuperExponentialCutoffPowerLaw" * "Constant" - 2017-08-26T10:35:16: Number of parameters ......: 8 - 2017-08-26T10:35:16: Number of spatial par's ...: 2 - 2017-08-26T10:35:16: RA .......................: 128.84 [-360,360] deg (fixed,scale=1) - 2017-08-26T10:35:16: DEC ......................: -45.18 [-90,90] deg (fixed,scale=1) - 2017-08-26T10:35:16: Number of spectral par's ..: 5 - 2017-08-26T10:35:16: Prefactor ................: 4.3553344038324e-09 +/- 4.75309654008435e-10 [1e-16,1e-06] ph/cm2/s/MeV (free,scale=1e-09,gradient) - 2017-08-26T10:35:16: Index1 ...................: -1.3435116067011 +/- 0.0311270092486095 [-0,-5] (free,scale=-1,gradient) - 2017-08-26T10:35:16: CutoffEnergy .............: 988.499237722443 +/- 181.86709257978 [1,1000000] MeV (free,scale=1000,gradient) - 2017-08-26T10:35:16: PivotEnergy ..............: 1000 [10,1000000] MeV (fixed,scale=1000,gradient) - 2017-08-26T10:35:16: Index2 ...................: 0.587129723482927 +/- 0.0279303486200403 [0.1,5] (free,scale=1,gradient) - 2017-08-26T10:35:16: Number of temporal par's ..: 1 - 2017-08-26T10:35:16: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) - 2017-08-26T10:35:16: === GModelSky === - 2017-08-26T10:35:16: Name ......................: Galactic_diffuse - 2017-08-26T10:35:16: Instruments ...............: all - 2017-08-26T10:35:16: Instrument scale factors ..: unity - 2017-08-26T10:35:16: Observation identifiers ...: all - 2017-08-26T10:35:16: Model type ................: DiffuseSource - 2017-08-26T10:35:16: Model components ..........: "DiffuseMapCube" * "Constant" * "Constant" - 2017-08-26T10:35:16: Number of parameters ......: 3 - 2017-08-26T10:35:16: Number of spatial par's ...: 1 - 2017-08-26T10:35:16: Normalization ............: 1 [0.1,10] (fixed,scale=1,gradient) - 2017-08-26T10:35:16: Number of spectral par's ..: 1 - 2017-08-26T10:35:16: Normalization ............: 1.10915296009432 +/- 0.00503367301009883 [0.1,1000] (free,scale=1,gradient) - 2017-08-26T10:35:16: Number of temporal par's ..: 1 - 2017-08-26T10:35:16: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) - 2017-08-26T10:35:16: === GModelSky === - 2017-08-26T10:35:16: Name ......................: Extragalactic_diffuse - 2017-08-26T10:35:16: Instruments ...............: all - 2017-08-26T10:35:16: Instrument scale factors ..: unity - 2017-08-26T10:35:16: Observation identifiers ...: all - 2017-08-26T10:35:16: Model type ................: DiffuseSource - 2017-08-26T10:35:16: Model components ..........: "DiffuseIsotropic" * "FileFunction" * "Constant" - 2017-08-26T10:35:16: Number of parameters ......: 3 - 2017-08-26T10:35:16: Number of spatial par's ...: 1 - 2017-08-26T10:35:16: Value ....................: 1 [0,10] (fixed,scale=1,gradient) - 2017-08-26T10:35:16: Number of spectral par's ..: 1 - 2017-08-26T10:35:16: Normalization ............: 1 [0,1000] (fixed,scale=1,gradient) - 2017-08-26T10:35:16: Number of temporal par's ..: 1 - 2017-08-26T10:35:16: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) - + 2018-01-25T20:07:55: +=================================+ + 2018-01-25T20:07:55: | Maximum likelihood optimisation | + 2018-01-25T20:07:55: +=================================+ + 2018-01-25T20:07:57: >Iteration 0: -logL=-177232.327, Lambda=1.0e-03 + 2018-01-25T20:07:58: >Iteration 1: -logL=-198931.136, Lambda=1.0e-03, delta=21698.809, step=1.0e+00, max(|grad|)=-22717.063466 [CutoffEnergy:4] + 2018-01-25T20:07:58: >Iteration 2: -logL=-200269.888, Lambda=1.0e-04, delta=1338.753, step=1.0e+00, max(|grad|)=-67629.683771 [CutoffEnergy:4] + 2018-01-25T20:07:59: >Iteration 3: -logL=-212351.965, Lambda=1.0e-05, delta=12082.076, step=1.0e+00, max(|grad|)=23026.802421 [Index2:6] + 2018-01-25T20:07:59: >Iteration 4: -logL=-213954.259, Lambda=1.0e-06, delta=1602.294, step=1.0e+00, max(|grad|)=-8297.380912 [CutoffEnergy:4] + 2018-01-25T20:07:59: >Iteration 5: -logL=-215347.973, Lambda=1.0e-07, delta=1393.714, step=1.0e+00, max(|grad|)=2746.754042 [Index2:6] + 2018-01-25T20:08:00: >Iteration 6: -logL=-215497.807, Lambda=1.0e-08, delta=149.834, step=1.0e+00, max(|grad|)=699.848484 [Index2:6] + 2018-01-25T20:08:00: Iteration 7: -logL=-215497.807, Lambda=1.0e-09, delta=-13.845, step=1.0e+00, max(|grad|)=-1201.982875 [Index1:3] (stalled) + 2018-01-25T20:08:01: Iteration 8: -logL=-215497.807, Lambda=1.0e-08, delta=-13.844, step=1.0e+00, max(|grad|)=-1201.959647 [Index1:3] (stalled) + 2018-01-25T20:08:01: Iteration 9: -logL=-215497.807, Lambda=1.0e-07, delta=-13.835, step=1.0e+00, max(|grad|)=-1201.727401 [Index1:3] (stalled) + 2018-01-25T20:08:02: Iteration 10: -logL=-215497.807, Lambda=1.0e-06, delta=-13.744, step=1.0e+00, max(|grad|)=-1199.408717 [Index1:3] (stalled) + 2018-01-25T20:08:02: Iteration 11: -logL=-215497.807, Lambda=1.0e-05, delta=-12.858, step=1.0e+00, max(|grad|)=-1176.594021 [Index1:3] (stalled) + 2018-01-25T20:08:03: Iteration 12: -logL=-215497.807, Lambda=1.0e-04, delta=-6.126, step=1.0e+00, max(|grad|)=-980.833963 [Index1:3] (stalled) + 2018-01-25T20:08:04: >Iteration 13: -logL=-215503.803, Lambda=1.0e-03, delta=5.995, step=1.0e+00, max(|grad|)=-285.964915 [Index1:3] + 2018-01-25T20:08:04: Iteration 14: -logL=-215503.803, Lambda=1.0e-04, delta=-8.762, step=1.0e+00, max(|grad|)=-730.461326 [Index1:3] (stalled) + 2018-01-25T20:08:05: >Iteration 15: -logL=-215504.976, Lambda=1.0e-03, delta=1.173, step=1.0e+00, max(|grad|)=-153.941336 [Index1:3] + 2018-01-25T20:08:05: Iteration 16: -logL=-215503.593, Lambda=1.0e-04, delta=-1.383, step=1.0e+00, max(|grad|)=-327.368445 [Index1:3] (stalled) + 2018-01-25T20:08:06: >Iteration 17: -logL=-215505.817, Lambda=1.0e-03, delta=2.225, step=1.0e+00, max(|grad|)=3.256216 [Index2:6] + 2018-01-25T20:08:06: >Iteration 18: -logL=-215505.824, Lambda=1.0e-04, delta=0.007, step=1.0e+00, max(|grad|)=-8.190316 [CutoffEnergy:4] + 2018-01-25T20:08:06: >Iteration 19: -logL=-215505.826, Lambda=1.0e-05, delta=0.002, step=1.0e+00, max(|grad|)=0.635263 [Index2:6] + 2018-01-25T20:08:07: + 2018-01-25T20:08:07: +=========================================+ + 2018-01-25T20:08:07: | Maximum likelihood optimisation results | + 2018-01-25T20:08:07: +=========================================+ + 2018-01-25T20:08:07: === GOptimizerLM === + 2018-01-25T20:08:07: Optimized function value ..: -215505.826 + 2018-01-25T20:08:07: Absolute precision ........: 0.005 + 2018-01-25T20:08:07: Acceptable value decrease .: 2 + 2018-01-25T20:08:07: Optimization status .......: converged + 2018-01-25T20:08:07: Number of parameters ......: 14 + 2018-01-25T20:08:07: Number of free parameters .: 7 + 2018-01-25T20:08:07: Number of iterations ......: 19 + 2018-01-25T20:08:07: Lambda ....................: 1e-06 + 2018-01-25T20:08:07: Maximum log likelihood ....: 215505.826 + 2018-01-25T20:08:07: Observed events (Nobs) ...: 202330.000 + 2018-01-25T20:08:07: Predicted events (Npred) ..: 202318.925 (Nobs - Npred = 11.0749561789562) + 2018-01-25T20:08:07: === GModels === + 2018-01-25T20:08:07: Number of models ..........: 3 + 2018-01-25T20:08:07: Number of parameters ......: 14 + 2018-01-25T20:08:07: === GModelSky === + 2018-01-25T20:08:07: Name ......................: Vela + 2018-01-25T20:08:07: Instruments ...............: all + 2018-01-25T20:08:07: Instrument scale factors ..: unity + 2018-01-25T20:08:07: Observation identifiers ...: all + 2018-01-25T20:08:07: Model type ................: PointSource + 2018-01-25T20:08:07: Model components ..........: "PointSource" * "SuperExponentialCutoffPowerLaw" * "Constant" + 2018-01-25T20:08:07: Number of parameters ......: 8 + 2018-01-25T20:08:07: Number of spatial par's ...: 2 + 2018-01-25T20:08:07: RA .......................: 128.835772118429 +/- 0.00162177813558897 [-360,360] deg (free,scale=1) + 2018-01-25T20:08:07: DEC ......................: -45.1835812138884 +/- 0.00114069728792873 [-90,90] deg (free,scale=1) + 2018-01-25T20:08:07: Number of spectral par's ..: 5 + 2018-01-25T20:08:07: Prefactor ................: 4.35032346821964e-09 +/- 4.73845090178596e-10 [1e-16,1e-06] ph/cm2/s/MeV (free,scale=1e-09,gradient) + 2018-01-25T20:08:07: Index1 ...................: -1.34367731366247 +/- 0.031088811599731 [-0,-5] (free,scale=-1,gradient) + 2018-01-25T20:08:07: CutoffEnergy .............: 990.275379109663 +/- 181.814299583364 [1,1000000] MeV (free,scale=1000,gradient) + 2018-01-25T20:08:07: PivotEnergy ..............: 1000 [10,1000000] MeV (fixed,scale=1000,gradient) + 2018-01-25T20:08:07: Index2 ...................: 0.587550117179991 +/- 0.0279192539614008 [0.1,5] (free,scale=1,gradient) + 2018-01-25T20:08:07: Number of temporal par's ..: 1 + 2018-01-25T20:08:07: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + 2018-01-25T20:08:07: === GModelSky === + 2018-01-25T20:08:07: Name ......................: Galactic_diffuse + 2018-01-25T20:08:07: Instruments ...............: all + 2018-01-25T20:08:07: Instrument scale factors ..: unity + 2018-01-25T20:08:07: Observation identifiers ...: all + 2018-01-25T20:08:07: Model type ................: DiffuseSource + 2018-01-25T20:08:07: Model components ..........: "DiffuseMapCube" * "Constant" * "Constant" + 2018-01-25T20:08:07: Number of parameters ......: 3 + 2018-01-25T20:08:07: Number of spatial par's ...: 1 + 2018-01-25T20:08:07: Normalization ............: 1 [0.1,10] (fixed,scale=1,gradient) + 2018-01-25T20:08:07: Number of spectral par's ..: 1 + 2018-01-25T20:08:07: Normalization ............: 1.10941973066973 +/- 0.00503412002598653 [0.1,1000] (free,scale=1,gradient) + 2018-01-25T20:08:07: Number of temporal par's ..: 1 + 2018-01-25T20:08:07: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + 2018-01-25T20:08:07: === GModelSky === + 2018-01-25T20:08:07: Name ......................: Extragalactic_diffuse + 2018-01-25T20:08:07: Instruments ...............: all + 2018-01-25T20:08:07: Instrument scale factors ..: unity + 2018-01-25T20:08:07: Observation identifiers ...: all + 2018-01-25T20:08:07: Model type ................: DiffuseSource + 2018-01-25T20:08:07: Model components ..........: "DiffuseIsotropic" * "FileFunction" * "Constant" + 2018-01-25T20:08:07: Number of parameters ......: 3 + 2018-01-25T20:08:07: Number of spatial par's ...: 1 + 2018-01-25T20:08:07: Value ....................: 1 [0,10] (fixed,scale=1,gradient) + 2018-01-25T20:08:07: Number of spectral par's ..: 1 + 2018-01-25T20:08:07: Normalization ............: 1 [0,1000] (fixed,scale=1,gradient) + 2018-01-25T20:08:07: Number of temporal par's ..: 1 + 2018-01-25T20:08:07: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) The fit converged after 19 iterations with spectral parameters that are reasonably close to those found in @@ -242,13 +241,16 @@ using the Fermi-LAT Science Tools. .. code-block:: none - 2017-08-26T13:05:12: === GModelSky === - 2017-08-26T13:05:12: Name ......................: Vela - 2017-08-26T13:05:12: Instruments ...............: all - 2017-08-26T13:05:12: Test Statistic ............: 326326.556902542 + 2018-01-25T20:05:57: Name ......................: Vela + 2018-01-25T20:05:57: Instruments ...............: all + 2018-01-25T20:05:57: Test Statistic ............: 326341.439917148 which is also close to the value determined by gtlike. +.. note:: + Unlike gtlike, :ref:`ctlike` can also fit the source location. This has been + done in the example above by setting the parameter attributes to ``free="1"``. + .. warning:: ctools supports for the moment only the fitting of point sources for Fermi-LAT data. Other spatial shapes need to be preconvolved with the diff --git a/doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.png b/doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.png index 5377e79..529f6c8 100644 Binary files a/doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.png and b/doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.png differ diff --git a/doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.rst b/doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.rst index cbccdee..9b614d3 100644 --- a/doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.rst +++ b/doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.rst @@ -5,77 +5,44 @@ Generate a spectral energy distribution for a source .. admonition:: What you will learn - You will learn how to use :ref:`ctlike` to derive the spectral energy + You will learn how to use :ref:`csspec` to derive the spectral energy density of a source from Fermi-LAT data. -So far the :ref:`csspec` script does not work for Fermi-LAT data, but you -will learn here a method that you can use to derive the spectrum of any -source using Fermi-LAT data. For this you first need a little Python code -to transform the spectral component of the Vela source in the -:ref:`model definition file ` -from a super exponentially cut-off power law into a node function. -You do this as follows: - -.. code-block:: python - - >>> import gammalib - >>> models = gammalib.GModels('vela_results.xml') - >>> energies = gammalib.GEnergies(10, gammalib.GEnergy(100.0, 'MeV'), gammalib.GEnergy(100.0, 'GeV')) - >>> nodes = gammalib.GModelSpectralNodes() - >>> for energy in energies: - >>> nodes.append(energy, models['Vela'].spectral().eval(energy)) - >>> for par in nodes: - >>> if 'Energy' in par.name(): - >>> par.fix() - >>> if 'Intensity' in par.name(): - >>> par.min(1.0e-30) - >>> models['Vela'].spectral(nodes) - >>> models.save('model_nodes.xml') - -This will create a -:ref:`model definition file ` -with the following structure: - -.. code-block:: xml - - - - - - - - - - - - - - ... - - -Instead of the super exponentially cut-off power law the model now contains -a node function with ten intensity nodes between 100 MeV and 100 GeV, and the -:ref:`ctlike` tool will now adjust the intensities of each of the nodes which -will result in a spectrum. To do this type now: +To determine a spectral of the Vela pulsar you can use the :ref:`csspec` +script. To do this, type .. code-block:: bash - $ ctlike - Input event list, counts cube or observation definition XML file [obs.xml] - Input model definition XML file [models.xml] model_nodes.xml - Output model definition XML file [vela_results.xml] vela_nodes_results.xml - -This will produce the -:ref:`model definition file ` -``vela_nodes_results.xml`` with the intensities of the fitted source at -each energy. The results are displayed graphically below. + $ csspec + Input event list, counts cube, or observation definition XML file [events.fits] obs.xml + Input model definition XML file [$CTOOLS/share/models/crab.xml] vela_results.xml + Source name [Crab] Vela + Spectrum generation method (SLICE|NODES|AUTO) [AUTO] + Algorithm for defining energy bins (FILE|LIN|LOG) [LOG] + Start value for first energy bin in TeV [0.1] 0.0001 + Stop value for last energy bin in TeV [100.0] 0.1 + Number of energy bins (1-200) [20] 10 + Output spectrum file [spectrum.fits] + +This will generate a logarithmically spaced spectrum composed of 10 energy bins +comprised within 100 MeV and 100 GeV. The :ref:`csspec` tool is run in the ``AUTO`` +mode, which for Fermi-LAT data corresponds to the ``NODES`` method. :ref:`csspec` +will convert the Vela spectrum in the input model into a node function and fit +all intensity nodes using :ref:`ctlike`. The resulting node intensities are +then interpreted as the spectral point, and are displayed graphically below: .. figure:: howto_fermi_spectrum.png :width: 600px :align: center - *Spectrum of the Vela pulsar derived using a node function* + *Spectrum of the Vela pulsar derived using csspec* .. note:: - The ``NodeFunction`` spectral models implements a piece-wise power law - that is defined by the intensity values at each node. + The figure was created using the ``show_spectrum.py`` script that is + located in the ctools example folder. The example script requires the + `matplotlib `_ Python module for display. + You may reproduce the plot by typing + + .. code-block:: bash + + $ $CTOOLS/share/examples/python/show_spectrum.py spectrum.fits diff --git a/doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.png b/doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.png new file mode 100644 index 0000000..0ac75eb Binary files /dev/null and b/doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.png differ diff --git a/doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.rst b/doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.rst new file mode 100644 index 0000000..f7a795d --- /dev/null +++ b/doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.rst @@ -0,0 +1,42 @@ +.. _howto_fermi_tsmap: + +Generate a Test Statistic map +----------------------------- + + .. admonition:: What you will learn + + You will learn how to use :ref:`cttsmap` to generate a Test Staristic + map from Fermi-LAT data. + +The Test Statistic (or maximum likelihood ratio) is a measure of the detection +significance of a gamma-ray source. By displacing the location of a test source +on a grid of positions you can generate a Test Statistic map that helps in +finding significant source and assessing the position uncertainty of a +source. You do this by using the :ref:`cttsmap` tool as follows: + +.. code-block:: bash + + $ cttsmap + Input event list, counts cube or observation definition XML file [events.fits] obs.xml + Test source name [Crab] Vela + Input model definition XML file [$CTOOLS/share/models/crab.xml] vela_results.xml + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 128.84 + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] -45.18 + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR] + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] + Image scale (in degrees/pixel) [0.02] 0.3 + Size of the X axis in pixels [200] 10 + Size of the Y axis in pixels [200] 10 + Output Test Statistic map file [tsmap.fits] + +:ref:`cttsmap` created a 10 x 10 pixels map with a pixel size of 0.3 degrees +around the location of the Vela pulsar and saved the result in the FITS file +``tsmap.fits``. The file also contains the values of all fitted parameters +at each grid position. The Test Statistics map is displayed using +`ds9 `_ in the figure below: + +.. figure:: howto_fermi_tsmap.png + :width: 400px + :align: center + + *Test Statistic map for Fermi-LAT of the Vela pulsar* diff --git a/doc/source/users/tutorials/howto/fermi/howto_fermi_ulimit.rst b/doc/source/users/tutorials/howto/fermi/howto_fermi_ulimit.rst index 1c90ff9..037f4c5 100644 --- a/doc/source/users/tutorials/howto/fermi/howto_fermi_ulimit.rst +++ b/doc/source/users/tutorials/howto/fermi/howto_fermi_ulimit.rst @@ -44,18 +44,18 @@ specifying ``emin=0.0001 emax=0.1`` (all values are given in TeV): .. code-block:: bash $ ctulimit eref=0.001 emin=0.0001 emax=0.1 - Input event list, counts cube or observation definition XML file [obs.xml] - Source of interest [Test] - Input model definition XML file [model_lat_ulimit.xml] + Input event list, counts cube or observation definition XML file [events.fits] obs.xml + Source of interest [Crab] Test + Input model definition XML file [$CTOOLS/share/models/crab.xml] models_ulimit.xml The results of the upper limit computation can then be extracted from the ``ctulimit.log`` file that is created by :ref:`ctulimit`: .. code-block:: bash - 2017-08-26T14:37:48: +=====================+ - 2017-08-26T14:37:48: | Upper limit results | - 2017-08-26T14:37:48: +=====================+ - 2017-08-26T14:37:48: Differential flux limit ...: 1.00100099727198e-13 ph/cm2/s/MeV at 0.001 TeV - 2017-08-26T14:37:48: Integral flux limit .......: 9.9999999627471e-10 ph/cm2/s within [0.0001-0.1] TeV - 2017-08-26T14:37:48: Energy flux limit .........: 1.10785216561628e-12 erg/cm2/s within [0.0001-0.1] TeV + 2018-01-25T20:43:02: +=====================+ + 2018-01-25T20:43:02: | Upper limit results | + 2018-01-25T20:43:02: +=====================+ + 2018-01-25T20:43:02: Differential flux limit ...: 1.00100099727198e-13 ph/cm2/s/MeV at 0.001 TeV + 2018-01-25T20:43:02: Integral flux limit .......: 9.9999999627471e-10 ph/cm2/s within [0.0001-0.1] TeV + 2018-01-25T20:43:02: Energy flux limit .........: 1.10785216561628e-12 erg/cm2/s within [0.0001-0.1] TeV diff --git a/doc/source/users/tutorials/howto/fermi/index.rst b/doc/source/users/tutorials/howto/fermi/index.rst index 8e6a8e7..b1c26a1 100644 --- a/doc/source/users/tutorials/howto/fermi/index.rst +++ b/doc/source/users/tutorials/howto/fermi/index.rst @@ -33,5 +33,6 @@ tutorial that is based on a simple analysis of the Vela pulsar. howto_fermi_fitting howto_fermi_butterfly howto_fermi_spectrum + howto_fermi_tsmap howto_fermi_ulimit howto_fermi_errors -- libgit2 0.21.4