Commit 90a9bcb59a9dd582b478bc59927e99bcdb1c317e
Merge branch '1456-fix-cshessobs-datapath' into integration
Showing
1 changed file
with
8 additions
and
2 deletions
scripts/cshessobs.py
| ... | ... | @@ -44,6 +44,7 @@ class cshessobs(ctools.cscript): |
| 44 | 44 | # Set name |
| 45 | 45 | self.name = "cshessobs" |
| 46 | 46 | self.version = "0.1.0" |
| 47 | + self.datapath = "" | |
| 47 | 48 | |
| 48 | 49 | # Check on existence of HESSFITS environment variable |
| 49 | 50 | try: |
| ... | ... | @@ -53,7 +54,6 @@ class cshessobs(ctools.cscript): |
| 53 | 54 | "Please set the environment variable \"HESSFITS\" to use this script") |
| 54 | 55 | |
| 55 | 56 | # Initialise some members |
| 56 | - self.datapath = "" | |
| 57 | 57 | self.inmodels = None |
| 58 | 58 | self.outobs = "obs.xml" |
| 59 | 59 | self.nodes = 1 |
| ... | ... | @@ -450,7 +450,13 @@ class cshessobs(ctools.cscript): |
| 450 | 450 | # Open fits file to determine the observation name |
| 451 | 451 | fits = gammalib.GFits(eventfile) |
| 452 | 452 | object_name = fits["EVENTS"].string("OBJECT") |
| 453 | - trgrate = fits["EVENTS"].real("ZTRGRATE") | |
| 453 | + | |
| 454 | + # Retrieve trigger rate if available | |
| 455 | + trgrate = 0.0 | |
| 456 | + if fits["EVENTS"].has_card("ZTRGRATE"): | |
| 457 | + trgrate = fits["EVENTS"].real("ZTRGRATE") | |
| 458 | + | |
| 459 | + # Close FITS file | |
| 454 | 460 | fits.close() |
| 455 | 461 | |
| 456 | 462 | # Append observation to XML and set attributes | ... | ... |