Skip to content

Commit

Permalink
Merge branch 'release/2.1.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
thespacedoctor committed Jun 22, 2020
2 parents fe7624a + 267faa2 commit cba4494
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@

## Release Notes

**v2.1.5 - June 22, 2020**

* **refactor**: tunnel changes due to new jump box installation at QUB
* **fixed:** some NED galaxies not reported if redshift does not exist but a semi-major axis is given

**v2.1.4 - June 18, 2020**

* **fixed**: an empty crossmatch set could cause a transient database update when not required
Expand Down
2 changes: 1 addition & 1 deletion sherlock/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.1.4'
__version__ = '2.1.5'
9 changes: 5 additions & 4 deletions sherlock/catalogue_conesearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from HMpTy.mysql import conesearch as hmptyConesearch
import copy


class catalogue_conesearch(object):
"""
*The worker class for the conesearch module*
Expand All @@ -34,7 +35,7 @@ class catalogue_conesearch(object):
- ``nearestOnly`` -- return only the nearest object. Default *False*
- ``physicalSearch`` -- is this a physical search, so only return matches with distance information. Default *False*
- ``upperMagnitudeLimit`` -- the upper magnitude limit if a magnitude cut is requird with the conesearch. Default *False*
- ``lowerMagnitudeLimit`` -- the lower magnitude limit if a magnitude cut is requird with the conesearch. Default *False*
- ``magnitudeLimitFilter`` -- the filter to use for the magnitude limit if requird. Default *False*, ("_u"|"_g"|"_r"|"_i"|"_z"|"_y"|"U"|"B"|"V"|"R"|"I"|"Z"|"J"|"H"|"K"|"G")
Expand Down Expand Up @@ -104,7 +105,7 @@ class catalogue_conesearch(object):
ra=["23:01:07.99", 45.36722, 13.875250],
dec=["-01:58:04.5", 30.45671, -25.26721],
radiusArcsec=60.,
colMaps=colMaps,
tableName="tcs_view_agn_milliquas_v4_5",
Expand Down Expand Up @@ -210,12 +211,12 @@ def search(self):
- ``matchIndies`` -- the indicies of the input transient sources (syncs with ``uniqueMatchDicts``)
- ``uniqueMatchDicts`` -- the crossmatch results
**Usage**
See class docstring for usage examples
.. todo ::
Expand Down
17 changes: 10 additions & 7 deletions sherlock/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from docopt import docopt
from fundamentals.mysql import readquery


class database(object):
"""
*the database object for sherlock, setting up ssh tunnels and various database connections*
Expand All @@ -32,12 +33,12 @@ class database(object):
- ``log`` -- logger
- ``settings`` -- the settings dictionary
**Return**
- ``dbConns`` -- a dictionary of the database connections required by sherlock
**Usage**
Expand All @@ -54,7 +55,7 @@ class database(object):
transientsDbConn = dbConns["transients"]
cataloguesDbConn = dbConns["catalogues"]
```
.. todo ::
Expand Down Expand Up @@ -86,7 +87,7 @@ def connect(self):
- ``transientsDbConn`` -- the database hosting the transient source data
- ``cataloguesDbConn`` -- connection to the database hosting the contextual catalogues the transients are to be crossmatched against
See the class docstring for usage
Expand Down Expand Up @@ -117,10 +118,12 @@ def connect(self):
dbConns = []
for dbSettings in [transientSettings, catalogueSettings]:
port = False
if dbSettings and dbSettings["tunnel"]:
if dbSettings and "tunnel" in dbSettings and dbSettings["tunnel"]:
port = self._setup_tunnel(
tunnelParameters=dbSettings["tunnel"]
)
elif dbSettings and "port" in dbSettings and dbSettings["port"]:
port = int(dbSettings["port"])

if dbSettings:
# SETUP A DATABASE CONNECTION FOR THE STATIC CATALOGUES
Expand Down Expand Up @@ -179,12 +182,12 @@ def _setup_tunnel(
**Key Arguments**
- ``tunnelParameters`` -- the tunnel parameters found associated with the database settings
**Return**
- ``sshPort`` -- the port the ssh tunnel is connected via
.. todo ::
Expand Down
17 changes: 14 additions & 3 deletions sherlock/transient_catalogue_crossmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,12 @@ def physical_separation_crossmatch_against_catalogue(
thisMatch = False
physical_separation_kpc = row["physical_separation_kpc"]
newsearch_name = search_name

# FIRST CHECK FOR MAJOR AXIS MEASUREMENT
# BYPASS NED FAULTY AXES MEASUREMENTS:
# https://gist.github.com/search?utf8=%E2%9C%93&q=user%3Athespacedoctor+ned

if row["major_axis_arcsec"] and ("ned" not in search_name or (row["unkMag"] and row["unkMag"] < 20.)):

if row["separationArcsec"] < row["major_axis_arcsec"] * self.settings["galaxy radius stetch factor"]:
thisMatch = True
newsearch_name = newsearch_name + \
Expand Down Expand Up @@ -879,8 +880,18 @@ def physical_separation_crossmatch_against_catalogue(
if matchSubset:

from operator import itemgetter
matchSubset = sorted(matchSubset, key=itemgetter(
'physical_separation_kpc'), reverse=False)

physicalDicts = []
physicalDicts[:] = [m for m in matchSubset if m[
'physical_separation_kpc']]

semiMajor = []
semiMajor[:] = [m for m in matchSubset if not m[
'physical_separation_kpc']]

matchSubset = sorted(physicalDicts, key=itemgetter(
'physical_separation_kpc'), reverse=False) + sorted(semiMajor, key=itemgetter(
'separationArcsec'), reverse=False)

if nearestOnly == True:
theseMatches = matchSubset[0]
Expand Down
4 changes: 1 addition & 3 deletions sherlock/transient_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ def _rank_classifications(
if mergedMatch["direct_distance_scale"]:
mergedMatch["physical_separation_kpc"] = mergedMatch[
"direct_distance_scale"] * mergedMatch["separationArcsec"]
print(mergedMatch["physical_separation_kpc"])

elif mergedMatch["scale"]:
mergedMatch["physical_separation_kpc"] = mergedMatch[
"scale"] * mergedMatch["separationArcsec"]
Expand Down Expand Up @@ -1359,8 +1359,6 @@ def classification_annotations(
elif classType in [2, 3]:
annotation.append("is possibly associated with")

print(xm["catalogue_object_id"])

self.log.debug('completed the ``classification_annotations`` method')
return None

Expand Down

0 comments on commit cba4494

Please sign in to comment.