quickstart.html 48.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Getting Started</title>

<link href="ctools.css" media="screen,print" type="text/css" rel="stylesheet">
</head>
<body>
<p class="Header">Getting started</p>
<p class="Title">First steps with ctools</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">
This page gives provides a step-by-step description of the CTA data
analysis procedure implemented in ctools. In this example we will
simulate data for the Crab nebula, observed on-axis, as a single source
in the CTA field of view.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
example consists of the following analysis steps:</p>
<p style="padding-top: 0pt; text-align: left;" class="Body"><a href="#Simulating_CTA_data">Simulating CTA data</a></p>
<p style="padding-top: 0pt; text-align: left;" class="Body"><a href="#Binning_CTA_data">Binning CTA data</a></p>
<p style="padding-top: 0pt; text-align: left;" class="Body"><a href="#Fitting_CTA_data">Fitting CTA data</a></p>
<p style="padding-top: 0pt; text-align: left;" class="Body"><a href="#Doing_an_unbinned_analysis">Doing an unbinned analysis</a></p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">And
please read also:
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body"><a href="#Some_final_remarks">Some final remarks</a></p>
<p style="padding-top: 0pt; text-align: left;" class="Body"><a href="#Getting_Help">Getting Help</a></p>
<br>
<br>
<p class="Title"><a name="Simulating_CTA_data"></a>Simulating
CTA data</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">CTA
data are simulated by the executable <span style="font-family: Courier New,Courier,monospace;">ctobssim</span>.
To start the executable, type <span style="font-family: Courier New,Courier,monospace;">ctobssim</span>
at the console prompt (which is denoted by <span style="font-family: Courier New,Courier,monospace;">&gt;</span>).
It will query for a number of parameters. The example shown below will
work on a system that has been installed in the default directory <span style="font-family: Courier New,Courier,monospace;">/usr/local/gamma</span>.
If ctools have been installed in another directory, please adjust the
parameter names accordingly.
</p>
<p class="Code">
&gt; ctobssim<br>
Model [test/data/crab_alone.xml] /usr/local/gamma/share/models/crab.xml
<br>
Output event data file [events.fits] <br>
Calibration database [test/irf] /usr/local/gamma/share/caldb/cta<br>
Instrument response function [kb_E_50h_v3] <br>
RA for ROI centre (degrees) (0-360) [83.63] <br>
Dec for ROI centre (degrees) (-90-90) [22.01] <br>
Radius of ROI (degrees) (0-180) [10.0] <br>
Start time (MET in s) (0) [0.0] <br>
End time (MET in s) (0) [1800.0] <br>
Lower energy limit (TeV) (0) [0.1] <br>
Upper energy limit (TeV) (0) [100.0] <br>
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">Each
line represents a query for one parameter. The line starts with a short
description of the parameter, followed by the default parameter value
proposed by <span style="font-family: Courier New,Courier,monospace;">ctobssim</span>
in squared brackets <span style="font-family: Courier New,Courier,monospace;">[ ]</span>.
If no parameter is entered (which is the case for the majority of
parameters shown here), the default parameter will be used.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
CTA instrument properties (effective area, PSF width) are taken for the
moment from Konrad Bernl&ouml;hrs sensitivity files which are
stored in <span style="font-family: Courier New,Courier,monospace;">/usr/local/gamma/share/caldb/cta</span>.
To test another CTA configuration you may adapt the instrument response
function name accordingly (see the <a href="#Some_final_remarks">final
remarks</a>).</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">Events
are simulated based on the instrument properties and based on a source
and background model. Only events that fall within the
specified region of interest (ROI), defined as a circle around a sky
position in Right Ascension and Declination (in degrees), will be
stored in the output event data file. The duration of the simulation is
taken here to 30 minutes (or 1800 seconds). Events are simulated for
energies between 0.1 and 100 TeV.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
source and background model is defined by the XML file <span style="font-family: Courier New,Courier,monospace;">/usr/local/gamma/share/models/crab.xml</span>:
</p>
<p class="Code">
&lt;?xml version="1.0" standalone="no"?&gt;<br>
&lt;source_library title="source library"&gt;<br>
&nbsp; &lt;source name="MAGIC Crab (Albert et al. 2008, ApJ,
674, 1037)" type="PointSource"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;spectrum type="PowerLaw"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;parameter name="Prefactor" scale="1e-16" value="5.7"&nbsp;
min="1e-07" max="1000.0" free="1"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;parameter name="Index"&nbsp;&nbsp;&nbsp;&nbsp;
scale="-1"&nbsp;&nbsp;&nbsp; value="2.48"
min="0.0"&nbsp;&nbsp; max="+5.0"&nbsp;&nbsp;
free="1"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;parameter name="Scale"&nbsp;&nbsp;&nbsp;&nbsp;
scale="1e6"&nbsp;&nbsp; value="0.3"&nbsp;
min="0.01"&nbsp; max="1000.0" free="0"/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/spectrum&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;spatialModel
type="SkyDirFunction"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="RA"&nbsp; scale="1.0" value="83.6331" min="-360" max="360"
free="0"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="DEC" scale="1.0" value="22.0145" min="-90"&nbsp;
max="90"&nbsp; free="0"/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/spatialModel&gt;<br>
&nbsp; &lt;/source&gt;<br>
&nbsp; &lt;source name="Background" type="RadialAcceptance"
instrument="CTA"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;spectrum type="PowerLaw"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;parameter name="Prefactor" scale="1e-6" value="61.8"
min="0.0"&nbsp; max="1000.0" free="1"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;parameter name="Index"&nbsp;&nbsp;&nbsp;&nbsp;
scale="-1"&nbsp;&nbsp; value="1.85" min="0.0"&nbsp;
max="+5.0"&nbsp;&nbsp; free="1"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;parameter name="Scale"&nbsp;&nbsp;&nbsp;&nbsp;
scale="1e6"&nbsp; value="1.0"&nbsp; min="0.01" max="1000.0"
free="0"/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/spectrum&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;radialModel
type="Gaussian"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;parameter name="Sigma" scale="1.0" value="3.0" min="0.01"
max="10.0" free="1"/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/radialModel&gt;<br>
&nbsp; &lt;/source&gt;<br>
&lt;/source_library&gt;
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
model consists of a source library that contains 2
"sources":&nbsp;the Crab nebula and an instrumental background
model.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
Crab nebula is modelled by a factorized sky model that has a spectral
and a spatial component (tags <span style="font-family: Courier New,Courier,monospace;">&lt;spectrum&gt;</span>
and <span style="font-family: Courier New,Courier,monospace;">&lt;spatialModel&gt;</span>,
respectively). The spectrum is modelled by a power law, which is
defined by 3 parameters: the <span style="font-family: Courier New,Courier,monospace;">Prefactor</span>,
the <span style="font-family: Courier New,Courier,monospace;">Index</span>
and the <span style="font-family: Courier New,Courier,monospace;">Scale</span>.
The spatial model has 2 parameters: Right Ascension in degrees (<span style="font-family: Courier New,Courier,monospace;">RA</span>),
and Declination in degrees (<span style="font-family: Courier New,Courier,monospace;">DEC</span>).
Each parameter has a <span style="font-family: Courier New,Courier,monospace;">value</span>
and a <span style="font-family: Courier New,Courier,monospace;">scale</span>
factor, the real value of the parameter being the product <span style="font-family: Courier New,Courier,monospace;">value *
scale</span>. Typically, <span style="font-family: Courier New,Courier,monospace;">scale</span>
is chosen so that <span style="font-family: Courier New,Courier,monospace;">value</span>
is of the order of 1 (this is relevant for model fitting later). In
addition,&nbsp;<span style="font-family: Courier New,Courier,monospace;">value</span>
is bound by a minimum (<span style="font-family: Courier New,Courier,monospace;">min</span>)
and maximum (<span style="font-family: Courier New,Courier,monospace;">max</span>)
value, and a parameter may be free (<span style="font-family: Courier New,Courier,monospace;">free="1"</span>)
or fixed (<span style="font-family: Courier New,Courier,monospace;">free="0"</span>).
The <span style="font-family: Courier New,Courier,monospace;">min</span>,
<span style="font-family: Courier New,Courier,monospace;">max</span>,
and <span style="font-family: Courier New,Courier,monospace;">free</span>
attributes are not relevant here for the simulations, but they will be
important for the model fitting later.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
spectral intensity <span style="font-family: Courier New,Courier,monospace;">I(E)</span>
(in units of photons/cm2/s/MeV) of the power law is given by&nbsp;</p>
<p style="padding-top: 0pt; text-align: center; font-family: Courier New,Courier,monospace;" class="Body">I(E) = Prefactor * (E/Scale)^Index</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">where
the <span style="font-family: Courier New,Courier,monospace;">E</span>
and <span style="font-family: Courier New,Courier,monospace;">Scale</span>
are given in MeV.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
instrumental background of CTA is modelled by a factorized data model
that has a spectral and a radial component (tags <span style="font-family: Courier New,Courier,monospace;">&lt;spectrum&gt;</span>
and <span style="font-family: Courier New,Courier,monospace;">&lt;radialModel&gt;</span>,
respectively). The spectral component describes the <span style="font-weight: bold;">on-axis background
counting rate</span> of CTA as function of energy in units of
counts/s/sr/TeV.
The radial component describes the variation of the background rate
with <span style="font-weight: bold;">offset angle squared</span>,
(i.e.&nbsp;square of the offset angle with respect to the pointing
direction) which is modelled here by a Gaussian. The only parameter of
the radial component is the width of the Gaussian <span style="font-family: Courier New,Courier,monospace;">Sigma</span>,
which is here set to 3 degrees squared.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body"><span style="font-family: Courier New,Courier,monospace;">ctobssim</span>
has a couple of hidden parameters, the most important one being
certainly <span style="font-family: Courier New,Courier,monospace;">seed</span>.
<span style="font-family: Courier New,Courier,monospace;">seed</span>
is an integer that specifies the seed value for the random number
generator, and changing this parameter will allow to generate
statistically independent Monte Carlo samples of CTA event data. To
use for example a seed value of 41 one should type:
</p>
<p class="Code">&gt; ctobssim seed=41<br>
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">
<span style="font-family: Courier New,Courier,monospace;">ctobssim</span>
will write 2 files in the working directory: <span style="font-family: Courier New,Courier,monospace;">events.fits</span>
and <span style="font-family: Courier New,Courier,monospace;">ctobssim.log</span>.
The first file contains the simulated events in FITS format and can be
inspected using <a href="http://heasarc.gsfc.nasa.gov/docs/software/ftools/fv/" target="_blank"><span style="font-family: Courier New,Courier,monospace;">fv</span></a>
or <a href="http://hea-www.harvard.edu/RD/ds9/" target="_blank"><span style="font-family: Courier New,Courier,monospace;">ds9</span></a>.
The FITS file will contain 3 extensions: an empty primary image, a
binary table named <span style="font-family: Courier New,Courier,monospace;">EVENTS</span>
that holds the events (one row per event), and a binary table named <span style="font-family: Courier New,Courier,monospace;">GTI</span>
holding the Good Time Interval (for the moment a single row with 2
columns providing the start and the stop time of the simulated time
interval).</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
second file produced by <span style="font-family: Courier New,Courier,monospace;">ctobssim</span>
is a human readable log file that contains information about
the job execution. As example, the last lines from this file are shown
here:</p>
<p class="Code">2011-01-31T23:50:39: +==================+<br>
2011-01-31T23:50:39: | Simulate photons |<br>
2011-01-31T23:50:39: +==================+<br>
2011-01-31T23:50:39:&nbsp; Simulated photons .........: 33943<br>
2011-01-31T23:50:39:&nbsp; Simulation area ...........: 3.2e+10 cm2<br>
2011-01-31T23:50:39:&nbsp; Simulation cone ...........: RA=83.63
deg, Dec=22.01deg, r=10 deg<br>
2011-01-31T23:50:39:&nbsp; Time interval .............: 0 s - 1800 s<br>
2011-01-31T23:50:39:&nbsp; Energy range ..............: 100 GeV -
100 TeV<br>
2011-01-31T23:50:39:&nbsp; Random number seed ........: 1<br>
2011-01-31T23:50:39: <br>
2011-01-31T23:50:39: +=================+<br>
2011-01-31T23:50:39: | Simulate events |<br>
2011-01-31T23:50:39: +=================+<br>
2011-01-31T23:50:39:&nbsp; MC source events ..........: 649<br>
2011-01-31T23:50:39:&nbsp; MC background events ......: 3407<br>
2011-01-31T23:50:39: <br>
2011-01-31T23:50:39: +==========================+<br>
2011-01-31T23:50:39: | Save events in FITS file |<br>
2011-01-31T23:50:39: +==========================+<br>
2011-01-31T23:50:39: <br>
2011-01-31T23:50:39: Application "ctobssim" terminated after consuming
14 seconds of CPU time.<br>
<br>
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">Each
line starts with the UTC time at which the line has been written. In
this
run, 33943 Crab photons have been thrown over an area of 3.2 square
kilometres during a time interval of 1800 seconds. 649 of these photons
have been registered by CTA as events. In the same time
interval, 3407 background events have been registred by CTA.</p>
<br>
<br>
<p class="Title"><a name="Binning_CTA_data"></a>Binning
CTA data</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">
As next analysis step the data are binned in a counts map using the
executable <span style="font-family: Courier New,Courier,monospace;">ctbin</span>.
A counts map is a 3 dimensional data cube, spanned by Right Ascension
(or Galactic longitude), Declination (or Galactic latitude), and the
logarithm (base 10) of energy.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body"><span style="font-family: Courier New,Courier,monospace;">ctbin</span>
is executed by typing:</p>
<p class="Code">
&gt; ctbin<br>
Event data file name [test/data/crab_events.fits.gz] events.fits<br>
Output file name [cntmap.fits] <br>
Start value for first energy bin in TeV [0.1] <br>
Stop value for last energy bin in TeV [100.0] <br>
Number of energy bins [20] <br>
Projection method e.g. AIT|ARC|CAR|GLS|MER|NCP|SIN|STG|TAN [CAR] <br>
Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] <br>
First coordinate of image center in degrees (RA or galactic l) [83.63] <br>
Second coordinate of image center in degrees (DEC or galactic b)
[22.01] <br>
Image scale (in degrees/pixel) [0.02] <br>
Size of the X axis in pixels [200] <br>
Size of the Y axis in pixels [200] </p>
<p style="padding-top: 0pt; text-align: left;" class="Body">
In this example we adjust the event data file name and accept all the
remaining parameter defaults as they perfectly
satisfy our needs. The counts map will be centred on the location of
the Crab (Right Ascension 83.63 degrees, Declination 22.01 degrees) and
will be aligned in celestial coordinates. A cartesian projection has
been selected (<span style="font-weight: bold;">note that
the cartesian projection is the only valid project available for the
moment</span>). The counts map has 200 x 200
spatial pixels of 0.02 x 0.02 degrees in size, hence it covers a total
area of 4 x 4 degrees.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">A
set of 20 counts maps will be created, which are logarithmically spaced
in energy, and which cover the energy range from 0.1 TeV to 100 TeV. In
this example, the counts map will be saved as <span style="font-family: Courier New,Courier,monospace;">cntmap.fits</span>
in the
working directory.
In addition to the counts map, that is stored as the primary image
extension, the FITS
file also contains an extension named <span style="font-family: Courier New,Courier,monospace;">EBOUNDS</span>
that defines the energy boundaries that were used, and an extension <span style="font-family: Courier New,Courier,monospace;">GTI</span>
that defines the Good Time Intervals that have been used. The following
image shows the resulting FITS file. The <span style="font-family: Courier New,Courier,monospace;">EBOUNDS</span>
table has 20 rows, one for each energy bin, while the <span style="font-family: Courier New,Courier,monospace;">GTI</span>
table has jusr a single row, indicating the start and stop time of the
simulated data.</p>
<br>
<div style="text-align: center;"><img alt="CTA counts map FITS file" src="images/cntmap-fits.jpg"><br>
</div>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">An
image
of the first bin, covering the energy range 100 -&nbsp;141 GeV, is
shown below:
</p>
<div style="text-align: center;"><img style="width: 496px; height: 518px;" alt="CTA counts map" src="images/cntmap-map.jpg"><br>
</div>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">For
illustrating, the last few lines of the log file <span style="font-family: Courier New,Courier,monospace;">ctbin.log</span>
are shown below:
</p>
<p class="Code">2011-02-01T09:28:05: +=========+<br>
2011-02-01T09:28:05: | Binning |<br>
2011-02-01T09:28:05: +=========+<br>
2011-02-01T09:28:05:&nbsp; Events in list ............: 4056<br>
2011-02-01T09:28:05:&nbsp; Events in map .............: 3683<br>
2011-02-01T09:28:05:&nbsp; Events outside map area ...: 373<br>
2011-02-01T09:28:05:&nbsp; Events outside energy bins : 0<br>
2011-02-01T09:28:05: <br>
2011-02-01T09:28:05: +============+<br>
2011-02-01T09:28:05: | Counts map |<br>
2011-02-01T09:28:05: +============+<br>
2011-02-01T09:28:05: === GSkymap ===<br>
2011-02-01T09:28:05:&nbsp; Number of pixels ..........: 40000<br>
2011-02-01T09:28:05:&nbsp; Number of maps ............: 20<br>
2011-02-01T09:28:05:&nbsp; X axis dimension ..........: 200<br>
2011-02-01T09:28:05:&nbsp; Y axis dimension ..........: 200<br>
2011-02-01T09:28:05: === GWcsCAR ===<br>
2011-02-01T09:28:05:&nbsp; Coordinate system .........: EQU<br>
2011-02-01T09:28:05:&nbsp; Reference coordinate ......: (83.63,
22.01) deg<br>
2011-02-01T09:28:05:&nbsp; Reference pixel ...........: (100.5,
100.5)<br>
2011-02-01T09:28:05:&nbsp; Increment at reference ....: (0.02,
0.02) deg<br>
2011-02-01T09:28:05:&nbsp; Coordinate of North Pole ..: (180, 0) deg<br>
2011-02-01T09:28:05:&nbsp; CD matrix .................: [0.02 0][0
0.02]<br>
2011-02-01T09:28:05:&nbsp; Inverse CD matrix .........: [50 -0][-0
50]<br>
2011-02-01T09:28:05:&nbsp; Coordinate of native pole .: (83.63,
112.01)<br>
2011-02-01T09:28:05: <br>
2011-02-01T09:28:05: Application "ctbin" terminated after consuming 10
seconds of CPU time.
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">From
the 4056 events that have been simulated and stored in the <span style="font-family: Courier New,Courier,monospace;">events.fits</span>
file, 3683 lie within the map boundaries and are thus put into the
resulting counts map. The counts map is stored in a cartesian
projection in a <a href="http://fits.gsfc.nasa.gov/fits_wcs.html" target="_blank">World Coordinate System (WCS)</a>
compliant format.
</p>
<br>
<br>
<p class="Title"><a name="Fitting_CTA_data"></a>Fitting
CTA data</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">
Now we are ready to fit the simulated data with a model. For simplicity
we use in this example the same model that we used to simulate the data
with <span style="font-family: Courier New,Courier,monospace;">ctobssim</span>.
Model fitting is done using the executable <span style="font-family: Courier New,Courier,monospace;">ctlike</span>,
and we do the fit by typing:
</p>
<p class="Code">
&gt; ctlike<br>
Event list, counts map or observation definition
file&nbsp;[test/data/crab_cntmap.fits.gz] cntmap.fits<br>
Calibration
database [test/irf] /usr/local/gamma/share/caldb/cta<br>
Instrument response function [kb_E_50h_v3] <br>
Source model [test/data/crab.xml] /usr/local/gamma/share/models/crab.xml<br>
Source model output file [crab_results.xml]
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">Fitting
of the data is done in <span style="font-family: Courier New,Courier,monospace;">BINNED</span>
mode, which means that the events have been binned into a counts map
and the fit computes the log-likelihood function by summing over all
200 x 200 x 20 bins of the counts map. There is an alternative method,
the so called <span style="font-family: Courier New,Courier,monospace;">UNBINNED</span>
mode, where the events are not binned into a counts map and the
log-likelihood is computed directly by summing over all events. We will
explore
the <span style="font-family: Courier New,Courier,monospace;">UNBINNED</span>
mode <a href="#Doing_an_unbinned_analysis">later</a>.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">
One of the parameters given to <span style="font-family: Courier New,Courier,monospace;">ctlike</span>
is a source model output file (we specified <span style="font-family: Courier New,Courier,monospace;">crab_results.xml</span>
in the example), and this file will be a copy of the model XML file
where the parameter values have been replaced by the fit results. In
addition, the statistical uncertainties are added for each fitted
parameter using the attribute <span style="font-family: Courier New,Courier,monospace;">error</span>.
Below we show the XML result file that has been produced by the run:
</p>
<p class="Code">&lt;?xml version="1.0"
encoding="UTF-8" standalone="no"?&gt;<br>
&lt;source_library title="source library"&gt;<br>
&nbsp; &lt;source name="MAGIC Crab (Albert et al. 2008, ApJ,
674, 1037)" type="DiffuseSource"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;spectrum type="PowerLaw"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="Prefactor" value="5.7765" error="0.243328" scale="1e-16"
min="1e-07" max="1000" free="1" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="Index" value="2.49937" error="0.0330191" scale="-1" min="0"
max="5" free="1" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="Scale" value="0.3" scale="1e+06" min="0.01" max="1000" free="0"
/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/spectrum&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;spatialModel
type="SkyDirFunction"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="RA" value="83.6331" scale="1" min="-360" max="360" free="0"
/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="DEC" value="22.0145" scale="1" min="-90" max="90" free="0"
/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/spatialModel&gt;<br>
&nbsp; &lt;/source&gt;<br>
&nbsp; &lt;source name="Background" type="RadialAcceptance"
instrument="CTA"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;spectrum type="PowerLaw"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="Prefactor" value="61.7696" error="1.89829" scale="1e-06" min="0"
max="1000" free="1" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="Index" value="1.87195" error="0.0166039" scale="-1" min="0"
max="5" free="1" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="Scale" value="1" scale="1e+06" min="0.01" max="1000" free="0"
/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/spectrum&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;radialModel
type="Gaussian"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter
name="Sigma" value="3.00467" error="0.071261" scale="1" min="0.01"
max="10" free="1" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/radialModel&gt;<br>
&nbsp; &lt;/source&gt;<br>
&lt;/source_library&gt;
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">
In this example, the <span style="font-family: Courier New,Courier,monospace;">Prefactor</span>
and <span style="font-family: Courier New,Courier,monospace;">Index</span>
of the spectral model for the Crab as well as the <span style="font-family: Courier New,Courier,monospace;">Prefactor</span>,
<span style="font-family: Courier New,Courier,monospace;">Index</span>
and <span style="font-family: Courier New,Courier,monospace;">Sigma</span>
parameter of the radial acceptance model have been fitted (all
parameters having the attribute <span style="font-family: Courier New,Courier,monospace;">free="1"</span>
are fitted).
</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">To
get more details about the model fitting one can inspect the log file.
Below
we show the last lines of the <span style="font-family: Courier New,Courier,monospace;">ctlike.log</span>
log file that has been produced by this run:
</p>
<p class="Code">2011-02-01T09:53:17:
+=================================+<br>
2011-02-01T09:53:17: | Maximum likelihood optimisation |<br>
2011-02-01T09:53:17: +=================================+<br>
2011-02-01T09:53:20:&nbsp; Initial iteration: func=18092.1,
Lambda=0.001<br>
2011-02-01T09:53:24:&nbsp; Iteration 1: func=18090, Lambda=0.0001,
delta=2.08792<br>
2011-02-01T09:53:27:&nbsp; Iteration 2: func=18090, Lambda=1e-05,
delta=0.0021398<br>
2011-02-01T09:53:30:&nbsp; Iteration 3: func=18090, Lambda=1e-06,
delta=4.80215e-06<br>
2011-02-01T09:53:34:&nbsp; Iteration 4: func=18090, Lambda=1e-07,
delta=1.7495e-08<br>
2011-02-01T09:53:37: <br>
2011-02-01T09:53:37: +=========================================+<br>
2011-02-01T09:53:37: | Maximum likelihood optimisation results |<br>
2011-02-01T09:53:37: +=========================================+<br>
2011-02-01T09:53:37: === GOptimizerLM ===<br>
2011-02-01T09:53:37:&nbsp; Optimized function value ..: 18090<br>
2011-02-01T09:53:37:&nbsp; Absolute precision ........: 1e-06<br>
2011-02-01T09:53:37:&nbsp; Optimization status .......: converged<br>
2011-02-01T09:53:37:&nbsp; Number of parameters ......: 11<br>
2011-02-01T09:53:37:&nbsp; Number of free parameters .: 5<br>
2011-02-01T09:53:37:&nbsp; Number of iterations ......: 4<br>
2011-02-01T09:53:37:&nbsp; Lambda ....................: 1e-07<br>
2011-02-01T09:53:37:&nbsp; Maximum log likelihood ....: -18090<br>
2011-02-01T09:53:37:&nbsp; Npred .....................: 3683<br>
2011-02-01T09:53:37: === GModels ===<br>
2011-02-01T09:53:37:&nbsp; Number of models ..........: 2<br>
2011-02-01T09:53:37:&nbsp; Number of parameters ......: 11<br>
2011-02-01T09:53:37: === GModelPointSource ===<br>
2011-02-01T09:53:37:&nbsp; Name ......................: MAGIC Crab
(Albert et al. 2008, ApJ, 674, 1037)<br>
2011-02-01T09:53:37:&nbsp; Instruments ...............: all<br>
2011-02-01T09:53:37:&nbsp; Number of parameters ......: 6<br>
2011-02-01T09:53:37:&nbsp; Number of spatial par's ...: 2<br>
2011-02-01T09:53:37:&nbsp;&nbsp; RA .......................:
83.6331 [-360,360] deg (fixed,scale=1)<br>
2011-02-01T09:53:37:&nbsp;&nbsp; DEC ......................:
22.0145 [-90,90] deg (fixed,scale=1)<br>
2011-02-01T09:53:37:&nbsp; Number of spectral par's ..: 3<br>
2011-02-01T09:53:37:&nbsp;&nbsp; Prefactor ................:
5.7765e-16 +/- 2.43328e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16)<br>
2011-02-01T09:53:37:&nbsp;&nbsp; Index ....................:
-2.49937 +/-&nbsp;0.0330191 [-0,-5]&nbsp; (free,scale=-1)<br>
2011-02-01T09:53:37:&nbsp;&nbsp; PivotEnergy ..............:
300000 [10000,1e+09] MeV (fixed,scale=1e+06)<br>
2011-02-01T09:53:37:&nbsp; Number of temporal par's ..: 1<br>
2011-02-01T09:53:37:&nbsp;&nbsp; Constant .................: 1
(relative value) (fixed,scale=1)<br>
2011-02-01T09:53:37: === GCTAModelRadialAcceptance ===<br>
2011-02-01T09:53:37:&nbsp; Name ......................: Background<br>
2011-02-01T09:53:37:&nbsp; Instruments ...............: CTA<br>
2011-02-01T09:53:37:&nbsp; Model type ................: "Gaussian"
* "PowerLaw" * "Constant"<br>
2011-02-01T09:53:37:&nbsp; Number of parameters ......: 5<br>
2011-02-01T09:53:37:&nbsp; Number of radial par's ....: 1<br>
2011-02-01T09:53:37:&nbsp;&nbsp; Sigma ....................:
3.00467 +/- 0.071261 [0.01,10] deg2 (free,scale=1)<br>
2011-02-01T09:53:37:&nbsp; Number of spectral par's ..: 3<br>
2011-02-01T09:53:37:&nbsp;&nbsp; Prefactor ................:
6.17696e-05 +/- 1.89829e-06 [0,0.001] ph/cm2/s/MeV (free,scale=1e-06)<br>
2011-02-01T09:53:37:&nbsp;&nbsp; Index ....................:
-1.87195 +/-&nbsp;0.0166039 [-0,-5]&nbsp; (free,scale=-1)<br>
2011-02-01T09:53:37:&nbsp;&nbsp; PivotEnergy ..............:
1e+06 [10000,1e+09] MeV (fixed,scale=1e+06)<br>
2011-02-01T09:53:37:&nbsp; Number of temporal par's ..: 1<br>
2011-02-01T09:53:37:&nbsp;&nbsp; Constant .................: 1
(relative value) (fixed,scale=1)<br>
2011-02-01T09:53:37: <br>
2011-02-01T09:53:37: Application "ctlike" terminated after consuming 41
seconds of CPU time.
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
maximum likelihood optimizer required 4 iterations to converge. This is
pretty fast, but recall that we used the same model file for the
simulation and for fitting, hence the initial parameter values are
already very close to the best fitting values. To see the impact of the
initial parameters on the fit result, you may re-run <span style="font-family: Courier New,Courier,monospace;">ctlike</span>
using another copy of the model XML file where the <span style="font-family: Courier New,Courier,monospace;">value</span>
attributes of the parameters that should be fitted are changed. You
will see that the optimizer requires a couple of more iterations, but
it should converge to the same solution (provided that the initial
values are not too far of the best fitting values).&nbsp;
</p>
<br>
<br>
<p class="Title"><a name="Doing_an_unbinned_analysis"></a>Doing
an unbinned analysis</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">As
gamma-ray events are rare, the counts maps generated by <span style="font-family: Courier New,Courier,monospace;">ctbin</span>
will in general be sparse, having many empty pixels, in
particular at high energies. An alternative analysis technique consists
of working directly on the event list without binning the events in a
counts map. We
will see the benefit of such an analysis later once we re-run <span style="font-family: Courier New,Courier,monospace;">ctlike</span>
in unbinned mode.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">For
unbinned analysis we have first to define the data
space region over which the analysis is done. This is similiar to the <span style="font-family: Courier New,Courier,monospace;">ctbin</span>
step in binned analysis where we define the size of the counts map, the
energy range, and the time interval. For unbinned analysis we have no
such thing as a counts map, but we have to define over which region of
the data space the selected events are spread (because we have to
integrate
over this region to compute the total number of predicted events in the
data space that we analyse). Furthermore, we have to define what energy
range is covered, and what time interval is spanned by the data. All
this is done by the executable <span style="font-family: Courier New,Courier,monospace;">ctselect</span>,
which replaces the <span style="font-family: Courier New,Courier,monospace;">ctbin</span>
step in an unbinned analysis.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body"><span style="font-family: Courier New,Courier,monospace;">ctselect</span>
performs an event selection by choosing only&nbsp;events within a
given
region-of-interest (ROI), within a given energy band, and within a
given time interval from the input event list. The ROI is a circular
region on the sky, for which we define the centre (in celestial
coordinates) and the radius. Such a circular ROI is sometimes also
called an <span style="font-weight: bold;">acceptance cone</span>.
The following example shows how <span style="font-family: Courier New,Courier,monospace;">ctselect</span>
is invoked on the simulated
test data: </p>
<p class="Code">
&gt; ctselect<br>
Input event data file [test/data/crab_events.fits.gz]
events.fits<br>
Output event data file [selected_events.fits] <br>
RA for ROI centre (degrees) (0-360) [83.63] <br>
Dec for ROI centre (degrees) (-90-90) [22.01] <br>
Radius of ROI (degrees) (0-180) [3.0] <br>
Start time (MET in s) (0) [0.0] <br>
End time (MET in s) (0) [1800.0] <br>
Lower energy limit (TeV) (0) [0.1] <br>
Upper energy limit (TeV) (0) [100.0]<br>
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body"><span style="font-family: Courier New,Courier,monospace;">ctselect</span>
takes the input event list <span style="font-family: Courier New,Courier,monospace;">events.fits</span>,
performs an event selection, and writes the selected event into the
file <span style="font-family: Courier New,Courier,monospace;">selected_events.fits</span>.
The parameters it will query for are the centre of the ROI, the
radius of the ROI, the start and stop time (in seconds), and the energy
lower and upper limits (in TeV). The event selection information is
also written as a set of <span style="font-weight: bold;">data
selection keywords</span> to the output events file <span style="font-family: Courier New,Courier,monospace;">selected_events.fits</span>,
by respecting the same syntax that has been implemented for Fermi-LAT.
The following image is a screen dump of the data
selection keywords that have been written to the <span style="font-family: Courier New,Courier,monospace;">EVENTS</span>
header in the file <span style="font-family: Courier New,Courier,monospace;">selected_events.fits</span>:</p>
<br>
<p style="padding-top: 0pt; text-align: center;" class="Body">&nbsp;<img style="width: 456px; height: 310px;" alt="Data selection keywords" src="images/dskeys.jpg">
</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">It
is important for unbinned analysis that these data selection keywords
exist. If they don't exist, <span style="font-family: Courier New,Courier,monospace;">ctlike</span>
will not execute in unbinned mode.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">Below
we show also for completeness the last few lines of the <span style="font-family: Courier New,Courier,monospace;">ctselect.log</span>
file. It gives information about the specific data selection that has
been performed.
</p>
<p class="Code">
2011-02-01T19:58:34: +=================+<br>
2011-02-01T19:58:34: | Event selection |<br>
2011-02-01T19:58:34: +=================+<br>
2011-02-01T19:58:34:&nbsp; Time range ................: 0-1800<br>
2011-02-01T19:58:34:&nbsp; Energy range ..............: 0.1-100 TeV<br>
2011-02-01T19:58:34:&nbsp; Acceptance cone centre ....: RA=83.63,
DEC=22.01 deg<br>
2011-02-01T19:58:34:&nbsp; Acceptance cone radius ....: 3 deg<br>
2011-02-01T19:58:34:&nbsp; cfitsio selection .........: TIME
&gt;= 0 &amp;&amp; TIME &lt;= 1800 &amp;&amp;
ENERGY &gt;= 0.1 &amp;&amp; ENERGY &lt;= 100
&amp;&amp; ANGSEP(83.63,<br>
22.01,RA,DEC) &lt;= 3<br>
2011-02-01T19:58:34:&nbsp; FITS filename .............:
events.fits[EVENTS][TIME &gt;= 0 &amp;&amp; TIME &lt;=
1800 &amp;&amp; ENERGY &gt;= 0.1 &amp;&amp; ENERGY
&lt;= <br>
100 &amp;&amp; ANGSEP(83.63,22.01,RA,DEC) &lt;= 3]<br>
2011-02-01T19:58:34: <br>
2011-02-01T19:58:34: Application "ctselect" terminated after consuming
10 seconds of CPU time.<br>
&nbsp;<br>
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">Now
that the event selection has been performed, <span style="font-family: Courier New,Courier,monospace;">ctlike</span>
can be run in unbinned mode. To do this, you have to type <span style="font-family: Courier New,Courier,monospace;">UNBINNED</span>
when the maximum likelihood method is queried. The remaining parameters
are similar to binned mode, except for the last one that asks now for
an event data file instead of a counts map. Specify here the selected
event list <span style="font-family: Courier New,Courier,monospace;">selected_events.fits</span>
that has been produced by <span style="font-family: Courier New,Courier,monospace;">ctselect</span>.
To run <span style="font-family: Courier New,Courier,monospace;">ctlike</span>
in unbinned mode, type the following:
</p>
<p class="Code">
&gt; ctlike<br>
Event list, counts map or observation definition
file&nbsp;[test/data/crab_events.fits.gz] selected_events.fits<br>
Calibration database [test/irf] /usr/local/gamma/share/caldb/cta<br>
Instrument response function [kb_E_50h_v3] <br>
Source model [test/data/crab.xml] /usr/local/gamma/share/models/crab.xml<br>
Source model output file [crab_results.xml] </p>
<p style="padding-top: 0pt; text-align: left;" class="Body">You
will recognise that <span style="font-family: Courier New,Courier,monospace;">ctlike</span>
runs much faster in unbinned mode compared to binned mode. This is
understandable as the selected event list contains only 4048 events,
while the binned counts map we used before had 200 x 200 x 20 = 800000
pixels. As unbinned maximum likelihood fitting loops over the events
(while binned maximum likelihood loops over the pixels), there are much
less operations to perform in unbinned than in binned mode (there is
some additional overhead in unbinned mode that comes from integrating
the models over the region of interest, yet this is negligible compared
to the operations needed when looping over the pixels). So as long as
you work with
short event lists, unbinned mode is faster. Unbinned <span style="font-family: Courier New,Courier,monospace;">ctlike</span>
should also be more
precise as no binning is performed, hence there is no loss of
information due to histogramming.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">Below
you see the corresponding output from the <span style="font-family: Courier New,Courier,monospace;">ctlike.log</span>
file. The fitted parameters are essentially identical to the ones found
in binned mode. The slight
difference with respect to the binned analysis may be explained by the
different event sample that has been used for the analysis: while
binned likelihood works on rectangular counts maps, unbinned likelihood
works on circular event selection regions. It is thus not possible to
select exactly the same events for both analyses!</p>
<p class="Code">
2011-02-02T14:32:54: +=================================+<br>
2011-02-02T14:32:54: | Maximum likelihood optimisation |<br>
2011-02-02T14:32:54: +=================================+<br>
2011-02-02T14:32:54:&nbsp; Initial iteration: func=33730.9,
Lambda=0.001<br>
2011-02-02T14:32:54:&nbsp; Iteration 1: func=33728.3,
Lambda=0.0001, delta=2.56377<br>
2011-02-02T14:32:54:&nbsp; Iteration 2: func=33728.3, Lambda=1e-05,
delta=0.00443209<br>
2011-02-02T14:32:54:&nbsp; Iteration 3: func=33728.3, Lambda=1e-06,
delta=5.81336e-06<br>
2011-02-02T14:32:54:&nbsp; Iteration 4: func=33728.3, Lambda=1e-07,
delta=1.31549e-08<br>
2011-02-02T14:32:54: <br>
2011-02-02T14:32:54: +=========================================+<br>
2011-02-02T14:32:54: | Maximum likelihood optimisation results |<br>
2011-02-02T14:32:54: +=========================================+<br>
2011-02-02T14:32:54: === GOptimizerLM ===<br>
2011-02-02T14:32:54:&nbsp; Optimized function value ..: 33728.3<br>
2011-02-02T14:32:54:&nbsp; Absolute precision ........: 1e-06<br>
2011-02-02T14:32:54:&nbsp; Optimization status .......: converged<br>
2011-02-02T14:32:54:&nbsp; Number of parameters ......: 11<br>
2011-02-02T14:32:54:&nbsp; Number of free parameters .: 5<br>
2011-02-02T14:32:54:&nbsp; Number of iterations ......: 4<br>
2011-02-02T14:32:54:&nbsp; Lambda ....................: 1e-07<br>
2011-02-02T14:32:54:&nbsp; Maximum log likelihood ....: -33728.3<br>
2011-02-02T14:32:54:&nbsp; Npred .....................: 4048<br>
2011-02-02T14:32:54: === GModels ===<br>
2011-02-02T14:32:54:&nbsp; Number of models ..........: 2<br>
2011-02-02T14:32:54:&nbsp; Number of parameters ......: 11<br>
2011-02-02T14:32:54: === GModelPointSource ===<br>
2011-02-02T14:32:54:&nbsp; Name ......................: MAGIC Crab
(Albert et al. 2008, ApJ, 674, 1037)<br>
2011-02-02T14:32:54:&nbsp; Instruments ...............: all<br>
2011-02-02T14:32:54:&nbsp; Number of parameters ......: 6<br>
2011-02-02T14:32:54:&nbsp; Number of spatial par's ...: 2<br>
2011-02-02T14:32:54:&nbsp;&nbsp; RA .......................:
83.6331 [-360,360] deg (fixed,scale=1)<br>
2011-02-02T14:32:54:&nbsp;&nbsp; DEC ......................:
22.0145 [-90,90] deg (fixed,scale=1)<br>
2011-02-02T14:32:54:&nbsp; Number of spectral par's ..: 3<br>
2011-02-02T14:32:54:&nbsp;&nbsp; Prefactor ................:
5.83432e-16 +/- 2.44527e-17 [1e-23,1e-13] ph/cm2/s/MeV
(free,scale=1e-16)<br>
2011-02-02T14:32:54:&nbsp;&nbsp; Index ....................:
-2.50725 +/- 0.0328297 [-0,-5]&nbsp; (free,scale=-1)<br>
2011-02-02T14:32:54:&nbsp;&nbsp; PivotEnergy ..............:
300000 [10000,1e+09] MeV (fixed,scale=1e+06)<br>
2011-02-02T14:32:54:&nbsp; Number of temporal par's ..: 1<br>
2011-02-02T14:32:54:&nbsp;&nbsp; Constant .................: 1
(relative value) (fixed,scale=1)<br>
2011-02-02T14:32:54: === GCTAModelRadialAcceptance ===<br>
2011-02-02T14:32:54:&nbsp; Name ......................: Background<br>
2011-02-02T14:32:54:&nbsp; Instruments ...............: CTA<br>
2011-02-02T14:32:54:&nbsp; Model type ................: "Gaussian"
* "PowerLaw" * "Constant"<br>
2011-02-02T14:32:54:&nbsp; Number of parameters ......: 5<br>
2011-02-02T14:32:54:&nbsp; Number of radial par's ....: 1<br>
2011-02-02T14:32:54:&nbsp;&nbsp; Sigma ....................:
3.03472 +/- 0.0398509 [0.01,10] deg2 (free,scale=1)<br>
2011-02-02T14:32:54:&nbsp; Number of spectral par's ..: 3<br>
2011-02-02T14:32:54:&nbsp;&nbsp; Prefactor ................:
6.18897e-05 +/- 1.74306e-06 [0,0.001] ph/cm2/s/MeV (free,scale=1e-06)<br>
2011-02-02T14:32:54:&nbsp;&nbsp; Index ....................:
-1.86369 +/- 0.0156024 [-0,-5]&nbsp; (free,scale=-1)<br>
2011-02-02T14:32:54:&nbsp;&nbsp; PivotEnergy ..............:
1e+06 [10000,1e+09] MeV (fixed,scale=1e+06)<br>
2011-02-02T14:32:54:&nbsp; Number of temporal par's ..: 1<br>
2011-02-02T14:32:54:&nbsp;&nbsp; Constant .................: 1
(relative value) (fixed,scale=1)<br>
2011-02-02T14:32:54: <br>
2011-02-02T14:32:54: Application "ctlike" terminated after consuming 2
seconds of CPU time.<br>
</p>
<br>
<br>
<p class="Title"><a name="Some_final_remarks"></a>Some
final remarks <span style="color: red;">(updated for
ctools-00-02-03)</span></p>
<p style="padding-top: 0pt; text-align: left;" class="Body">First
you should notice that <span style="font-weight: bold;">ctools
are in the prototyping phase</span>. If GammaLib and ctatools are
installed on your system you should be able to run the above example
without any problems, and you can do even much more.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">You
may specify longer integration times for the simulation and for the
analysis, you can have several point sources in the
XML file, and you may try to fit all sources simultaneously using <span style="font-family: Courier New,Courier,monospace;">ctlike</span>.
Yet, for the moment,
you are limited to point sources (<span style="font-family: Courier New,Courier,monospace;">type="PointSource"</span>)
and their spectra should be power laws (<span style="font-family: Courier New,Courier,monospace;">type="PowerLaw"</span>).
Although there are already a number of other spectral types available
in GammaLib, I have not yet had the time to implement their Monte Carlo
generator, hence you cannot simulate events for spectral laws different
from power laws for the moment. You may try, however, fitting the
sources with other spectral laws, yet I have not tried this, and I
cannot guarantee that it works.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">There
is also only one radial acceptance model defined so far, and you should
use the model definition that is given in the example.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">So
far, there are four projection types supported: <span style="font-family: Courier New,Courier,monospace;">AZP</span>,
<span style="font-family: Courier New,Courier,monospace;">CAR</span>,
<span style="font-family: Courier New,Courier,monospace;">STG</span>,
and <span style="font-family: Courier New,Courier,monospace;">TAN</span>.
You can use them in Galactic (<span style="font-family: Courier New,Courier,monospace;">GAL</span>)
or celestial (<span style="font-family: Courier New,Courier,monospace;">CEL</span>)
coordinates.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
instrument response function that has been implemented so far in
GammaLib (yes, it is in GammaLib, not in ctatools) is very simple. It
just reads Konrad's effective area files to get the onaxis effective
area. It is assumed that the effective area varies with offset angle,
and a Gaussian as function of offset angle squared has been implemented
for the functional form of this variation. By default, the <span style="font-family: Courier New,Courier,monospace;">sigma</span>
of this Gaussian is fixed to 3 deg<sup>2</sup>.
This value can not be modified using the ctatools, but it can be
altered using the Python interface. In any case, this treatment of the
offset angle dependence is only preliminary and <span style="font-weight: bold;">will be changed as soon as a
format has been defined for the CTA response functions</span>.</p>
<p style="padding-top: 0pt; text-align: left;" class="Body"></p>
<p style="padding-top: 0pt; text-align: left;" class="Body"><span style="font-family: Courier New,Courier,monospace;">ctobssim</span>
and <span style="font-family: Courier New,Courier,monospace;">ctlike</span>
query for the name of the instrument response function file, and you
may specify different
response files if you want to study the impact of array configuration
on the results. To see what is available, type (adjust the
path corresponding to your installation directory):
</p>
<p class="Code">&gt; ls
/usr/local/gamma/share/caldb/cta<br>
kb_A_50h_v3.dat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
kb_D_50h_v3.dat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
kb_G_50h_v3.dat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
kb_J_50h_v3.dat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
kb_NB_50h_v3.dat<br>
kb_B_50h_v3.dat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
kb_E_50h_v3.dat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
kb_H_50h_v3.dat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
kb_K_50h_v3.dat<br>
kb_C_50h_v3.dat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
kb_F_50h_v3.dat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
kb_I_50h_v3.dat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
kb_NA_50h_v3.dat<br>
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">The
point spread function (PSF) definition is also read from these files.
So far, the <span style="font-weight: bold;">PSF is a
simple&nbsp;Gaussian</span>. The energy dependent Gaussian
width is defined by
the r68 parameter in Konrad's response files.</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body"><span style="font-weight: bold;">Lifetime
is assumed to be 100%</span>. I'm not sure whether lifetime is
folded in the
effective areas of Konrad's response files, if not, a corresponding
correction should be applied to all source fluxes obtained with the
ctatools.
</p>
<br>
<p style="padding-top: 0pt; text-align: left;" class="Body">Finally,
if
you want to have the log file also dumped to the screen as the
executable runs, add <span style="font-family: Courier New,Courier,monospace;">debug=yes</span>
on the command line, e.g.
</p>
<p class="Code">&gt; ctlike debug=yes
</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">
And now: <span style="font-weight: bold;">enjoy playing
with ctatools</span>.
</p>
<br>
<br>
<p class="Title"><a name="Getting_Help"></a>Getting
Help</p>
<p style="padding-top: 0pt; text-align: left;" class="Body">
Any questions, bug reports, or suggested enhancements related to
ctatools and GammaLib&nbsp;should be submitted
to <a href="mailto:jurgen.knodlseder@irap.omp.eu">jurgen.knodlseder@irap.omp.eu</a>.
</p>
<br>
<hr size="1">
<p class="Body">Last updated by: J&uuml;rgen
Kn&ouml;dlseder (4 April 2012)
</p>
</body></html>