Skip to content

Instantly share code, notes, and snippets.

@fabiofortkamp
Created October 7, 2019 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiofortkamp/ba1fbdc51a6ed1f67d12939721ef9f28 to your computer and use it in GitHub Desktop.
Save fabiofortkamp/ba1fbdc51a6ed1f67d12939721ef9f28 to your computer and use it in GitHub Desktop.
How to calculate radial remanence directions
import numpy as np
# example input parameters
phi_S_IV = 50
# how much each segment occupies of the whole magnet region
fractions_phi = np.array([20,20,20,20,20])
assert sum(fractions_phi) == 100
# vector of segment angular widths
delta_phi_S_values = np.array(fractions_phi)/100 * phi_S_IV
# vector of initial angular coordinates of each segment
phi_initial = np.append(np.array([0,]),np.cumsum(delta_phi_S_values)[:-1])
phi_final = phi_initial + delta_phi_S_values
alpha_radial = (phi_initial + phi_final)/2
print(alpha_radial)
@fabiofortkamp
Copy link
Author

This snippet corresponds to the problem of finding the remanence angles following this schematic figure:

radial

There are $n_{\mathrm{IV}}$ wedge-like segments, each with its inital and final angular coordinates; each segment is represented by the index $k$. Their "angular widths" $\Delta \phi_k$ are equivalent to the differences between final and initial angular coordinates.

The code calculates the angular coordinates of the center point of each segment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment