-
Notifications
You must be signed in to change notification settings - Fork 0
Shell Analysis Documentation
The implementation can be found in ~/lib/constant_density_shells.py
This portion of the code determines if a shell of (2D) data is constant density. Since shells can be any odd shape, calculating the exact expected eigenvalues of a constant density shell can get very complicated. Instead, we create a shell of constant density with the same dimensions and find the eigenvalues and vectors of the distribution. Then we can compare to the data shell to determine if it's consistent with a constant density shell.
There is only one function call required to retrieve the eigenvalues/eigenvectors of a constant-density shell:
shell_fit_2D(p, lower_ellipse, sep, guesses_per_branch=50, numiter=2, b_upper_guess=None, b_resolution=None, alpha_resolution=2*np.pi/3)
Finds the best fit semi-minor axis that gives eigenvectors closest to a constant density shell of specified dimensions. Tests are parallelized and optimized.
Input
-
p: position data for N stars in cluster (nd-array, size=[2,N]) -
lower_ellipse: (semi-major length, semi-minor length, alpha) for the inner ellipse (tuple) [alpha is optional] -
sep: semi-major axis separation (float) -
guesses_per_branch: (optional) the number of guesses for each resolution depth. Higher number means a more dense guess grid. (int, default:50) -
numiter: (optional) number of times to zoom in on best value. Higher number means a more precise semi-minor axis value. (int, default:2) -
b_upper_guess: (optional) initial guess as to the best b value. (float, default: given the initial separation, will start at an ellipse that has the same semi-major/semi-minor ratio) -
b_resolution: (optional) range for the guesses. (float, default: value ofsep)
Output
-
upper_ellipse: (semi-major length, semi-minor length, alpha) for the best-fit outer ellipse (tuple)
If shell analysis is run multiple times, calculates the averages and standard error of the set of runs.
Input
-
Ms: list of fit eigenvalues for each run (Mx, My, Mz) (list) -
evecs: list of fit eigenvectors for each run (Vx, Vy, Vz) (2D list)
Output
-
M_avg: average M (1D array) -
evecs_avg: average evecs [TODO] -
err: standard error of M measurements
Extracts the best fit eigenvalues of the mass matrices for a constant density ellipse, with density num_stars/(area of shape). If the ellipses are rotated, the angle alpha can be added to the lower_ellipse or upper_ellipse argument as shown below.
Input
-
lower_ellipse: (semi-major length, semi-minor length, alpha) for the inner ellipse (tuple) [alpha is optional] -
upper_ellipse: (semi-major length, semi-minor length, alpha) for the outer ellipse (tuple) [alpha is optional] -
num_stars: number of stars in the shell. This will determine how dense the shape is. The more dense, the more accurate the results, but also the slower the calculation (int)
Output
-
M: list of best-fit eigenvalues (Mx, My, Mz) (list) -
evecs: list of best-fit eigenvectors (Vx, Vy, Vz) (2D list)
References:
- Hong, J., Kim, E., Lee, H. M., & Spurzem, R. (2013). Comparative study between N-body and Fokker–Planck simulations for rotating star clusters – II. Two-component models. Monthly Notices of the Royal Astronomical Society, 430(4), 2960-2972. doi:10.1093/mnras/stt099