Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Add inverse field distortion for nT #180

Open
ramirezdiego opened this issue Jul 2, 2021 · 0 comments
Open

Add inverse field distortion for nT #180

ramirezdiego opened this issue Jul 2, 2021 · 0 comments

Comments

@ramirezdiego
Copy link
Collaborator

ramirezdiego commented Jul 2, 2021

Issue to not lose track of this open point. The approach now for simulations is of course to not apply any FDC, since there's no distortion to correct for. But this can be reversed.

Inspiration can be taken from these lines, used for 1T (thanks @petergaemers for sharing):

WFSim/wfsim/core.py

Lines 708 to 731 in b204045

def inverse_field_distortion(x, y, z, resource):
"""For 1T the pattern map is a data driven one so we need to reverse engineer field distortion
into the simulated positions
:param x: 1d array of float
:param y: 1d array of float
:param z: 1d array of float
:param resource: instance of resource class
returns z: 1d array, postions 2d array
"""
positions = np.array([x, y, z]).T
for i_iter in range(6): # 6 iterations seems to work
dr = resource.fdc_3d(positions)
if i_iter > 0:
dr = 0.5 * dr + 0.5 * dr_pre # Average between iter
dr_pre = dr
r_obs = np.sqrt(x**2 + y**2) - dr
x_obs = x * r_obs / (r_obs + dr)
y_obs = y * r_obs / (r_obs + dr)
z_obs = - np.sqrt(z**2 + dr**2)
positions = np.array([x_obs, y_obs, z_obs]).T
positions = np.array([x_obs, y_obs]).T
return z_obs, positions

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant