Marcel Preda
Guest
Mon Nov 14, 2011 11:07 am
Hi there,
I have a ocean code which has to to some post-processing on a wave
form.
Practically I have to call value() many times (~ 3000 000) on a
waveform, and it takes some time.
I saw in the profiler that this call is most consuming.
My code is looking simmilar with the next one.
/*
@params:
wf - wave form
startF - start freq
endF - end freq
spectralRes - step freq
*/
procedure( myProc(wf startF endF spectralRes)
( let (my_freq)
my_freq = startF
while( my_freq <= endF
my_value = value( wf my_freq )
;; DO SOMETHING HERE
my_freq = my_freq + spectralRes
)
;;;
)
As you see, in the while loop I call my_value = value( wf my_freq )
lots of time.
If is possible I want to get all the values in a list, with just one
call.
something like:
l_my_values = value( wf xStart xEnd xStep)
Is it possible ?
I had a look on the value() documentation, but looks like such a call
is not possible.
Any other function which can do this ?
Thank you,
Marcel
Andrew Beckett
Guest
Wed Nov 16, 2011 2:49 pm
Marcel Preda wrote, on 11/14/11 09:07:
Quote:
As you see, in the while loop I call my_value = value( wf my_freq )
lots of time.
If is possible I want to get all the values in a list, with just one
call.
something like:
l_my_values = value( wf xStart xEnd xStep)
Is it possible ?
I had a look on the value() documentation, but looks like such a call
is not possible.
Any other function which can do this ?
Thank you,
Marcel
Marcel,
Using:
l_my_values = cadr(abWaveToList(sample(wf xStart xEnd xStep) ?transpose t))
should do this. The code for abWaveToList is here:
/* abWaveToList.il
Author A.D.Beckett
Group Custom IC (UK), Cadence Design Systems Ltd.
Language SKILL
Date Nov 17, 2003
Modified
By
Convert a waveform to a list
***************************************************
SCCS Info: @(#) abWaveToList.il 11/17/03.15:08:15 1.1
*/
/************************************************************************
* *
* (abWaveToList wave @key transpose) *
* *
* Take a waveform object, and return it as a list of xy pairs. Or *
* if transpose is set, it returns a list of x values followed by a list *
* of y values. *
* *
************************************************************************/
(procedure (abWaveToList wave @key transpose)
(let (xList yList xyList len
(xVec (drGetWaveformXVec wave))
(yVec (drGetWaveformYVec wave))
)
(setq len (drVectorLength xVec))
;-----------------------------------------------------------------
; Return value of this if is the list
;-----------------------------------------------------------------
(if transpose
(progn
(for i 0 (sub1 len)
(setq xList (tconc xList (drGetElem xVec i)))
(setq yList (tconc yList (drGetElem yVec i)))
)
(list (car xList) (car yList))
)
; else
(progn
(for i 0 (sub1 len)
(setq xyList (tconc xyList (list (drGetElem xVec i)
(drGetElem yVec i))))
)
(car xyList)
)
) ; if
) ; let
) ; procedure
Andrew
Marcel Preda
Guest
Wed Nov 16, 2011 9:32 pm
On Nov 16, 3:49 pm, Andrew Beckett <andr...@DcEaLdEeTnEcTe.HcIoSm>
wrote:
Quote:
Marcel Preda wrote, on 11/14/11 09:07:
As you see, in the while loop I call my_value = value( wf my_freq )
lots of time.
If is possible I want to get all the values in a list, with just one
call.
something like:
l_my_values = value( wf xStart xEnd xStep)
Is it possible ?
I had a look on the value() documentation, but looks like such a call
is not possible.
Any other function which can do this ?
Thank you,
Marcel
Marcel,
Using:
l_my_values = cadr(abWaveToList(sample(wf xStart xEnd xStep) ?transpose t))
should do this. The code for abWaveToList is here:
/* abWaveToList.il
Author A.D.Beckett
Group Custom IC (UK), Cadence Design Systems Ltd.
Language SKILL
Date Nov 17, 2003
Modified
By
Convert a waveform to a list
***************************************************
SCCS Info: @(#) abWaveToList.il 11/17/03.15:08:15 1.1
*/
/************************************************************************
* *
* (abWaveToList wave @key transpose) *
* *
* Take a waveform object, and return it as a list of xy pairs. Or *
* if transpose is set, it returns a list of x values followed by a list *
* of y values. *
* *
************************************************************************/
(procedure (abWaveToList wave @key transpose)
(let (xList yList xyList len
(xVec (drGetWaveformXVec wave))
(yVec (drGetWaveformYVec wave))
)
(setq len (drVectorLength xVec))
;-----------------------------------------------------------------
; Return value of this if is the list
;-----------------------------------------------------------------
(if transpose
(progn
(for i 0 (sub1 len)
(setq xList (tconc xList (drGetElem xVec i)))
(setq yList (tconc yList (drGetElem yVec i)))
)
(list (car xList) (car yList))
)
; else
(progn
(for i 0 (sub1 len)
(setq xyList (tconc xyList (list (drGetElem xVec i)
(drGetElem yVec i))))
)
(car xyList)
)
) ; if
) ; let
) ; procedure
Andrew
Hi Andrew,
Thanks a lot.
I see now that your abWaveToList code is 8 years old, looks like I did
search enough on the web :(
Best Reagrds,
Marcel