GammaLib based analysis of TeV data Proposal for a CTA High-level Science Analysis framework J. Knödlseder (CESR, Toulouse)

Slides:



Advertisements
Similar presentations
XMM EPIC MOS Jenny Carter 4 th EPIC BG WG Meeting Mallorca, 25/10/06 BGWG blank sky data analysis Jenny Carter, University of Leicester.
Advertisements

High Energy Gamma Ray Group
Binding python to other languages (Fortran and C).
CSE 1302 Lecture 8 Inheritance Richard Gesick Figures from Deitel, “Visual C#”, Pearson.
GLAST Science Support CenterAugust 9, 2004 Likelihood Analysis of LAT Data James Chiang (GLAST SSC – SLAC)
Status report on Light Simulator Claudia Cecchi Francesca Marcucci Monica Pepe Software meeting Udine January
GLAST LAT Project Astrostatistics Workshop, HEAD meeting, 10 September 2004 James Chiang (GSSC/UMBC) 1 Gamma-ray Large Area Space Telescope Challenges.
GLAST Science Support Center February 12, 2004 DC1 Closeout Detecting Gamma-Ray Bursts in the DC1 Data David Band (GSSC)
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
1 Tom Stephens GSSC/GSFC Database Access and the dataSubselector Tool December 8, 2003 DC1 Kickoff Workshop.
C&A 10April06 1 Point Source Detection and Localization Using the UW HealPixel database Toby Burnett University of Washington.
Guide To UNIX Using Linux Third Edition
1 TEV PA Meeting July 2009 Preliminary Fermi-LAT Limits on High Energy Gamma Lines from WIMP Annihilation Yvonne Edmonds representing the Fermi-LAT Collaboration.
C++ fundamentals.
Python Introduction.
GLAST Science Support Center June 29, 2005Data Challenge II Software Workshop GRB Analysis David Band GSFC/UMBC.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
© iPerimeter Ltd Unix and IBM i  AIX and Linux run natively on Power Systems  IBM i can do Unix type things in two ways:  Posix/QShell  Ordinary.
GLAST Science Support CenterAugust 9, 2004 Implementation of the Standard Analysis Environment (SAE) James Peachey (HEASARC/GLAST SSC—GSFC/L3)
Lecture 8 Inheritance Richard Gesick. 2 OBJECTIVES How inheritance promotes software reusability. The concepts of base classes and derived classes. To.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Java Analysis Studio Status Update 12 May 2000 Altas Software Week Tony Johnson
PHP TUTORIAL. HISTORY OF PHP  PHP as it's known today is actually the successor to a product named PHP/FI.  Created in 1994 by Rasmus Lerdorf, the very.
SPACE TELESCOPE SCIENCE INSTITUTE Operated for NASA by AURA COS Pipeline Language(s) We plan to develop CALCOS using Python and C Another programming language?
K. Harrison CERN, 20th April 2004 AJDL interface and LCG submission - Overview of AJDL - Using AJDL from Python - LCG submission.
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Adam Zok Science Undergraduate Laboratory Internship Program August 14, 2008.
G.Corti, P.Robbe LHCb Software Week - 19 June 2009 FSR in Gauss: Generator’s statistics - What type of object is going in the FSR ? - How are the objects.
Eagle: Maturation and Evolution 17th Annual Tcl Conference Joe Mistachkin.
GLAST Science Support Center May 8, 2006 GUC Meeting Demonstration of GRB Spectral Analysis with the SAE David Band (GSSC/JCA-UMBC)
A statistical test for point source searches - Aart Heijboer - AWG - Cern june 2002 A statistical test for point source searches Aart Heijboer contents:
SIMO SIMulation and Optimization ”New generation forest planning system” Antti Mäkinen & Jussi Rasinmäki Dept. of Forest Resource Management.
Source catalog generation Aim: Build the LAT source catalog (1, 3, 5 years) Jean Ballet, CEA SaclayGSFC, 29 June 2005 Four main functions: Find unknown.
Mar 1-3 – DC2 Kickoff Meeting - 1 Tom Stephens GSSC Database Programmer Retrieving, Filtering and Previewing Data.
Fermi LAT Monash University Nov 21, 2009 R.DuboisFermi LAT Science Analysis Tutorial1 Issues in a Nutshell LS5039 Low stats: 4k photons in 1 yr Strong.
Mantid Stakeholder Review Nick Draper 01/11/2007.
Mantid Stakeholder Review Nick Draper 01/11/2007.
SPI Data Analysis A. Strong MPE Moriond, Les Arcs 2002.
Page 1 PACS GRITS 17 June 2011 Herschel Data Analysis Guerilla Style: Keeping flexibility in a system with long development cycles Bernhard Schulz NASA.
K. Harrison CERN, 22nd September 2004 GANGA: ADA USER INTERFACE - Ganga release status - Job-Options Editor - Python support for AJDL - Job Builder - Python.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
SPI NIGHTLIES Alex Hodgkins. SPI nightlies  Build and test various software projects each night  Provide a nightlies summary page that displays all.
Fermi Cycle-2 Proposal Workshop Center for Astrophysics, Feb. 13, 2009 Dave Davis, FSSC 1 FSSC Science Tools for Cycle 2.
Source catalog generation for DC2 Aim (in order of priority): 1.Improve on source detection algorithm and error box. 2.Provide a list of source identifications.
CUPID (Bob Narron)GRITS - May 14, CUPID “Customizable User Pipeline for IRS Data” Abstract: The CUPID package will allow users to run the Spitzer.
AdaptJ Sookmyung Women’s Univ. PSLAB. 1. 목차 1. Overview 2. Collecting Trace Data using the AdaptJ Agent 2.1 Recording a Trace 3. Analyzing Trace Data.
June 27-29, DC2 Software Workshop - 1 Tom Stephens GSSC Database Programmer GSSC Data Servers for DC2.
C++ Functions A bit of review (things we’ve covered so far)
GammaLib based analysis of TeV data A high-level Science Analysis framework for CTA Jürgen Knödlseder (IRAP, Toulouse)
1 Meeting Nazionale sull'analisi dei dati dell'osservatorio Fermi-LAT Oct. 01, ASDC/Frascati Introduction to Fermi-LAT Science Analysis Software.
GammaLib A versatile framework for the analysis of astronomical gamma-ray data.
Pyragen A PYTHON WRAPPER GENERATOR TO APPLICATION CORE LIBRARIES Fernando PEREIRA, Christian THEIS - HSE/RP EDMS tech note:
All-sky source search Aim: Look for a fast method to find sources over the whole sky Selection criteria Algorithms Iteration Simulations Energy information.
GLAST Science Support Center November 8, 2005 GUC Action Item #15 AI#15: Pre-Launch GI Proposal Tools David Band (GSSC/JCA-UMBC)
3 nd Coding Sprint Jürgen Knödlseder (IRAP) 1.GammaLib and ctools concepts 2.Coding for GammaLib and ctools 3.Current status 4.Goals of this sprint.
Source catalog generation Aim: Build the LAT source catalog (1, 3, 5 years) Jean Ballet, CEA SaclaySLAC, 23 May 2005 Four main functions: Find unknown.
Likelihood analysis of small diffuse sources Riccardo Rando Elisa Mosconi, Omar Tibolla DC2 Kickoff Meeting – SLAC, 1-3 March 2006.
CTA - serving the community at large J. Knödlseder (CESR)
Towards a CTA high-level science analysis framework
Jean Ballet, CEA Saclay GSFC, 31 May 2006 All-sky source search
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
Application of HEALpix Pixelization to Gamma-ray Data
4th Coding Sprint Short intro into GammaLib and ctools concepts
Lecture 22 Inheritance Richard Gesick.
Intro to PHP.
Eagle: Maturation and Evolution
10th ASTRI GENERAL MEETING
SPL – PS1 Introduction to C++.
Presentation transcript:

GammaLib based analysis of TeV data Proposal for a CTA High-level Science Analysis framework J. Knödlseder (CESR, Toulouse)

Observing gamma rays All measure photons ! - localization - time - energy (- polarization) MeV keV GeV TeV

Analysing gamma rays Common features Data are photon based (event lists or event histograms) Background is important or dominating (reduction techniques are crucial) Instruments are complex (time variable background and instrument properties, indirect imaging) Common formats, methods and issues All community data are in FITS format (OGIP) (ftools, DS9, …) Most analysis systems break down analysis tasks in executables (bricks of science analysis) (ftools like executables; analysis pipeline by chaining executables) Many missions use the IRAF parameter interface (ftools, Chandra, INTEGRAL, SWIFT, Fermi, …) Most systems rely on a maximum likelihood optimizer (Poisson statistics) (INTEGRAL/SPI, Fermi, COMPTEL, …) Execution time and data volume is an issue …

Stop re-inventing the wheel GammaLib keep what is common add only what is really needed Towards GammaLib: spi_toolslib developed by CESR for INTEGRAL/SPI analysis (delivered with OSA via ISDC) see also re-implementation of ideas initially developped for CGRO/COMPTEL analysis still many things are SPI specific

The GammaLib idea Write a generic, self-contained, open source, multi-platform C++ library that implements all code required for high-level science analysis of gamma-ray data generic: GammaLib core code does not depend on a specific instrument type or architecture self-contained: does not depend on any other library (considerable cost-reduction for maintenance; not fully fulfilled since dependence on cfitsio) open source: GNU licence ( multi-platform C++: should compile on any POSIX-compliant platform (32 and 64 bit) Implement instrument specific modules need no re-compilation of GammaLib core either add-on libraries or embedded in GammaLib (core+inst)

The GammaLib concept Generic core services such as input/output in standard formats and numerical support (e.g. matrix handling/solving) Instrument specific support (data content, response function, background handling) Generic analysis services (abstract combination of observations and events) High-level analysis support (model fitting) yellow = prototype exists

CTA specific support Derive instrument specific C++ classes from pure virtual base classes GObservation: observation specific data (time interval, GTI, energy range, region of interest, event container, response function) GEventList & GEventCube: unbinned and binned data containers GEventAtom & GEventBin: individual event and event bin (collection of events with similar properties) GResponse: instrument specific response function (effective area, point spread function, energy dispersion, time dispersion, livetime) GInstDir: event direction in instrument coordinates (sky direction for imaging instruments like CTA, Fermi/LAT, detector coordinates otherwise) GRoi: region of interest (region of event directions to be used for analysis; e.g. cone for CTA, Fermi/LAT) GPointing: instrument pointing (pointing direction, livetime information, etc.) CTA implementation Prototype classes using simple response function (based on Konrad’s analysis results on assuming Gaussian PSF, no zenith angle dependence, no energy and time dispersion)

Using GammaLib as a toolbox ftools like analysis use GammaLib as API to create specific analysis tasks analysis executables derive from GApplication base class native implementation of IRAF parameter interface native implementation of reporting interface (not yet prototyped)

Example: ctbin tool Class definition class ctbin : public GApplication { public: ctbin(int argc, char *argv[]) : GApplication(“ctbin”, “1.0”, argc, argv) {;} int run(void); }; Tool & class implementation int main (int argc, char *argv[]) { ctbin application(argc, argv); int rc = application.run(); return rc; } int ctbin::run(void) { // Get parameters std::string evfile = par("evfile")->value(); std::string outfile = par("outfile")->value(); int enumbins = toint(par("enumbins")->value()); // Code.... // End of tool return 0; } Tool derives from GApplication base class using default constructor. run method does the job … GApplication class provides access to parameters in ctbin.par file Creates instance of application class and runs application

Example: ctbin.par file # General parameters #=================== evfile, f, a, "eventlist_reco.fits.gz",,,"Event data file name" outfile, f, a, "cntmap.fits",,, "Output file name" # Energy binning parameters #========================== ebinalg, s, a, "LOG", FILE|LIN|LOG,,"Algorithm for defining energy bins" emin, r, a, 0.02,,,"Start value for first energy bin in TeV" emax, r, a, 100.0,,,"Stop value for last energy bin in TeV" enumbins, i, a, 20,,,"Number of energy bins" ebinfile, f, a, "NONE",,,"Name of the file containing the energy bin definition" # Spatial binning parameters #=========================== nxpix, i, a, 200,,, "Size of the X axis in pixels" nypix, i, a, 200,,, "Size of the Y axis in pixels" binsz, r, a, 0.02,,, "Image scale (in degrees/pixel)" coordsys, s, a, "CEL", CEL|GAL,,"Coordinate system (CEL - celestial, GAL - galactic)" xref, r, a, ,,, "First coordinate of image center in degrees (RA or galactic l)" yref, r, a, ,,, "Second coordinate of image center in degrees (DEC or galactic b)" axisrot, r, a, 0.0,,, "Rotation angle of image axis, in degrees" proj, s, a, "CAR",,, "Projection method e.g. AIT|ARC|CAR|GLS|MER|NCP|SIN|STG|TAN" # Standard parameters #==================== chatter, i, h, 1,0,4, "Chattiness of output" clobber, b, h, yes,,, "Overwrite existing output files with new output files?" debug, b, h, no,,, "Debugging mode activated" mode, s, h, "ql",,, "Mode of automatic parameters" Parameter type (file, string, real, integer, boolean) Parameter mode (auto, hidden, query, learn) Parameter value Parameter minimum / maximum or options Text for parameter query

Example: running ctbin Interactively: Queries for all automatic parameters $./ctbin Event data file name [eventlist_reco.fits.gz] Output file name [cntmap.fits] Start value for first energy bin in TeV [0.02] Stop value for last energy bin in TeV [100.0] Number of energy bins [20] Projection method e.g. AIT|ARC|CAR|GLS|MER|NCP|SIN|STG|TAN [CAR] Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] First coordinate of image center in degrees (RA or galactic l) [117.02] Second coordinate of image center in degrees (DEC or galactic b) [-33.35] Image scale (in degrees/pixel) [0.02] Size of the X axis in pixels [200] Size of the Y axis in pixels [200] $ Command line: Specify all automatic parameters as arguments $./ctbin evfile=eventlist_reco.fits.gz outfile=cntmap.fits emin=0.02 emax=100.0 enumbins=20 proj=CAR coordsys=CEL xref= yref= binsz=0.02 nxpix=200 nypix=200 $ Default value

Example: ctbin usage of GammaLib // Load events as unbinned data GCTAObservation run; run.load_unbinned(evfile); // Create skymap std::string wcs = par("proj")->value(); std::string coords = par("coordsys")->value(); double x = todouble(par("xref")->value()); double y = todouble(par("yref")->value()); double dx = todouble(par("binsz")->value()); double dy = todouble(par("binsz")->value()); int nx = toint(par("nxpix")->value()); int ny = toint(par("nypix")->value()); GSkymap map = GSkymap(wcs, coords, x, y, dx, dy, nx, ny, enumbins); // Fill sky map GCTAEventList* events = (GCTAEventList*)run.events(); for (GCTAEventList::iterator event = events->begin(); event != events->end(); ++event) { GSkyDir dir = ((GCTAInstDir*)event->dir())->skydir(); GSkyPixel pixel = map.dir2xy(dir); int index = run.ebounds()->index(*(event->energy())); map(pixel, index) += 1.0; } // Save counts map GFits file; map.write(&file); file.saveto(outfile, clobber); Load CTA events into an instance of an observation. Create skymap that will hold the binned counts map Fill skymap by iterating over all events. Save skymap as FITS file GammaLib natively implements WCS, including HealPix

Example: ctbin counts map

ctatools: a GammaLib based analysis framework

Scripting ctatools Python bindings for ctatools SWIG (Simplified Wrapper and Interface Generator - builds interfaces for C/C++ programs for Python, Tcl, Perl, PHP, Ruby, Java, … Requires only one interface definition file per C++ class (almost identical to class definiton header file; e.g. GApplication.h => GApplication.i) Highly portable and exists for many platforms (UNIX, LINUX, Mac OSX, Windows) Python interface implemented for ctatools Running ctbin under python $ python >>> from ctatools import * >>> task = ctbin() >>> print task === GApplication === Name : ctbin Version : v1r0p0 >>> task.par("evfile").value("eventlist_reco.fits.gz") >>> task.par("outfile").value("cntmap.fits") >>>... >>> task.par("nypix").value("200") >>> task.run() 0 >>>

Scripting GammaLib CTA analysis without ctatools (scripting GammaLib directly) $ python >>> from gammalib import * >>> >>> run = GCTAObservation() >>> run.load_binned("cntmap.fits.gz") >>> run.response("kb_E_50h_v3", "../inst/cta/test/irf") >>> >>> obs = GObservations() >>> obs.append(run) >>> >>> dir = GSkyDir() >>> dir.radec_deg(117.0, -33.0) >>> point_source = GModelSpatialPtsrc(dir) >>> power_law = GModelSpectralPlaw(1.0e-7, -2.1) >>> power_law.par(0).min(1.0e-12) >>> crab = GModel(point_source, power_law) >>> crab.name("Crab") >>> models = GModels() >>> models.append(crab) >>> obs.models(models) >>> >>> opt = GOptimizerLM() >>> opt.max_iter(1000) >>> obs.optimize(opt) >>> print obs Parameter : Prefactor: 1.269e-08 +/ e+00 [1.000e-12,infty[ ph/cm2/s/MeV Parameter : Index: e+00 +/ e+00 Load counts map into CTA observation object and set instrument response function (only CTA specific part!). Append CTA observation to list of observations (just one here). Define model to be fitted to data: point source at (RA,Dec)=(117,-33) with simple power law spectrum (positively constrained). Append point-source model to list of models (just one here) and attach list to observations. Maximum likelihood optimization using Levenberg-Marquardt optimizer.

Binned likelihood analysis Merit function (to be maximized) Model value for bin i Number of counts in bin i Number of bins

Finely binned likelihood analysis Reduce binsize until one event at maximum in each bin: Total number of model counts within the dataspace (region-of-interest). Implicitely a sum over all events.

Unbinned likelihood analysis Reduce binsize until one event at maximum in each bin: Total number of model counts within the dataspace (region-of-interest). Implicitely a sum over all events. Binsize  0: unbinned analysis Explicit sum over all events. Probability that event k originates from model. Integration over region-of-interest (energy, measured direction, time). Number of events

GammaLib / ctatools development Developement under CVS Hudson continuous integration server ( Required development efforts ~200 man months (GammaLib & ctatools) CESR contribution shaped to meet these requirements Your contribution is welcome! (i.e. non-CTA instrument interfaces, library extension, code optimisation, scripts, …)

Conclusions Status Prototype GammaLib software available (not everything is already implemented …) Prototype CTA and LAT instrument interfaces are implemented Simple CTA data analysis possible (point source fitting) Next steps Add missing core components to GammaLib (reporting, XML interface for model specification, …) Enhance existing GammaLib core components (extended / diffuse models, more complex spectral laws, parameter error estimation, …) Enhance CTA instrument interface (more realistic response function, background handling) Add / enhance ctatools to complete analysis chain Conclusion The prototype software demonstrates that a generic gamma-ray high-level analysis framework is feasible. CTA analysis in this framework will profit from multi-mission interfaces enabling broad-band spectral analysis of sources from a few tens of keV up to tens of TeV.