Commit b6c16ddee3641886a7dae84bf6640d0ae665b67b
Merge branch '1555-science-verification' into integration
Showing
9 changed files
with
166 additions
and
19 deletions
doc/source/user_manual/getting_started/models.rst
| @@ -216,6 +216,21 @@ Elliptical source | @@ -216,6 +216,21 @@ Elliptical source | ||
| 216 | </spectrum> | 216 | </spectrum> |
| 217 | </source> | 217 | </source> |
| 218 | 218 | ||
| 219 | + .. code-block:: xml | ||
| 220 | + | ||
| 221 | + <source name="Crab" type="ExtendedSource"> | ||
| 222 | + <spatialModel type="EllipticalGauss"> | ||
| 223 | + <parameter name="RA" scale="1.0" value="83.6331" min="-360" max="360" free="1"/> | ||
| 224 | + <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="1"/> | ||
| 225 | + <parameter name="PA" scale="1.0" value="45.0" min="-360" max="360" free="1"/> | ||
| 226 | + <parameter name="MinorRadius" scale="1.0" value="0.5" min="0.001" max="10" free="1"/> | ||
| 227 | + <parameter name="MajorRadius" scale="1.0" value="2.0" min="0.001" max="10" free="1"/> | ||
| 228 | + </spatialModel> | ||
| 229 | + <spectrum type="..."> | ||
| 230 | + ... | ||
| 231 | + </spectrum> | ||
| 232 | + </source> | ||
| 233 | + | ||
| 219 | 234 | ||
| 220 | Diffuse source | 235 | Diffuse source |
| 221 | ^^^^^^^^^^^^^^ | 236 | ^^^^^^^^^^^^^^ |
test/data/sciver/cena_lobes_parkes.fits deleted
No preview for this file type
test/data/sciver/cena_lobes_parkes.fits.gz
0 → 100644
No preview for this file type
test/data/sciver/crab_const.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-12" value="2.0" 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="ConstantValue"> | ||
| 10 | + <parameter name="Value" scale="1" value="1" min="0.1" max="10" 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/data/sciver/crab_cube.fits.gz
0 → 100644
No preview for this file type
test/data/sciver/crab_cube.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="1.0" value="1.0" min="1e-07" max="1000.0" free="1"/> | ||
| 6 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | ||
| 7 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | ||
| 8 | + </spectrum> | ||
| 9 | + <spatialModel type="MapCubeFunction" file="data/sciver/crab_cube.fits"> | ||
| 10 | + <parameter name="Normalization" scale="1" value="1" min="0.1" max="10" 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/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/data/sciver/crab_map_roi.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"> | ||
| 10 | + <parameter scale="1" name="Prefactor" min="0.001" max="1000.0" value="1" 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
| 1 | #! /usr/bin/env python | 1 | #! /usr/bin/env python |
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This script performs the ctools science verification. It creates and | 3 | # This script performs the ctools science verification. It creates and |
| 4 | -# analyses the pull distributions for a variety of model in unbinned | 4 | +# analyses the pull distributions for a variety of models in unbinned |
| 5 | # analysis mode. At the end the script produces a JUnit compliant | 5 | # analysis mode. At the end the script produces a JUnit compliant |
| 6 | # science verification report. | 6 | # science verification report. |
| 7 | # | 7 | # |
| @@ -191,31 +191,35 @@ class sciver(gammalib.GPythonTestSuite): | @@ -191,31 +191,35 @@ class sciver(gammalib.GPythonTestSuite): | ||
| 191 | self.append(self.spec_nodes, "Test nodes model") | 191 | self.append(self.spec_nodes, "Test nodes model") |
| 192 | 192 | ||
| 193 | # Append spatial tests | 193 | # Append spatial tests |
| 194 | - self.append(self.spec_ptsrc, "Test point source model") | ||
| 195 | - self.append(self.spec_rdisk, "Test radial disk model") | ||
| 196 | - self.append(self.spec_rgauss, "Test radial Gaussian model") | ||
| 197 | - self.append(self.spec_rshell, "Test radial shell model") | ||
| 198 | - self.append(self.spec_edisk, "Test elliptical disk model") | ||
| 199 | - self.append(self.spec_egauss, "Test elliptical Gaussian model") | ||
| 200 | - self.append(self.spec_map, "Test elliptical Gaussian model") | 194 | + self.append(self.spat_ptsrc, "Test point source model") |
| 195 | + self.append(self.spat_rdisk, "Test radial disk model") | ||
| 196 | + self.append(self.spat_rgauss, "Test radial Gaussian model") | ||
| 197 | + self.append(self.spat_rshell, "Test radial shell model") | ||
| 198 | + self.append(self.spat_edisk, "Test elliptical disk model") | ||
| 199 | + self.append(self.spat_egauss, "Test elliptical Gaussian model") | ||
| 200 | + self.append(self.spat_const, "Test diffuse isotropic 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)") | ||
| 204 | + self.append(self.spat_cube, "Test diffuse cube model") | ||
| 201 | 205 | ||
| 202 | # Return | 206 | # Return |
| 203 | return | 207 | return |
| 204 | 208 | ||
| 205 | # Generate and analyse pull distributions | 209 | # Generate and analyse pull distributions |
| 206 | - def pull(self, model, trials=100): | 210 | + def pull(self, model, trials=100, ra=83.63, dec=22.01, rad=5.0): |
| 207 | """ | 211 | """ |
| 208 | Generate and analyse pull distributions. | 212 | Generate and analyse pull distributions. |
| 209 | """ | 213 | """ |
| 210 | # Generate pull distribution | 214 | # Generate pull distribution |
| 211 | - outfile = generate_pull_distribution(model, trials=trials) | 215 | + outfile = generate_pull_distribution(model, trials=trials, |
| 216 | + ra=ra, dec=dec, rad=rad) | ||
| 212 | 217 | ||
| 213 | # Analyse pull distribution | 218 | # Analyse pull distribution |
| 214 | self.results = analyse_pull_distribution(outfile) | 219 | self.results = analyse_pull_distribution(outfile) |
| 215 | 220 | ||
| 216 | # Return | 221 | # Return |
| 217 | return | 222 | return |
| 218 | - | ||
| 219 | 223 | ||
| 220 | # Test parameter result | 224 | # Test parameter result |
| 221 | def test(self, name): | 225 | def test(self, name): |
| @@ -340,7 +344,7 @@ class sciver(gammalib.GPythonTestSuite): | @@ -340,7 +344,7 @@ class sciver(gammalib.GPythonTestSuite): | ||
| 340 | return | 344 | return |
| 341 | 345 | ||
| 342 | # Test point source model | 346 | # Test point source model |
| 343 | - def spec_ptsrc(self): | 347 | + def spat_ptsrc(self): |
| 344 | """ | 348 | """ |
| 345 | Test point source model. | 349 | Test point source model. |
| 346 | """ | 350 | """ |
| @@ -354,7 +358,7 @@ class sciver(gammalib.GPythonTestSuite): | @@ -354,7 +358,7 @@ class sciver(gammalib.GPythonTestSuite): | ||
| 354 | return | 358 | return |
| 355 | 359 | ||
| 356 | # Test radial disk model | 360 | # Test radial disk model |
| 357 | - def spec_rdisk(self): | 361 | + def spat_rdisk(self): |
| 358 | """ | 362 | """ |
| 359 | Test radial disk model. | 363 | Test radial disk model. |
| 360 | """ | 364 | """ |
| @@ -369,7 +373,7 @@ class sciver(gammalib.GPythonTestSuite): | @@ -369,7 +373,7 @@ class sciver(gammalib.GPythonTestSuite): | ||
| 369 | return | 373 | return |
| 370 | 374 | ||
| 371 | # Test radial Gaussian model | 375 | # Test radial Gaussian model |
| 372 | - def spec_rgauss(self): | 376 | + def spat_rgauss(self): |
| 373 | """ | 377 | """ |
| 374 | Test radial Gaussian model. | 378 | Test radial Gaussian model. |
| 375 | """ | 379 | """ |
| @@ -384,7 +388,7 @@ class sciver(gammalib.GPythonTestSuite): | @@ -384,7 +388,7 @@ class sciver(gammalib.GPythonTestSuite): | ||
| 384 | return | 388 | return |
| 385 | 389 | ||
| 386 | # Test radial shell model | 390 | # Test radial shell model |
| 387 | - def spec_rshell(self): | 391 | + def spat_rshell(self): |
| 388 | """ | 392 | """ |
| 389 | Test radial shell model. | 393 | Test radial shell model. |
| 390 | """ | 394 | """ |
| @@ -400,7 +404,7 @@ class sciver(gammalib.GPythonTestSuite): | @@ -400,7 +404,7 @@ class sciver(gammalib.GPythonTestSuite): | ||
| 400 | return | 404 | return |
| 401 | 405 | ||
| 402 | # Test elliptical disk model | 406 | # Test elliptical disk model |
| 403 | - def spec_edisk(self): | 407 | + def spat_edisk(self): |
| 404 | """ | 408 | """ |
| 405 | Test elliptical disk model. | 409 | Test elliptical disk model. |
| 406 | """ | 410 | """ |
| @@ -417,7 +421,7 @@ class sciver(gammalib.GPythonTestSuite): | @@ -417,7 +421,7 @@ class sciver(gammalib.GPythonTestSuite): | ||
| 417 | return | 421 | return |
| 418 | 422 | ||
| 419 | # Test elliptical Gaussian model | 423 | # Test elliptical Gaussian model |
| 420 | - def spec_egauss(self): | 424 | + def spat_egauss(self): |
| 421 | """ | 425 | """ |
| 422 | Test elliptical Gaussian model. | 426 | Test elliptical Gaussian model. |
| 423 | """ | 427 | """ |
| @@ -433,12 +437,60 @@ class sciver(gammalib.GPythonTestSuite): | @@ -433,12 +437,60 @@ class sciver(gammalib.GPythonTestSuite): | ||
| 433 | self.test("Pull_Background_Index") | 437 | self.test("Pull_Background_Index") |
| 434 | return | 438 | return |
| 435 | 439 | ||
| 440 | + # Test diffuse isotropic model | ||
| 441 | + def spat_const(self): | ||
| 442 | + """ | ||
| 443 | + Test diffuse isotropic model. | ||
| 444 | + """ | ||
| 445 | + self.pull("data/sciver/crab_const") | ||
| 446 | + self.test("Pull_Crab_Prefactor") | ||
| 447 | + self.test("Pull_Crab_Index") | ||
| 448 | + self.test("Pull_Background_Prefactor") | ||
| 449 | + self.test("Pull_Background_Index") | ||
| 450 | + return | ||
| 451 | + | ||
| 436 | # Test diffuse map model | 452 | # Test diffuse map model |
| 437 | - def spec_map(self): | 453 | + def spat_map(self): |
| 438 | """ | 454 | """ |
| 439 | Test diffuse map model. | 455 | Test diffuse map model. |
| 440 | """ | 456 | """ |
| 441 | - self.pull("data/sciver/crab_map") | 457 | + self.pull("data/sciver/crab_map", ra=201.3651, dec=-43.0191) |
| 458 | + self.test("Pull_Crab_Prefactor") | ||
| 459 | + self.test("Pull_Crab_Index") | ||
| 460 | + self.test("Pull_Background_Prefactor") | ||
| 461 | + self.test("Pull_Background_Index") | ||
| 462 | + return | ||
| 463 | + | ||
| 464 | + # Test diffuse map model (small ROI) | ||
| 465 | + def spat_map_roi(self): | ||
| 466 | + """ | ||
| 467 | + Test diffuse map model (small ROI). | ||
| 468 | + """ | ||
| 469 | + self.pull("data/sciver/crab_map_roi", ra=201.3651, dec=-43.0191, rad=1.5) | ||
| 470 | + self.test("Pull_Crab_Prefactor") | ||
| 471 | + self.test("Pull_Crab_Index") | ||
| 472 | + self.test("Pull_Background_Prefactor") | ||
| 473 | + self.test("Pull_Background_Index") | ||
| 474 | + return | ||
| 475 | + | ||
| 476 | + # Test diffuse map model (not normalized and scaled) | ||
| 477 | + def spat_map_nn(self): | ||
| 478 | + """ | ||
| 479 | + Test diffuse map model (not normalized and scaled). | ||
| 480 | + """ | ||
| 481 | + self.pull("data/sciver/crab_map_nn", ra=201.3651, dec=-43.0191, rad=1.5) | ||
| 482 | + self.test("Pull_Crab_Prefactor") | ||
| 483 | + self.test("Pull_Crab_Index") | ||
| 484 | + self.test("Pull_Background_Prefactor") | ||
| 485 | + self.test("Pull_Background_Index") | ||
| 486 | + return | ||
| 487 | + | ||
| 488 | + # Test diffuse cube model | ||
| 489 | + def spat_cube(self): | ||
| 490 | + """ | ||
| 491 | + Test diffuse cube model. | ||
| 492 | + """ | ||
| 493 | + self.pull("data/sciver/crab_cube") | ||
| 442 | self.test("Pull_Crab_Prefactor") | 494 | self.test("Pull_Crab_Prefactor") |
| 443 | self.test("Pull_Crab_Index") | 495 | self.test("Pull_Crab_Index") |
| 444 | self.test("Pull_Background_Prefactor") | 496 | self.test("Pull_Background_Prefactor") |