osprey-dcs / quartz-calib

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Check for valid waveform before attempting the linear fit #1

Open sjstein opened 4 months ago

sjstein commented 4 months ago

Currently the code does a cursory check for a valid looking waveform by calculating the mean and making sure it shows a positive (or negative - depending on which part of the routine it is in) value.

This is not adequate for slower acquisition rates, as it appears it is grabbing waveforms which show the transition of polarity.

numpy should have a way of looking for "flatness" of the waveform, or perhaps just use the polyfit tool and look for a slope close to zero.

sjstein commented 4 months ago

Suggest to address issue #2 before dealing with this one as, with the reduction of the number of polarity switches, making this super efficient becomes less important (could likely get away with just a time delay - but better to check for a smooth waveform anyway)