diff --git a/views.py b/views.py index ecb744a..f8c7ecb 100644 --- a/views.py +++ b/views.py @@ -345,6 +345,22 @@ class UpperLimitView(APIView): Flux = max(FL, 0) # flux cannot be lower than zero + # NORMALIZED BACKGROUND RATE + # **************************************************************** + # in units of ct/s/keV/arcmin^2 + + sr_to_arcmin2 = (180 / np.pi * 60) ** 2 + + pix_area = ( + hp.nside2pixarea(nside=4096) * sr_to_arcmin2 + ) # nside2pixarea yields area in sr + + bg_area = pix_area * Bnpix # get total bg region area + + en_range = 12 - 4 + + NBR = Bcounts / t / en_range / bg_area + # handle exceptions: write error text to the response # zero out all math results except Exception as e: @@ -531,6 +547,7 @@ class UpperLimitView(APIView): # count rates "SourceRate": CR, "BackgroundRate": BR, + "NormalizedBackgroundRate": NBR, # ct/s/keV/arcmin2 # contamination "Contamination": contamination, "NearbySources": nearby_sources,