From 6e7fafe8dcd85f6aac8c63044534bb255d833b07 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Tue, 24 Jul 2018 15:05:10 +0200 Subject: [PATCH] Produce slimmer event list and counts cube for unit testing (#2310) --- cscripts/Makefile.am | 5 ++--- dev/make_test_data.py | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pyext/Makefile.am | 4 ++-- test/data/crab_cntmap.fits | Bin 0 -> 54720 bytes test/data/crab_cntmap.fits.gz | Bin 20569 -> 0 bytes test/data/crab_cntmap_small.fits.gz | Bin 2745 -> 0 bytes test/data/crab_events.fits | 28 ++++++++++++++++++++++++++++ test/data/crab_events.fits.gz | Bin 104430 -> 0 bytes test/test_csobsinfo.py | 2 +- test/test_csresmap.py | 26 +++++++++++++------------- test/test_csresspec.py | 4 ++-- test/test_csspec.py | 3 +-- test/test_ctbin.py | 34 +++++++++++++++++----------------- test/test_ctbkgcube.py | 16 ++++++++-------- test/test_ctcubemask.py | 28 ++++++++++++++-------------- test/test_ctedispcube.py | 18 +++++++++--------- test/test_cterror.py | 26 ++++++++++++++++++-------- test/test_ctexpcube.py | 34 +++++++++++++++++----------------- test/test_ctlike.py | 26 ++++++++++++++++++-------- test/test_ctmapcube.py | 30 +++++++++++++++--------------- test/test_ctmodel.py | 14 +++++++------- test/test_ctobssim.py | 22 +++++++++++----------- test/test_ctphase.py | 2 +- test/test_ctprob.py | 6 +++--- test/test_ctpsfcube.py | 29 +++++++++-------------------- test/test_ctselect.py | 77 ++++++++++++++++++++++++++++++++++++++--------------------------------------- test/test_ctulimit.py | 29 +++++++++++++++++------------ test/test_pipelines.py | 14 +++++++------- 28 files changed, 345 insertions(+), 219 deletions(-) create mode 100755 dev/make_test_data.py create mode 100755 test/data/crab_cntmap.fits delete mode 100755 test/data/crab_cntmap.fits.gz delete mode 100755 test/data/crab_cntmap_small.fits.gz create mode 100644 test/data/crab_events.fits delete mode 100755 test/data/crab_events.fits.gz diff --git a/cscripts/Makefile.am b/cscripts/Makefile.am index c152ab2..7a88492 100755 --- a/cscripts/Makefile.am +++ b/cscripts/Makefile.am @@ -162,9 +162,8 @@ testdata = $(top_srcdir)/test/data/crab.xml \ $(top_srcdir)/test/data/obs_unbinned.xml \ $(top_srcdir)/test/data/obs_stacked.xml \ $(top_srcdir)/test/data/obs_stacked_two.xml \ - $(top_srcdir)/test/data/crab_events.fits.gz \ - $(top_srcdir)/test/data/crab_cntmap.fits.gz \ - $(top_srcdir)/test/data/crab_cntmap_small.fits.gz \ + $(top_srcdir)/test/data/crab_events.fits \ + $(top_srcdir)/test/data/crab_cntmap.fits \ $(top_srcdir)/test/data/crab_expcube.fits.gz \ $(top_srcdir)/test/data/crab_psfcube.fits.gz \ $(top_srcdir)/test/data/crab_edispcube.fits.gz \ diff --git a/dev/make_test_data.py b/dev/make_test_data.py new file mode 100755 index 0000000..b8a38ea --- /dev/null +++ b/dev/make_test_data.py @@ -0,0 +1,87 @@ +#! /usr/bin/env python +# ========================================================================== +# Generates test data +# +# Copyright (C) 2018 Juergen Knoedlseder +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ========================================================================== +import gammalib +import ctools + + +# ================= # +# Create event list # +# ================= # +def create_event_list(): + """ + Create event list + """ + # Simulate events + sim = ctools.ctobssim() + sim['inmodel'] = 'test/data/crab.xml' + sim['outevents'] = 'test/data/crab_events.fits' + sim['caldb'] = 'prod2' + sim['irf'] = 'South_0.5h' + sim['edisp'] = False + sim['ra'] = 83.63 + sim['dec'] = 22.51 + sim['rad'] = 2.0 + sim['tmin'] = '2020-01-01T00:00:00' + sim['tmax'] = '2020-01-01T00:05:00' + sim['emin'] = 1.0 + sim['emax'] = 100.0 + sim.execute() + + # Return + return + + +# ================== # +# Create counts cube # +# ================== # +def create_count_cube(): + """ + Create counts cube + """ + # Allocate ctbin application and set parameters + bin = ctools.ctbin() + bin['inobs'] = 'test/data/crab_events.fits' + bin['outcube'] = 'test/data/crab_cntmap.fits' + bin['ebinalg'] = 'LOG' + bin['emin'] = 1.0 + bin['emax'] = 100.0 + bin['enumbins'] = 5 + bin['usepnt'] = True # Use pointing for map centre + bin['nxpix'] = 20 + bin['nypix'] = 20 + bin['binsz'] = 0.2 + bin['coordsys'] = 'CEL' + bin['proj'] = 'TAN' + bin.execute() + + # Return + return + + +# ======================== # +# Main routine entry point # +# ======================== # +if __name__ == '__main__': + + # Run tests + create_event_list() + create_count_cube() + diff --git a/pyext/Makefile.am b/pyext/Makefile.am index 434c721..546b175 100755 --- a/pyext/Makefile.am +++ b/pyext/Makefile.am @@ -64,8 +64,8 @@ testscripts = ctools/tests/__init__.py \ # Test data to be distributed in $(pyexecdir)/ctools/tests/data testdata = $(top_srcdir)/test/data/crab.xml \ - $(top_srcdir)/test/data/crab_events.fits.gz \ - $(top_srcdir)/test/data/crab_cntmap.fits.gz \ + $(top_srcdir)/test/data/crab_events.fits \ + $(top_srcdir)/test/data/crab_cntmap.fits \ $(top_srcdir)/test/data/phased_events.fits.gz \ $(top_srcdir)/test/data/invalid_event_list.fits.gz \ $(top_srcdir)/test/data/model_temporal_phasecurve.xml \ diff --git a/test/data/crab_cntmap.fits b/test/data/crab_cntmap.fits new file mode 100755 index 0000000..4433ee4 Binary files /dev/null and b/test/data/crab_cntmap.fits differ diff --git a/test/data/crab_cntmap.fits.gz b/test/data/crab_cntmap.fits.gz deleted file mode 100755 index 7b4ac37..0000000 Binary files a/test/data/crab_cntmap.fits.gz and /dev/null differ diff --git a/test/data/crab_cntmap_small.fits.gz b/test/data/crab_cntmap_small.fits.gz deleted file mode 100755 index 231accf..0000000 Binary files a/test/data/crab_cntmap_small.fits.gz and /dev/null differ diff --git a/test/data/crab_events.fits b/test/data/crab_events.fits new file mode 100644 index 0000000..123f676 --- /dev/null +++ b/test/data/crab_events.fits @@ -0,0 +1,28 @@ +SIMPLE = T / file does conform to FITS standard BITPIX = 8 / number of bits per data pixel NAXIS = 0 / number of data axes EXTEND = T / FITS dataset may contain extensions COMMENT FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H COMMENT FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H COMMENT FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H END XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 36 / width of table in bytes NAXIS2 = 253 / number of rows in table PCOUNT = 0 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 8 / number of fields in each row TTYPE1 = 'EVENT_ID' / label for field 1 TFORM1 = '1J ' / data format of field: 4-byte INTEGER TZERO1 = 2147483648 / offset for unsigned integers TSCAL1 = 1 / data are not scaled TTYPE2 = 'TIME ' / label for field 2 TFORM2 = '1D ' / data format of field: 8-byte DOUBLE TUNIT2 = 's ' / physical unit of field TTYPE3 = 'RA ' / label for field 3 TFORM3 = '1E ' / data format of field: 4-byte REAL TUNIT3 = 'deg ' / physical unit of field TTYPE4 = 'DEC ' / label for field 4 TFORM4 = '1E ' / data format of field: 4-byte REAL TUNIT4 = 'deg ' / physical unit of field TTYPE5 = 'ENERGY ' / label for field 5 TFORM5 = '1E ' / data format of field: 4-byte REAL TUNIT5 = 'TeV ' / physical unit of field TTYPE6 = 'DETX ' / label for field 6 TFORM6 = '1E ' / data format of field: 4-byte REAL TUNIT6 = 'deg ' / physical unit of field TTYPE7 = 'DETY ' / label for field 7 TFORM7 = '1E ' / data format of field: 4-byte REAL TUNIT7 = 'deg ' / physical unit of field TTYPE8 = 'MC_ID ' / label for field 8 TFORM8 = '1J ' / data format of field: 4-byte INTEGER EXTNAME = 'EVENTS ' / name of this extension DSTYP1 = 'TIME ' / Data sub-space type DSUNI1 = 's ' / Data sub-space unit DSVAL1 = 'TABLE ' / Data sub-space value DSREF1 = ':GTI ' / Data sub-space reference DSTYP2 = 'ENERGY ' / Data sub-space type DSUNI2 = 'TeV ' / Data sub-space unit DSVAL2 = '1:100 ' / Data sub-space value DSTYP3 = 'POS(RA,DEC)' / Data sub-space type DSUNI3 = 'deg ' / Data sub-space unit DSVAL3 = 'CIRCLE(83.63,22.51,2)' / Data sub-space value NDSKEYS = 3 / Number of data sub-space keys NMCIDS = 2 / Number of Monte Carlo identifiers MID00001= 1 / Monte Carlo identifier for model 1 MMN00001= 'Crab ' / Name of model 1 MID00002= 2 / Monte Carlo identifier for model 2 MMN00002= 'Background' / Name of model 2 CREATOR = 'GammaLib' / Program which created the file TELESCOP= 'CTA ' / Telescope OBS_ID = '000001 ' / Observation identifier DATE-OBS= '2020-01-01' / Observation start date TIME-OBS= '00:00:00' / Observation start time DATE-END= '2020-01-01' / Observation end date TIME-END= '00:05:00' / Observation end time TSTART = 6.3110886918E+08 / [s] Mission time of start of observation TSTOP = 6.3110916918E+08 / [s] Mission time of end of observation MJDREFI = 51544 / [days] Integer part of time reference MJD MJDREFF = 5.0000000000E-01 / [days] Fractional part of time reference MJD TIMEUNIT= 's ' / Time unit TIMESYS = 'TT ' / Time system TIMEREF = 'LOCAL ' / Time reference TELAPSE = 2.9999999970E+02 / [s] Mission elapsed time ONTIME = 2.9999999970E+02 / [s] Total good time including deadtime LIVETIME= 2.9399999971E+02 / [s] Total livetime DEADC = 9.8000000000E-01 / Deadtime correction factor TIMEDEL = 1.0000000000E+00 / Time resolution OBJECT = ' ' / Observed object RA_OBJ = 0.0000000000E+00 / [deg] Target Right Ascension DEC_OBJ = 0.0000000000E+00 / [deg] Target Declination RA_PNT = 8.3630000000E+01 / [deg] Pointing Right Ascension DEC_PNT = 2.2510000000E+01 / [deg] Pointing Declination ALT_PNT = 9.0000000000E+01 / [deg] Average altitude of pointing AZ_PNT = 0.0000000000E+00 / [deg] Average azimuth of pointing RADECSYS= 'FK5 ' / Coordinate system EQUINOX = 2.0000000000E+03 / Epoch CONV_DEP= 0.0000000000E+00 / Convergence depth of telescopes CONV_RA = 0.0000000000E+00 / [deg] Convergence Right Ascension CONV_DEC= 0.0000000000E+00 / [deg] Convergence Declination OBSERVER= 'string ' / Observer N_TELS = 0 / Number of telescopes in event list TELLIST = 'string ' / Telescope IDs GEOLAT = 0.0000000000E+00 / [deg] Geographic latitude of array centre GEOLON = 0.0000000000E+00 / [deg] Geographic longitude of array centre ALTITUDE= 0.0000000000E+00 / [km] Altitude of array centre EUNIT = 'TeV ' / Energy unit EVTVER = 'draft1 ' / Event list version number END €AÂÎúˆvä|B§4¦A°= ?½>‡¾õÛ±¼ÎTÛ€AÂÎú™¥þB§R%A¯ã·?¢z€AÂÎú <°B§Q‘A°?ÂÊ(¾ÿ]<ÞŸL€AÂÎú¡7ªšB§eˆA°0^?·o¾ùP=�®â€AÂÎú¡ä ½B§S=A°6�?– ,¾÷w<÷e|€AÂÎú«_eóB§ 4A°%V?ƒá¾ûÇN½~ЀAÂÎú­¸¸B§Q…A¯ï®?ÂRÜ¿™f<ÝóE€AÂÎú¶Ê B§/ÉA°_?©øb¿ã0½ E„€ AÂÎú¸"þ´B§:}A¯ë°?‚¿[¼oŽ€ +AÂÎú¾ÞÁNB§èA°W�?¢Hm¾ï9†½€|€ AÂÎúÆÿ£€B§E~A°(€?”©î¾úþ�;­ùŽ€ AÂÎú̸�$B§VpA°XÀ?œ¦¾îî#=b'€ AÂÎúÎZÚB§"ñA¯Ø¹?�Ϻ¿wy½j�'€AÂÎúÎÜü9B§¡A°?�¥Ù¾ÿ›¯½Œ©ë€AÂÎúÏø™DB¦ü A°3Œ?ŽO¾ø4¾½Þ€AÂÎúæì‚`B§O8A¯ì:?” Ë¿õ<»Ç§€AÂÎúëWÐB§O¹A°E.?£þn¾óÒÿ<Ã93€AÂÎúìYƒB§5¥A°Vq?©rR¾ï‚@¼¿�€AÂÎúì@t6B§:ËA°?½à¥¿.¸¼fk8€AÂÎúî^GÌB§0(A¯Íy?­…¿ßü½‹Ì€AÂÎúóc¤lB§'ÅA°�?ºæf¾ý}g½F³à€AÂÎúõ_|TB§KCA°1‘?¢®Ì¾øºU<� [€AÂÎúõ˜SòB§?�A°Š?‰ñ‡¿Þ»²sÄ€AÂÎúÿä!B§=1A¯ß ?�=¿®2¼@S€AÂÎûîÓšB§I$A°|4?Äm¾æÃŒA¯Éá?óÌò¿ S4»îI;€%AÂÎú¦Å÷FB§0(A°yZ?æ0龿Çǽr[€&AÂÎú¨áÑ}B§4%A¯¼.?Îðn¿ €¼Õæ€'AÂÎú´€fˆB§>A° +?÷JÚ¿® ¼!­€(AÂÎú¸MïB§IDA°aH@a�¾ìÌ“B§FÅA¯ï?Ûva¿«w;ùÍå€/AÂÎúè +o”B§?A°(?@6j¾û»ÒÓ€0AÂÎúùž:ÎB§-WA¯®±?àÓJ¿ ¸ï½o2€1AÂÎû°«ãB§c…A°r(?áoo¾è’ý=t_%€2AÂÎûNônB§:¸A°}ù@ÞR¾å k¼h‚‚€3AÂÎûbdB§4fA°T$?ð…Q¾ðƒ¼Òö€4AÂÎû ÿ�ŒB§D*A°D3?êǾô;>ù€5AÂÎû Ò[«B§=ÊA°de@ :-¾ìp¼ ~÷€6AÂÎû$^;B§KäA°t·@ ¾çðõ<ŠZÊ€7AÂÎûóÔ8B§eÓA°0S?í™#¾ù=‚Ã'€8AÂÎúƒpÜþB§DhA°Qy@VÁ¾ðÀ–;[W€9AÂÎú‰˜¨B§EA°Ê@HÌu¾ÿl!;•þ€:AÂÎú”,¶B§=AÂÎú¥“´B§LƒA°t²@Z§¾çò<“”$€?AÂÎúªê’xB§EåA°Vž@H’A¯üüA@¯E¿ïÙ»ì°-€SAÂÎû½eâB§DA°WÍAWÙc¾ï+‡;3‰Y€TAÂÎûKäB§;®A¯ògA3[¿By¼L1߀UAÂÎú˜0ÙÍB§EvA°%ÛA¾ò1¾û§û;¬4¾€VAÂÎúÓÀ�HB§CwA¯Ì"AˆæC¿ *:Ö§¯€WAÂÎû\aÞB§MA°‡A‡·¿¾X<šòÍ€XAÂÎúÂýjB§JA°6±B?:d¾÷rY<\ØF€YAÂÎúø‡²hB§I–A°²B7’ÿ¿9B£ÏSA­»G?­K¿HÏÑ¿Í#ÀbAÂÎúŠ!ÍBªñØA®Ôí?îr¿%F7?Úßp€cAÂÎúŠä^B¦&FA§‚÷@8¡‚¿Èùd¿ÅÙ€dAÂÎúŒ¼`B¨ƒÝAºñÏ@ŽÉT?[úœ?zí€eAÂÎúŒ¡úB¨ÏvA©i0?›–5¿ªxt?9½€fAÂÎú�QÆ+B¦%’A¾Îù?ú £?«Ç~¿VX€gAÂÎú�œü{B¤ûEA¬¹Ù?¹+¿jOk¿‡˜k€hAÂÎú�ºnBªªÆA´þÔ@wh=üµI?ÉDÙ€iAÂÎú‘½ÍiB¨ÊYAà (?„ ÷?料?2tÈ€jAÂÎú‘¾ÞÇB¦ƒ§A»ñ@?œ?{­À¾¯(€kAÂÎú‘ÈžSB¦·¿AÀa5?‚ëJ?ÄÓ¾}��€lAÂÎú’Ê{¸B©ÈÝA¶´"?žuÖ>ªoð?”èk€mAÂÎú“ðpB¦‰A¤ó—@ Uh¿ñêY¿´:€nAÂÎú”! îB§wZA¹ržA|\?+Æ‹=Â4€oAÂÎú”~îB¨f^A¶%Í?½">„Ø?ˆÌ€pAÂÎú•¥ xBªÏßA¸¿É?ý?êS?Ñø€qAÂÎú–q,B¦ÏuA¶ïU?þ— >¶Êò¾Tâ€rAÂÎú– ‡\B¤¥A·À.?ˆ$>ïî¿¿€sAÂÎú—6;àB§%A´{÷@·6=O.½Ážë€tAÂÎú™±×9B¥Ï0A¨±Œ?�ö0¿µú:¿-E€uAÂÎúšm èB«uMAµâV?Šå\>tà/?÷Ìã€vAÂÎú›b«ÊB©'A¶«è@õˆ;>§96?[)C€wAÂÎúŸq¼B¦©‘Aá&?€šÞ?øÓÙ¾‹L4€xAÂÎú£(WáB«A±�h@µ’¼¾›6?ãmó€yAÂÎú¤ +S‰B§ÃïAªç@Crç¿’Ï¿>pü9€zAÂÎú¤(Ã;B¨ÕÓA¶3@‹y&>ˆ£Ó?9éa€{AÂÎú¦_A®B¤´7Aª=}@áIE¿œÌ"¿˜q1€|AÂÎú¦gˆõBªý…A®ás@ |¿#¤„?Ý’�€}AÂÎú©:SÛB¥I6A½ò?‰Z`?ž;á¿gMÞ€~AÂÎú©ó¯LB¤ž±Aµý7?“\a>yâ,¿›ÒQ€AÂÎú«@I«B¥A° +ã?ôﹿ6¿„í*€€AÂÎú­ük—B¤!A®Äg@>» ¿(¿¹þÔ€�AÂÎú®ZB¦2A¥éAŒs¿ð¿ ú€‚AÂÎú®<ѶB¤¦ªA¼Ñ ?øœš?Œv5¿™~€ƒAÂÎú¯–d…B¥f!A¯šP?Þgj¿–ò¿\ó€„AÂÎú±üº6B©éAÂ@£?€x¤?ãÿ?T�€…AÂÎú³M ™B©ý A°‚@¥ ¾üOì?¡ãÛ€†AÂÎú´7x`B©ƒ{A³NË?– ½½ªÀ?…UE€‡AÂÎú¶‘xäB¥áA«Ò*@¡×¶¿ƒ²-¿~Ö€ˆAÂÎú·#orB¦VïA¶;0@‹ +>Š*¾Ù?À‰AÂÎú·”Bª! A°¤Œ?ŒÅ¾Ø½Â?ª'€ŠAÂÎú¸Æ|bB¨çA´Í@~€»æ¥à?BD�€‹AÂÎú»ôÂB¥yœAºú±?Õ�ø?]hÒ¿Q¼ €ŒAÂÎú¼!èŒB§¥»A´…Å?»xÃ=c ¦>7(B€�AÂÎú¼yyÃB§vA¸Ö‹@¡2â?D½¼ €ŽAÂÎú¼á^B¦C[A§Š²@� ¿Èƒ¼¾î_ê€�AÂÎú½I%hB©ÊPA¼ƒB@É´Ð?‡�r?”p÷€�AÂÎú½›¯ˆB¤*¹A©Ê¿@îÓx¿£¬¿¸‹y€‘AÂÎú¾5hçB©ZA·ïÉ@èYÏ>ø-¢?Y�Ö€’AÂÎú¾UPBBª5KA¾ÜAMCß?­WE?¬“€“AÂÎú¾]1„B¦&A¦‹˜?Ö«õ¿ØoV¿öÀ€”AÂÎú¾vØ�BªåüA··œ@ΊZ>î_?ÖeÙ€•AÂÎú¿õB¦`ðA·ºð?Ž^ù>éì¾Ï½Ý€–AÂÎúÀ +^ÂBª~Aª(x@A-¿�º ?Àå�€—AÂÎúÀ-å�B¨#ùA¨{x?ð§Ç¿¹|À>Òa)€˜AÂÎúÁßjB¤6ÐA¸Ÿ¤@©?<¿³V&€™AÂÎúÁ@B¤PA³Œ/@&ν½u%e¿®Y€šAÂÎúÁ@VBª, A¸¬H@f”1?¨(?«s+€›AÂÎúÁTlB¥ØãA¯Ð?ž +R¿!ÐÜ¿'ÑN€œAÂÎúÂê(GBªÆˆAºrw?ˆJ8?N3Ó?΢Ѐ�AÂÎúÃDjöB¦T7A´�*AK!=Š*¾ÜÍ€žAÂÎúÃcЬB¤ÕA¸þ%@#è×?-z¿¹zV€ŸAÂÎúÄÀ‘ B¨vpA§Û?®›À¿ÐõØ?Ú$€ AÂÎúÆ|SÕB¤­üA¶¸?¬Ì¶>�±µ¿˜I€¡AÂÎúÉrZB§–6AÁÐL@ ?Û¿Ï>—΀¢AÂÎú͵º‰B§ÃâA©Ç?µOA¿°Ôß>qHJ€£AÂÎúÏñÿ—B¥¯ªAÀ¦i@«9>?É^¿7ïñ€¤AÂÎúÑ]PÿB¤p‰A±ºº?òšJ¾“Ml¿§¿€¥AÂÎúÒôB¨d½A­l?ú�å¿aaA?àæ€¦AÂÎúÒ«9B©½Aª_&?…„é¿›j?R2AÂÎúÒðM>B¤¾2A°£*?ô#ð¾ÙÕP¿•FÅ€¨AÂÎúÖ=ÖÖB¦2íA¼&È@ÿO?�Av¾ùAÂÎúÖ˜eB¥6 A¶·X?ª° +>ª_Å¿qmh€ªAÂÎúÖírB¥£½A³{Á@n¢v½”“½¿?¶€«AÂÎú×jÄžB©ØäA§Ô3?¡á¿Ã]?šŸ¢€¬AÂÎúØ"æþB¨bÚA½]•?üÆü?”±÷?€­AÂÎúØMÒB©lA¹v7?Ï¢˜?,á0?W ƒ€®AÂÎúÙ g‰BªŽ½A³á{@cÎW¼‡DŒ?ÂÿE€¯AÂÎúÙ •^B¨+jA¶¦ê?–Fº>¤ï™>֛倰AÂÎúÙÊ%†B©_A¹\2?…�?)œÕ?T¾µ€±AÂÎúÙË!¨B¨7FA¸m…@£²´? O–>á,6€²AÂÎúÚñ<ÆB£ƒ˜A¯}6?µŠÅ¿%Á¿ÞaÙ€³AÂÎúÝ‚{¸B¥Åг€µAÂÎúÞÑ(yB¤£ÁA½³¶@¼,w?š¢¥¿™�[€¶AÂÎúß ¦0B¦þÓA©¼î@I¿¥w½ü˜ò€·AÂÎúß2FcB§]@A·t?„Û¦>¿ÿ|=D¸û€¸AÂÎúß—îIB¨.A½i|@`¼?•e�>×¼€¹AÂÎúß�ÑXB¥r§AÀŸ™?�„‚?É¿SÌ€ºAÂÎúà°’ðB©XzA¹�²?ƒ*‘?0ê?ub“€»AÂÎúá—dªB¥ÍMA¦½@š­j¿àÖÆ¿.Œl€¼AÂÎúâ9²ÂB¨1–A¤€æ@æÏ¿ù#�>ßÖÛ€½AÂÎúâŒÅÿB¦�5A³Ù‘?ޝz¼è–¾¤ÌÞ€¾AÂÎúâ­–B§HÒA®Ùv?Š±Ì¿'`‘<9ã{€¿AÂÎúâä¦B¦m„A«üG?�.à¿�qÛ¾Æ;7€ÀAÂÎúãù?4B¥Û–A¥ÓŸ@è{=¿ãܱ¿'å€ÁAÂÎú䲌NB¦ªHA¼Z,?Ù¾@?„d ¾‹›ð€ÂAÂÎúä¿QçB¦HA§Ö2@_{¿ÃÄ5¿?€ÃAÂÎúå—ÄB¦ÿ-A²fm@¡C¾VøÚ½ùbº€ÄAÂÎúæ@žðB£°A±-B?²u¾´;¿Þô€ÅAÂÎúèéÎîB¥bÌA¶‹@"˜E>yOÄ¿]7~€ÆAÂÎúêãýB§oœA¹‰±@�ß?.¨P=¥¡Ü€ÇAÂÎú꜀÷B¤()A¯Ê?úfn¿iÙ¿¸,€ÈAÂÎúë̃B©UzA¨Ž@˜Ëž¿·ûÖ?w¼w€ÉAÂÎúì |B§uvA¶¥B?–r—>¤5µ=»¦P€ÊAÂÎúìQŽyB¨�GA¹3x@#Æ+?$5ï?lÔ€ËAÂÎúìÇ"=B¤©A¬ûA$ø¿~Üž¿šÊ?€ÌAÂÎúïA^iB¤ïáA­Ë�@.d ¿H!¿Š*€ÍAÂÎúñdíÈB¤­A´Þh?ʆö=Ô|¿˜©æ€ÎAÂÎúò±B§ +A¿ÖD@™¾?¼ѽÎPs€ÏAÂÎúò,†˜B©å A®^/@‚h‡¿5l1?œ‘±€ÐAÂÎúòdúFB§æA®A[?�{ÿ:a罿åU€ÑAÂÎúòÆÿíB¨ÛëA°ïP? ìí¾ÈHé?=ž<€ÒAÂÎúòØC¿B¥¯"A¸bG@(ª&? +7}¿9�_€ÓAÂÎúóHú’B¨ÔA¸Ý¢@lH?¡»?8¦"€ÔAÂÎúôï¾–B§§æA·ø…@*ÁÞ>ùw>:“R€ÕAÂÎúõ…± B¥ ¤AÁØ?¬œ©?ܶé¿�£€ÖAÂÎúõ†@üB¨Š=A¨ '?Œ"s¿À\B?÷ä€×AÂÎúõÆ!OB¥¨ÞA®y?‡‡¿Aÿ\¿>DÀØAÂÎúöaÍ·B§š¨A´& ?¡ÓÚ< ó´>"ÁŒ€ÙAÂÎúöhÌB¥ˆA­Æ?Œ°1¿I5r¿M‘‘€ÚAÂÎúöÃè�B¥úªA¦¾?’ð{¿à"Õ¿T%€ÛAÂÎú÷œTB¤V=A¬’?½i+¿}0 +¿® [€ÜAÂÎú÷ÚH B¨hA¼?¢Hy?†·n>±²€ÝAÂÎúù ‘B¨ÏA«ë\?œà¿‚U»?8~-€ÞAÂÎúùJÊ(B¥PA©V ?´›2¿«je¿…0€ßAÂÎúû‚`_B¤ßŠA¦ö·@ñ¿ÑM㿎À5€àAÂÎúýÕ\ãB¨½›A³éÖ@$ª§¼œ¹?/·€áAÂÎúþ-3ÄB©àA»®ô?´¤Ó?súó?Wº8€âAÂÎúÿX•æB¤§ãA®ÚP@N,S¿%ïü¿š°ˆ€ãAÂÎúÿ«¼B§âA¨“@,ª¿Á ú½êŽ€äAÂÎûZbB¦:ÍA«$A?ýÚ¿Žèü¾õ™ñ€åAÂÎûM'BB¥Â A¦�q?ë/¿ØøL¿3¼f€æAÂÎûú B§¬A´Ön@27:= ²=᫦€çAÂÎû {B§H A¨“AOü¿¸‚<#ãf€èAÂÎûo¢B¥®«A¯eä@ÖÇ�¿U�¿;Wö€éAÂÎûŇÚBªÕA©§ë?ËŒ>¿¦?¨•Ï€êAÂÎûKOB©eŸAªÁP?ÓÞ…¿”À-?~Ȥ€ëAÂÎûùB©­+A¶úã?‡eA>»éÿ?Ž}Ì€ìAÂÎûËhB§æÂAªz¹@å„Ï¿™‘Õ>˜ûõ€íAÂÎû +[èçB¥°0A±§„?í;šDX¿:Cˆ€îAÂÎû +Š×0B¨nïA¬ƒ?€@†¿qê0? ®j€ïAÂÎû +Æ2îB©JA¬_?†{¿qýè?X¾€ðAÂÎû +Þª¨B¦~ñA®¡dAk·Ú¿.Eq¾µ™€ñAÂÎû HÓTB¦üNAº +è?…E^?>Ѿ³€òAÂÎû uÂÖB¨û A¾à©?¥{ô?­ž?I³Ý€óAÂÎûB,ÜB§ÃáA¸]ï@/ßu? ;o>nY€ôAÂÎû_AìB¨»A°Dì@‹�¾óHó?C€õAÂÎû]Î^B«"JA²*§@z7¾i$?ån}€öAÂÎû8Æ +B¥ÒA¯tÍ?Äö¿ w¿~ú�€÷AÂÎûß«$B¥Ò1A¹ªC?ŒT?3"+¿)H½€øAÂÎûôB£°7AµÖ?Ñg->D¿Òü{€ùAÂÎû´¤BªÑA²çp?—¢¤¾3û?§q¾€úAÂÎû<ùB§Ô(A¸c€@„TÐ? ñ >…ùØ€ûAÂÎû`e¸B¨)éA¸±m?Žw3?ǹ>ÔÒþ€üAÂÎûo<�B¤Ç·AªPÁ@m³ë¿›¡p¿“ãÞ€ýAÂÎûô‹ÒB§ÊçA§·B@Ù»Þ¿ÅÌq>~ªzXTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 16 / width of table in bytes NAXIS2 = 1 / number of rows in table PCOUNT = 0 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 2 / number of fields in each row TTYPE1 = 'START ' / label for field 1 TFORM1 = '1D ' / data format of field: 8-byte DOUBLE TTYPE2 = 'STOP ' / label for field 2 TFORM2 = '1D ' / data format of field: 8-byte DOUBLE EXTNAME = 'GTI ' / name of this extension MJDREFI = 51544 / [days] Integer part of time reference MJD MJDREFF = 5.0000000000E-01 / [days] Fractional part of time reference MJD TIMEUNIT= 's ' / Time unit TIMESYS = 'TT ' / Time system TIMEREF = 'LOCAL ' / Time reference END AÂÎú‚—�NAÂÎû—�L \ No newline at end of file diff --git a/test/data/crab_events.fits.gz b/test/data/crab_events.fits.gz deleted file mode 100755 index e35b054..0000000 Binary files a/test/data/crab_events.fits.gz and /dev/null differ diff --git a/test/test_csobsinfo.py b/test/test_csobsinfo.py index 5391cec..5f31590 100755 --- a/test/test_csobsinfo.py +++ b/test/test_csobsinfo.py @@ -134,7 +134,7 @@ class Test(test): self.test_value(len(obsinfo.offsets()), 1, 'Test number of offsets') self.test_value(obsinfo.offsets()[0], 0.5, 'Test offset angle') self.test_value(obsinfo.ebounds().size(), 1, 'Test number of energy boundaries') - self.test_value(obsinfo.ebounds().emin().GeV(), 100.0, 'Test minimum energy') + self.test_value(obsinfo.ebounds().emin().TeV(), 1.0, 'Test minimum energy') self.test_value(obsinfo.ebounds().emax().TeV(), 100.0, 'Test maximum energy') # Return diff --git a/test/test_csresmap.py b/test/test_csresmap.py index 4b072eb..e6f2cf4 100755 --- a/test/test_csresmap.py +++ b/test/test_csresmap.py @@ -73,8 +73,8 @@ class Test(test): ' outmap="csresmap_cmd1.fits"'+ \ ' inmodel="'+self._model+'"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ - ' emin=0.1 emax=100.0 enumbins=20'+ \ - ' nxpix=50 nypix=50 binsz=0.02'+ \ + ' emin=1.0 emax=100.0 enumbins=5'+ \ + ' nxpix=20 nypix=20 binsz=0.2'+ \ ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ ' algorithm="SUBDIVSQRT"'+ \ ' logfile="csresmap_cmd1.log" chatter=1' @@ -91,8 +91,8 @@ class Test(test): ' outmap="csresmap_cmd1.fits"'+ \ ' inmodel="'+self._model+'"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ - ' emin=0.1 emax=100.0 enumbins=20'+ \ - ' nxpix=50 nypix=50 binsz=0.02'+ \ + ' emin=1.0 emax=100.0 enumbins=5'+ \ + ' nxpix=20 nypix=20 binsz=0.2'+ \ ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ ' algorithm="SUBDIVSQRT"'+ \ ' logfile="csresmap_cmd2.log" debug=yes chatter=2' @@ -119,12 +119,12 @@ class Test(test): resmap['inmodel'] = self._model resmap['caldb'] = self._caldb resmap['irf'] = self._irf - resmap['emin'] = 0.1 + resmap['emin'] = 1.0 resmap['emax'] = 100.0 - resmap['enumbins'] = 20 - resmap['nxpix'] = 50 - resmap['nypix'] = 50 - resmap['binsz'] = 0.02 + resmap['enumbins'] = 5 + resmap['nxpix'] = 20 + resmap['nypix'] = 20 + resmap['binsz'] = 0.2 resmap['coordsys'] = 'CEL' resmap['proj'] = 'CAR' resmap['xref'] = 83.63 @@ -162,7 +162,7 @@ class Test(test): resmap.execute() # Check pull distribution file - self._check_result_file('csresmap_py2.fits', nx=200, ny=200) + self._check_result_file('csresmap_py2.fits') # Run csresmap with SUBDIVSQRT algorithm resmap = cscripts.csresmap() @@ -185,7 +185,7 @@ class Test(test): resmap.execute() # Check pull distribution file - self._check_result_file('csresmap_py3.fits', nx=200, ny=200) + self._check_result_file('csresmap_py3.fits') # Run csresmap with SIGNIFICANCE algorithm resmap = cscripts.csresmap() @@ -208,14 +208,14 @@ class Test(test): resmap.execute() # Check pull distribution file - self._check_result_file('csresmap_py4.fits', nx=200, ny=200) + self._check_result_file('csresmap_py4.fits') # Return return # Check result file - def _check_result_file(self, filename, nx=50, ny=50): + def _check_result_file(self, filename, nx=20, ny=20): """ Check result file """ diff --git a/test/test_csresspec.py b/test/test_csresspec.py index 00d690e..a70bfd7 100755 --- a/test/test_csresspec.py +++ b/test/test_csresspec.py @@ -181,7 +181,7 @@ class Test(test): resspec.execute() # Check result file - self._check_result_file('csresspec_py3.fits', 20, 5) + self._check_result_file('csresspec_py3.fits', 5, 5) # Set-up csresspec for counts cube with source mask resspec = cscripts.csresspec() @@ -208,7 +208,7 @@ class Test(test): resspec.execute() # Check result file - self._check_result_file('csresspec_py4.fits', 20, 5) + self._check_result_file('csresspec_py4.fits', 5, 5) # Set-up csresspec for On/Off observations resspec = cscripts.csresspec() diff --git a/test/test_csspec.py b/test/test_csspec.py index 1126f52..3eb8e59 100755 --- a/test/test_csspec.py +++ b/test/test_csspec.py @@ -43,7 +43,6 @@ class Test(test): test.__init__(self) # Set members - self._inobs = self._datadir + '/crab_cntmap_small.fits' self._inonoff = self._datadir + '/onoff_obs.xml' self._expcube = self._datadir + '/crab_expcube.fits' self._psfcube = self._datadir + '/crab_psfcube.fits' @@ -146,7 +145,7 @@ class Test(test): # Set-up stacked csspec spec = cscripts.csspec() - spec['inobs'] = self._inobs + spec['inobs'] = self._cntcube spec['expcube'] = self._expcube spec['psfcube'] = self._psfcube spec['edispcube'] = self._edispcube diff --git a/test/test_ctbin.py b/test/test_ctbin.py index 55b3823..125ef94 100755 --- a/test/test_ctbin.py +++ b/test/test_ctbin.py @@ -72,7 +72,7 @@ class Test(test): # Setup ctbin command cmd = ctbin+' inobs="'+self._events+'"'+ \ ' outcube="cntmap_cmd1.fits"'+\ - ' emin=0.1 emax=100.0 enumbins=10 ebinalg="LOG"'+ \ + ' emin=1.0 emax=100.0 enumbins=10 ebinalg="LOG"'+ \ ' nxpix=40 nypix=40 binsz=0.1 coordsys="CEL"'+ \ ' xref=83.63 yref=22.01 proj="CAR"'+ \ ' logfile="ctbin_cmd1.log" chatter=1' @@ -83,12 +83,12 @@ class Test(test): # Load counts cube and check content. evt = gammalib.GCTAEventCube('cntmap_cmd1.fits') - self._check_cube(evt, 3105) + self._check_cube(evt, 245) # Setup ctbin command cmd = ctbin+' inobs="events_that_do_not_exist.fits"'+ \ ' outcube="cntmap_cmd2.fits"'+\ - ' emin=0.1 emax=100.0 enumbins=10 ebinalg="LOG"'+ \ + ' emin=1.0 emax=100.0 enumbins=10 ebinalg="LOG"'+ \ ' nxpix=40 nypix=40 binsz=0.1 coordsys="CEL"'+ \ ' xref=83.63 yref=22.01 proj="CAR"'+ \ ' logfile="ctbin_cmd2.log" debug=yes chatter=1' @@ -100,7 +100,7 @@ class Test(test): # Setup ctbin command with different ebounds than input cmd = ctbin+' inobs="'+self._events+'"'+ \ ' outcube="cntmap_cmd3.fits"'+\ - ' emin=0.5 emax=20.0 enumbins=10 ebinalg="LOG"'+ \ + ' emin=2.0 emax=20.0 enumbins=10 ebinalg="LOG"'+ \ ' nxpix=40 nypix=40 binsz=0.1 coordsys="CEL"'+ \ ' xref=83.63 yref=22.01 proj="CAR"'+ \ ' logfile="ctbin_cmd3.log" chatter=3' @@ -111,7 +111,7 @@ class Test(test): # Load counts cube and check content. evt = gammalib.GCTAEventCube('cntmap_cmd3.fits') - self._check_cube(evt, 617) + self._check_cube(evt, 115) # Check ctbin --help self._check_help(ctbin) @@ -152,7 +152,7 @@ class Test(test): binning['inobs'] = self._events binning['outcube'] = 'ctbin_py1.fits' binning['ebinalg'] = 'LOG' - binning['emin'] = 0.1 + binning['emin'] = 1.0 binning['emax'] = 100.0 binning['enumbins'] = 10 binning['nxpix'] = 40 @@ -170,15 +170,15 @@ class Test(test): binning.run() # Check content of observation container and counts cube - self._check_observation(binning, 3105) - self._check_cube(binning.cube(), 3105) + self._check_observation(binning, 245) + self._check_cube(binning.cube(), 245) # Copy ctbin tool cpy_bin = binning.copy() # Check content of observation container and counts cube - self._check_observation(cpy_bin, 3105) - self._check_cube(cpy_bin.cube(), 3105) + self._check_observation(cpy_bin, 245) + self._check_cube(cpy_bin.cube(), 245) # Run copy of ctbin tool again cpy_bin['logfile'] = 'ctbin_py2.log' @@ -197,7 +197,7 @@ class Test(test): # Load counts cube and check content evt = gammalib.GCTAEventCube('ctbin_py1.fits') - self._check_cube(evt, 3105) + self._check_cube(evt, 245) # Now clear ctbin tool binning.clear() @@ -217,7 +217,7 @@ class Test(test): binning = ctools.ctbin(obs) binning['outcube'] = 'ctbin_py3.fits' binning['ebinalg'] = 'LOG' - binning['emin'] = 0.1 + binning['emin'] = 1.0 binning['emax'] = 100.0 binning['enumbins'] = 10 binning['nxpix'] = 40 @@ -237,16 +237,16 @@ class Test(test): # Check content of observation and cube (need multiplier=3 since # three identical observations have been appended) - self._check_observation(binning, 3105, multiplier=3) - self._check_cube(binning.cube(), 3105, multiplier=3) + self._check_observation(binning, 245, multiplier=3) + self._check_cube(binning.cube(), 245, multiplier=3) # Load counts cube and check content. evt = gammalib.GCTAEventCube('ctbin_py3.fits') - self._check_cube(evt, 3105, multiplier=3) + self._check_cube(evt, 245, multiplier=3) # And finally go for a fully Pythonic version with all parameters # being specified in a dictionary - pars = {'inobs': self._events, 'ebinalg': 'LIN', 'emin': 0.1, + pars = {'inobs': self._events, 'ebinalg': 'LIN', 'emin': 1.0, 'emax': 100.0, 'enumbins': 10, 'nxpix': 40, 'nypix': 40, 'binsz': 0.1, 'coordsys': 'CEL', 'proj': 'CAR', 'xref': 83.63, 'yref': 22.01, 'outcube': 'ctbin_py4.fits', @@ -258,7 +258,7 @@ class Test(test): # Load counts cube and check content evt = gammalib.GCTAEventCube('ctbin_py4.fits') - self._check_cube(evt, 3105) + self._check_cube(evt, 245) # Return return diff --git a/test/test_ctbkgcube.py b/test/test_ctbkgcube.py index 55b3de7..541a1bb 100755 --- a/test/test_ctbkgcube.py +++ b/test/test_ctbkgcube.py @@ -72,7 +72,7 @@ class Test(test): ' outcube="ctbkgcube_cmd1.fits"'+ \ ' outmodel="ctbkgcube_cmd1.xml"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \ + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \ ' nxpix=10 nypix=10 binsz=0.4'+ \ ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ ' logfile="ctbkgcube_cmd1.log" chatter=1' @@ -91,7 +91,7 @@ class Test(test): ' outcube="ctbkgcube_cmd2.fits"'+ \ ' outmodel="ctbkgcube_cmd2.xml"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \ + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \ ' nxpix=10 nypix=10 binsz=0.4'+ \ ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ ' logfile="ctbkgcube_cmd2.log" debug=yes chatter=1' @@ -158,9 +158,9 @@ class Test(test): bkgcube['caldb'] = self._caldb bkgcube['irf'] = self._irf bkgcube['ebinalg'] = 'LOG' - bkgcube['emin'] = 0.1 + bkgcube['emin'] = 1.0 bkgcube['emax'] = 100.0 - bkgcube['enumbins'] = 20 + bkgcube['enumbins'] = 5 bkgcube['nxpix'] = 10 bkgcube['nypix'] = 10 bkgcube['binsz'] = 0.4 @@ -224,7 +224,7 @@ class Test(test): bkgcube['ebinalg'] = 'LOG' bkgcube['emin'] = 0.2 bkgcube['emax'] = 150.0 - bkgcube['enumbins'] = 20 + bkgcube['enumbins'] = 5 bkgcube['nxpix'] = 10 bkgcube['nypix'] = 10 bkgcube['binsz'] = 0.4 @@ -243,13 +243,13 @@ class Test(test): bkgcube.execute() # Check result files - self._check_result_files('ctbkgcube_py5', nenergies=23) + self._check_result_files('ctbkgcube_py5', nenergies=8) # Return return # Check result files - def _check_result_files(self, filename, nenergies=21, nmodels=2): + def _check_result_files(self, filename, nenergies=6, nmodels=2): """ Check result file @@ -276,7 +276,7 @@ class Test(test): return # Check background cube - def _check_cube(self, cube, nenergies=21): + def _check_cube(self, cube, nenergies=6): """ Check background cube diff --git a/test/test_ctcubemask.py b/test/test_ctcubemask.py index 51d0dad..2a24581 100755 --- a/test/test_ctcubemask.py +++ b/test/test_ctcubemask.py @@ -72,8 +72,8 @@ class Test(test): cmd = ctcubemask+' inobs="'+self._cntcube+'"'+ \ ' regfile="'+self._exclusion+'"'+ \ ' outcube="ctcubemask_cmd1.fits"'+ \ - ' ra=83.63 dec=22.01 rad=2.0'+ \ - ' emin=0.1 emax=100.0'+ \ + ' ra=83.63 dec=22.01 rad=1.0'+ \ + ' emin=1.0 emax=100.0'+ \ ' logfile="ctcubemask_cmd1.log" chatter=1' # Check if execution was successful @@ -87,8 +87,8 @@ class Test(test): cmd = ctcubemask+' inobs="counts_cube_that_does_not_exist.fits"'+ \ ' regfile="'+self._exclusion+'"'+ \ ' outcube="ctcubemask_cmd2.fits"'+ \ - ' ra=83.63 dec=22.01 rad=2.0'+ \ - ' emin=0.1 emax=100.0'+ \ + ' ra=83.63 dec=22.01 rad=1.0'+ \ + ' emin=1.0 emax=100.0'+ \ ' logfile="ctcubemask_cmd2.log" debug=yes chatter=2' # Check if execution failed @@ -128,8 +128,8 @@ class Test(test): mask['regfile'] = self._exclusion mask['ra'] = 83.63 mask['dec'] = 22.01 - mask['rad'] = 2.0 - mask['emin'] = 0.1 + mask['rad'] = 1.0 + mask['emin'] = 1.0 mask['emax'] = 100.0 mask['outcube'] = 'ctcubemask_py1.fits' mask['logfile'] = 'ctcubemask_py1.log' @@ -151,8 +151,8 @@ class Test(test): mask['ra'] = 83.63 mask['dec'] = 22.01 mask['rad'] = 3.0 - mask['emin'] = 1.0 - mask['emax'] = 100.0 + mask['emin'] = 2.0 + mask['emax'] = 10.0 mask['outcube'] = 'ctcubemask_py2.fits' mask['logfile'] = 'ctcubemask_py2.log' mask['chatter'] = 3 @@ -163,7 +163,7 @@ class Test(test): mask.execute() # Check result file - self._check_result_file('ctcubemask_py2.fits', events=573) + self._check_result_file('ctcubemask_py2.fits', events=65) # Copy ctcubemask tool cpy_mask = mask.copy() @@ -179,7 +179,7 @@ class Test(test): cpy_mask.execute() # Check result file - self._check_result_file('ctcubemask_py3.fits', events=573) + self._check_result_file('ctcubemask_py3.fits', events=65) # Clear ctcubemask tool cpy_mask.clear() @@ -197,7 +197,7 @@ class Test(test): mask['regfile'] = 'NONE' mask['ra'] = 83.63 mask['dec'] = 22.01 - mask['rad'] = 3.0 + mask['rad'] = 1.0 mask['emin'] = 'NONE' mask['emax'] = 'NONE' mask['outcube'] = 'ctcubemask_py4.xml' @@ -209,13 +209,13 @@ class Test(test): mask.execute() # Check result file - self._check_result_file('filtered_crab_cntmap.fits', events=5542) + self._check_result_file('filtered_crab_cntmap.fits', events=132) # Return return # Check result file - def _check_result_file(self, filename, events=4921): + def _check_result_file(self, filename, events=126): """ Check result file """ @@ -223,7 +223,7 @@ class Test(test): cube = gammalib.GCTAEventCube(filename) # Check counts cube - self.test_value(cube.size(), 800000, 'Check for number of cube bins') + self.test_value(cube.size(), 2000, 'Check for number of cube bins') self.test_value(cube.number(), events, 'Check for number of events') # Return diff --git a/test/test_ctedispcube.py b/test/test_ctedispcube.py index 59bde83..b1ee390 100755 --- a/test/test_ctedispcube.py +++ b/test/test_ctedispcube.py @@ -70,7 +70,7 @@ class Test(test): ' incube="NONE"'+ \ ' outcube="ctedispcube_cmd1.fits"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \ + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \ ' nxpix=10 nypix=10 binsz=0.4'+ \ ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ ' migramax=2.0 migrabins=10'+ \ @@ -88,7 +88,7 @@ class Test(test): ' incube="NONE"'+ \ ' outcube="ctedispcube_cmd2.fits"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \ + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \ ' nxpix=10 nypix=10 binsz=0.4'+ \ ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ ' migramax=2.0 migrabins=10'+ \ @@ -133,9 +133,9 @@ class Test(test): edispcube['caldb'] = self._caldb edispcube['irf'] = self._irf edispcube['ebinalg'] = 'LOG' - edispcube['emin'] = 0.1 + edispcube['emin'] = 1.0 edispcube['emax'] = 100.0 - edispcube['enumbins'] = 20 + edispcube['enumbins'] = 5 edispcube['nxpix'] = 10 edispcube['nypix'] = 10 edispcube['binsz'] = 0.4 @@ -175,7 +175,7 @@ class Test(test): cpy_edispcube.execute() # Check result file - self._check_result_file('ctedispcube_py2.fits', nenergies=23) + self._check_result_file('ctedispcube_py2.fits', nenergies=8) # Now clear copy of ctedispcube tool cpy_edispcube.clear() @@ -193,9 +193,9 @@ class Test(test): edispcube['caldb'] = self._caldb edispcube['irf'] = self._irf edispcube['ebinalg'] = 'LOG' - edispcube['emin'] = 0.1 + edispcube['emin'] = 1.0 edispcube['emax'] = 100.0 - edispcube['enumbins'] = 20 + edispcube['enumbins'] = 5 edispcube['nxpix'] = 10 edispcube['nypix'] = 10 edispcube['binsz'] = 0.4 @@ -221,7 +221,7 @@ class Test(test): return # Check result file - def _check_result_file(self, filename, nenergies=21): + def _check_result_file(self, filename, nenergies=6): """ Check result file @@ -242,7 +242,7 @@ class Test(test): return # Check energy dispersion cube - def _check_cube(self, cube, nenergies=21, nmigras=10): + def _check_cube(self, cube, nenergies=6, nmigras=10): """ Check energy dispersion cube diff --git a/test/test_cterror.py b/test/test_cterror.py index 8e03ba1..ac3e9ac 100755 --- a/test/test_cterror.py +++ b/test/test_cterror.py @@ -257,31 +257,41 @@ class Test(test): # Check number of models self.test_value(models.size(), nmodels, 'Check number of models') + # Set reference values + prefactor = 3.65452317573063e-16 + prefactor_error = 1.12697923756417e-16 + index = 2.39356360626209 + index_error = 0.131093571504494 + pre_background = 1.01409721534593 + pre_background_error = 0.122650321517162 + index_background = 0.0436264224948547 + index_background_error = 0.110703165254809 + # If there are models in the container then check them if nmodels > 0: self.test_value(models['Crab']['Prefactor'].value(), - 5.6530206356786e-16, 1.0e-4 * 5.6530206356786e-16, + prefactor, 1.0e-4 * prefactor, 'Check fitted Crab Prefactor') self.test_value(models['Crab']['Prefactor'].error(), - 2.45970361827369e-17, 1.0e-3 * 2.45970361827369e-17, + prefactor_error, 1.0e-3 * prefactor_error, 'Check Crab Prefactor error') self.test_value(models['Crab']['Index'].value(), - -2.45716228083265, 1.0e-4 * 2.45716228083265, + -index, 1.0e-4 * index, 'Check fitted Crab Index') self.test_value(models['Crab']['Index'].error(), - 0.0366617454398694, 1.0e-3 * 0.0366617454398694, + index_error, 1.0e-3 * index_error, 'Check Crab Index error') self.test_value(models['Background']['Prefactor'].value(), - 1.01525433446138, 1.0e-4 * 1.01525433446138, + pre_background, 1.0e-4 * pre_background, 'Check fitted background Prefactor') self.test_value(models['Background']['Prefactor'].error(), - 0.0334412516391298, 1.0e-4 * 0.0334412516391298, + pre_background_error, 1.0e-4 * pre_background_error, 'Check background Prefactor error') self.test_value(models['Background']['Index'].value(), - -0.005132848897274, 1.0e-3 * 0.005132848897274, + index_background, 1.0e-3 * index_background, 'Check fitted background Index') self.test_value(models['Background']['Index'].error(), - 0.0200624490548333, 1.0e-4 * 0.0200624490548333, + index_background_error, 1.0e-4 * index_background_error, 'Check background Index error') # Return diff --git a/test/test_ctexpcube.py b/test/test_ctexpcube.py index 79544a3..ef62d06 100755 --- a/test/test_ctexpcube.py +++ b/test/test_ctexpcube.py @@ -70,8 +70,8 @@ class Test(test): ' incube="NONE"'+ \ ' outcube="ctexpcube_cmd1.fits"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \ - ' nxpix=200 nypix=200 binsz=0.02'+ \ + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \ + ' nxpix=20 nypix=20 binsz=0.2'+ \ ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ ' logfile="ctexpcube_cmd1.log" chatter=1' @@ -87,8 +87,8 @@ class Test(test): ' incube="NONE"'+ \ ' outcube="ctexpcube_cmd2.fits"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \ - ' nxpix=200 nypix=200 binsz=0.02'+ \ + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \ + ' nxpix=20 nypix=20 binsz=0.2'+ \ ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ ' logfile="ctexpcube_cmd2.log" debug=yes chatter=1' @@ -131,12 +131,12 @@ class Test(test): expcube['caldb'] = self._caldb expcube['irf'] = self._irf expcube['ebinalg'] = 'LOG' - expcube['emin'] = 0.1 + expcube['emin'] = 1.0 expcube['emax'] = 100.0 - expcube['enumbins'] = 20 - expcube['nxpix'] = 200 - expcube['nypix'] = 200 - expcube['binsz'] = 0.02 + expcube['enumbins'] = 5 + expcube['nxpix'] = 20 + expcube['nypix'] = 20 + expcube['binsz'] = 0.2 expcube['coordsys'] = 'CEL' expcube['proj'] = 'CAR' expcube['xref'] = 83.63 @@ -172,7 +172,7 @@ class Test(test): cpy_expcube.execute() # Check result file - self._check_result_file('ctexpcube_py2.fits', nenergies=23) + self._check_result_file('ctexpcube_py2.fits', nenergies=8) # Now clear copy of ctexpcube tool cpy_expcube.clear() @@ -189,12 +189,12 @@ class Test(test): expcube['caldb'] = self._caldb expcube['irf'] = self._irf expcube['ebinalg'] = 'LOG' - expcube['emin'] = 0.1 + expcube['emin'] = 1.0 expcube['emax'] = 100.0 - expcube['enumbins'] = 20 - expcube['nxpix'] = 200 - expcube['nypix'] = 200 - expcube['binsz'] = 0.02 + expcube['enumbins'] = 5 + expcube['nxpix'] = 20 + expcube['nypix'] = 20 + expcube['binsz'] = 0.2 expcube['coordsys'] = 'CEL' expcube['proj'] = 'CAR' expcube['xref'] = 83.63 @@ -214,7 +214,7 @@ class Test(test): return # Check result file - def _check_result_file(self, filename, nenergies=21): + def _check_result_file(self, filename, nenergies=6): """ Check result file @@ -235,7 +235,7 @@ class Test(test): return # Check exposure cube - def _check_cube(self, cube, nenergies=21): + def _check_cube(self, cube, nenergies=6): """ Check exposure cube diff --git a/test/test_ctlike.py b/test/test_ctlike.py index 9270532..560c82a 100755 --- a/test/test_ctlike.py +++ b/test/test_ctlike.py @@ -247,31 +247,41 @@ class Test(test): # Check number of models self.test_value(models.size(), nmodels, 'Check number of models') + # Set reference values + prefactor = 3.65452317573063e-16 + prefactor_error = 1.07582291031224e-16 + index = 2.39356360626209 + index_error = 0.126492171703747 + pre_background = 1.01409721534593 + pre_background_error = 0.122650321517162 + index_background = 0.0436264224948547 + index_background_error = 0.110703165254809 + # If there are models in the container then check them if nmodels > 0: self.test_value(models['Crab']['Prefactor'].value(), - 5.6530206356786e-16, 1.0e-4 * 5.6530206356786e-16, + prefactor, 1.0e-4 * prefactor, 'Check fitted Crab Prefactor') self.test_value(models['Crab']['Prefactor'].error(), - 2.48304276536022e-17, 1.0e-4 * 2.48304276536022e-17, + prefactor_error, 1.0e-4 * prefactor_error, 'Check Crab Prefactor error') self.test_value(models['Crab']['Index'].value(), - -2.45716228083265, 1.0e-4 * 2.45716228083265, + -index, 1.0e-4 * index, 'Check fitted Crab Index') self.test_value(models['Crab']['Index'].error(), - 0.0386777873333435, 1.0e-4 * 0.0386777873333435, + index_error, 1.0e-4 * index_error, 'Check Crab Index error') self.test_value(models['Background']['Prefactor'].value(), - 1.01525433446138, 1.0e-4 * 1.01525433446138, + pre_background, 1.0e-4 * pre_background, 'Check fitted background Prefactor') self.test_value(models['Background']['Prefactor'].error(), - 0.0334412516391298, 1.0e-4 * 0.0334412516391298, + pre_background_error, 1.0e-4 * pre_background_error, 'Check background Prefactor error') self.test_value(models['Background']['Index'].value(), - -0.005132848897274, 1.0e-3 * 0.005132848897274, + index_background, 1.0e-3 * index_background, 'Check fitted background Index') self.test_value(models['Background']['Index'].error(), - 0.0200624490548333, 1.0e-4 * 0.0200624490548333, + index_background_error, 1.0e-4 * index_background_error, 'Check background Index error') # Return diff --git a/test/test_ctmapcube.py b/test/test_ctmapcube.py index b1dc791..720953b 100755 --- a/test/test_ctmapcube.py +++ b/test/test_ctmapcube.py @@ -72,8 +72,8 @@ class Test(test): # Setup ctmapcube command cmd = ctmapcube+' inmodel="'+self._model+'"'+ \ ' outcube="ctmapcube_cmd1.fits"'+\ - ' emin=0.1 emax=100.0 enumbins=10 ebinalg=LOG'+ \ - ' nxpix=100 nypix=100 binsz=0.04 coordsys=CEL'+ \ + ' emin=1.0 emax=100.0 enumbins=5 ebinalg=LOG'+ \ + ' nxpix=20 nypix=20 binsz=0.2 coordsys=CEL'+ \ ' xref=83.63 yref=22.01 proj=CAR'+ \ ' logfile="ctmapcube_cmd1.log" chatter=1' @@ -87,8 +87,8 @@ class Test(test): # Setup ctmapcube command cmd = ctmapcube+' inmodel="events_that_do_not_exist.fits"'+ \ ' outcube="ctmapcube_cmd2.fits"'+\ - ' emin=0.1 emax=100.0 enumbins=10 ebinalg=LOG'+ \ - ' nxpix=100 nypix=100 binsz=0.04 coordsys=CEL'+ \ + ' emin=1.0 emax=100.0 enumbins=5 ebinalg=LOG'+ \ + ' nxpix=20 nypix=20 binsz=0.2 coordsys=CEL'+ \ ' xref=83.63 yref=22.01 proj=CAR'+ \ ' logfile="ctmapcube_cmd2.log" debug=yes ' @@ -128,12 +128,12 @@ class Test(test): # Now set ctmapcube parameters mapcube['inmodel'] = self._model mapcube['ebinalg'] = 'LOG' - mapcube['emin'] = 0.1 + mapcube['emin'] = 1.0 mapcube['emax'] = 100.0 - mapcube['enumbins'] = 10 - mapcube['nxpix'] = 100 - mapcube['nypix'] = 100 - mapcube['binsz'] = 0.04 + mapcube['enumbins'] = 5 + mapcube['nxpix'] = 20 + mapcube['nypix'] = 20 + mapcube['binsz'] = 0.2 mapcube['coordsys'] = 'CEL' mapcube['proj'] = 'CAR' mapcube['xref'] = 83.63 @@ -181,12 +181,12 @@ class Test(test): mapcube = ctools.ctmapcube() mapcube.models(gammalib.GModels(self._model)) mapcube['ebinalg'] = 'LIN' - mapcube['emin'] = 0.1 + mapcube['emin'] = 1.0 mapcube['emax'] = 100.0 - mapcube['enumbins'] = 10 - mapcube['nxpix'] = 100 - mapcube['nypix'] = 100 - mapcube['binsz'] = 0.04 + mapcube['enumbins'] = 5 + mapcube['nxpix'] = 20 + mapcube['nypix'] = 20 + mapcube['binsz'] = 0.2 mapcube['coordsys'] = 'CEL' mapcube['proj'] = 'CAR' mapcube['xref'] = 83.63 @@ -229,7 +229,7 @@ class Test(test): return # Check map cube - def _check_cube(self, cube, nmaps=11, npixels=10000): + def _check_cube(self, cube, nmaps=6, npixels=400): """ Check map cube diff --git a/test/test_ctmodel.py b/test/test_ctmodel.py index 8105064..673138a 100755 --- a/test/test_ctmodel.py +++ b/test/test_ctmodel.py @@ -72,7 +72,7 @@ class Test(test): ' inmodel="'+self._model+'"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ ' rad=5.0 ra=83.63 dec=22.01 tmin=0.0 tmax=1800'+ \ - ' emin=0.1 emax=100.0 enumbins=10 ebinalg="LOG"'+ \ + ' emin=1.0 emax=100.0 enumbins=5 ebinalg="LOG"'+ \ ' nxpix=40 nypix=40'+ \ ' binsz=0.1 coordsys="CEL" proj="CAR"'+ \ ' xref=83.63 yref=22.01'+ \ @@ -92,7 +92,7 @@ class Test(test): ' inmodel="model_that_does_not_exist.xml"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ ' rad=5.0 ra=83.63 dec=22.01 tmin=0.0 tmax=1800'+ \ - ' emin=0.1 emax=100.0 enumbins=10 ebinalg="LOG"'+ \ + ' emin=1.0 emax=100.0 enumbins=5 ebinalg="LOG"'+ \ ' nxpix=40 nypix=40'+ \ ' binsz=0.1 coordsys="CEL" proj="CAR"'+ \ ' xref=83.63 yref=22.01'+ \ @@ -145,9 +145,9 @@ class Test(test): model['tmin'] = 0 model['tmax'] = 1800 model['ebinalg'] = 'LOG' - model['emin'] = 0.1 + model['emin'] = 1.0 model['emax'] = 100.0 - model['enumbins'] = 10 + model['enumbins'] = 5 model['nxpix'] = 40 model['nypix'] = 40 model['binsz'] = 0.1 @@ -213,7 +213,7 @@ class Test(test): model.execute() # Check result file - self._check_result_file('ctmodel_py3.fits', nx=200, ny=200, nebins=20) + self._check_result_file('ctmodel_py3.fits', nx=20, ny=20, nebins=5) # Publish with name model.publish('My model') @@ -222,7 +222,7 @@ class Test(test): return # Check result file - def _check_result_file(self, filename, nx=40, ny=40, nebins=10): + def _check_result_file(self, filename, nx=40, ny=40, nebins=5): """ Check result file @@ -247,7 +247,7 @@ class Test(test): return # Check model cube - def _check_cube(self, cube, nx=40, ny=40, nebins=10): + def _check_cube(self, cube, nx=40, ny=40, nebins=5): """ Check model cube diff --git a/test/test_ctobssim.py b/test/test_ctobssim.py index 12e4cbf..7232a0e 100755 --- a/test/test_ctobssim.py +++ b/test/test_ctobssim.py @@ -74,10 +74,10 @@ class Test(test): cmd = ctobssim+' inmodel="'+self._model+'" '+ \ ' outevents="ctobssim_cmd1.fits"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'" '+ \ - ' ra=83.63 dec=22.01 rad=3.0'+ \ + ' ra=83.63 dec=22.01 rad=2.0'+ \ ' tmin="2020-01-01T00:00:00"'+ \ ' tmax="2020-01-01T00:05:00"'+ \ - ' emin=0.1 emax=100.0'+ \ + ' emin=1.0 emax=100.0'+ \ ' logfile="ctobssim_cmd1.log" chatter=1' # Check if execution was successful @@ -86,16 +86,16 @@ class Test(test): # Load counts cube and check content. evt = gammalib.GCTAEventList('ctobssim_cmd1.fits') - self._test_list(evt, 3775) + self._test_list(evt, 253) # Setup ctobssim command cmd = ctobssim+' inmodel="model_that_does_not_exist.xml"'+ \ ' outevents="ctobssim_cmd2.fits"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'" '+ \ - ' ra=83.63 dec=22.01 rad=3.0'+ \ + ' ra=83.63 dec=22.01 rad=2.0'+ \ ' tmin="2020-01-01T00:00:00"'+ \ ' tmax="2020-01-01T00:05:00"'+ \ - ' emin=0.1 emax=100.0'+ \ + ' emin=1.0 emax=100.0'+ \ ' logfile="ctobssim_cmd2.log" debug=yes chatter=1' # Check if execution failed @@ -137,10 +137,10 @@ class Test(test): sim['irf'] = self._irf sim['ra'] = 83.63 sim['dec'] = 22.01 - sim['rad'] = 3.0 + sim['rad'] = 2.0 sim['tmin'] = '2020-01-01T00:00:00' sim['tmax'] = '2020-01-01T00:05:00' - sim['emin'] = 0.1 + sim['emin'] = 1.0 sim['emax'] = 100.0 sim['outevents'] = 'ctobssim_py1.fits' sim['logfile'] = 'ctobssim_py1.log' @@ -152,21 +152,21 @@ class Test(test): # Check content of observation self._test_observation(sim) - self._test_list(sim.obs()[0].events(), 3775) + self._test_list(sim.obs()[0].events(), 253) # Save events sim.save() # Load counts cube and check content. evt = gammalib.GCTAEventList('ctobssim_py1.fits') - self._test_list(evt, 3775) + self._test_list(evt, 253) # Copy ctobssim tool cpy_sim = sim.copy() # Retrieve observation and check content of copy self._test_observation(cpy_sim) - self._test_list(cpy_sim.obs()[0].events(), 3775) + self._test_list(cpy_sim.obs()[0].events(), 253) # Execute copy of ctobssim tool again, now with a higher chatter # level than before @@ -179,7 +179,7 @@ class Test(test): # Load counts cube and check content. evt = gammalib.GCTAEventList('ctobssim_py2.fits') - self._test_list(evt, 3775) + self._test_list(evt, 253) # Set-up observation container pnts = [{'ra': 83.63, 'dec': 21.01}, diff --git a/test/test_ctphase.py b/test/test_ctphase.py index b497075..8c60bd9 100755 --- a/test/test_ctphase.py +++ b/test/test_ctphase.py @@ -248,7 +248,7 @@ class Test(test): return # Check result file - def _check_result_file(self, filename, nevents=3736): + def _check_result_file(self, filename, nevents=253): """ Check result file diff --git a/test/test_ctprob.py b/test/test_ctprob.py index c5a5ef7..2e29105 100755 --- a/test/test_ctprob.py +++ b/test/test_ctprob.py @@ -202,7 +202,7 @@ class Test(test): return # Check result file - def _check_result_file(self, filename, nevents=3736): + def _check_result_file(self, filename, nevents=253): """ Check result file @@ -232,7 +232,7 @@ class Test(test): return # Check observation and event list - def _check_obs(self, obs, nobs=1, nevents=22220): + def _check_obs(self, obs, nobs=1, nevents=253): """ Check observation and event list @@ -257,7 +257,7 @@ class Test(test): return # Check events - def _check_events(self, events, nevents=22220): + def _check_events(self, events, nevents=253): """ Check event list diff --git a/test/test_ctpsfcube.py b/test/test_ctpsfcube.py index 6f6b7de..5d6f264 100755 --- a/test/test_ctpsfcube.py +++ b/test/test_ctpsfcube.py @@ -70,8 +70,8 @@ class Test(test): ' incube="NONE"'+ \ ' outcube="ctpsfcube_cmd1.fits"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \ - ' nxpix=200 nypix=200 binsz=0.02'+ \ + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \ + ' nxpix=20 nypix=20 binsz=0.2'+ \ ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ ' amax=0.3 anumbins=10'+ \ ' logfile="ctpsfcube_cmd1.log" chatter=1' @@ -88,8 +88,8 @@ class Test(test): ' incube="NONE"'+ \ ' outcube="ctpsfcube_cmd2.fits"'+ \ ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ - ' ebinalg="LOG" emin=0.1 emax=100.0 enumbins=20'+ \ - ' nxpix=200 nypix=200 binsz=0.02'+ \ + ' ebinalg="LOG" emin=1.0 emax=100.0 enumbins=5'+ \ + ' nxpix=20 nypix=20 binsz=0.2'+ \ ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ ' amax=0.3 anumbins=10'+ \ ' logfile="ctpsfcube_cmd2.log" debug=yes chatter=1' @@ -133,9 +133,9 @@ class Test(test): psfcube['caldb'] = self._caldb psfcube['irf'] = self._irf psfcube['ebinalg'] = 'LOG' - psfcube['emin'] = 0.1 + psfcube['emin'] = 1.0 psfcube['emax'] = 100 - psfcube['enumbins'] = 20 + psfcube['enumbins'] = 5 psfcube['nxpix'] = 10 psfcube['nypix'] = 10 psfcube['binsz'] = 0.4 @@ -175,7 +175,7 @@ class Test(test): cpy_psfcube.execute() # Check result file - self._check_result_file('ctpsfcube_py2.fits', nenergies=23) + self._check_result_file('ctpsfcube_py2.fits', nenergies=8) # Now clear copy of ctpsfcube tool cpy_psfcube.clear() @@ -192,17 +192,6 @@ class Test(test): psfcube['incube'] = self._cntcube psfcube['caldb'] = self._caldb psfcube['irf'] = self._irf - #psfcube['ebinalg'] = 'LOG' - #psfcube['emin'] = 0.1 - #psfcube['emax'] = 100 - #psfcube['enumbins'] = 20 - #psfcube['nxpix'] = 10 - #psfcube['nypix'] = 10 - #psfcube['binsz'] = 0.4 - #psfcube['coordsys'] = 'CEL' - #psfcube['proj'] = 'CAR' - #psfcube['xref'] = 83.63 - #psfcube['yref'] = 22.01 psfcube['amax'] = 0.3 psfcube['anumbins'] = 10 psfcube['addbounds'] = True @@ -221,7 +210,7 @@ class Test(test): return # Check result file - def _check_result_file(self, filename, nenergies=21): + def _check_result_file(self, filename, nenergies=6): """ Check result file @@ -242,7 +231,7 @@ class Test(test): return # Check PSF cube - def _check_cube(self, cube, nenergies=21): + def _check_cube(self, cube, nenergies=6): """ Check PSF cube diff --git a/test/test_ctselect.py b/test/test_ctselect.py index 8642f56..65b764b 100755 --- a/test/test_ctselect.py +++ b/test/test_ctselect.py @@ -72,9 +72,9 @@ class Test(test): # Setup ctselect command cmd = ctselect+' inobs="'+self._events+'"'+ \ ' outobs="ctselect_cmd1.fits"'+ \ - ' rad=2.0'+ \ + ' rad=1.0'+ \ ' tmin=2020-01-01T00:01:10 tmax=2020-01-01T00:03:40'+ \ - ' emin=0.2 emax=80.0'+ \ + ' emin=2.0 emax=80.0'+ \ ' logfile="ctselect_cmd1.log" chatter=1' # Check if execution was successful @@ -87,9 +87,9 @@ class Test(test): # Setup ctselect command cmd = ctselect+' inobs="event_file_that_does_not_exist.fits"'+ \ ' outobs="ctselect_cmd2.fits"'+ \ - ' rad=2.0'+ \ + ' rad=1.0'+ \ ' tmin=2020-01-01T00:01:10 tmax=2020-01-01T00:03:40'+ \ - ' emin=0.2 emax=80.0'+ \ + ' emin=2.0 emax=80.0'+ \ ' logfile="ctselect_cmd2.log" debug=yes chatter=1' # Check if execution failed @@ -126,10 +126,10 @@ class Test(test): # Now set ctselect parameters select['inobs'] = self._events - select['rad'] = 2.0 + select['rad'] = 1.0 select['tmin'] = '2020-01-01T00:01:10' select['tmax'] = '2020-01-01T00:03:40' - select['emin'] = 0.2 + select['emin'] = 2.0 select['emax'] = 80.0 select['outobs'] = 'ctselect_py1.fits' select['logfile'] = 'ctselect_py1.log' @@ -176,7 +176,7 @@ class Test(test): cpy_select['ra'] = 83.63 cpy_select['dec'] = 22.01 cpy_select['tmin'] = '2020-01-01T00:01:10' - cpy_select['emin'] = 0.2 + cpy_select['emin'] = 2.0 cpy_select['usethres'] = 'USER' cpy_select['outobs'] = 'ctselect_py3.fits' cpy_select['logfile'] = 'ctselect_py3.log' @@ -205,7 +205,7 @@ class Test(test): # beyond the energies covered in the event file is specified, hence # an empty event list will be saved. select = ctools.ctselect(obs) - select['rad'] = 2.0 + select['rad'] = 1.0 select['tmin'] = '2020-01-01T00:01:10' select['tmax'] = '2020-01-01T00:03:40' select['emin'] = 120.0 @@ -226,10 +226,10 @@ class Test(test): # Setup ctselect tool for an invalid event file select = ctools.ctselect() select['inobs'] = self._invalid_events - select['rad'] = 2.0 + select['rad'] = 1.0 select['tmin'] = '2020-01-01T00:01:10' select['tmax'] = '2020-01-01T00:03:40' - select['emin'] = 0.2 + select['emin'] = 2.0 select['emax'] = 80.0 select['outobs'] = 'ctselect_py5.fits' select['logfile'] = 'ctselect_py5.log' @@ -248,10 +248,10 @@ class Test(test): # value should be ignored. select = ctools.ctselect() select['inobs'] = self._events+'[EVENTS]' - select['rad'] = 2.0 + select['rad'] = 1.0 select['tmin'] = '2020-01-01T00:01:10' select['tmax'] = '2020-01-01T00:03:40' - select['emin'] = 0.2 + select['emin'] = 2.0 select['emax'] = 0.0 # Signals that "emax" should be ignored select['outobs'] = 'ctselect_py6.fits' select['logfile'] = 'ctselect_py6.log' @@ -267,7 +267,7 @@ class Test(test): # Now ignore the "emin" value. select = ctools.ctselect() select['inobs'] = self._events+'[EVENTS]' - select['rad'] = 2.0 + select['rad'] = 1.0 select['tmin'] = '2020-01-01T00:01:10' select['tmax'] = '2020-01-01T00:03:40' select['emin'] = 0.0 # Signals that "emin" should be ignored @@ -281,7 +281,7 @@ class Test(test): select.execute() # Check result file - self._check_result_file('ctselect_py7.fits', nevents=1504) + self._check_result_file('ctselect_py7.fits', nevents=60) # Now set "emin > emax" select['emin'] = 150.0 @@ -304,10 +304,10 @@ class Test(test): select['usepnt'] = False select['ra'] = 83.63 select['dec'] = 24.01 - select['rad'] = 3.0 + select['rad'] = 2.0 select['tmin'] = '2020-01-01T00:01:10' select['tmax'] = '2020-01-01T00:03:40' - select['emin'] = 0.2 + select['emin'] = 2.0 select['emax'] = 80.0 select['outobs'] = 'ctselect_py9.fits' select['logfile'] = 'ctselect_py9.log' @@ -332,21 +332,20 @@ class Test(test): select.execute() # Check result file - self._check_result_file('ctselect_py10.fits', nevents=833, rad=3.) + self._check_result_file('ctselect_py10.fits', nevents=31, rad=2.0) - # Finally test a custom defined RoI - # enclosed in the original one + # Finally test a custom defined RoI enclosed in the original one select = ctools.ctselect() - select['inobs'] = self._events - select['usepnt'] = False - select['ra'] = 83.63 - select['dec'] = 24.01 - select['rad'] = 1.0 - select['tmin'] = '2020-01-01T00:01:10' - select['tmax'] = '2020-01-01T00:03:40' - select['emin'] = 0.2 - select['emax'] = 80.0 - select['outobs'] = 'ctselect_py11.fits' + select['inobs'] = self._events + select['usepnt'] = False + select['ra'] = 83.63 + select['dec'] = 24.01 + select['rad'] = 0.4 + select['tmin'] = '2020-01-01T00:01:10' + select['tmax'] = '2020-01-01T00:03:40' + select['emin'] = 2.0 + select['emax'] = 80.0 + select['outobs'] = 'ctselect_py11.fits' select['logfile'] = 'ctselect_py11.log' select['chatter'] = 3 @@ -355,15 +354,15 @@ class Test(test): select.execute() # Check result file - self._check_result_file('ctselect_py11.fits', nevents=117, dec=24.01, rad=1.) + self._check_result_file('ctselect_py11.fits', nevents=1, dec=24.01, rad=0.4) # Now test phase cut select = ctools.ctselect() select['inobs'] = self._phased_events - select['rad'] = 2.0 + select['rad'] = 1.0 select['tmin'] = 'INDEF' select['tmax'] = 'INDEF' - select['emin'] = 0.1 + select['emin'] = 1.0 select['emax'] = 100.0 select['phase'] = '0.1:0.4,0.6:0.8' select['outobs'] = 'ctselect_py12.fits' @@ -375,15 +374,15 @@ class Test(test): select.execute() # Check result file - self._check_result_file('ctselect_py12.fits', nevents=1909, dec = 22.01) + self._check_result_file('ctselect_py12.fits', nevents=365, dec=22.01) # Now test another phase cut select = ctools.ctselect() select['inobs'] = self._phased_events - select['rad'] = 2.0 + select['rad'] = 1.0 select['tmin'] = 'INDEF' select['tmax'] = 'INDEF' - select['emin'] = 0.1 + select['emin'] = 1.0 select['emax'] = 100.0 select['phase'] = '0.8:0.3' select['outobs'] = 'ctselect_py13.fits' @@ -395,7 +394,7 @@ class Test(test): select.execute() # Check result file - self._check_result_file('ctselect_py13.fits', nevents=1995, dec = 22.01) + self._check_result_file('ctselect_py13.fits', nevents=395, dec=22.01) # Test invalid minimum phase value self.test_try('Test invalid minimum phase value') @@ -485,7 +484,7 @@ class Test(test): return # Check result file - def _check_result_file(self, filename, nevents=744, dec=22.51, rad=2.0): + def _check_result_file(self, filename, nevents=28, dec=22.51, rad=1.0): """ Check result file @@ -510,7 +509,7 @@ class Test(test): return # Check observation and event list - def _check_obs(self, obs, nobs=1, nevents=744): + def _check_obs(self, obs, nobs=1, nevents=28): """ Check observation and event list @@ -535,7 +534,7 @@ class Test(test): return # Check events - def _check_events(self, events, nevents=744, dec=22.51, rad=2.0): + def _check_events(self, events, nevents=28, dec=22.51, rad=1.0): """ Check event list diff --git a/test/test_ctulimit.py b/test/test_ctulimit.py index 5a8f180..0329795 100755 --- a/test/test_ctulimit.py +++ b/test/test_ctulimit.py @@ -137,12 +137,17 @@ class Test(test): ulimit.run() ulimit.save() + # Set reference value + ref_diff = 2.7504120441004e-17 + ref_flux = 1.66909538876204e-11 + ref_eflux = 6.46471558856293e-11 + # Check results - self.test_value(ulimit.diff_ulimit(), 3.11978988143113e-17, 1.0e-21, + self.test_value(ulimit.diff_ulimit(), ref_diff, 1.0e-21, 'Check differential upper limit') - self.test_value(ulimit.flux_ulimit(), 2.11102478123946e-11, 1.0e-16, + self.test_value(ulimit.flux_ulimit(), ref_flux, 1.0e-16, 'Check upper limit on photon flux') - self.test_value(ulimit.eflux_ulimit(), 9.32520808361777e-11, 1.0e-16, + self.test_value(ulimit.eflux_ulimit(), ref_eflux, 1.0e-16, 'Check upper limit on energy flux') # Check obs() method @@ -156,19 +161,19 @@ class Test(test): cpy_ulimit = ulimit.copy() # Check results of copy - self.test_value(cpy_ulimit.diff_ulimit(), 3.11978988143113e-17, 1.0e-21, + self.test_value(cpy_ulimit.diff_ulimit(), ref_diff, 1.0e-21, 'Check differential upper limit') - self.test_value(cpy_ulimit.flux_ulimit(), 2.11102478123946e-11, 1.0e-16, + self.test_value(cpy_ulimit.flux_ulimit(), ref_flux, 1.0e-16, 'Check upper limit on photon flux') - self.test_value(cpy_ulimit.eflux_ulimit(), 9.32520808361777e-11, 1.0e-16, + self.test_value(cpy_ulimit.eflux_ulimit(), ref_eflux, 1.0e-16, 'Check upper limit on energy flux') # Check results - self.test_value(cpy_ulimit.diff_ulimit(), 3.11978988143113e-17, 1.0e-21, + self.test_value(cpy_ulimit.diff_ulimit(), ref_diff, 1.0e-21, 'Check differential upper limit') - self.test_value(cpy_ulimit.flux_ulimit(), 2.11102478123946e-11, 1.0e-16, + self.test_value(cpy_ulimit.flux_ulimit(), ref_flux, 1.0e-16, 'Check upper limit on photon flux') - self.test_value(cpy_ulimit.eflux_ulimit(), 9.32520808361777e-11, 1.0e-16, + self.test_value(cpy_ulimit.eflux_ulimit(), ref_eflux, 1.0e-16, 'Check upper limit on energy flux') # Now clear copy of ctulimit tool @@ -203,11 +208,11 @@ class Test(test): ulimit.execute() # Check results - self.test_value(ulimit.diff_ulimit(), 3.11978988143113e-17, 1.0e-21, + self.test_value(ulimit.diff_ulimit(), ref_diff, 1.0e-21, 'Check differential upper limit') - self.test_value(ulimit.flux_ulimit(), 2.11102478123946e-11, 1.0e-16, + self.test_value(ulimit.flux_ulimit(), ref_flux, 1.0e-16, 'Check upper limit on photon flux') - self.test_value(ulimit.eflux_ulimit(), 9.32520808361777e-11, 1.0e-16, + self.test_value(ulimit.eflux_ulimit(), ref_eflux, 1.0e-16, 'Check upper limit on energy flux') # Test invalid model name diff --git a/test/test_pipelines.py b/test/test_pipelines.py index 147f3e3..756a40a 100755 --- a/test/test_pipelines.py +++ b/test/test_pipelines.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs tests processing pipelines # -# Copyright (C) 2014-2016 Juergen Knoedlseder +# Copyright (C) 2014-2018 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -77,11 +77,11 @@ class Test(gammalib.GPythonTestSuite): result_name = 'results.xml' ra = 83.63 dec = 22.01 - rad_sim = 10.0 - rad_select = 3.0 + rad_sim = 3.0 + rad_select = 2.0 tstart = 0.0 tstop = 300.0 - emin = 0.1 + emin = 1.0 emax = 100.0 # Simulate events @@ -132,11 +132,11 @@ class Test(gammalib.GPythonTestSuite): # Set script parameters ra = 83.63 dec = 22.01 - rad_sim = 10.0 - rad_select = 3.0 + rad_sim = 3.0 + rad_select = 2.0 tstart = 0.0 tstop = 300.0 - emin = 0.1 + emin = 1.0 emax = 100.0 # Simulate events -- libgit2 0.21.4