Skip to content

Simulate

See also: introductory tutorial on how to simulate a cluster.

ocelot.simulate.cluster.SimulatedCluster ¤

A class for simulating and keeping track of a simulated cluster - including its original membership list and any observations simulated from it.

This class is the main entry point in ocelot for simulating star clusters.

Parameters:

Name Type Description Default
parameters SimulatedClusterParameters or dict

Parameters of the simulated cluster to generate. Should be a SimulatedClusterParameters object, but may also be a dict with keys for required parameters such as position, etc.

required
models (SimulatedClusterModels, dict or None)

SimulatedClusterModels object or dict containing models used to overwrite or augment certain simulation features. Default: None

None
prune_simulated_cluster str

Optional string used early during cluster simulation to prune a simulated cluster. Will be passed to pandas.DataFrame.query(). It can access parameters read directly from cluster isochrones, including magnitude, temperature, and luminosity. Default: ""

''
random_seed int or None

Random seed to use for cluster generation. When set, cluster generation with the same seed should be identical. Default: None

None
features SimulatedClusterFeatures or dict or None

A SimulatedClusterFeatures or dict object specifying features of cluster generation to turn off. Mostly intended to aid with testing. Default: None

None
observations list of str or None

List of observations to generate. Soon to be deprecated; do not use.

None

Attributes:

Name Type Description
isochrone DataFrame

Dataframe containing the isochrone used to simulate this cluster.

cluster DataFrame

Dataframe containing the true members of the cluster.

observations dict of pd.DataFrame

Dict of dataframes, with each one containing a different observation of the same cluster.

_check_if_has_enough_stars() ¤

Checks if the cluster has enough stars.

make() ¤

Makes entire cluster according to specification set at initialization.

This is the main function that should be used to simulate a cluster.

Returns:

Type Description
SimulatedCluster

A reference to the SimulatedCluster object.

make_cluster() ¤

Creates the true stars and positions in a cluster.

In general, just calling .make() is the recommended method for most users.

Returns:

Type Description
SimulatedCluster

A reference to the SimulatedCluster object.

make_observations() ¤

Makes all observations of the cluster.

In general, just calling .make() is the recommended method for most users.

Returns:

Type Description
SimulatedCluster

A reference to the SimulatedCluster object.

make_observation(survey, seed=None) ¤

Makes one observation of the cluster.

In general, just calling .make() is the recommended method for most users.

Parameters:

Name Type Description Default
survey str

Name of the survey (i.e. name in self.observations) to make.

required
seed None

Seed used to reseed the random generator. Useful for doing multiple different simulated observations of the same cluster. May not be supported by all cluster observation models. Default: None, meaning that the current cluster random number generator generated from the seed specified during class initialization is used.

None

Returns:

Type Description
DataFrame

The simulated cluster observation made by this method.

ocelot.simulate.cluster.SimulatedClusterParameters dataclass ¤

Class for keeping track of parameters specified for a cluster to simulate.

Parameters:

Name Type Description Default
position SkyCoord

Position of the cluster as an astropy SkyCoord. Must have full 3D distance and 3D velocity information.

required
mass float

Mass of the cluster in solar masses.

required
log_age float

Age of the cluster in log (base 10) years.

required
metallicity float

The metallicity of the cluster, [Fe/H].

required
r_core float

The core radius of the cluster, in parsecs.

required
r_tidal float

The tidal radius of the cluster, in parsecs.

required
extinction float

The extinction (A_V / A_0) of the cluster in magnitudes.

required
differential_extinction float

Amount of differential extinction to apply to the cluster, also in magnitudes. Default: 0.

0.0
minimum_stars int

Specify the minimum number of stars the cluster can have. Default: 0

1
virial_ratio float

Virial ratio of the cluster. Acts as a square-root scale factor to the cluster's velocity dispersion. Default: 0.5, meaning that the cluster is virialized.

0.5
eta_virial_ratio float

Scale factor of the 1D velocity dispersion equation. Default: 10, which is a good approximation for most clusters.

10.0
id int

ID of the simulated cluster. When set, this allows for unique identification of different simulated clusters. Default: 0.

0

Attributes:

Name Type Description
r_50 float

The half-light radius of the cluster in parsecs.

velocity_dispersion_1d float

The 1D velocity dispersion of the cluster in metres per second.

get_position_as_skycoord(frame='icrs', with_zeroed_proper_motions=False) ¤

Returns the position of the cluster as a SkyCoord.

to_dict() ¤

Converts class (and all fields) to dict. Useful for saving information.

ocelot.simulate.cluster.SimulatedClusterModels dataclass ¤

Class for keeping track of all models that a generated SimulatedCluster will use.

Parameters:

Name Type Description Default
distribution BaseClusterDistributionModel or None

The distribution model for the cluster. Must be an instance of BaseClusterDistributionModel. Default: None, meaning that a King62 model is used

None
binaries BaseBinaryStarModel or None

The binary star model for the cluster. Must be an instance of BaseBinaryStarModel. Default: None, meaning that a MoeDiStefanoMultiplicityRelation (with Duchene-Kraus+13 below 1 MSun) is used.

None
differential_reddening BaseDifferentialReddeningModel or None

The differential reddening model for the cluster. Must be an instance of BaseDifferentialReddeningModel. Default: None, meaning that a FractalDifferentialReddening model is used.

None
observations list or tuple of BaseObservation

A list or tuple of observation models for the cluster. Each model must be an instance of a BaseObservation. These observation models will be iterated through when generating cluster observations to generate as many (or few) observation simulations of a cluster as you'd like. Observation models must be unique. Default: None, meaning that no cluster observation simulation will be generated.

tuple()

Attributes:

Name Type Description
observations_dict dict of BaseObservation models

Same as the observations parameter, but with observations instead organized into a dictionary.

initialise_defaults(parameters, seed) ¤

For all class attributes, replace None values with sensible default models.

This method is called during simulated cluster generation and should not need to be used by users.

Parameters:

Name Type Description Default
parameters SimulatedClusterParameters

The parameters of the cluster to simulate.

required
seed int

Random seed to use for default models that incorporate randomness.

required

with_default_options(parameters, seed) staticmethod ¤

Return an instance of a SimulatedClusterModels model with default options.

Parameters:

Name Type Description Default
parameters SimulatedClusterParameters

The parameters of the cluster to simulate.

required
seed int

Random seed to use for default models that incorporate randomness.

required

Returns:

Type Description
SimulatedClusterModels

An instance of SimulatedClusterModels with default options already set up.

ocelot.simulate.cluster.SimulatedClusterFeatures dataclass ¤

Class for keeping track of all features used to simulate a cluster.

This class mostly exists to aid in testing parts of ocelot.simulate with certain physical effects turned on or off.

Parameters:

Name Type Description Default
binary_stars bool

Whether or not to simulate binary stars in the cluster. Default: True

True
differential_extinction bool

Whether or not to simulate differential extinction of the cluster. Default: True

True
selection_effects bool

Whether or not to simulate selection effects in simulated observations of the cluster. Default: True

True
astrometric_uncertainties bool

Whether or not to apply astrometric uncertainties to observations of the cluster. Default: True

True
photometric_uncertainties bool

Whether or not to apply photometric uncertainties to observations of the cluster. Default: True

True