Home > Community > Forums > Custom IC SKILL > Import csv data and jartListToWaveform()

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Import csv data and jartListToWaveform() 

Last post Thu, Oct 13 2011 5:42 AM by ritterp. 1 replies.
Started by ritterp 13 Oct 2011 03:57 AM. Topic has 1 replies and 1242 views
Page 1 of 1 (2 items)
Sort Posts:
  • Thu, Oct 13 2011 3:57 AM

    • ritterp
    • Not Ranked
    • Joined on Sat, Sep 18 2010
    • Crolles, Rhone
    • Posts 9
    • Points 90
    Import csv data and jartListToWaveform() Reply

     Hello,

    I apologize if this question has been asked before. In spite of its very basic nature I could not find any answer to the following problem on the cadence forums.

    From a previous simulation I have a CSV textfile with time/value pairs

    input.csv

    0.00000000000e+00 -1.10875637805e+00
    2.00000000000e-13 -1.10875643662e+00
    ....

     and the following skill code is used to import it:

    pFILE=infile("input.csv")

    if( pFILE then
    lDATA=list()
    time=0
    value=0

    while(gets( tLINE pFILE)
    time=substring(tLINE 1 17)
    value=substring(tLINE 19 18)
    lDATA=cons(list(time value) lDATA)
    )
    wDATA=artListToWaveform(lDATA)
    newWindow()
    plot(wDATA)
    )

    close(pFILE)

    Unfortunately my input.csv is pretty large (300K lines) and artListToWaveform(lDATA) crashes with a stack overflow. Moreover, the import itself is not as fast as I'd like it to be, but this is probably due to the substring function

    Is there a more efficieny way for importing large csv files? Thank you in advance.

    Regards, Phil

    • Post Points: 5
  • Thu, Oct 13 2011 5:42 AM

    • ritterp
    • Not Ranked
    • Joined on Sat, Sep 18 2010
    • Crolles, Rhone
    • Posts 9
    • Points 90
    Re: Import csv data and jartListToWaveform() Reply

    I've just came across getAsciiWave() which is much faster than my handmade solution, and, even more importantly, it does not crash at 300K lines.

    ... I knew there must be a simple solution ;-)

    • Post Points: 5
Page 1 of 1 (2 items)
Sort Posts:
Started by ritterp at 13 Oct 2011 03:57 AM. Topic has 1 replies.