Skip to content
Snippets Groups Projects
Commit 598696f2 authored by Ger van Diepen's avatar Ger van Diepen
Browse files

Task #2699

Use a try/except around import of TKP.config
parent de23a5ec
No related branches found
No related tags found
No related merge requests found
...@@ -9,12 +9,8 @@ import sys, pylab, string ...@@ -9,12 +9,8 @@ import sys, pylab, string
import numpy as np import numpy as np
import monetdb.sql as db import monetdb.sql as db
import logging import logging
from tkp.config import config
DERUITER_R = config['source_association']['deruiter_radius'] def expected_fluxes_in_fov(conn, ra_central, decl_central, fov_radius, assoc_theta, bbsfile, storespectraplots=False, deruiter_radius=0.):
print "DERUITER_R =",DERUITER_R
def expected_fluxes_in_fov(conn, ra_central, decl_central, fov_radius, assoc_theta, bbsfile, storespectraplots=False):
"""Search for VLSS, WENSS and NVSS sources that """Search for VLSS, WENSS and NVSS sources that
are in the given FoV. The FoV is set by its central position are in the given FoV. The FoV is set by its central position
(ra_central, decl_central) out to a radius of fov_radius. (ra_central, decl_central) out to a radius of fov_radius.
...@@ -23,11 +19,25 @@ def expected_fluxes_in_fov(conn, ra_central, decl_central, fov_radius, assoc_the ...@@ -23,11 +19,25 @@ def expected_fluxes_in_fov(conn, ra_central, decl_central, fov_radius, assoc_the
All units are in degrees. All units are in degrees.
deruiter_radius is a measure for the association uncertainty that takes
position errors into account (see thesis Bart Scheers). If not given
as a positive value, it is read from the TKP config file. If not
available, it defaults to 3.717.
The query returns all vlss sources (id) that are in the FoV. The query returns all vlss sources (id) that are in the FoV.
If so, the counterparts from other catalogues are returned as well If so, the counterparts from other catalogues are returned as well
(also their ids). (also their ids).
""" """
DERUITER_R = deruiter_radius
if DERUITER_R <= 0:
try:
from tkp.config import config
DERUITER_R = config['source_association']['deruiter_radius']
print "DERUITER_R =",DERUITER_R
except:
DERUITER_R=3.717
if ra_central + alpha(fov_radius, decl_central) > 360: if ra_central + alpha(fov_radius, decl_central) > 360:
"This will be implemented soon" "This will be implemented soon"
raise BaseException("ra = %s > 360 degrees, not implemented yet" % str(ra_central + alpha(fov_radius, decl_central))) raise BaseException("ra = %s > 360 degrees, not implemented yet" % str(ra_central + alpha(fov_radius, decl_central)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment