Commit 77d3524fd729f2167c9f729c5acd6b257f8ad434

Authored by knodlseder
1 parent 3fe9280f

add radius and width parameters

Showing 1 changed file with 10 additions and 11 deletions
scripts/cssens.py
@@ -119,7 +119,8 @@ class cssens(GApplication): @@ -119,7 +119,8 @@ class cssens(GApplication):
119 pars.append(GPar("sigma","r","h","5.0","","","Significance threshold")) 119 pars.append(GPar("sigma","r","h","5.0","","","Significance threshold"))
120 pars.append(GPar("ts_use","b","h","yes","","","Use TS?")) 120 pars.append(GPar("ts_use","b","h","yes","","","Use TS?"))
121 pars.append(GPar("index","r","h","-2.48","","","Assumed spectral index")) 121 pars.append(GPar("index","r","h","-2.48","","","Assumed spectral index"))
122 - pars.append(GPar("max_iter","i","h","50","","","Maximum number of iterations")) 122 + pars.append(GPar("radius","r","h","0.1","","","Extended source model radius"))
  123 + pars.append(GPar("width","r","h","0.05","","","Extended source model width"))
123 pars.append(GPar("num_avg","i","h","3","","","Number of iterations for sliding average")) 124 pars.append(GPar("num_avg","i","h","3","","","Number of iterations for sliding average"))
124 pars.append_standard() 125 pars.append_standard()
125 pars.save(parfile) 126 pars.save(parfile)
@@ -146,6 +147,8 @@ class cssens(GApplication): @@ -146,6 +147,8 @@ class cssens(GApplication):
146 self.m_ts_thres = self["sigma"].real()*self["sigma"].real() 147 self.m_ts_thres = self["sigma"].real()*self["sigma"].real()
147 self.m_use_ts = self["ts_use"].boolean() 148 self.m_use_ts = self["ts_use"].boolean()
148 self.m_index = self["index"].real() 149 self.m_index = self["index"].real()
  150 + self.m_radius = self["radius"].real()
  151 + self.m_width = self["width"].real()
149 self.m_max_iter = self["max_iter"].integer() 152 self.m_max_iter = self["max_iter"].integer()
150 self.m_num_avg = self["num_avg"].integer() 153 self.m_num_avg = self["num_avg"].integer()
151 154
@@ -311,8 +314,7 @@ class cssens(GApplication): @@ -311,8 +314,7 @@ class cssens(GApplication):
311 return model 314 return model
312 315
313 def set_src_model(self, l, b, flux=1.0, index=-2.48, \ 316 def set_src_model(self, l, b, flux=1.0, index=-2.48, \
314 - type="point", sigma=1.0, radius=1.0, width=0.1, \  
315 - fitpos=False, fitidx=False): 317 + type="point", fitpos=False, fitidx=False):
316 """ 318 """
317 Returns a single source with Crab-like spectrum. The source flux 319 Returns a single source with Crab-like spectrum. The source flux
318 can be scaled in Crab units. The Crab spectrum is based on MAGIC 320 can be scaled in Crab units. The Crab spectrum is based on MAGIC
@@ -325,11 +327,8 @@ class cssens(GApplication): @@ -325,11 +327,8 @@ class cssens(GApplication):
325 flux - Source flux [Crabs] 327 flux - Source flux [Crabs]
326 index - Spectral index 328 index - Spectral index
327 type - Source type ("point", "gauss", "disk", "shell") 329 type - Source type ("point", "gauss", "disk", "shell")
328 - sigma - Gaussian sigma (for type="gauss")  
329 - radius - Disk or shell inner radius [deg] (for type="disk" and type="shell")  
330 - width - Shell width [deg] (for type="shell")  
331 - fitpos - Fit position? (default: True)  
332 - fitidx - Fit index? (default: True) 330 + fitpos - Fit position and size? (default: False)
  331 + fitidx - Fit index? (default: False)
333 """ 332 """
334 # Set source location 333 # Set source location
335 location = GSkyDir() 334 location = GSkyDir()
@@ -356,7 +355,7 @@ class cssens(GApplication): @@ -356,7 +355,7 @@ class cssens(GApplication):
356 spatial["DEC"].fix() 355 spatial["DEC"].fix()
357 source = GModelPointSource(spatial, spectrum) 356 source = GModelPointSource(spatial, spectrum)
358 elif type == "gauss": 357 elif type == "gauss":
359 - radial = GModelRadialGauss(location, sigma) 358 + radial = GModelRadialGauss(location, self.radius)
360 if fitpos: 359 if fitpos:
361 radial["RA"].free() 360 radial["RA"].free()
362 radial["DEC"].free() 361 radial["DEC"].free()
@@ -367,7 +366,7 @@ class cssens(GApplication): @@ -367,7 +366,7 @@ class cssens(GApplication):
367 radial["Sigma"].fix() 366 radial["Sigma"].fix()
368 source = GModelExtendedSource(radial, spectrum) 367 source = GModelExtendedSource(radial, spectrum)
369 elif type == "disk": 368 elif type == "disk":
370 - radial = GModelRadialDisk(location, radius) 369 + radial = GModelRadialDisk(location, self.radius)
371 if fitpos: 370 if fitpos:
372 if fitpos: 371 if fitpos:
373 radial["RA"].free() 372 radial["RA"].free()
@@ -379,7 +378,7 @@ class cssens(GApplication): @@ -379,7 +378,7 @@ class cssens(GApplication):
379 radial["Radius"].fix() 378 radial["Radius"].fix()
380 source = GModelExtendedSource(radial, spectrum) 379 source = GModelExtendedSource(radial, spectrum)
381 elif type == "shell": 380 elif type == "shell":
382 - radial = GModelRadialShell(location, radius, width) 381 + radial = GModelRadialShell(location, self.radius, self.width)
383 if fitpos: 382 if fitpos:
384 radial["RA"].free() 383 radial["RA"].free()
385 radial["DEC"].free() 384 radial["DEC"].free()