mardi 2 juillet 2019

Select data in a list with an IF-statement

I'm trying to do a fit in some data that I have, but since it's too large I want to make it do a fit only in the first 50 lines of data so I can see how well it works. I already have a while loop that iterates over the entire data, however, I want put it inside an IF-statement so it'll look only at the first 50 values of the list

I tried using the range function but that doesn't do what I described.

yDataLoc = yData
 startValues = [ max(yData ) ]
 counter = 0
 if yDataLoc in yDataLoc[:50]:
      while max( yDataLoc ) - min( yDataLoc ) > .1e-11:
         counter += 1
         if counter > 5: ### max 20 peak...emergency break to avoid infinite loop
             break

I expected this to go through the first 50 items in the array but it's not working.

Aucun commentaire:

Enregistrer un commentaire