def _PL2spec(self, source, F, i, dist, sig): """Set parameters for a PowerLaw2 sepctrum source Parameters: - self - This CatalogSourceExtractor object - source - The Source object we are modifying - F - The integrated flux of the source calculated from the catalog parameters - i - The spectral index of the source from the catalog - dist - Distance from source to ROI center - sig - Source significance from catalog Return value: - none - Sets the Spectrum component of the provided Source object Usage: self._PL2spec(self,source,F,i,dist,sig) Description: This method sets the necessary parameters for a LogParabola spectrum source. By default the parameters of the source are fixed unless the source is within the radius limit defined by the user for variable sources (which defaults to the extraction region from the FT1 file) and the source is above the specified significance limit (default 4). In that case the Integral and Index parameters are allowed to vary. Note: The index values (i) in the catalog are given as positive values (i.e. used in the form of flux = E^-i dE). However the convention in the model editor seems to be to use negative values so the index sign is flipped when creating the source. If it is desirable to use positive index values, simply swap out the current index parameter assignment for the one commented out. """ fscale = int(floor(log10(F))) pfValue = F / 10**fscale integral = Parameter(name="Integral", value=pfValue, scale=10**fscale, min=0.0001, max=10000.0, free=False) index = Parameter( name="Index", value=-i, scale=1.0, min=-5.0, max=-1.0, free=False) #flip the sign, positive in catalog but negative here # index = Parameter(name="Index",value = i, scale = -1.0, min = 1.0, max = 5.0, free = False) # use this one if you want to have positive index values lowerLimit = Parameter(name="LowerLimit", value=100, scale=1.0, min=30.0, max=5e5, free=False) upperLimit = Parameter(name="UpperLimit", value=1e5, scale=1.0, min=30.0, max=5e5, free=False) if (dist <= self.radLim and dist <= self.radius and sig >= self.catParams['sigLimit']): index.setFree(True) integral.setFree(True) spectrum = Spectrum( type='PowerLaw2', parameters=[integral, index, lowerLimit, upperLimit]) source.setSpectrum(spectrum)
def _LPspec(self, source, f, i, p, b, dist, sig): """Set parameters for a LogParabola sepctrum source Parameters: - self - This CatalogSourceExtractor object - source - The Source object we are modifying - F - The integrated flux of the source calculated from the catalog parameters - i - The spectral index of the source from the catalog - p - The pivot energy of the source from the catalog - used to set the Eb parameter - b - The beta index from the catalog - dist - Distance from source to ROI center - sig - Source significance from catalog Return value: - none - Sets the Spectrum component of the provided Source object Usage: self._LPspec(self,source,f,i,p,b,dist,sig) Description: This method sets the necessary parameters for a PowerLaw2 spectrum source. By default the parameters of the source are fixed unless the source is within the radius limit defined by the user for variable sources (which defaults to the extraction region from the FT1 file) and the source is above the specified significance limit (default 4). In that case the norm, alpha, and beta parameters are allowed to vary. Note: The index values (i & b) in the catalog are given as positive values (i.e. used in the form of flux = E^-i dE). However the convention in the model editor seems to be to use negative values so the index sign is flipped when creating the source. If it is desirable to use positive index values, simply swap out the current index parameter assignment for the one commented out. """ fscale = int(floor(log10(f))) pfValue = f / 10**fscale norm = Parameter(name="norm", value=pfValue, scale=10**fscale, min=0.0001, max=10000.0, free=False) alpha = Parameter( name="alpha", value=-i, scale=1.0, min=-5.0, max=0, free=False) # flip the sign, positive in catalog but negative here beta = Parameter( name="beta", value=-b, scale=1.0, min=-10.0, max=0, free=False) # flip the sign, positive in catalog but negative here # alpha = Parameter(name="alpha",value = i, scale = -1.0, min = 0, max = 5.0, free = False) # use this one if you want to have positive index values # beta = Parameter(name="beta",value = b, scale = -1.0, min = 0, max = 10.0, free = False) # use this one if you want to have positive index values Eb = Parameter( name="Eb", value=p, scale=1.0, min=30., max=5e5, free=False) # flip the sign, positive in catalog but negative here if (dist <= self.radLim and dist <= self.radius and sig >= self.catParams['sigLimit']): alpha.setFree(True) beta.setFree(True) integral.setFree(True) spectrum = Spectrum(type='LogParabola', parameters=[norm, alpha, beta, Eb]) source.setSpectrum(spectrum)
def _COspec(self,source,f,i,p,c,dist,sig): """Set parameters for a PLSuperExpCutoff sepctrum source Parameters: - self - This CatalogSourceExtractor object - source - The Source object we are modifying - f - The flux of the source from the catalog - i - The spectral index of the source from the catalog - p - The pivot energy of the source from the catalog - used to set the Scale parameter - c - The cutoff energy from the catalog - dist - Distance from source to ROI center - sig - Source significance from catalog Return value: - none - Sets the Spectrum component of the provided Source object Usage: self._COspec(self,source,f,i,p,c,dist,sig) Description: This method sets the necessary parameters for a PLSuperExpCutoff spectrum source. By default the parameters of the source are fixed unless the source is within the radius limit defined by the user for variable sources (which defaults to the extraction region from the FT1 file) and the source is above the specified significance limit (default 4). In that case the Index1, Cutoff, and Prefactor parameters are allowed to vary. Note: The index values (i) in the catalog are given as positive values (i.e. used in the form of flux = E^-i dE). However the convention in the model editor seems to be to use negative values so the index sign is flipped when creating the source. If it is desirable to use positive index values, simply swap out the current index parameter assignment for the one commented out. """ fscale=int(floor(log10(f))) pfValue = f/10**fscale prefactor = Parameter(name="Prefactor",value = pfValue, scale = 10**fscale, min = 0.001, max = 1000.0, free = False) index1 = Parameter(name="Index1",value = -i, scale = 1.0, min = -5.0, max = 0, free = False) #flip the sign, positive in catalog but negative here index2 = Parameter(name="Index2",value = -1.0, scale = 1.0, min = -5.0, max = 0, free = False) #flip the sign, positive in catalog but negative here # index = Parameter(name="Index",value = i, scale = -1.0, min = 0, max = 5.0, free = False) # use this one if you want to have positive index values # index2 = Parameter(name="Index2",value = 1.0, scale = -1.0, min = 0, max = 5.0, free = False) #flip the sign, positive in catalog but negative here if c<=1e5: cutoff = Parameter(name="Cutoff", value = c , scale = 1.0, min = 10, max = 1e5) else: cutoff = Parameter(name="Cutoff", value = c , scale = 1.0, min = 10, max = 2*c) scale = Parameter(name="Scale",value = p, scale = 1.0, min = 30.0, max = 5e5, free = False) if (dist<=self.radLim and dist <= self.radius and sig >= self.catParams['sigLimit']): index1.setFree(True) if c<=1e5:cutoff.setFree(True) prefactor.setFree(True) spectrum = Spectrum(type='PLSuperExpCutoff',parameters=[prefactor,index1,scale,cutoff,index2]) source.setSpectrum(spectrum)