Added normalized background rate output in units ct/s/keV/arcmin2

This commit is contained in:
2025-07-16 16:57:36 +03:00
parent 3f4ca4075f
commit a2c528644c

View File

@@ -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,