-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requirement: Provide support for high sampling rates #17
Comments
Storing last sample time instead of sample rate makes this easy, see my comment on #16 |
Storing the sample rate as an 8-byte IEEE float (aka a 'double') allows high resolution and huge range. Another "MSEED3 Time Structure" takes 11 bytes, for what that's worth. |
Here is crude Python test script I wrote a while ago to test the precision of sampling rates. The result might be somehow academic but it still shows that a high precision sampling rate can be justified. from decimal import Decimal as D
import numpy as np
starttime_in_ns = 124734934578
# Awkward sampling rate to force floating point errors.
sampling_rate_in_sec = 201.12345678
# Max number of samples for 4 bytes record length field. Assumes 2 bytes per
# sample which is very achievable with compression.
samples = 4294967295 // 2
endtime_in_ns_d = \
D(starttime_in_ns) + D("1000000000") / D(sampling_rate_in_sec) * D(samples)
# Use a single precision sampling rate.
endtime_in_ns_single = \
starttime_in_ns + 1000000000 / np.float32(sampling_rate_in_sec) * samples
# Double precision
endtime_in_ns_double = \
starttime_in_ns + 1000000000 / np.float64(sampling_rate_in_sec) * samples
print("Endtime in ns - accurate: ", int(endtime_in_ns_d))
print("\n--> Single precision")
print("Endtime in ns - floating point", int(endtime_in_ns_single))
diff = abs(int(endtime_in_ns_d) - int(endtime_in_ns_single))
print("Difference in ns: ", diff)
print("Difference as a factor of dt: ",
(diff / 1E9) / (1.0 / sampling_rate_in_sec))
print("\n--> Double precision")
print("Endtime in ns - floating point", int(endtime_in_ns_double))
diff = abs(int(endtime_in_ns_d) - int(endtime_in_ns_double))
print("Difference in ns: ", diff)
print("Difference as a factor of dt: ",
(diff / 1E9) / (1.0 / sampling_rate_in_sec)) Output:
|
Is this requirement talking about the precision of the sampling rate ? If it's the first (high precision), which I think it is, the requirement should be renamed as Provide support for high precision sampling rates |
miniSEED 2.4 can already store a single precision floating point sampling rate with the help of blockette 100. Thus it already supports a huge range and at least this functionality must be retained. So my interpretation is that this requirement is about the precision and about choosing a single or double precision floating point sampling rate (or some alternative representation with a similar or better accuracy). |
Summary(Please let me know if I missed a point or misunderstood something) Please vote on:
|
yes |
|
yes |
|
Support high sample rates (topic) is different than specifying a precision for the sample rate.
|
Yes, if we want for instance to open to laboratory experiments on rock samples |
|
2 similar comments
|
|
Provide support for high sampling rates.
The text was updated successfully, but these errors were encountered: