Commit 60735ba50a1e894440cae3b125535883150a0ddb
1 parent
6593baf2
Add model for not-normalized and scaled map. Test all diffuse models.
Showing
2 changed files
with
48 additions
and
2 deletions
test/data/sciver/crab_map_nn.xml
0 → 100644
| 1 | +<?xml version="1.0" standalone="no"?> | ||
| 2 | +<source_library title="source library"> | ||
| 3 | + <source name="Crab" type="DiffuseSource"> | ||
| 4 | + <spectrum type="PowerLaw"> | ||
| 5 | + <parameter name="Prefactor" scale="1e-16" value="5.7" min="1e-07" max="1000.0" free="1"/> | ||
| 6 | + <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/> | ||
| 7 | + <parameter name="Scale" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/> | ||
| 8 | + </spectrum> | ||
| 9 | + <spatialModel type="SpatialMap" file="data/sciver/cena_lobes_parkes.fits" normalize="0"> | ||
| 10 | + <parameter scale="1" name="Prefactor" min="0.001" max="1000.0" value="3" free="0"/> | ||
| 11 | + </spatialModel> | ||
| 12 | + </source> | ||
| 13 | + <source name="Background" type="CTAIrfBackground" instrument="CTA"> | ||
| 14 | + <spectrum type="PowerLaw"> | ||
| 15 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e3" free="1"/> | ||
| 16 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | ||
| 17 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | ||
| 18 | + </spectrum> | ||
| 19 | + </source> | ||
| 20 | +</source_library> |
test/science_verification.py
| @@ -199,19 +199,21 @@ class sciver(gammalib.GPythonTestSuite): | @@ -199,19 +199,21 @@ class sciver(gammalib.GPythonTestSuite): | ||
| 199 | #self.append(self.spat_egauss, "Test elliptical Gaussian model") | 199 | #self.append(self.spat_egauss, "Test elliptical Gaussian model") |
| 200 | self.append(self.spat_const, "Test diffuse isotropic model") | 200 | self.append(self.spat_const, "Test diffuse isotropic model") |
| 201 | self.append(self.spat_map, "Test diffuse map model") | 201 | self.append(self.spat_map, "Test diffuse map model") |
| 202 | + self.append(self.spat_map_roi, "Test diffuse map model (small ROI)") | ||
| 203 | + self.append(self.spat_map_nn, "Test diffuse map model (not normalized and scaled)") | ||
| 202 | self.append(self.spat_cube, "Test diffuse cube model") | 204 | self.append(self.spat_cube, "Test diffuse cube model") |
| 203 | 205 | ||
| 204 | # Return | 206 | # Return |
| 205 | return | 207 | return |
| 206 | 208 | ||
| 207 | # Generate and analyse pull distributions | 209 | # Generate and analyse pull distributions |
| 208 | - def pull(self, model, trials=100, ra=83.63, dec=22.01): | 210 | + def pull(self, model, trials=100, ra=83.63, dec=22.01, rad=5.0): |
| 209 | """ | 211 | """ |
| 210 | Generate and analyse pull distributions. | 212 | Generate and analyse pull distributions. |
| 211 | """ | 213 | """ |
| 212 | # Generate pull distribution | 214 | # Generate pull distribution |
| 213 | outfile = generate_pull_distribution(model, trials=trials, | 215 | outfile = generate_pull_distribution(model, trials=trials, |
| 214 | - ra=ra, dec=dec) | 216 | + ra=ra, dec=dec, rad=rad) |
| 215 | 217 | ||
| 216 | # Analyse pull distribution | 218 | # Analyse pull distribution |
| 217 | self.results = analyse_pull_distribution(outfile) | 219 | self.results = analyse_pull_distribution(outfile) |
| @@ -460,6 +462,30 @@ class sciver(gammalib.GPythonTestSuite): | @@ -460,6 +462,30 @@ class sciver(gammalib.GPythonTestSuite): | ||
| 460 | self.test("Pull_Background_Index") | 462 | self.test("Pull_Background_Index") |
| 461 | return | 463 | return |
| 462 | 464 | ||
| 465 | + # Test diffuse map model (small ROI) | ||
| 466 | + def spat_map_roi(self): | ||
| 467 | + """ | ||
| 468 | + Test diffuse map model (small ROI). | ||
| 469 | + """ | ||
| 470 | + self.pull("data/sciver/crab_map_roi", ra=201.3651, dec=-43.0191, rad=1.5) | ||
| 471 | + self.test("Pull_Crab_Prefactor") | ||
| 472 | + self.test("Pull_Crab_Index") | ||
| 473 | + self.test("Pull_Background_Prefactor") | ||
| 474 | + self.test("Pull_Background_Index") | ||
| 475 | + return | ||
| 476 | + | ||
| 477 | + # Test diffuse map model (not normalized and scaled) | ||
| 478 | + def spat_map_nn(self): | ||
| 479 | + """ | ||
| 480 | + Test diffuse map model (not normalized and scaled). | ||
| 481 | + """ | ||
| 482 | + self.pull("data/sciver/crab_map_nn", ra=201.3651, dec=-43.0191, rad=1.5) | ||
| 483 | + self.test("Pull_Crab_Prefactor") | ||
| 484 | + self.test("Pull_Crab_Index") | ||
| 485 | + self.test("Pull_Background_Prefactor") | ||
| 486 | + self.test("Pull_Background_Index") | ||
| 487 | + return | ||
| 488 | + | ||
| 463 | # Test diffuse cube model | 489 | # Test diffuse cube model |
| 464 | def spat_cube(self): | 490 | def spat_cube(self): |
| 465 | """ | 491 | """ |