# Demo galaxy: recombination Lyα emission with dust. [AI-Codex]
dataset_type: pointcloud_voronoi
driver_type: mcrtsimulation
device: cpu
log_level: info

dust:
  model: laursen
  variant: LAURSEN_SMC
  z_ref: 0.005
  f_ion: 0.01

pointcloud_voronoi:
  # Only diffuse gas contributes these luminosities; all gas still scatters.
  field_filters:
    _diffuse:
      particle_type: gas
      else: zero
      conditions:
        - {field: StarFormationRate, op: "==", value: 0.0}
    Lya_recB_emissivity:
      inherit: _diffuse
    Lya_collexc_emissivity:
      inherit: _diffuse
  hilbert_bits: 8
  loader: gadget
  gadget:
    path: ./tng50-halo625-gas-stars-v2.hdf5
    fields: [PositionX, PositionY, PositionZ, Temperature, Density, HIdensity,
             VelocityX, VelocityY, VelocityZ, Lya_recB_emissivity, Volume,
             DustAbsorptionCoefficient]
    zoom_box: [[0.4945, 0.5055], [0.4945, 0.5055], [0.4919, 0.5029]]

mcrtsimulation:
  outputpath: output-lya-recombination-dust
  overwrite: true
  linename: Lya
  interactor: ResonantWithDustInteractor
  acc_scheme: Smith15
  use_atau0nl: true
  seed: 121567
  nphotons_max: 100000
  nphotons_step_max: 1000
  nsteps_per_photon_max: 10000  # per launch; unfinished packets resume
  max_steps_without_scatter: 9999
  save_inputphotons: true
  write_inputphotons_restframe: true
  use_peeling: true
  populate:
    Emissivity: Lya_recB_emissivity
  emissionmodel:
    mode: datasetsource
    datasetsource:
      linename: Lya
      emission_position: centroid
      nphotons_per_unit_lum: 296246
      nphotons_per_source_min: 1
      nphotons_per_source_max: 1000000
      lum_threshold_fraction: 0.99
    spectrum:
      shape: gaussian
      recipe: thermal
      scope: local
  outputprocessors:
  - type: photon
    streams: [input, original]
  - type: sbmap
    streams: [input, peel]
    units: erg/s/cm2/arcsec2
    observer_redshift: 0.0
    center: [0.509, 0.489, 0.736]
    north: [0.0, 1.0, 0.0]
    nbins_x: 96
    nbins_y: 64
    left_x: 0.401
    right_x: 0.599
    left_y: 0.434
    right_y: 0.566
  - type: apertureSpectrum
    streams: [input, peel]
    units: erg/s
    center: [0.509, 0.489, 0.736]
    north: [0.0, 1.0, 0.0]
    left: -10.0
    right: 10.0
    nbins: 160
    aperture_radii: [10 pkpc, 30 pkpc, 500 pkpc]
