Solved by tom in post #2 
              
              
                Don’t use linspace here but use arange. linspace uaes floating point under the hood more and that isn’t a good match with largeish integers. 
Bestregards 
Thomas