clustertools.cluster.operations module

Perform an operation on a cluster and return a new cluster

clustertools.cluster.operations.add_rotation(cluster, qrot)[source]

Add a degree of rotation to an already generated StarCluster

Parameters:
clusterclass

StarCluster

qrotfloat

fraction of stars with v_phi < 0 that are switched to vphi > 0

Returns:
x,y,z,vx,vy,vzfloat

stellar positions and velocities (now with rotation)

clustertools.cluster.operations.from_amuse(cluster)[source]

Convert stellar positions/velocities, centre of mass, and orbital position and velocity fronm AMUSE Vector and Scalar Quantities to pckms

Parameters:
clusterclass

StarCluster

Returns:
None
History:
2022 - Written - Webb (UofT)
clustertools.cluster.operations.reset_nbody_scale(cluster, mass=True, radii=True, rvirial=True, projected=False, **kwargs)[source]

Assign new conversions for real mass, size, and velocity to Nbody units

  • kwargs are passed to the virial_radius function. See the virial_radius documenation in functions.py

Parameters:
clusterclass

StarCluster instance

massbool

find new mass conversion (default: True)

radiibool

find new radius conversion (default: True)

rvirialbool (default: True)

use virial radius to set conversion rate for radii as opposed to the approximation that rbar=4/3 rm

projectedbool

use projected values to calculate radius conversion (default: False)

Returns:
zmbarfloat

mass conversion

rbarfloat

radius conversion

vbarfloat

velocity conversion

tbarfloat

time conversion

History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.return_cluster(cluster, units0, origin0, rorder0, rorder_origin0, sortstars=False, centre_method=None)[source]

return cluster to a specific combination of units and origin

Parameters:
clusterclass

StarCluster

units0str

units that StarCluster will be changed to

origin0str

origin that StarCluster will be changed to

sortstarsbool

sort star by radius after coordinate change (default: False)

centre_methodstr

method for shifting coordinates to clustercentric coordinates (see to_cluster). (default: None)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.save_cluster(cluster)[source]

Save cluster’s units and origin

Parameters:
clusterclass

StarCluster

Returns:
cluster.units, cluster.originstr

units and origin of StarCluster

History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.to_WDunits(cluster, analyze=True)[source]

Convert stellar positions/velocities, centre of mass, and orbital position and velocity to Walter Dehnen Units

Parameters:
clusterclass

StarCluster

analyzebool

run analysis function (default: True)

Returns:
None
History:
2022 - Written - Webb (UofT)
clustertools.cluster.operations.to_amuse(cluster, analyze=True)[source]

Convert stellar positions/velocities, centre of mass, and orbital position and velocity to AMUSE Vector and Scalar Quantities

Parameters:
clusterclass

StarCluster

analyzebool

run analysis function (default: True)

Returns:
None
History:
2022 - Written - Webb (UofT)
clustertools.cluster.operations.to_audays(cluster)[source]

Convert binary star semi-major axis and periods to solar radii and days

Parameters:
clusterclass

StarCluster

Returns:
None
clustertools.cluster.operations.to_centre(cluster, sortstars=True, centre_method=None)[source]

Shift coordinates such that origin is the centre of mass

Parameters:
clusterclass

StarCluster

sortstarsbool

sort star by radius after coordinate change (default: False)

centre_methodstr

method for shifting coordinates to clustercentric coordinates (see to_cluster). (default: None)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.to_cluster(cluster, sortstars=True, centre_method=None)[source]

Shift coordinates to clustercentric reference frame

  • When units=’radec’ and origin=’sky’, the cluster will be shifted to clustercentric coordinates using either:

–centre_method=None: angular distance between each star’s RA/DEC and the RA/DEC of the cluster’s centre with proper motions directly subtracted off –centre_method=’orthographic’ , positions and velocities changed to orthnormal coordinates (Helmi et al. 2018) – centre_method=’VandeVen’ , positions and velocities changed to clustercentric coordinates using method outlined by Van de Ven et al. 2005

  • Note the the line of site positions and velocities will just have the galactocentric coordinates of the cluster

subtracted off. Be sure to set projected=True when making any calculations to use only x and y coordinates

Parameters:
clusterclass

StarCluster

sortstarsbool

sort star by radius after coordinate change (default: False)

centre_methodstr

method for shifting coordinates to clustercentric coordinates. (default: None)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.to_galaxy(cluster, sortstars=True)[source]

Shift coordinates to galactocentric reference frame

Parameters:
clusterclass

StarCluster

sortstarsbool

sort star by radius after coordinate change (default: False)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.to_galpy(cluster, analyze=True)[source]

Convert stellar positions/velocities, centre of mass, and orbital position and velocity to galpy units

Parameters:
clusterclass

StarCluster

analyzebool

run analysis function (default: True)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.to_kpcgyr(cluster, analyze=True)[source]

Convert stellar positions/velocities, centre of mass, and orbital position and velocity to kpc and kpc/Gyr

Parameters:
clusterclass

StarCluster

analyzebool

run analysis function (default: True)

Returns:
None
History:
2022 - Written - Webb (UofT)
clustertools.cluster.operations.to_kpckms(cluster, analyze=True)[source]

Convert stellar positions/velocities, centre of mass, and orbital position and velocity to kpc and km/s

Parameters:
clusterclass

StarCluster

analyzebool

run analysis function (default: True)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.to_nbody(cluster, analyze=True)[source]

Convert stellar positions/velocities, centre of mass, and orbital position and velocity to Nbody units

  • requires that cluster.zmbar, cluster.rbar, cluster.vbar are set (defaults are 1)

Parameters:
clusterclass

StarCluster

analyzebool

run analysis function (default: True)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.to_origin(cluster, origin, sortstars=True, centre_method=None)[source]

Shift cluster to origin as defined by keyword

Parameters:
clusterclass

StarCluster

originstr

origin of coordinate system to be shifted to (centre, cluster, galaxy, sky)

sortstarsbool

sort star by radius after coordinate change (default: False)

centre_methodstr

method for shifting coordinates to clustercentric coordinates (see to_cluster). (default: None)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.to_pckms(cluster, analyze=True)[source]

Convert stellar positions/velocities, centre of mass, and orbital position and velocity to pc and km/s

Parameters:
clusterclass

StarCluster

analyzebool

run analysis function (default: True)

Returns
——-
None
clustertools.cluster.operations.to_pcmyr(cluster, analyze=True)[source]

Convert stellar positions/velocities, centre of mass, and orbital position and velocity to pc and pc/Myr

Parameters:
clusterclass

StarCluster

analyzebool

run analysis function (default: True)

Returns:
None
History:
2022 - Written - Webb (UofT)
clustertools.cluster.operations.to_radec(cluster, sortstars=True, centre_method=None, analyze=True)[source]

Convert to on-sky position, proper motion, and radial velocity of cluster

Parameters:
clusterclass

StarCluster

sortstarsbool

sort star by radius after coordinate change (default: False)

centre_methodstr

method for shifting coordinates to clustercentric coordinates (see to_cluster). (default: None)

analyzebool

run analysis function (default: True)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.to_sky(cluster, sortstars=True, centre_method=None)[source]

Calculate on-sky position, proper motion, and radial velocity of cluster

  • Also changes units to radec

Parameters:
clusterclass

StarCluster

sortstarsbool

sort star by radius after coordinate change (default: False)

centre_methodstr

method for shifting coordinates to clustercentric coordinates. (default: None)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.to_sudays(cluster)[source]
Convert binary star semi-major axis and periods to solar radii and days

Note: Masses will be converted to solar masses

Parameters:
clusterclass

StarCluster

Returns:
None
clustertools.cluster.operations.to_units(cluster, units)[source]

Convert stellar positions/velocities, centre of mass, and orbital position and velocity to user defined units

Parameters:
clusterclass

StarCluster

unitsstr

units to be converted to (nbody,galpy,pckms,kpckms,radec)

Returns:
None
History:
2018 - Written - Webb (UofT)
clustertools.cluster.operations.virialize(cluster, qvir=0.5, specific=True, full=True, projected=False, softening=0.0)[source]

Adjust stellar velocities so cluster is in virial equilibrium

Parameters:
clusterclass

StarCluster

qvirfloat

value you wish to virial parameter to be (default: 0.5)

specificbool

find specific energies (default: True)

full: bool

do full array of stars at once with numba (default: full_default)

projectedbool

use projected values when calculating energies (default: False)

softeningfloat

Plummer softening length in cluster.units (default: 0.0)

Returns
——-
qvfloat

scaling factor used to adjust velocities