Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 28b440a602d8
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 946ef1ba79c5
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Jul 24, 2020

  1. Copy the full SHA
    946ef1b View commit details
Showing with 15 additions and 4 deletions.
  1. +13 −3 scopehal/TouchstoneParser.cpp
  2. +2 −1 scopeprotocols/DeEmbedDecoder.cpp
16 changes: 13 additions & 3 deletions scopehal/TouchstoneParser.cpp
Original file line number Diff line number Diff line change
@@ -100,6 +100,7 @@ SParameterPoint SParameterVector::InterpolatePoint(float frequency)
//If values have opposite signs, but are smallish, we cross at 0 vs +/- pi, so also no wrapping needed.
if(
( (phase_hi > 0) && (phase_lo > 0) ) ||
( (phase_hi < 0) && (phase_lo < 0) ) ||
( (fabs(phase_hi) < M_PI_4) && (fabs(phase_lo) < M_PI_4) )
)
{
@@ -110,12 +111,21 @@ SParameterPoint SParameterVector::InterpolatePoint(float frequency)
//Shift everything by pi, then interpolate normally, then shift back.
else
{
phase_lo += M_PI;
phase_hi += M_PI;
//Shift the negative phase by a full circle
if(phase_lo < 0)
phase_lo += 2*M_PI;
if(phase_hi < 0)
phase_hi += 2*M_PI;

ret.m_phase = phase_lo + (phase_hi - phase_lo)*frac - M_PI;
//Normal interpolation
ret.m_phase = phase_lo + (phase_hi - phase_lo)*frac;

//If we went out of range, rescale
if(ret.m_phase > 2*M_PI)
ret.m_phase -= 2*M_PI;
}


ret.m_frequency = frequency;
return ret;
}
3 changes: 2 additions & 1 deletion scopeprotocols/DeEmbedDecoder.cpp
Original file line number Diff line number Diff line change
@@ -184,7 +184,8 @@ void DeEmbedDecoder::Refresh()
for(size_t i=0; i<nouts; i++)
{
//Resample the S-parameter file for our point
auto point = m_sparams.SamplePoint(2, 1, bin_hz * i);
float freq = bin_hz * i;
auto point = m_sparams.SamplePoint(2, 1, freq);
float cosval = cos(-point.m_phase);
float sinval = sin(-point.m_phase);