Utilities¶
Plotting¶
There exists several built in plotting tools to help visualize a StarCluster
.
Functions¶
|
Plot the xy/xz/yz coordinates of each star in the cluster |
|
Plot the ra/dec or pmra/pmdec coordinates of each star in the cluster |
Output¶
There exists several built in tools for creating standardized output files.
Functions¶
|
Output a snapshot in clustertools format |
|
Output simple stellar evolution information in clustertools format |
|
Output a snapshot in NBODY6 fort.10 format |
|
Output a snapshot in gyrfalcon/NEMO format |
It is of course possible to include custom output functions, which for simplicity could be put in the custom folder which is imported. As an example I have included custom_outputs.py
that demonstrates several output functions that I frequently use.
Coordinates¶
While coordinate transformations to a StarCluster
are handled via Operations, users may find the below functions helpful if trying to manually do some coordinate transformations. Note that several of these functions (cart_to_cyl
,``sky_coords``,``cart_to_sky``) are wrappers around galpy
coordinate transformations.
Functions¶
|
Get the spherical coordinates of every star in the cluster |
|
Convert cartesian coordinates to spherical coordinates |
|
Convert cartesian coordinates to spherical coordinates |
|
Get the cylindrical coordinates of every star in the cluster |
|
Convert cartesian coordinates to cylindrical coordinates |
|
Convert cylindrical coordinates to cartesian coordinates |
|
Get the sky coordinates of every star in the cluster |
|
Convert cartesian coordinates to sky coordinates |
Recipes¶
Finally, several functions that are used throughout StarCluster
that users may find helpful are listed below.
Functions¶
|
Split an array into bins with equal numbers of elements |
|
Split an array into bins of equal width |
|
Split an array into bins with equal numbers of elements |
|
Split an array into bins of equal width with a roaming average |
|
Generate points from a power-law distribution function |
|
Find distribution function using nx bins |
|
Find distribution function using nx bins |
|
Find histogram data using nx bins |
|
Calculate mean profile of parameter y that depends on x |
|
Smooth a profile |
|
Perform simple linear interpolation between two points in 2D |
Find distance to each point's nearest neighbour |
|
|
Find distance between two points (made for use with numba) |
Constants¶
For convenience purposes, a few constants are saved to be used globally throughout clustertools
. A function that prints the conversion table between kw
and stellar evolution type, as discussed in Cluster is also included here.
Functions¶
|
Legend for converting kwtype (from NBODY6) to stellar evolution type |