fix find_closest_dataset() if log scale axes are used

This commit is contained in:
Stefan Frederik 2022-09-13 13:39:25 +02:00
parent d4fe981525
commit 6effda2bfc
8 changed files with 119 additions and 84 deletions

View File

@ -2527,9 +2527,6 @@ int find_closest_wave(int i, Graph_ctx *gr)
yval = G_Y(xctx->mousey);
xval = G_X(xctx->mousex);
if(gr->logx) xval = pow(10, xval);
if(gr->logy) yval = pow(10, yval);
dbg(0, "x=%g y=%g\n", xval, yval);
/* get data to plot */
my_strdup2(474, &node, get_tok_value(r->prop_ptr,"node",0));
my_strdup2(1012, &sweep, get_tok_value(r->prop_ptr,"sweep",0));
@ -2580,14 +2577,16 @@ int find_closest_wave(int i, Graph_ctx *gr)
int cnt=0, wrap;
register SPICE_DATA *gvx = xctx->graph_values[sweep_idx];
register SPICE_DATA *gvy = xctx->graph_values[idx];
dbg(1, "find_closest_wave(): dset=%d\n", dset);
first = -1;
/* Process "npoints" simulation items
* p loop split repeated 2 timed (for x and y points) to preserve cache locality */
prev_prev_x = prev_x = 0;
last = ofs;
dbg(1, "find_closest_wave(): xval=%g yval=%g\n", xval, yval);
for(p = ofs ; p < ofs + xctx->graph_npoints[dset]; p++) {
if(gr->logx) xx = mylog10(gvx[p]);
else xx = gvx[p];
else xx = gvx[p];
if(gr->logy) yy = mylog10(gvy[p]);
else yy = gvy[p];
wrap = (sweep_idx == 0 && cnt > 1 && XSIGN(xx - prev_x) != XSIGN(prev_x - prev_prev_x));

View File

@ -1,4 +1,5 @@
v {xschem version=3.0.0 file_version=1.2 }
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {}
V {}
@ -1458,13 +1459,10 @@ cwtAyKwqggMC8z8AAABAXz/APixDHOviNio/cIyWTt0GHEAHmaX3NW0zQHJvU5F/bTNA3V5CW3kqoL85
UsA+"
}
C {test_ac.sym} 160 -210 0 0 {name=x15}
C {test_ac_xyce.sym} 160 -170 0 0 {name=x16}
C {rom8k.sym} 480 -730 0 0 {name=x17}
C {poweramp_xyce.sym} 480 -650 0 0 {name=x18
tclcommand="xschem descend"}
C {test_doublepin.sym} 160 -130 0 0 {name=x19}
C {test_doublepin.sym} 160 -170 0 0 {name=x19}
C {classD_amp.sym} 480 -770 0 0 {name=x20}
C {delta_sigma.sym} 480 -610 0 0 {name=x21}
C {solar_panel.sym} 480 -570 0 0 {name=x22}
C {test_extracted_netlist.sym} 160 -90 0 0 {name=x23
C {delta_sigma.sym} 480 -650 0 0 {name=x21}
C {solar_panel.sym} 480 -610 0 0 {name=x22}
C {test_extracted_netlist.sym} 160 -130 0 0 {name=x23
tclcommand="xschem descend"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,5 @@
v {xschem version=3.0.0 file_version=1.2 }
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {}
V {}
@ -30,7 +31,7 @@ unitx=n
node="cal
saout"
color="4 5"
}
dataset=-1}
B 2 260 -1220 720 -1090 {flags=graph
y1 = 0.647319
y2 = 0.652563
@ -43,7 +44,7 @@ subdivx=4
node="plus
minus"
color="4 5"
dataset=3}
dataset=-1}
T {CAL} 140 -180 0 1 0.4 0.4 {}
T {EN} 140 -130 0 1 0.4 0.4 {}
T {CALIBRATION

View File

@ -1,4 +1,5 @@
v {xschem version=3.0.0 file_version=1.2 }
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {}
V {}
@ -14,7 +15,7 @@ C {lab_pin.sym} 180 -260 0 1 {name=l6 sig_type=std_logic lab=IPLUS}
C {lab_pin.sym} 180 -210 0 1 {name=l1 sig_type=std_logic lab=IMINUS}
C {lab_pin.sym} 450 -240 0 0 {name=l2 sig_type=std_logic lab=IOUT}
C {lab_pin.sym} 450 -120 0 0 {name=p35 lab=0}
C {bsource.sym} 450 -150 0 1 {name=B1 VAR=V FUNC="'OFFSET + AMPLITUDE/2*(tanh(V(IPLUS,IMINUS)*300))'"
C {bsource.sym} 450 -150 0 1 {name=B1 VAR=V FUNC="\{OFFSET + AMPLITUDE/2*(tanh(V(IPLUS,IMINUS)*300))\}"
}
C {title.sym} 160 -30 0 0 {name=l3 author="Stefan Schippers"}
C {res.sym} 570 -240 1 0 {name=R1