InitialConditionsCartesian#

class pisces.extensions.simulation.core.initial_conditions.InitialConditionsCartesian(directory: str | Path)[source]#

Abstract base class for Cartesian initial conditions.

Provides a general framework for simulations defined in Cartesian coordinates with ndim active spatial dimensions. This class enforces the presence and dimensionality of position and velocity vectors and provides convenience accessors for them.

Key features:
  • Ensures positions are length vectors of shape (ndim,).

  • Ensures velocities are length/time vectors of shape (ndim,).

  • Defines model_positions and model_velocities properties for retrieving validated unyt arrays with physical units.

Subclasses specify the dimensionality by setting _ndim and may extend validation to include orientation, spin, or other Cartesian-specific keys.

Methods

__init__(directory)

Load an existing set of initial conditions from a target directory.

add_model(name, model, model_config[, ...])

Add a new model to the initial conditions set.

add_particles_to_model(particle_path, model_name)

Attach a particle dataset file to an existing model in the initial conditions.

compute_center_of_mass([models, masses])

Compute the mass-weighted center of mass (COM) position for one or more models in the initial conditions.

compute_center_of_mass_frame_positions([...])

Compute the positions of models in the center-of-mass (COM) frame.

compute_center_of_mass_frame_velocities([...])

Compute the velocities of models in the center-of-mass (COM) frame.

compute_center_of_mass_velocity([models, masses])

Compute the mass-weighted center-of-mass (COM) velocity for one or more models in the initial conditions.

compute_total_mass([models, masses])

Compute the total mass of one or more models in the initial conditions.

create_ics(directory, *models[, ...])

Create a new initial conditions (IC) directory and return an InitialConditions instance.

generate_particles(model_name, num_particles)

Generate particles for a stored model using its internal particle generation method.

get_model_coordinate_system(model_name)

Retrieve the coordinate system of a stored model without fully loading it.

get_model_fields(model_name)

Inspect the available fields in a stored model without fully loading it.

get_model_grid(model_name)

Retrieve the grid object of a stored model without fully loading it.

get_model_info(model_name)

Retrieve the configuration information for a specific model.

get_model_metadata(model_name)

Inspect the metadata of a stored model without fully loading it.

get_model_summary(model_name[, include_fields])

Retrieve a combined summary of a stored model without fully loading it.

get_particle_count(model_name)

Inspect the number of particles in each species group for a stored model.

get_particle_fields(model_name)

Inspect the available fields for each particle species in a model.

get_particle_path(model_name)

Retrieve the particle file path associated with a specific model.

get_particle_path_dict()

Retrieve a dictionary mapping model names to their associated particle file paths.

get_particle_species(model_name)

List the particle species present in the stored particle dataset for a given model.

has_model(model_name)

Check if a model with the given name exists in these initial conditions.

has_particles(model_name)

Check if a specific model has associated particles.

list_models()

List all models currently stored in these initial conditions.

list_models_with_particles()

List all models that have associated particle datasets.

load_model(name)

Load a specific model from the initial conditions.

load_particles(model_name, **kwargs)

Load the particle dataset associated with a specific model.

remove_model(name)

Remove a model and its associated files from the initial conditions.

remove_particles_from_model(model_name[, ...])

Detach and optionally delete the particle dataset associated with a specific model.

shift_to_COM_frame([models, masses])

Shift the positions and velocities of models into the center-of-mass (COM) frame.

update_model(model_name, **parameters)

Update parameters of an existing model in the initial conditions.

Attributes

config

The configuration manager for the initial conditions.

directory

The directory where the initial conditions are stored.

logger

Logger instance for the InitialConditions class.

metadata

The metadata associated with the initial conditions.

model_positions

The positions of the models in the initial conditions.

model_velocities

The velocities of the models in the initial conditions.

models

The processed models used in the initial conditions.

ndim

The number of spatial dimensions for the initial conditions.

particles

The particle files associated with the models in the initial conditions.