Commit 040da64481194d7ac601d9f8feb0afbdfe272720
1 parent
df193cc3
Change CTA 3D background "BGD" keywords to "BKG" (#2343)
Showing
16 changed files
with
90 additions
and
94 deletions
ChangeLog
| 1 | -2018-07-27 | |
| 1 | +2018-07-31 | |
| 2 | 2 | |
| 3 | 3 | * Version 1.6.0 released |
| 4 | 4 | ======================== |
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | Keep existing library path in installation script on Mac OS X (#2420) |
| 17 | 17 | csphagen produces Xspec compliant data (#2404) |
| 18 | 18 | Add show_rmf.py example script |
| 19 | + Change CTA 3D background "BGD" keywords to "BKG" (#2343) | |
| 19 | 20 | Add ras() and decs() methods to csobsinfo (#2313) |
| 20 | 21 | Also compute TS in csspec for On/Off analysis using wstat statistic (#2312) |
| 21 | 22 | Allow specifying of input sky map in ctskymap (#2311) | ... | ... |
NEWS
| 1 | 1 | New Features and Important Changes in ctools 1.6.0 |
| 2 | 2 | |
| 3 | -27 July 2018 | |
| 3 | +31 July 2018 | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | Introduction |
| ... | ... | @@ -226,7 +226,7 @@ None |
| 226 | 226 | |
| 227 | 227 | csobs2caldb - Generate calibration database entry for an IACT observation |
| 228 | 228 | ------------------------------------------------------------------------- |
| 229 | -None | |
| 229 | +Change background template table name from "BGD" to "BKG" (#2343). | |
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | csobsdef - Generate observation definition XML file |
| ... | ... | @@ -288,6 +288,8 @@ parameter due to a bug in the code. This bug was fixed (#2448). |
| 288 | 288 | |
| 289 | 289 | csroot2caldb - Generates calibration database from ROOT file |
| 290 | 290 | ------------------------------------------------------------ |
| 291 | +Change background template table name from "BGD" to "BKG" (#2343). | |
| 292 | + | |
| 291 | 293 | The ROOT Python module is now imported in the run method and not globally so |
| 292 | 294 | that no conflit arises with the "--help" option (#2652). |
| 293 | 295 | ... | ... |
caldb/data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz
No preview for this file type
caldb/data/cta/prod2/bcf/North_50h/irf_file.fits.gz
No preview for this file type
caldb/data/cta/prod2/bcf/North_5h/irf_file.fits.gz
No preview for this file type
caldb/data/cta/prod2/bcf/South_0.5h/irf_file.fits.gz
No preview for this file type
caldb/data/cta/prod2/bcf/South_50h/irf_file.fits.gz
No preview for this file type
caldb/data/cta/prod2/bcf/South_5h/irf_file.fits.gz
No preview for this file type
caldb/data/cta/prod2/caldb.indx
No preview for this file type
cscripts/csobs2caldb.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Creates a calibration database entry for an IACT observation |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2015-2017 Michael Mayer | |
| 5 | +# Copyright (C) 2015-2018 Michael Mayer | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -32,7 +32,7 @@ from cscripts import calutils |
| 32 | 32 | class csobs2caldb(ctools.csobservation): |
| 33 | 33 | """ |
| 34 | 34 | Creates a calibration database entry for an IACT observation. |
| 35 | - | |
| 35 | + | |
| 36 | 36 | The creation of a calibration database entry is useful for performing |
| 37 | 37 | simulations for current Imaging Air Cherenkov Telescopes (IACTs). |
| 38 | 38 | The class takes an observation definition XML file as input and uses |
| ... | ... | @@ -40,7 +40,7 @@ class csobs2caldb(ctools.csobservation): |
| 40 | 40 | the first observation will be used, but the user can specify the |
| 41 | 41 | index of any observation using the hidden "index" parameter. |
| 42 | 42 | """ |
| 43 | - | |
| 43 | + | |
| 44 | 44 | # Constructor |
| 45 | 45 | def __init__(self, *argv): |
| 46 | 46 | """ |
| ... | ... | @@ -81,7 +81,7 @@ class csobs2caldb(ctools.csobservation): |
| 81 | 81 | if self.obs().is_empty(): |
| 82 | 82 | raise ValueError('No or empty observation provided for ' |
| 83 | 83 | 'parameter "inobs".') |
| 84 | - | |
| 84 | + | |
| 85 | 85 | # Get index of observation to be used |
| 86 | 86 | index = self['index'].integer() |
| 87 | 87 | |
| ... | ... | @@ -89,7 +89,7 @@ class csobs2caldb(ctools.csobservation): |
| 89 | 89 | if index < 0 or index >= self.obs().size(): |
| 90 | 90 | raise IndexError('Parameter "index=%d" outside the validity ' |
| 91 | 91 | 'range [0,%d].' % (index, self.obs().size())) |
| 92 | - | |
| 92 | + | |
| 93 | 93 | # Get observation |
| 94 | 94 | self._observation = self.obs()[index] |
| 95 | 95 | |
| ... | ... | @@ -97,13 +97,13 @@ class csobs2caldb(ctools.csobservation): |
| 97 | 97 | if not self._observation.classname() == 'GCTAObservation': |
| 98 | 98 | raise RuntimeError('Input observation not of type ' |
| 99 | 99 | '"GCTAObservation".') |
| 100 | - | |
| 100 | + | |
| 101 | 101 | # Make sure we have an IRF response associated with the CTA |
| 102 | 102 | # observation |
| 103 | 103 | if not self._observation.response().classname() == 'GCTAResponseIrf': |
| 104 | 104 | raise RuntimeError('Response of input observation not of ' |
| 105 | 105 | 'type "GCTAResponseIrf".') |
| 106 | - | |
| 106 | + | |
| 107 | 107 | # Get calibration database name. If the "caldb" parameter is "NONE" |
| 108 | 108 | # or empty then use the instrument name from the observation as |
| 109 | 109 | # calibration database name. |
| ... | ... | @@ -132,13 +132,11 @@ class csobs2caldb(ctools.csobservation): |
| 132 | 132 | Creates an IRF FITS file |
| 133 | 133 | """ |
| 134 | 134 | # Write header into logger |
| 135 | - if self._logTerse(): | |
| 136 | - self._log("\n") | |
| 137 | - self._log.header2("Creating IRF file") | |
| 135 | + self._log_header2(gammalib.TERSE, 'Creating IRF file') | |
| 138 | 136 | |
| 139 | 137 | # Get response for the observation |
| 140 | 138 | rsp = self._observation.response() |
| 141 | - | |
| 139 | + | |
| 142 | 140 | # Extract response file names |
| 143 | 141 | fname_aeff = rsp.aeff().filename() |
| 144 | 142 | fname_psf = rsp.psf().filename() |
| ... | ... | @@ -151,7 +149,7 @@ class csobs2caldb(ctools.csobservation): |
| 151 | 149 | self._log_value(gammalib.NORMAL, 'Point spread function', fname_psf.url()) |
| 152 | 150 | self._log_value(gammalib.NORMAL, 'Energy dispersion', fname_edisp.url()) |
| 153 | 151 | self._log_value(gammalib.NORMAL, 'Background rate', fname_bkg.url()) |
| 154 | - | |
| 152 | + | |
| 155 | 153 | # Open FITS files of response components |
| 156 | 154 | fits_aeff = gammalib.GFits(fname_aeff) |
| 157 | 155 | fits_psf = gammalib.GFits(fname_psf) |
| ... | ... | @@ -163,10 +161,10 @@ class csobs2caldb(ctools.csobservation): |
| 163 | 161 | ext_psf = fname_psf.extname("POINT SPREAD FUNCTION") |
| 164 | 162 | ext_edisp = fname_edisp.extname("ENERGY DISPERSION") |
| 165 | 163 | ext_bkg = fname_bkg.extname("BACKGROUND") |
| 166 | - | |
| 164 | + | |
| 167 | 165 | # Create empty FITS file |
| 168 | 166 | fits = gammalib.GFits() |
| 169 | - | |
| 167 | + | |
| 170 | 168 | # Append IRF component to FITS file |
| 171 | 169 | fits.append(fits_aeff[ext_aeff]) |
| 172 | 170 | fits.append(fits_psf[ext_psf]) |
| ... | ... | @@ -186,7 +184,7 @@ class csobs2caldb(ctools.csobservation): |
| 186 | 184 | self._log("\n") |
| 187 | 185 | self._log(str(fits[ext_bkg].header())) |
| 188 | 186 | self._log("\n") |
| 189 | - | |
| 187 | + | |
| 190 | 188 | # Return fits file |
| 191 | 189 | return fits |
| 192 | 190 | |
| ... | ... | @@ -195,16 +193,14 @@ class csobs2caldb(ctools.csobservation): |
| 195 | 193 | Creates an IRF index FITS file |
| 196 | 194 | """ |
| 197 | 195 | # Write header into logger |
| 198 | - if self._logTerse(): | |
| 199 | - self._log('\n') | |
| 200 | - self._log.header2('Creating database index file') | |
| 196 | + self._log_header2(gammalib.TERSE, 'Creating database index file') | |
| 201 | 197 | |
| 202 | 198 | # Open calibration database index |
| 203 | 199 | indx_file = self._base_dir + '/caldb.indx' |
| 204 | - | |
| 200 | + | |
| 205 | 201 | # Open index file (or create one if it does not exist) |
| 206 | 202 | cif = gammalib.GFits(indx_file, True) |
| 207 | - | |
| 203 | + | |
| 208 | 204 | # Retrieve "CIF" table |
| 209 | 205 | if cif.contains('CIF'): |
| 210 | 206 | table = cif.table('CIF') |
| ... | ... | @@ -212,7 +208,7 @@ class csobs2caldb(ctools.csobservation): |
| 212 | 208 | # ... or create binary table if no "CIF" table exists yet, append |
| 213 | 209 | # binary table to CIF file and return a reference to the appended |
| 214 | 210 | # table to work with |
| 215 | - else: | |
| 211 | + else: | |
| 216 | 212 | table = cif.append(calutils.create_cif_table()) |
| 217 | 213 | |
| 218 | 214 | # Check if output config already exist |
| ... | ... | @@ -223,9 +219,9 @@ class csobs2caldb(ctools.csobservation): |
| 223 | 219 | if caldir == self._cal_dir: |
| 224 | 220 | has_config = True |
| 225 | 221 | break |
| 226 | - | |
| 227 | - # Create columns if not available | |
| 228 | - if not has_config: | |
| 222 | + | |
| 223 | + # Create columns if not available | |
| 224 | + if not has_config: | |
| 229 | 225 | # Append 4 rows to CIF extension |
| 230 | 226 | table.append_rows(4) |
| 231 | 227 | row_index = table.nrows() |
| ... | ... | @@ -241,7 +237,7 @@ class csobs2caldb(ctools.csobservation): |
| 241 | 237 | # Set date |
| 242 | 238 | now = str(datetime.datetime.now()) |
| 243 | 239 | today, time = now.split() |
| 244 | - | |
| 240 | + | |
| 245 | 241 | # Set element |
| 246 | 242 | table['TELESCOP'][row] = self._mission |
| 247 | 243 | table['INSTRUME'][row] = self._caldb |
| ... | ... | @@ -268,7 +264,7 @@ class csobs2caldb(ctools.csobservation): |
| 268 | 264 | row = row_index-3 |
| 269 | 265 | table['CAL_CNAM'][row] = 'RPSF' |
| 270 | 266 | table['CAL_DESC'][row] = self._caldb+' point spread function' |
| 271 | - | |
| 267 | + | |
| 272 | 268 | # Add energy dispersion information |
| 273 | 269 | row = row_index-2 |
| 274 | 270 | table['CAL_CNAM'][row] = 'EDISP' |
| ... | ... | @@ -276,7 +272,7 @@ class csobs2caldb(ctools.csobservation): |
| 276 | 272 | |
| 277 | 273 | # Add background information |
| 278 | 274 | row = row_index-1 |
| 279 | - table['CAL_CNAM'][row] = 'BGD' | |
| 275 | + table['CAL_CNAM'][row] = 'BKG' | |
| 280 | 276 | table['CAL_DESC'][row] = self._caldb+' background' |
| 281 | 277 | |
| 282 | 278 | # Log resulting FITS table and header |
| ... | ... | @@ -286,35 +282,33 @@ class csobs2caldb(ctools.csobservation): |
| 286 | 282 | if self._logExplicit(): |
| 287 | 283 | self._log(str(table.header())) |
| 288 | 284 | self._log('\n') |
| 289 | - | |
| 285 | + | |
| 290 | 286 | # Return CIF FITS file |
| 291 | 287 | return cif |
| 292 | - | |
| 288 | + | |
| 293 | 289 | def _make_dirs(self): |
| 294 | 290 | """ |
| 295 | 291 | Make CALDB directories |
| 296 | 292 | """ |
| 297 | 293 | # Write header into logger |
| 298 | - if self._logTerse(): | |
| 299 | - self._log("\n") | |
| 300 | - self._log.header2("Creating directory structure") | |
| 294 | + self._log_header2(gammalib.TERSE, 'Creating directory structure') | |
| 301 | 295 | |
| 302 | 296 | # Create calibration database |
| 303 | - caldb = gammalib.GCaldb(self["rootdir"].string()) | |
| 304 | - | |
| 297 | + caldb = gammalib.GCaldb(self['rootdir'].string()) | |
| 298 | + | |
| 305 | 299 | # Set calibration directory |
| 306 | - self._cal_dir = "data" | |
| 307 | - self._cal_dir += "/"+self._mission.lower() | |
| 308 | - self._cal_dir += "/"+self._caldb.lower() | |
| 309 | - self._cal_dir += "/bcf/"+self["irf"].string() | |
| 310 | - | |
| 300 | + self._cal_dir = 'data' | |
| 301 | + self._cal_dir += '/'+self._mission.lower() | |
| 302 | + self._cal_dir += '/'+self._caldb.lower() | |
| 303 | + self._cal_dir += '/bcf/'+self['irf'].string() | |
| 304 | + | |
| 311 | 305 | # Set absolute path |
| 312 | - self._base_dir = caldb.rootdir() +"/data" | |
| 313 | - self._base_dir += "/"+self._mission.lower() | |
| 314 | - self._base_dir += "/"+self._caldb.lower() | |
| 315 | - | |
| 306 | + self._base_dir = caldb.rootdir() +'/data' | |
| 307 | + self._base_dir += '/'+self._mission.lower() | |
| 308 | + self._base_dir += '/'+self._caldb.lower() | |
| 309 | + | |
| 316 | 310 | # Set directory for irf file |
| 317 | - self._rsp_dir = caldb.rootdir() + "/" + self._cal_dir | |
| 311 | + self._rsp_dir = caldb.rootdir() + '/' + self._cal_dir | |
| 318 | 312 | |
| 319 | 313 | # Log resulting FITS table |
| 320 | 314 | self._log_value(gammalib.NORMAL, 'Calibration directory', self._cal_dir) |
| ... | ... | @@ -324,7 +318,7 @@ class csobs2caldb(ctools.csobservation): |
| 324 | 318 | else: |
| 325 | 319 | name = 'IRF directory (existing)' |
| 326 | 320 | self._log_value(gammalib.NORMAL, name, self._rsp_dir) |
| 327 | - | |
| 321 | + | |
| 328 | 322 | # Create IRF directory is it does not yet exist |
| 329 | 323 | if not os.path.isdir(self._rsp_dir): |
| 330 | 324 | os.makedirs(self._rsp_dir) |
| ... | ... | @@ -344,21 +338,19 @@ class csobs2caldb(ctools.csobservation): |
| 344 | 338 | |
| 345 | 339 | # Get parameters |
| 346 | 340 | self._get_parameters() |
| 347 | - | |
| 341 | + | |
| 348 | 342 | # Write input parameters and header into logger |
| 349 | - if self._logTerse(): | |
| 350 | - self._log('\n') | |
| 351 | - self._log.header1('Creating CALDB entry') | |
| 352 | - | |
| 343 | + self._log_header1(gammalib.TERSE, 'Creating CALDB entry') | |
| 344 | + | |
| 353 | 345 | # Create directory structure |
| 354 | 346 | self._make_dirs() |
| 355 | - | |
| 347 | + | |
| 356 | 348 | # Create/update calibration database |
| 357 | 349 | self._caldb_inx = self._make_caldb_index() |
| 358 | - | |
| 350 | + | |
| 359 | 351 | # Create response file |
| 360 | 352 | self._irf_fits = self._make_irf_file() |
| 361 | - | |
| 353 | + | |
| 362 | 354 | # Return |
| 363 | 355 | return |
| 364 | 356 | |
| ... | ... | @@ -371,7 +363,7 @@ class csobs2caldb(ctools.csobservation): |
| 371 | 363 | |
| 372 | 364 | # Set response filename |
| 373 | 365 | filename = self._rsp_dir + '/' + self._outfile |
| 374 | - | |
| 366 | + | |
| 375 | 367 | # Write filenames into logger |
| 376 | 368 | self._log_value(gammalib.NORMAL, 'CALDB index file', |
| 377 | 369 | self._caldb_inx.filename().url()) |
| ... | ... | @@ -382,7 +374,7 @@ class csobs2caldb(ctools.csobservation): |
| 382 | 374 | |
| 383 | 375 | # Save response file |
| 384 | 376 | self._irf_fits.saveto(filename, self._clobber()) |
| 385 | - | |
| 377 | + | |
| 386 | 378 | # Return |
| 387 | 379 | return |
| 388 | 380 | |
| ... | ... | @@ -394,6 +386,6 @@ if __name__ == '__main__': |
| 394 | 386 | |
| 395 | 387 | # Create instance of application |
| 396 | 388 | app = csobs2caldb(sys.argv) |
| 397 | - | |
| 389 | + | |
| 398 | 390 | # Execute application |
| 399 | 391 | app.execute() | ... | ... |
cscripts/csroot2caldb.py
| ... | ... | @@ -130,12 +130,12 @@ class csroot2caldb(ctools.cscript): |
| 130 | 130 | irf['EDISP_DOC'] = '???' |
| 131 | 131 | irf['EDISP_BOUNDS'] = copy.deepcopy(cal_bounds) |
| 132 | 132 | irf['EDISP_DESC'] = 'CTA energy dispersion' |
| 133 | - irf['BGD_NAME'] = 'BKG' | |
| 134 | - irf['BGD_HDUCLAS3'] = 'FULL-ENCLOSURE' | |
| 135 | - irf['BGD_HDUCLAS4'] = '3D' | |
| 136 | - irf['BGD_DOC'] = '???' | |
| 137 | - irf['BGD_BOUNDS'] = copy.deepcopy(cal_bounds) | |
| 138 | - irf['BGD_DESC'] = 'CTA background' | |
| 133 | + irf['BKG_NAME'] = 'BKG' | |
| 134 | + irf['BKG_HDUCLAS3'] = 'FULL-ENCLOSURE' | |
| 135 | + irf['BKG_HDUCLAS4'] = '3D' | |
| 136 | + irf['BKG_DOC'] = '???' | |
| 137 | + irf['BKG_BOUNDS'] = copy.deepcopy(cal_bounds) | |
| 138 | + irf['BKG_DESC'] = 'CTA background' | |
| 139 | 139 | |
| 140 | 140 | # Set parameter dependent IRF information |
| 141 | 141 | if self['psftype'].string() == 'King': |
| ... | ... | @@ -183,7 +183,7 @@ class csroot2caldb(ctools.cscript): |
| 183 | 183 | ds['EA_DIR'] = obs_dir |
| 184 | 184 | ds['PSF_DIR'] = obs_dir |
| 185 | 185 | ds['EDISP_DIR'] = obs_dir |
| 186 | - ds['BGD_DIR'] = obs_dir | |
| 186 | + ds['BKG_DIR'] = obs_dir | |
| 187 | 187 | |
| 188 | 188 | # Set path to response components. If the "outdir" parameter is set |
| 189 | 189 | # then prefix the value to the path of the response components |
| ... | ... | @@ -193,13 +193,13 @@ class csroot2caldb(ctools.cscript): |
| 193 | 193 | ds['EA_PATH'] = outdir+'/'+ds['EA_DIR'] |
| 194 | 194 | ds['PSF_PATH'] = outdir+'/'+ds['PSF_DIR'] |
| 195 | 195 | ds['EDISP_PATH'] = outdir+'/'+ds['EDISP_DIR'] |
| 196 | - ds['BGD_PATH'] = outdir+'/'+ds['BGD_DIR'] | |
| 196 | + ds['BKG_PATH'] = outdir+'/'+ds['BKG_DIR'] | |
| 197 | 197 | else: |
| 198 | 198 | ds['BASE_PATH'] = base_dir |
| 199 | 199 | ds['EA_PATH'] = ds['EA_DIR'] |
| 200 | 200 | ds['PSF_PATH'] = ds['PSF_DIR'] |
| 201 | 201 | ds['EDISP_PATH'] = ds['EDISP_DIR'] |
| 202 | - ds['BGD_PATH'] = ds['BGD_DIR'] | |
| 202 | + ds['BKG_PATH'] = ds['BKG_DIR'] | |
| 203 | 203 | |
| 204 | 204 | # Set IRF component file names. If the "split" parameter is "yes" then |
| 205 | 205 | # split the IRF components over several files. |
| ... | ... | @@ -207,12 +207,12 @@ class csroot2caldb(ctools.cscript): |
| 207 | 207 | ds['EA_FILE'] = 'ea_'+version+'.fits' |
| 208 | 208 | ds['PSF_FILE'] = 'psf_'+version+'.fits' |
| 209 | 209 | ds['EDISP_FILE'] = 'edisp_'+version+'.fits' |
| 210 | - ds['BGD_FILE'] = 'bgd_'+version+'.fits' | |
| 210 | + ds['BKG_FILE'] = 'bgd_'+version+'.fits' | |
| 211 | 211 | else: |
| 212 | 212 | ds['EA_FILE'] = 'irf_'+version+'.fits' |
| 213 | 213 | ds['PSF_FILE'] = 'irf_'+version+'.fits' |
| 214 | 214 | ds['EDISP_FILE'] = 'irf_'+version+'.fits' |
| 215 | - ds['BGD_FILE'] = 'irf_'+version+'.fits' | |
| 215 | + ds['BKG_FILE'] = 'irf_'+version+'.fits' | |
| 216 | 216 | |
| 217 | 217 | # Create directory structure |
| 218 | 218 | if not os.path.isdir(ds['EA_PATH']): |
| ... | ... | @@ -221,8 +221,8 @@ class csroot2caldb(ctools.cscript): |
| 221 | 221 | os.makedirs(ds['PSF_PATH']) |
| 222 | 222 | if not os.path.isdir(ds['EDISP_PATH']): |
| 223 | 223 | os.makedirs(ds['EDISP_PATH']) |
| 224 | - if not os.path.isdir(ds['BGD_PATH']): | |
| 225 | - os.makedirs(ds['BGD_PATH']) | |
| 224 | + if not os.path.isdir(ds['BKG_PATH']): | |
| 225 | + os.makedirs(ds['BKG_PATH']) | |
| 226 | 226 | |
| 227 | 227 | # Return ds |
| 228 | 228 | return ds |
| ... | ... | @@ -255,19 +255,19 @@ class csroot2caldb(ctools.cscript): |
| 255 | 255 | ea_filename = ds['EA_PATH']+'/'+ds['EA_FILE'] |
| 256 | 256 | psf_filename = ds['PSF_PATH']+'/'+ds['PSF_FILE'] |
| 257 | 257 | edisp_filename = ds['EDISP_PATH']+'/'+ds['EDISP_FILE'] |
| 258 | - bgd_filename = ds['BGD_PATH']+'/'+ds['BGD_FILE'] | |
| 258 | + bgd_filename = ds['BKG_PATH']+'/'+ds['BKG_FILE'] | |
| 259 | 259 | |
| 260 | 260 | # Open IRF component files |
| 261 | 261 | if self['split'].boolean(): |
| 262 | 262 | ds['EA_FITS'] = gammalib.GFits(ea_filename, True) |
| 263 | 263 | ds['PSF_FITS'] = gammalib.GFits(psf_filename, True) |
| 264 | 264 | ds['EDISP_FITS'] = gammalib.GFits(edisp_filename, True) |
| 265 | - ds['BGD_FITS'] = gammalib.GFits(bgd_filename, True) | |
| 265 | + ds['BKG_FITS'] = gammalib.GFits(bgd_filename, True) | |
| 266 | 266 | else: |
| 267 | 267 | ds['EA_FITS'] = gammalib.GFits(ea_filename, True) |
| 268 | 268 | ds['PSF_FITS'] = ds['EA_FITS'] |
| 269 | 269 | ds['EDISP_FITS'] = ds['EA_FITS'] |
| 270 | - ds['BGD_FITS'] = ds['EA_FITS'] | |
| 270 | + ds['BKG_FITS'] = ds['EA_FITS'] | |
| 271 | 271 | |
| 272 | 272 | # Open HDUs |
| 273 | 273 | ds['HDU_EA'] = self._open_hdu(ds['EA_FITS'], "EFFECTIVE AREA", |
| ... | ... | @@ -282,9 +282,9 @@ class csroot2caldb(ctools.cscript): |
| 282 | 282 | irf['EDISP_NAME'], irf['EDISP_HDUCLAS3'], |
| 283 | 283 | irf['EDISP_HDUCLAS4'], irf['EDISP_DOC'], |
| 284 | 284 | irf) |
| 285 | - ds['HDU_BGD'] = self._open_hdu(ds['BGD_FITS'], "BACKGROUND", | |
| 286 | - irf['BGD_NAME'], irf['BGD_HDUCLAS3'], | |
| 287 | - irf['BGD_HDUCLAS4'], irf['BGD_DOC'], | |
| 285 | + ds['HDU_BKG'] = self._open_hdu(ds['BKG_FITS'], "BACKGROUND", | |
| 286 | + irf['BKG_NAME'], irf['BKG_HDUCLAS3'], | |
| 287 | + irf['BKG_HDUCLAS4'], irf['BKG_DOC'], | |
| 288 | 288 | irf) |
| 289 | 289 | |
| 290 | 290 | # Return |
| ... | ... | @@ -318,10 +318,10 @@ class csroot2caldb(ctools.cscript): |
| 318 | 318 | if self['split'].boolean(): |
| 319 | 319 | ds['PSF_FITS'].save(True) |
| 320 | 320 | ds['EDISP_FITS'].save(True) |
| 321 | - ds['BGD_FITS'].save(True) | |
| 321 | + ds['BKG_FITS'].save(True) | |
| 322 | 322 | ds['PSF_FITS'].close() |
| 323 | 323 | ds['EDISP_FITS'].close() |
| 324 | - ds['BGD_FITS'].close() | |
| 324 | + ds['BKG_FITS'].close() | |
| 325 | 325 | |
| 326 | 326 | # Return |
| 327 | 327 | return |
| ... | ... | @@ -421,7 +421,7 @@ class csroot2caldb(ctools.cscript): |
| 421 | 421 | Directory structure dictionary |
| 422 | 422 | """ |
| 423 | 423 | # Set list of IRF component names |
| 424 | - names = ['EA', 'PSF', 'EDISP', 'BGD'] | |
| 424 | + names = ['EA', 'PSF', 'EDISP', 'BKG'] | |
| 425 | 425 | |
| 426 | 426 | # Initialise CIF row index |
| 427 | 427 | row = ds['HDU_CIF'].nrows() |
| ... | ... | @@ -1049,7 +1049,7 @@ class csroot2caldb(ctools.cscript): |
| 1049 | 1049 | Translate ROOT to CALDB background extension. |
| 1050 | 1050 | |
| 1051 | 1051 | The following ROOT histograms are used: |
| 1052 | - - BGRatePerSqDeg_offaxis -> BGD | |
| 1052 | + - BGRatePerSqDeg_offaxis -> BKG | |
| 1053 | 1053 | |
| 1054 | 1054 | Parameters |
| 1055 | 1055 | ---------- |
| ... | ... | @@ -1081,11 +1081,11 @@ class csroot2caldb(ctools.cscript): |
| 1081 | 1081 | self._renorm_onaxis(array, array_1D) |
| 1082 | 1082 | |
| 1083 | 1083 | # Write boundary keywords |
| 1084 | - self._set_cif_keywords(ds['HDU_BGD'], irf['BGD_NAME'], | |
| 1085 | - irf['BGD_BOUNDS'], irf['BGD_DESC'], irf) | |
| 1084 | + self._set_cif_keywords(ds['HDU_BKG'], irf['BKG_NAME'], | |
| 1085 | + irf['BKG_BOUNDS'], irf['BKG_DESC'], irf) | |
| 1086 | 1086 | |
| 1087 | - # Create "BGD" data column | |
| 1088 | - self._make_3D(array, ds['HDU_BGD'], 'BGD', '1/(MeV s sr)') | |
| 1087 | + # Create "BKG" data column | |
| 1088 | + self._make_3D(array, ds['HDU_BKG'], 'BKG', '1/(MeV s sr)') | |
| 1089 | 1089 | |
| 1090 | 1090 | # Return |
| 1091 | 1091 | return | ... | ... |
doc/source/admin/release_history/1.6.rst
| ... | ... | @@ -42,6 +42,8 @@ Improvements |
| 42 | 42 | * [`2404 <https://cta-redmine.irap.omp.eu/issues/2404>`_] - |
| 43 | 43 | :ref:`csphagen` produces Xspec compliant data |
| 44 | 44 | * Add ``show_rmf.py`` example script |
| 45 | +* [`2343 <https://cta-redmine.irap.omp.eu/issues/2343>`_] - | |
| 46 | + Change CTA 3D background ``BGD`` keywords to ``BKG`` | |
| 45 | 47 | * [`2313 <https://cta-redmine.irap.omp.eu/issues/2313>`_] - |
| 46 | 48 | Add `ras()` and `decs()` methods to :ref:`csobsinfo` |
| 47 | 49 | * [`2312 <https://cta-redmine.irap.omp.eu/issues/2312>`_] - | ... | ... |
test/data/iactdata/events/irf_file.fits.gz
No preview for this file type
test/data/irf_file.fits.gz
No preview for this file type
test/dev/cta_kb_root2caldb.py
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | # area (i.e. the area before applying any theta cut). This is required by |
| 8 | 8 | # GammaLib as the maximum likelihood analysis does not imply any theta cut. |
| 9 | 9 | # |
| 10 | -# Copyright (C) 2014-2016 Juergen Knoedlseder | |
| 10 | +# Copyright (C) 2014-2018 Juergen Knoedlseder | |
| 11 | 11 | # |
| 12 | 12 | # This program is free software: you can redistribute it and/or modify |
| 13 | 13 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -23,7 +23,6 @@ |
| 23 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 | 24 | # |
| 25 | 25 | # ========================================================================== |
| 26 | -#from ROOT import TFile, TH1F, TH2F | |
| 27 | 26 | from ROOT import TFile, TH1F |
| 28 | 27 | from datetime import datetime |
| 29 | 28 | import gammalib |
| ... | ... | @@ -96,7 +95,7 @@ class caldb(): |
| 96 | 95 | self.edisp_bounds = [self.cal_name, self.cal_version, self.cal_cut, self.cal_analysis] |
| 97 | 96 | self.edisp_desc = "CTA energy dispersion" |
| 98 | 97 | # |
| 99 | - self.bgd_name = "BGD" | |
| 98 | + self.bgd_name = "BKG" | |
| 100 | 99 | self.bgd_doc = "???" |
| 101 | 100 | self.bgd_bounds = [self.cal_name, self.cal_version, self.cal_cut, self.cal_analysis] |
| 102 | 101 | self.bgd_desc = "CTA background" | ... | ... |
test/test_csobs2caldb.py
| ... | ... | @@ -34,7 +34,7 @@ class Test(test): |
| 34 | 34 | This test class makes unit tests for the csobs2caldb script by using it |
| 35 | 35 | from the command line and from Python. |
| 36 | 36 | """ |
| 37 | - | |
| 37 | + | |
| 38 | 38 | # Constructor |
| 39 | 39 | def __init__(self): |
| 40 | 40 | """ |
| ... | ... | @@ -159,13 +159,13 @@ class Test(test): |
| 159 | 159 | aeff = gammalib.GFilename(db.filename('','','EFF_AREA','','',expr)) |
| 160 | 160 | psf = gammalib.GFilename(db.filename('','','RPSF','','',expr)) |
| 161 | 161 | edisp = gammalib.GFilename(db.filename('','','EDISP','','',expr)) |
| 162 | - bgd = gammalib.GFilename(db.filename('','','BGD','','',expr)) | |
| 162 | + bkg = gammalib.GFilename(db.filename('','','BKG','','',expr)) | |
| 163 | 163 | |
| 164 | 164 | # Check whether files exist |
| 165 | 165 | self.test_assert(aeff.exists(), 'Effective area file exists') |
| 166 | 166 | self.test_assert(psf.exists(), 'Point spread function file exists') |
| 167 | 167 | self.test_assert(edisp.exists(), 'Energy dispersion file exists') |
| 168 | - self.test_assert(bgd.exists(), 'Background file exists') | |
| 169 | - | |
| 168 | + self.test_assert(bkg.exists(), 'Background file exists') | |
| 169 | + | |
| 170 | 170 | # Return |
| 171 | 171 | return | ... | ... |