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 119 pars.append(GPar("sigma","r","h","5.0","","","Significance threshold"))
120 120 pars.append(GPar("ts_use","b","h","yes","","","Use TS?"))
121 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 124 pars.append(GPar("num_avg","i","h","3","","","Number of iterations for sliding average"))
124 125 pars.append_standard()
125 126 pars.save(parfile)
... ... @@ -146,6 +147,8 @@ class cssens(GApplication):
146 147 self.m_ts_thres = self["sigma"].real()*self["sigma"].real()
147 148 self.m_use_ts = self["ts_use"].boolean()
148 149 self.m_index = self["index"].real()
  150 + self.m_radius = self["radius"].real()
  151 + self.m_width = self["width"].real()
149 152 self.m_max_iter = self["max_iter"].integer()
150 153 self.m_num_avg = self["num_avg"].integer()
151 154  
... ... @@ -311,8 +314,7 @@ class cssens(GApplication):
311 314 return model
312 315  
313 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 319 Returns a single source with Crab-like spectrum. The source flux
318 320 can be scaled in Crab units. The Crab spectrum is based on MAGIC
... ... @@ -325,11 +327,8 @@ class cssens(GApplication):
325 327 flux - Source flux [Crabs]
326 328 index - Spectral index
327 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 333 # Set source location
335 334 location = GSkyDir()
... ... @@ -356,7 +355,7 @@ class cssens(GApplication):
356 355 spatial["DEC"].fix()
357 356 source = GModelPointSource(spatial, spectrum)
358 357 elif type == "gauss":
359   - radial = GModelRadialGauss(location, sigma)
  358 + radial = GModelRadialGauss(location, self.radius)
360 359 if fitpos:
361 360 radial["RA"].free()
362 361 radial["DEC"].free()
... ... @@ -367,7 +366,7 @@ class cssens(GApplication):
367 366 radial["Sigma"].fix()
368 367 source = GModelExtendedSource(radial, spectrum)
369 368 elif type == "disk":
370   - radial = GModelRadialDisk(location, radius)
  369 + radial = GModelRadialDisk(location, self.radius)
371 370 if fitpos:
372 371 if fitpos:
373 372 radial["RA"].free()
... ... @@ -379,7 +378,7 @@ class cssens(GApplication):
379 378 radial["Radius"].fix()
380 379 source = GModelExtendedSource(radial, spectrum)
381 380 elif type == "shell":
382   - radial = GModelRadialShell(location, radius, width)
  381 + radial = GModelRadialShell(location, self.radius, self.width)
383 382 if fitpos:
384 383 radial["RA"].free()
385 384 radial["DEC"].free()
... ...