Skip to content

Commit

Permalink
Merge pull request #13 from erykoff/fixlengths
Browse files Browse the repository at this point in the history
Fix length checks and improve logging.
  • Loading branch information
erykoff committed Apr 14, 2021
2 parents 324f0ee + 025aad4 commit 4206108
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 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.6.3'
__version__ = '3.6.4'

__version_info__ = __version__.split('.')
21 changes: 10 additions & 11 deletions fgcm/fgcmConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,6 @@ def __init__(self, configDict, lutIndex, lutStd, expInfo, ccdOffsets, checkFiles
# based on mjdRange, look at epochs; also sort.
# confirm that we cover all the exposures, and remove excess epochs

if self.epochNames is None:
self.epochNames = []
for i in range(self.epochMJDs.size):
self.epochNames.append('epoch%d' % (i))

# are they sorted?
if (self.epochMJDs != np.sort(self.epochMJDs)).any():
raise ValueError("epochMJDs must be sorted in ascending order")
Expand All @@ -494,9 +489,18 @@ def __init__(self, configDict, lutIndex, lutStd, expInfo, ccdOffsets, checkFiles
if test.min() == 0:
self.fgcmLog.warn("Exposure start MJD before epoch range. Adding additional epoch.")
self.epochMJDs = np.insert(self.epochMJDs, 0, self.mjdRange[0] - 1.0)
if self.epochNames is not None:
self.epochNames.insert(0, 'epoch-pre')
if test.max() == self.epochMJDs.size:
self.fgcmLog.warn("Exposure end MJD after epoch range. Adding additional epoch.")
self.epochMJDs = np.insert(self.epochMJDs, len(self.epochMJDs), self.mjdRange[1] + 1.0)
if self.epochNames is not None:
self.epochNames.insert(len(self.epochNames), 'epoch-post')

if self.epochNames is None:
self.epochNames = []
for i in range(self.epochMJDs.size):
self.epochNames.append('epoch%d' % (i))

# crop to valid range
self.epochMJDs = self.epochMJDs[test[0]-1:test[1]+1]
Expand Down Expand Up @@ -764,12 +768,7 @@ def validate(self):
def _setDefaultLengths(self):
"""
"""

# Check the fudge factors...
type(self).__dict__['sedTermDict']._length = len(self.bands)

# And the epoch names
type(self).__dict__['epochNames']._length = len(self.epochMJDs)
pass

def _convertDictToBandList(self, inputDict, dtype, default,
required=False, ndarray=False, dictName=''):
Expand Down
5 changes: 3 additions & 2 deletions fgcm/fgcmMakeStars.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ def makePrimaryStars(self, raArray, decArray, filterNameArray,
extraQuantityArraysUse = extraQuantityArrays[p1a[useFlag]]

if raArrayUse.size == 0:
self.fgcmLog.info("Nothing found for pixel %d" % (ipring[p1a[0]]))
self.fgcmLog.info(" No observations in pixel %d, %s band" %
(ipring[p1a[0]], primaryBand))
continue

esutil.numpy_util.to_native(raArrayUse, inplace=True)
Expand Down Expand Up @@ -439,7 +440,7 @@ def makePrimaryStars(self, raArray, decArray, filterNameArray,
hist, rev = esutil.stat.histogram(fakeId[i1], rev=True)

if (hist.max() == 1):
self.fgcmLog.warn("No matches found for pixel %d, band %s!" %
self.fgcmLog.warn(" No matches found for pixel %d, %s band" %
(ipring[p1a[0]], primaryBand))
continue

Expand Down

0 comments on commit 4206108

Please sign in to comment.