Printing waveforms in current plot window in AWD

Discussion in 'Cadence' started by Svenn Are Bjerkem, Aug 9, 2007.

  1. Hi,

    I have a problem printing the waveforms from an AWD window into a
    result window.

    What I have tried so far:

    (setq plotWin (window 5))
    (awvPrintWaveform plotWin->awvWaveInfoDpl->subwinArr[0]->plotWaveList)

    Which give me error messages like:
    *Error* unknown data type drwave:229167128
    one for each waveform in the window.

    I then try to assign some waveforms to variables:
    (setq w1 (car plotWin->awvWaveInfoDpl->subwinArr[0]->plotWaveList))
    (setq w2 (cadr plotWin->awvWaveInfoDpl->subwinArr[0]->plotWaveList))
    (setq w3 (caddr plotWin->awvWaveInfoDpl->subwinArr[0]->plotWaveList))
    (setq w4 (cadddr plotWin->awvWaveInfoDpl->subwinArr[0]->plotWaveList))

    (awvPrintWaveform w1 w2 w3 w4)

    Which works.

    plotWin->awvWaveInfoDpl->subwinArr[0]->plotWaveList alone return
    (drwave:229167128 drwave:229167152 drwave:229167176 drwave:229167200
    drwave:229167224)
    which to me looks like a list.

    Finder tells me that awvPrintWaveform needs to have each waveform
    listed separately even if the explanatory text claims that it prints a
    list, it doesn't, at least not for me.

    Then I try:
    foreach waveForm plotWin->awvWaveInfoDpl->subwinArr[0]->plotWaveList
    awvPrintWaveform(waveForm)
    which works in the sense that it gives me one print window per
    waveform. This will give me one file per waveform, and is not quite
    what I need.

    I need some kind of solution which takes a list of objects and
    dissolve them in a sequence of variables. This is probably a lamda or
    a mapcar, but I don't get it right.

    Any ideas?
     
    Svenn Are Bjerkem, Aug 9, 2007
    #1
  2. Hi again,

    I was playing around a bit to solve this problem and found a possible
    solution:

    ; First I get the list of all the waves from the wanted waveform
    window
    (setq wlist (plotWin->awvWaveInfoDpl->subwinArr[0]->plotWaveList)

    ;Then I get a list of the x-axis data with sweepValues
    ; Assuming all waves have same length I just grab from the first wave
    in list
    setq xlist (sweepValues (car wlist))

    ; Then I use mapcar to iterate over those x-coordinates and for each
    waveform
    ; extract the y-value at that x with value() and send it off to printf
    to get it
    (foreach mapcar x xlist (printf "\n%L" x) (foreach mapcar obj l
    (printf "\t%L" (value obj x))))

    Problem as far as I see is that I get a lot of annoying (t t t) lines
    towards the end:
    (from CDS.log)
    .....
    \o 4.981806e-09 0.0008387304 0.0008722564 0.0009083612
    \o 4.990903e-09 0.0008422031 0.0008751578 0.0009107513
    \t 5e-09 0.0008463219 0.0008790259 0.0009143342((t t t)
    \t (t t t)
    \t (t t t)
    \t (t t t)
    ....

    I guess it is printf which wants to show how successful it was, but I
    eventually want to write to file so I probably don't care. I am
    looking for a better solution that also is able to print the name of
    the waveform at the top. I get this from the awvGetWaveNameList() but
    I am not sure if the sequence of waveform expression names are always
    the same as the one from plotWin->awvWaveInfoDpl->subwinArr[0]-
    functionality, and hours/codeline is now wandering off to infinity....
     
    Svenn Are Bjerkem, Aug 17, 2007
    #2
  3. I have been fiddling with the script a little bit more and came up
    with something that actually can be copy-pasted into your CIW in case
    somebody would like to help debugging. I have currently two issues:
    1) I get one more heading column than I actually have data for.
    2) I do not know if the headings are actually aligned with their data.

    I currently don't know the reason for 1)

    For 2) I use two different ways of getting the data:
    For the header I use the resulting list of awvGetWaveNameList and for
    the data I use the awful awvWaveInfoDpl->subwinArr[0]->plotWaveList
    which also the awv save state uses. I would have liked to use the
    first list of indexes that awvGetWaveNameList spits out, but I have so
    far not been able to connect those numbers to the internal data of the
    AWD window. I will probably come up with a solution as time goes by,
    but I am thankful for any advice that make the search for a solution
    easier.

    Be careful with monte-carlo plots as excel may choke on too many
    columns or rows :)

    Now, here it is:

    (hiSetBindKey "awv" "ShiftCtrl<Key>p" "(SABprintWaveform
    hiGetCurrentWindow())")
    (procedure (SABprintWaveform winId)
    (let (fp header x xlist wlist obj)
    (setq fp (outfile "printedWaves.txt"))
    (setq header (buildString (cadr (awvGetWaveNameList winId)) "\t"))
    (fprintf fp "time\t%s" header)
    (setq wlist winId->awvWaveInfoDpl->subwinArr[0]->plotWaveList)
    (setq xlist (sweepValues (car wlist)))
    (foreach mapcar x xlist (fprintf fp "\n%L" x)
    (foreach mapcar obj wlist (fprintf fp "\t%L" (value obj x))))
    (fprintf fp "\n")
    (close fp)
    )
    )
     
    Svenn Are Bjerkem, Aug 19, 2007
    #3
  4. < stuff snipped >

    Well, if you use wavescan, you can simply select the waveforms in the graph, and
    hit the table icon and it will "print" them to a table window directly within
    the tool...

    Regards,

    Andrew.
     
    Andrew Beckett, Sep 16, 2007
    #4
  5. The only way you are going to get me using Wavescan is to EOL AWD. :)
     
    Svenn Are Bjerkem, Sep 19, 2007
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.