From: Achim G. <Str...@ne...> - 2020-09-11 20:48:18
|
Ethan A Merritt writes: >> I'm using it as a way to average over a large number of samples that are >> sampled equidistantly (kernel density is way slower obviously). The >> documentation doesn't really tell how it is implemented or supposed to >> work, so I've experimented a bit to find out. > > I take the blame for any failures in either the implementation or > the documentation of the "bins" option, since I wrote both. > I would be happy to amend the code or the description to cover > uses that I didn't anticipate. No blame to go around… any feature is prone to be (mis)used in ways never intended, once it's there. :-) > Since I envisioned it as a histogramming tool, it did not occur to > me that users would want to plot "with lines" rather than using > boxes or impulses. Therefore I did not think about or test the > clipping behaviour. No good deed goes unpunished, as they say. > As it happens, the routines that draw boxes or impulses do the clipping as > they draw each one. The routine that draws "with lines" assumes that the > inrange/outrange/undefined status of each point has already been flagged, > and only considers clipping if a particular line segment changes state. > This is so that successive in range points are drawn as a single poly-line > with smooth joins rather than being split into individual segments. > Normally the inrange/outrange flag is set on data entry, but those flags > apply to the original data points rather than to the binned totals. > I have now added a separate pass to re-check the binned data against > yrange so that clipping works as you expect it to. > (New code added for both 5.4 and 5.5). Great, I'll check it out later. > I remain a little uneasy about the use of negative values in the weighting > column, although I don't have a specific example in mind that will fail. So far I have not yet encountered any problems with that and I have likely given this part quite a bit of exercise as most of the data I'm plotting is roughly centered about zero. > Thanks for the explanation of what you are using it for. > I agree that in that mode "bins" is similar to a kernel density model > that uses a delta function rather than a Gaussian kernel. I would suggest that it would be welcome if one could specify the kernel function and/or provide a way to implement general FIR filtering on the original data. While the moving average trick is cute, it is also quite slow and cumbersome once you need to average over a large number of samples. > I may not have phrased that well. It weights the _contribution_ of each > sample by the value in the seconds column. If no second column is > provided, the weight is 1. That seems a more accessible description to me, thanks. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Factory and User Sound Singles for Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds |