You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After running some CPU profiling tool it seems that this function is taking, by large, a good deal of the CPU. Presumably iterating over m to get a shifted average histogram is eating a lot of CPU.
Do we really need a shifted average histogram? This is only to display a histogram under the image, right?
defsetData(self, data):
# Calculate histogram.# Use shifted average histogram to avoid binning artefacts.# generate set of m histograms# each has class width h# start points 0, h/m, 2h/m, ..., (m-1)h/m# 1 < m < 64# sum to averageifself.lboundisNone:
self.lbound=data.min()
ifself.uboundisNone:
self.ubound=data.max()
ifself.lthreshisNone:
self.lthresh=self.lboundifself.uthreshisNone:
self.uthresh=self.uboundnbins=64m=4self.bins=np.linspace(data.min(), data.max(), nbins)
self.counts=np.zeros(nbins)
h=self.bins[1] -self.bins[0]
foriinrange(m):
these=np.bincount(np.digitize(data.flat, self.bins+i*h/m, right=True), minlength=nbins)
self.counts+=these[0:nbins]
The text was updated successfully, but these errors were encountered:
I suspect this is Mick's work. The histogram used to have nasty aliasing meaning at time 1 in n peaks was 1/n higher depending how the data was divided between the histogram bins. This was very ugly and the autoscaling of the histogram meant it continually changed. The newer histograms are much cleaner, but maybe we need a lazy histogram where it is only calculated and redisplayed if the image doesn't change for some period.
After running some CPU profiling tool it seems that this function is taking, by large, a good deal of the CPU. Presumably iterating over m to get a shifted average histogram is eating a lot of CPU.
Do we really need a shifted average histogram? This is only to display a histogram under the image, right?
The text was updated successfully, but these errors were encountered: