[SciPy-Dev] First contact

Roberto Bucher roberto.bucher at supsi.ch
Wed Aug 11 11:55:10 EDT 2010


Thanks Derek

I solved the problem by changing the lines
    # Avoid leading zeros in num
    num=num[0]
    
    while num[0]==0:
        num=num[1:]

with these lines
    # Avoid leading zeros in num
    [num,den]=normalize(num,den)

Best regards

Roberto

On Wednesday 11 August 2010 17:02:59 Derek Homeier wrote:
> Hi Roberto,
> 
> welcome to the list!
> 
> > The first problem was related with the function "ss2tf" which gives
> > as return
> > numerator a 2 dimensional array, not more usable by the print
> > function of the
> > 
> > class. I added these lines at the end of the function:
> >    # Avoid leading zeros in num
> >    num=num[0]
> >    
> >    while num[0]==0:
> >        num=num[1:]
> > 
> > but I don't want to get problems with other modules...
> 
> I must admit I have no idea what this output is typically supposed to
> look like,
> but I note that in the first step you are already replacing a 2D-array
> with its first
> 1D-element, which is probably not desired if you have input with
> D.shape[0] > 1.
> The print function of which class are you referring to BTW?
> 
> For the second part, you could replace the "while" loop with a numpy
> operation:
> 
> num = num[num.nonzero()[0][0]:]
> 
> HTH,
> 										Derek

-- 
-----------------------------------------------------------------------------
Coltivate Linux! Tanto Windows si pianta da solo...
-----------------------------------------------------------------------------
University of Applied Sciences of Southern Switzerland
Dept. Innovative Technologies
CH-6928 Lugano-Manno
http://web.dti.supsi.ch/~bucher



More information about the SciPy-Dev mailing list