Microseconds per time unit role?

Discussions and questions about sampling
ba_ca
Posts: 2
Joined: 27 Sep 2019, 09:21
Contact:

Microseconds per time unit role?

Unread postby ba_ca » 13 May 2022, 09:49

I have two very basic questions regarding "microseconds per time unit" and its relation to resulting sampling frequency.

Say I want to be using 100 Hz sampling frequency in our lab for our electrophysiological experiments.

My sampling configuration currently looks like this in Spike2 v7.04:
- waveform file;
- 1401 (the old one);
- optimise: partial (fixed time units);
- groups: keep same sample rate groups;
- AdcRate: 100 Hz;
- microseconds per time unit: 10.


(1) Do I need to multiply/divide 100 Hz (AdcRate) by "microseconds per time unit" to get the final sampling frequency or is it fixed to 100 Hz (as I would wish) since I chose "optimise - partial (fixed time units)"?

(2) Also, in my settings, if I change the value of the "microseconds per time unit" from 10 to 5 (or any other value without sampling error indication), how does this affect the waveform data I would record compared to the previous setting? Would the recorded waveform still be at 100 Hz sampling frequency (since I chose "optimise - partial (fixed time units)"?

I know that these are very basic questions but I just want to be 100% sure before I start a series of experiments where this information will be crucial.

Thank you in advance for your support.

User avatar
Tim Bergel
Site Admin
Posts: 2379
Joined: 19 Jun 2008, 14:40
Location: Cambridge, England
Contact:

Re: Microseconds per time unit role?

Unread postby Tim Bergel » 13 May 2022, 12:23

Hi there,

No worries with basic questions - as you say you need to be sure about this sort of thing.

(1) Do I need to multiply/divide 100 Hz (AdcRate) by "microseconds per time unit" to get the final sampling frequency or is it fixed to 100 Hz (as I would wish) since I chose "optimise - partial (fixed time units)"?

No, we wouldn't do something like that! The necessary arithmetic is done for you by Spike2 which will try to achieve the closest possible match between your requested rates and those that are actually achieved. The various optimisation options control what Spike2 is allowed to do when trying to get a match, but in all cases it is simply trying to match what it can do to what you want. The ADC sampling rates which are shown in the sampling configuration dialog channels page are what you will actually get.

(2) Also, in my settings, if I change the value of the "microseconds per time unit" from 10 to 5 (or any other value without sampling error indication), how does this affect the waveform data I would record compared to the previous setting? Would the recorded waveform still be at 100 Hz sampling frequency (since I chose "optimise - partial (fixed time units)"?

It affects the closeness with which Spike2 can match your requested ADC rates (as well as the accuracy of timing of Event and Marker data and also the timing resolution in the data file which is produced). If you change from 10 to 5 microseconds Spike2 will still be able to hit 100 Hz exactly as 100 Hz requires a 10,000 microsecond interval and 5 divides exactly into 10,000. But if you change it to 3 microseconds you will see an effect because that doesn't divide exactly into 10,000. You will see the effect of this on the channel sampling rates which are shown. But the error will be very small and your data would still be timed completely accurately as Spike2 works with the actual sampling rate which is achieved.
Tim Bergel Cambridge Electronic Design

ba_ca
Posts: 2
Joined: 27 Sep 2019, 09:21
Contact:

Re: Microseconds per time unit role?

Unread postby ba_ca » 16 May 2022, 07:07

Thank you for the clarification Tim,
I am really happy to see that the setting works as I would intend it to.

One more thing. Let's use the example above that I still want to record a single waveform at 100 Hz for no longer than 1 hour. I can see in the sampling resolution settings that changing "microseconds per time unit" from 10 to 5 will allow me to record about 3 hours instead of 6. Lowering that value to 2 microseconds will allow me to record only for an hour. Regardless of what I choose, my desired sampling rate (Sr) stays at 100 Hz with no errors.

My question is, would changing this value (with no errors) make a difference for the single waveform that I need to record at 100 Hz SR or is it just a feature that would make a difference only if more waveforms are recorded, especially at different SR's?
It seems intuitive for me that changing this value would impact the recorded data in some way but I am not sure.

User avatar
Tim Bergel
Site Admin
Posts: 2379
Joined: 19 Jun 2008, 14:40
Location: Cambridge, England
Contact:

Re: Microseconds per time unit role?

Unread postby Tim Bergel » 16 May 2022, 14:35

Hi again,

There would be no difference whatsoever to the waveform that you collect, though as you say it would begin to have an effect were you sampling many channels at different sampling rates where it could affect the accuracy with which your requested rates could be achieved.

It does, however, have a small effect on the data file which is collected. To consider an extreme case, suppose you were to set microseconds per time to 10,000 - the time interval between your ADC samples. This would still work (at least in theory - depends upon your 1401 type) and you would still get 100Hz ADC data. However the data file would be a bit odd as it would be impossible have a time difference smaller than ten milliseconds - the time 'quantum' for the file would be 10 milliseconds. This has some effects - for example and precise peak timing would not be possible - and it worth avoiding if possible - as a very rough rule-of-thumb I would attempt to get maybe 100 time quanta between ADC samples, at least with lower sampling rates.

So reducing microseconds per time unit to 2 would give you very fine time gradations between ADC samples and reduce the maximum file duration, but would not affect the ADC waveform nor the accuracy with which is was sampled.
Tim Bergel Cambridge Electronic Design


Return to “Sampling data”

Who is online

Users browsing this forum: No registered users and 1 guest

cron