In [1]:
import math
import numpy as np
In [2]:
# start values
real_min = np.double(-2.0)
real_max = np.double(1.0)
ima_min = np.double(-1.5)
ima_max = np.double(1.5)
zoom = np.double(8552330950415.195)
print("zoom " + str(zoom))
image_width = np.int(1000)
image_height = np.int(1000)
xcoord = np.double(501.705349998)
ycoord = np.double(450.64976)
In [3]:
# calculate deltas
real_delta = np.double((real_max - real_min) / image_width)
ima_delta = np.double((ima_max - ima_min) / image_height)
In [4]:
# map image space coordinates to complex plane
xcoord_cplane = real_min + xcoord * real_delta
ycoord_cplane = ima_min + ycoord * ima_delta
# or you can alternatively use numpy interpolate
xcoord_cplane_np = np.interp(xcoord, [0, image_width], [real_min, real_max])
ycoord_cplane_np = np.interp(ycoord, [0, image_height], [ima_min, ima_max])
In [5]:
# Applying zoom to current delta
real_delta_zoom = real_delta / zoom
ima_delta_zoom = ima_delta / zoom
print("real_delta_zoom " + repr(real_delta_zoom))
print("ima_delta_zoom " + repr(ima_delta_zoom))
In [6]:
# New Complex plane derived from mapped image coordinates and zoom delta
real_min_zoom = xcoord_cplane - (image_width / 2 * real_delta_zoom)
real_max_zoom = xcoord_cplane + (image_width / 2 * real_delta_zoom)
ima_min_zoom = ycoord_cplane - (image_height / 2 * ima_delta_zoom)
ima_max_zoom = ycoord_cplane + (image_height / 2 * ima_delta_zoom)
In [7]:
print("Complex Plane:")
print("\tReal " + repr(real_min_zoom) + " " + repr(real_max_zoom))
print("\tImaginary " + repr(ima_min_zoom) + " " + repr(ima_max_zoom))
In [ ]: