Feature #1146
Create GCTAInstBackground class for handling of background model in instrument coordinates
Status: | Closed | Start date: | 02/13/2014 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | 00-09-00 | |||
Duration: |
Description
Follow-up of discussion in issue #1096.
I propose the following XML interface:
<?xml version="1.0" standalone="no"?>
<source_library title="source library">
<source name="MyModel" type="CTAInstBackground" instrument="CTA" id="00001">
<spectrum type="PowerLaw">
<parameter name="Prefactor" scale="1.0" value="1.0" min="1e-6" max="1e6" free="1"/>
<parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/>
<parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
</spectrum>
</source>
</source_library>
There is no information on the background file here as this will be handled by the observation definition file.
Recurrence
No recurrence.
Related issues
History
#1 Updated by Knödlseder Jürgen almost 11 years ago
- Status changed from New to In Progress
- Assigned To set to Knödlseder Jürgen
- Target version set to 00-08-02
- % Done changed from 0 to 80
I made good progress in the implementation of the required code.
The GCTAModelInstBackground
class is now the analog to the GCTAModelBackground
class, and defines a background model in instrument coordinates. The background cube is taken from the response function, and a GCTABackground
abstract base class has been introduced that defines the interface for the instrumental background. The GCTABackground3D
class is an implementation of this abstract class that handles 3D response cubes spanned by DETX
, DETY
and energy.
Monte Carlo sampling, model evaluation and Npred integration are implemented in GCTAModelInstBackground
. For the latter, the integration precision has been fixed to 1e-4. Below a number of ctlike
runs with different precisions for the record:
=== 1e-3 =============================================== 2014-02-14T21:06:19: === GOptimizerLM === 2014-02-14T21:06:19: Optimized function value ..: 995501.109 2014-02-14T21:06:19: Absolute precision ........: 1e-06 2014-02-14T21:06:19: Optimization status .......: converged 2014-02-14T21:06:19: Number of parameters ......: 4 2014-02-14T21:06:19: Number of free parameters .: 2 2014-02-14T21:06:19: Number of iterations ......: 4 2014-02-14T21:06:19: Lambda ....................: 1e-07 2014-02-14T21:06:19: Maximum log likelihood ....: -995501.109 2014-02-14T21:06:19: Observed events (Nobs) ...: 151249.000 2014-02-14T21:06:19: Predicted events (Npred) ..: 151152.000 (Nobs - Npred = 97) 2014-02-14T21:06:19: === GModels === 2014-02-14T21:06:19: Number of models ..........: 1 2014-02-14T21:06:19: Number of parameters ......: 4 2014-02-14T21:06:19: === GCTAModelInstBackground === 2014-02-14T21:06:19: Name ......................: My model 2014-02-14T21:06:19: Instruments ...............: CTA 2014-02-14T21:06:19: Instrument scale factors ..: unity 2014-02-14T21:06:19: Observation identifiers ...: all 2014-02-14T21:06:19: Model type ................: "PowerLaw" * "Constant" 2014-02-14T21:06:19: Number of parameters ......: 4 2014-02-14T21:06:19: Number of spectral par's ..: 3 2014-02-14T21:06:19: Prefactor ................: 0.892675 +/- 0.00492726 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) 2014-02-14T21:06:19: Index ....................: -0.0248178 +/- 0.00357426 [-5,5] (free,scale=1,gradient) 2014-02-14T21:06:19: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) 2014-02-14T21:06:19: Number of temporal par's ..: 1 2014-02-14T21:06:19: Constant .................: 1 (relative value) (fixed,scale=1,gradient) 2014-02-14T21:06:19: 2014-02-14T21:06:19: +==============+ 2014-02-14T21:06:19: | Save results | 2014-02-14T21:06:19: +==============+ 2014-02-14T21:06:19: 2014-02-14T21:06:19: Application "ctlike" terminated after 6 wall clock seconds, consuming 2.82051 seconds of CPU time. === 1e-4 =============================================== 2014-02-14T21:20:25: === GOptimizerLM === 2014-02-14T21:20:25: Optimized function value ..: 993710.849 2014-02-14T21:20:25: Absolute precision ........: 1e-06 2014-02-14T21:20:25: Optimization status .......: converged 2014-02-14T21:20:25: Number of parameters ......: 4 2014-02-14T21:20:25: Number of free parameters .: 2 2014-02-14T21:20:25: Number of iterations ......: 4 2014-02-14T21:20:25: Lambda ....................: 1e-07 2014-02-14T21:20:25: Maximum log likelihood ....: -993710.849 2014-02-14T21:20:25: Observed events (Nobs) ...: 151249.000 2014-02-14T21:20:25: Predicted events (Npred) ..: 151152.000 (Nobs - Npred = 97) 2014-02-14T21:20:25: === GModels === 2014-02-14T21:20:25: Number of models ..........: 1 2014-02-14T21:20:25: Number of parameters ......: 4 2014-02-14T21:20:25: === GCTAModelInstBackground === 2014-02-14T21:20:25: Name ......................: My model 2014-02-14T21:20:25: Instruments ...............: CTA 2014-02-14T21:20:25: Instrument scale factors ..: unity 2014-02-14T21:20:25: Observation identifiers ...: all 2014-02-14T21:20:25: Model type ................: "PowerLaw" * "Constant" 2014-02-14T21:20:25: Number of parameters ......: 4 2014-02-14T21:20:25: Number of spectral par's ..: 3 2014-02-14T21:20:25: Prefactor ................: 0.895103 +/- 0.00494066 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) 2014-02-14T21:20:25: Index ....................: -0.0314981 +/- 0.00357426 [-5,5] (free,scale=1,gradient) 2014-02-14T21:20:25: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) 2014-02-14T21:20:25: Number of temporal par's ..: 1 2014-02-14T21:20:25: Constant .................: 1 (relative value) (fixed,scale=1,gradient) 2014-02-14T21:20:25: 2014-02-14T21:20:25: +==============+ 2014-02-14T21:20:25: | Save results | 2014-02-14T21:20:25: +==============+ 2014-02-14T21:20:25: 2014-02-14T21:20:25: Application "ctlike" terminated after 6 wall clock seconds, consuming 3.83421 seconds of CPU time. === 1e-5 =============================================== 2014-02-14T21:22:29: === GOptimizerLM === 2014-02-14T21:22:29: Optimized function value ..: 993771.163 2014-02-14T21:22:29: Absolute precision ........: 1e-06 2014-02-14T21:22:29: Optimization status .......: converged 2014-02-14T21:22:29: Number of parameters ......: 4 2014-02-14T21:22:29: Number of free parameters .: 2 2014-02-14T21:22:29: Number of iterations ......: 4 2014-02-14T21:22:29: Lambda ....................: 1e-07 2014-02-14T21:22:29: Maximum log likelihood ....: -993771.163 2014-02-14T21:22:29: Observed events (Nobs) ...: 151249.000 2014-02-14T21:22:29: Predicted events (Npred) ..: 151152.000 (Nobs - Npred = 97) 2014-02-14T21:22:29: === GModels === 2014-02-14T21:22:29: Number of models ..........: 1 2014-02-14T21:22:29: Number of parameters ......: 4 2014-02-14T21:22:29: === GCTAModelInstBackground === 2014-02-14T21:22:29: Name ......................: My model 2014-02-14T21:22:29: Instruments ...............: CTA 2014-02-14T21:22:29: Instrument scale factors ..: unity 2014-02-14T21:22:29: Observation identifiers ...: all 2014-02-14T21:22:29: Model type ................: "PowerLaw" * "Constant" 2014-02-14T21:22:29: Number of parameters ......: 4 2014-02-14T21:22:29: Number of spectral par's ..: 3 2014-02-14T21:22:29: Prefactor ................: 0.895664 +/- 0.00494376 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) 2014-02-14T21:22:29: Index ....................: -0.030747 +/- 0.00357426 [-5,5] (free,scale=1,gradient) 2014-02-14T21:22:29: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) 2014-02-14T21:22:29: Number of temporal par's ..: 1 2014-02-14T21:22:29: Constant .................: 1 (relative value) (fixed,scale=1,gradient) 2014-02-14T21:22:29: 2014-02-14T21:22:29: +==============+ 2014-02-14T21:22:29: | Save results | 2014-02-14T21:22:29: +==============+ 2014-02-14T21:22:29: 2014-02-14T21:22:29: Application "ctlike" terminated after 10 wall clock seconds, consuming 8.20626 seconds of CPU time. === 1e-6 =============================================== 2014-02-14T21:24:32: === GOptimizerLM === 2014-02-14T21:24:32: Optimized function value ..: 993763.185 2014-02-14T21:24:32: Absolute precision ........: 1e-06 2014-02-14T21:24:32: Optimization status .......: converged 2014-02-14T21:24:32: Number of parameters ......: 4 2014-02-14T21:24:32: Number of free parameters .: 2 2014-02-14T21:24:32: Number of iterations ......: 4 2014-02-14T21:24:32: Lambda ....................: 1e-07 2014-02-14T21:24:32: Maximum log likelihood ....: -993763.185 2014-02-14T21:24:32: Observed events (Nobs) ...: 151249.000 2014-02-14T21:24:32: Predicted events (Npred) ..: 151152.000 (Nobs - Npred = 97) 2014-02-14T21:24:32: === GModels === 2014-02-14T21:24:32: Number of models ..........: 1 2014-02-14T21:24:32: Number of parameters ......: 4 2014-02-14T21:24:32: === GCTAModelInstBackground === 2014-02-14T21:24:32: Name ......................: My model 2014-02-14T21:24:32: Instruments ...............: CTA 2014-02-14T21:24:32: Instrument scale factors ..: unity 2014-02-14T21:24:32: Observation identifiers ...: all 2014-02-14T21:24:32: Model type ................: "PowerLaw" * "Constant" 2014-02-14T21:24:32: Number of parameters ......: 4 2014-02-14T21:24:32: Number of spectral par's ..: 3 2014-02-14T21:24:32: Prefactor ................: 0.895173 +/- 0.00494105 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) 2014-02-14T21:24:32: Index ....................: -0.031187 +/- 0.00357426 [-5,5] (free,scale=1,gradient) 2014-02-14T21:24:32: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) 2014-02-14T21:24:32: Number of temporal par's ..: 1 2014-02-14T21:24:32: Constant .................: 1 (relative value) (fixed,scale=1,gradient) 2014-02-14T21:24:32: 2014-02-14T21:24:32: +==============+ 2014-02-14T21:24:32: | Save results | 2014-02-14T21:24:32: +==============+ 2014-02-14T21:24:32: 2014-02-14T21:24:32: Application "ctlike" terminated after 34 wall clock seconds, consuming 31.7309 seconds of CPU time.
#2 Updated by Knödlseder Jürgen almost 11 years ago
- Status changed from In Progress to Feedback
- % Done changed from 80 to 100
I consider this now as done. Just merged into integration
branch. Still need to do some pull distribution tests.
#3 Updated by Mayer Michael almost 11 years ago
Looks great to me. Until now I only found a copy&paste typo in a comment (in GCTAResponse.hpp line 185). Also I think it makes sense to have GCTAModelInstBackground
instead of the proposed GCTAInstBackground
. The Model
makes it clear that it has an xml-interface and a connection to GModel
.
#4 Updated by Mayer Michael over 10 years ago
I now tested the full interface using GCTABackground3D
and the GCTAModelInstBackground
interface with it.
It directly worked (after realising that the code requires DETX
and DETY
to be in degrees ).
I have one question though: Why is there the compilation flag G_LOG_INTERPOLATION
? In GCTABackground3D::read()
, we explicitly set the energy axis to log10-mode. Therefore, GCTAResponseTable
already interpolates in 'log10energy’, doesn’t it? Switching off the flag worked perfectly fine for me.
If we want the code itself to deal with the units, should that be in GCTABackground3D::read()
or rather in GCTAResponseTable
?
#5 Updated by Knödlseder Jürgen over 10 years ago
- Status changed from Feedback to Resolved
- Target version changed from 00-08-02 to 00-09-00
Skip release 0.8.2.
#6 Updated by Knödlseder Jürgen over 10 years ago
- Status changed from Resolved to Closed