make_simspin_file: Reformatting isolated galaxy simulations to contain spectra.

View source: R/make_simspin_file.R

make_simspin_fileR Documentation

Reformatting isolated galaxy simulations to contain spectra.

Description

The purpose of this function is to construct a SimSpin file containing the mock spectra for each particle contained within the galaxy simulation file. If the snapshot provided is from a cosmological simulation, the SEDs generated will be with respect to the Stellar Formation Time/Age, Metallicity and Initial Mass of each stellar particle. If the system is an N-body model, stellar particles are assumed to have an age and metallicity as provided to the function as disk_age, bulge_age, disk_Z and bulge_Z. Returned is an .Rdata file in a SimSpin readable format.

Usage

make_simspin_file(
  filename,
  cores = 1,
  disk_age = 5,
  bulge_age = 10,
  disk_Z = 0.024,
  bulge_Z = 0.001,
  template = "BC03lr",
  write_to_file = TRUE,
  output,
  overwrite = F,
  centre = NA,
  half_mass = NA,
  sph_spawn_n = 1
)

Arguments

filename

The path to the snapshot file.

cores

The number of cores across which to multi-thread the problem.

disk_age

The age of the disk particles in Gyr.

bulge_age

The age of the bulge particles in Gyr.

disk_Z

The metallicity of the disk particles as a mass fraction (mass of all metal elements above He over the total mass).

bulge_Z

The metallicity of the bulge particles as a mass fraction (mass of all metal elements above He over the total mass).

template

The stellar templates from which to derive the SEDs. Options include "BC03lr" (GALEXEV low resolution, Bruzual & Charlot 2003), "BC03hr" (GALEXEV high resolution, Bruzual & Charlot 2003) or "EMILES" (Vazdekis et al, 2016).

write_to_file

Boolean to specify whether the list produced should be written to a ".Rdata" file or output to the environment. Default is TRUE, so that files can be re-observed without having to generate spectra each time.

output

The path at which the output file is written. If not provided, file will be written at the location of the input filename with the addition of "_spectra.Rdata".

overwrite

If true, and the file already exists at the output location, a new file will be written over the old one.

centre

If simulation file contains all particles cutout from a box (rather than just particles from a single galaxy), you can specify the point around which the view should be centred. Numeric length = 3. Default is NA, in which case the system is centred around the median position. Specified in units of kpc.

half_mass

If simulation file contains all particles cutout from a box (rather than just particles from a single galaxy), you can the half-mass value at which the alignment function is run. Numeric length = 1. Default is NA, in which case half the total mass of the supplied simulation data is used. Specified in units of solar mass.

sph_spawn_n

Numeric describing the number of gas particles with which to sample the SPH smoothing length. Default is 1, which will not spawn additional gas particles. Increasing this value increases the number of particles used to model the gas distribution. This value may need to be tested for convergence depending on the resolution of the grid used to image the gas properties at the 'build_datacube()' stage.

Value

Returns an .Rdata file that contains a list of particle positions, velocities, and spectral weights (or a list containing the same information to the environment without writing to file, when 'write_to_file = F').

Examples

ss_file = make_simspin_file(filename = system.file("extdata",
                                                  "SimSpin_example_Gadget",
                                                   package = "SimSpin"),
                           write_to_file = FALSE)


kateharborne/SimSpin documentation built on April 28, 2024, 2 p.m.