vlabella / GLE

GLE - Graphics Layout Engine
BSD 3-Clause "New" or "Revised" License
23 stars 9 forks source link

Extraneous line in graph with multiple datasets on a single column #41

Open hacksterous opened 3 months ago

hacksterous commented 3 months ago

Xyce (SPICE-like circuit simulator) parameter sweep analyses put multiple datasets on the same column with time restarting at 0.0 again. In a graph, this causes a line drawn from the last point of a dataset N to the first point of dataset N + 1.

image

I have a tiny patch in GLE/src/gle/graph2.cpp that fixes the issue (new graph below):

image

I can provide the patch if anyone wants it.

rad83 commented 3 months ago

I would recommend mailing list for this type of discussion. It looks quiet there, but people listen. Anyway, if your data file contains multiple dataset in single column, you can isolate them using data [...] ignore n numrows m. I have not seen your patch, so I can not comment on your solution.

hacksterous commented 3 months ago

With GLE 4.3.3 I see this error (probably the numrows option was added later -- I will try with 4.3.5). However, Xyce doesn't keep the same numrows constant across STEP runs.

>> step.gle (11) |...p-tran.prn d1=c2,c3 d2=c2,c4 d3=c2,c5 comment End numrows 170|
>>                                                                     ^
>> Error: illegal data set identifier

The ideal fix would be to look for two blank lines like gnuplot (Xyce has a format=gnuplot specifier that inserts these blank lines after each STEP run). The fix I did was to check if the next x value is 0 and the current x value is non-0, and in that case, prevent the call to draw_vec. This is a hacky fix, however, works for me (most .TRAN simulations start at time 0).

rad83 commented 3 months ago

If I am not mistaken, the numrows option was added in 4.3.4.

I am not sure what Xyce is, but it is kind of shame it does not keep x-axis range identical over different runs.

Also, I am not sure if looking for two blank lines is the ideal solution, who knows what we could break. I would definitely prefer using different identifier without any possible previous meaning.

Finally, looking for next zero (or value lower than the previous one) is definitely not good solution as it brakes the ability to plot unsorted datasets.

In general, I am not big fan of mixing multiple datasets into single column, but as long as there is need to process such data, we should have a solution.

hacksterous commented 3 months ago

Thanks for the response. Check out Xyce.

I did a small change in my hack -- now I am keeping track of the minimum value of 'x' across datasets on the same column, and skipping the only when the next 'x' value is the minimum value. This takes care of the unordered data issue (within the same dataset). However, a better solution would be to have a gnuplot mode!

rad83 commented 3 months ago

I am keeping track of the minimum value of 'x' across datasets on the same column, and skipping the only when the next 'x' value is the minimum value. This takes care of the unordered data issue (within the same dataset).

Sorry, I don't understand. What is the actual condition to split column? Will be data [3, 6, 9, 2, 5, 8, 1, 4, 7] plotted as single set [1, 2, 3, 4, 5, 6, 7, 8, 9] or three different sets [1, 4, 7], [2, 5, 8], [3, 6, 9]? Because in my opinion, the later is not acceptable.

However, a better solution would be to have a gnuplot mode!

I am not familiar with term gnuplot model. If you are suggesting to interpret any two empty lines as column breaker, I don't think this is actually good idea. At least, it would have to be optional.

vlabella commented 3 months ago

I would hesitate to modify the way GLE reads data as it could break other people's code. In addition, these discussions are probably best for the mailing list. When data is not in the format GLE wants I usually write a script to massage it into the proper form. GLE interprets an "*" character as missing data and will skip it. also anything after "!" is ignored as a comment in a data file just like the script. Hope this helps.