pisces.extensions.simulation.core.initial_conditions.InitialConditions.add_model#

InitialConditions.add_model(name: str, model: str | Path | BaseModel, model_config, file_processing_mode: str = 'copy', overwrite: bool = False)[source]#

Add a new model to these initial conditions.

Parameters:
  • name (str) – Unique name/identifier for the model within the initial conditions set. If the provided name is not unique, then overwrite will determine if an error is raised or if the existing model is replaced.

  • model (str, Path or BaseModel) –

    The model to add, specified as either:

    • Path-like (str or Path): Path to the model file on disk. The file will be copied or moved into the initial conditions directory according to file_processing_mode.

    • BaseModel instance: An already loaded model object. Its source file path will be obtained from the model’s metadata.

    In both cases, the model file must exist and be accessible before calling this method.

  • model_config (tuple) –

    A tuple specifying the model configuration in the format

    (position, velocity[, orientation][, spin])
    

    Where:

    • position : sequence of length ndim or unyt array with shape (ndim,)

    • velocity : sequence of length ndim or unyt array with shape (ndim,)

    • orientation : optional; sequence or array defining orientation

    • spin : optional; scalar float

  • file_processing_mode ({"copy", "move"}, default "copy") –

    Determines how the provided model file is placed into the initial conditions directory:

    • "copy": The source file is copied into the IC directory, preserving the original file in its current location.

    • "move": The source file is moved into the IC directory, removing it from its original location.

  • overwrite (bool, optional) – If True, an existing model entry with the same name will be replaced, and any associated files will be deleted or overwritten as needed. If False (default), attempting to add a model with a duplicate name will raise a ValueError.