Skip to content

Commit

Permalink
Raise NoWorkFound when a quanta cant be run
Browse files Browse the repository at this point in the history
Some quanta cant run because they don't have enough data to do
statistics on. Raise a NoWorkFound error so the execution
framework does not register this as a pipeline execution failure.
  • Loading branch information
natelust committed Mar 27, 2022
1 parent 62aaff2 commit 71ee2a7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions python/lsst/analysis/drp/skyPlot.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from multiprocessing.sharedctypes import Value
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import median_absolute_deviation as sigmaMad
Expand Down Expand Up @@ -388,8 +389,16 @@ def skyPlot(self, catPlot, plotInfo, sumStats):
nBins = 45
xBinEdges = np.linspace(minRa, maxRa, nBins + 1)
yBinEdges = np.linspace(minDec, maxDec, nBins + 1)
binnedStats, xEdges, yEdges, binNums = binned_statistic_2d(xs, ys, colorVals, statistic="median",
bins=(xBinEdges, yBinEdges))
try:
binnedStats, xEdges, yEdges, binNums = binned_statistic_2d(xs, ys, colorVals,
statistic="median",
bins=(xBinEdges, yBinEdges))
except ValueError as err:
# This is raised with the following message:
# ValueError: The smallest edge difference is numerically 0.
# and means this data cannot be processed as there is no
# appropriate data to process.
raise pipeBase.NoWorkFound() from err

if len(xs) > 5000:
s = 500/(len(xs)**0.5)
Expand Down

0 comments on commit 71ee2a7

Please sign in to comment.