def api(): # gets json from the post request content = request.get_json() mandel = Mandelbrot( content['RealFrom'], content['RealTo'], content['ImaginaryFrom'], content['ImaginaryTo'], content['Intervall'], content['MaxIteration'], ) # safes the array mandel2Darray = mandel.do_the_loop() # turn 2D array into 1D array mandel1Darray = mandel2Darray.ravel().tolist() return jsonify(mandel1Darray)
from mandelbrot import Mandelbrot # realFrom, realTo, imgFrom, imgTo, interval, max_iter m = Mandelbrot(-2, 1, -1, 1, 0.01, 500) m.do_the_loop() m.show_image() # print len(m.do_the_loop().ravel().tolist()) # print (1-(-2))/0.1 # (realTo - realFrom) / interval => wie viel in einer zeile, ab wann umbruch