Skip to content

Commit

Permalink
Merge pull request #27 from erykoff/force-htm
Browse files Browse the repository at this point in the history
Add option to force htm matching when making stars.
  • Loading branch information
erykoff committed Feb 16, 2022
2 parents 66f97d1 + 8577389 commit fdffb39
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion fgcm/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '3.8.4'
__version__ = '3.8.5'

__version_info__ = __version__.split('.')
41 changes: 27 additions & 14 deletions fgcm/fgcmMakeStars.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def __init__(self,starConfig):
if 'randomSeed' not in starConfig:
starConfig['randomSeed'] = None

if 'useHtm' not in starConfig:
starConfig['useHtm'] = False

self.objCat = None

# Note that the order doesn't matter for the making of the stars
Expand Down Expand Up @@ -287,13 +290,17 @@ def makePrimaryStars(self, raArray, decArray, filterNameArray,
"""

# can we use the better smatch code?
try:
import smatch
hasSmatch = True
self.fgcmLog.info("Using smatch for matching.")
except ImportError:
hasSmatch = False
if self.starConfig['useHtm']:
self.fgcmLog.info("Using htm for matching.")
hasSmatch = False
else:
try:
import smatch
hasSmatch = True
self.fgcmLog.info("Using smatch for matching.")
except ImportError:
hasSmatch = False
self.fgcmLog.info("Using htm for matching.")

if (raArray.size != decArray.size):
raise ValueError("raArray, decArray must be same length.")
Expand Down Expand Up @@ -619,11 +626,14 @@ def makeMatchedStars(self, raArray, decArray, filterNameArray):
raise ValueError("Must run makePrimaryStars first")

# can we use the better smatch code?
try:
import smatch
hasSmatch = True
except ImportError:
if self.starConfig['useHtm']:
hasSmatch = False
else:
try:
import smatch
hasSmatch = True
except ImportError:
hasSmatch = False

if (raArray.size != decArray.size or
raArray.size != filterNameArray.size):
Expand Down Expand Up @@ -785,11 +795,14 @@ def makeReferenceMatches(self, refLoader):
"""

# can we use the better smatch code?
try:
import smatch
hasSmatch = True
except ImportError:
if self.starConfig['useHtm']:
hasSmatch = False
else:
try:
import smatch
hasSmatch = True
except ImportError:
hasSmatch = False

ipring = hp.ang2pix(self.starConfig['coarseNSide'],
np.radians(90.0 - self.objIndexCat['dec']),
Expand Down

0 comments on commit fdffb39

Please sign in to comment.