Closed houserockr closed 1 year ago
The Standard Data Format (SDF) is defined in Appendix B of the "Standard Data Format Utilities User's Guide" version B.02.01, P/N 5963-1715. Figure B-6 shows the file structure and Table B-1 shows common records. Page B-27 starts the section Reconstructing a Trace, which has information calculating the x-values and y-values for a trace. I think that's your best bet to answer your questions.
Per the SDF Utilities User's Guide, the x-values are calculated as follows, since your x_resolution_type is logarithmic:
x0 = abscissa_firstX x1 = x0 abscissa_deltaX x2 = x0 abscissa_deltaX^2 x3 = x0 abscissa_deltaX^3 . . . xn = x0 abscissa_deltaX^n (where n = num_of_points - 1)
given
abscissa_delta_x = 1.0174193661806048 abscissa_first_x = 20.0
x0 = 20 Hz x1 = 20.34838732 Hz x2 = 20.70284333 Hz x3 = 21.063473742594 Hz x400 = 19999.9999999607 Hz
In line 234, I needed to add value 4 to the data_type_decoder dict. No idea what it refers to, unfortunately. I just gave it an arbitrary name and it worked. No biggie.
I hadn't added all the data_type_decoder
values. I'll add 4, which is Frequency response
.
I needed to comment line 585, where you're trying to incorporate the channel_correction_factor with the np.sqrt(2) division. That didn't work for an entire array of data. Maybe it's even a subsequent error. Also, no biggie imho.
I was cheating, since I've only read data from an HP 35670A. This section of code needs to be cleaned up.
Looks like your y-data is complex ('y_is_complex': True,), which I believe means the real and imaginary values are interleaved. Assuming any factors/corrections were applied appropriately, it appears that:
y0 = -3.43252532e-02 + j2.08524466e-01 y1 = -3.20427716e-02 + j2.12265164e-01
It also looks like I'm returning the wrong number of y-values when the values are complex.
Thanks for getting back! The reconstruction of a trace on page B-27 is absolute gold! Thanks for sharing! Finally it makes sense :) I think you're right about the number of points, I'm getting n=400, when in fact I get 200 points each of which being a complex value. Also, thanks for pointing out that my y values are complex, I wouldn't have figured that out on my own. But in that case, it makes total sense to interleave both real and imaginary values like that.
The only thing is, now I don't really know how to interpret the y values. You were right, the trace shows a frequency response of a guitar effects pedal from 20-20kHz. However, I was expecting the y values to be scalar values representing the amplitude of the signal in dB. Can I simply take the real values or do I have to sqrt(real^2 + img^2)
?
I updated the code (v0.7.0) to return the y-data as python complex numbers when y_is_complex is true in the header file. You should be able to use abs()
to determine the magnitude of the data.
There was an error in handling the complex data, which I believe is now fixed in v0.8.2. I created a sample repository that plots the data for the FRTONMAX.DAT
, FRTONMID.DAT
, and FRTONMIN.DAT
files. The plots match what is shown at Ibanez TS-9 Tube Screamer on the bench, so I believe this issue is resolved and ready to be closed.
Thank you so much for all the info and the fixes of course.
I tested it and it works like a charm!
The only line of code I "stole" from your create_plot.py
is:
y_data = 20 * np.log10(np.abs(sdf_data))
:)
I learned a lot about SDF format and HP analyzers.
Here's a piece of rationale why I'm doing this: I wanted to figure out, where the TS effects pedal starts to "cut" low frequencies, i.e. where the graph crosses the zero line in the lows. Seems to be at around 170Hz. That's useful information for guitarists :)
Glad I could help. The sdfascii library is better for it and now supports more than just FFT measurements from an HP35670A.
FYI: I moved the sample repository to https://github.com/matthewrankin/sdfascii-examples
Hi there,
your lib (almost) made my day, because I've been trying to read data from this website. It contains traces of a frequency response analysis of a guitar effects pedal.
Spoiler alert: this falls in the "help needed" category, I couldn't select this while writing the issue.
I tried to read the following file with your lib and it kinda worked at the end, but I needed to make some changes and I ended up with three major questions. The file: https://heartfx.net/ts9/disk/FRTONMID.DAT
What I changed:
data_type_decoder
dict. No idea what it refers to, unfortunately. I just gave it an arbitrary name and it worked. No biggie.channel_correction_factor
with thenp.sqrt(2)
division. That didn't work for an entire array of data. Maybe it's even a subsequent error. Also, no biggie imho.The data:
The questions:
abscissa_first_x: 20
(Hz) and then dividing the entire frequency range (20Hz - 20kHz) by the number of points (401 in this case) and I'm getting the following plot.Which absolutely irritates me, because it seems as if there are actually two sets of data kind of interleaved in there. What's happening there? I mean one of the graphs actually looks almost right. That hump shouldn't be at 16k, but at 10k. But that could have something to do with log vs. linear scale. But where's the second graph coming from?
I would appreciate ANY hint on how to correctly interpret this weird SDF format by HP. I can only find tiny pieces of information online, it seems as if this is very closed source. :(