Common Models

Some models are common to all components. While these common models are the same in almost every respect these models do require an extra argument to define the “emitter” ("stellar", "blackhole", or "galaxy") that they act on.

TemplateEmission

A template is a simple generation model where a single template spectra is returned with some scaling applying. These can describe any emitter based on the spectra input into the template (which can either come from arrays of lnu and lam or a file).

Generation from a template model requires a Template, similar to the Grid required by extraction models.

[1]:
import numpy as np
from unyt import Hz, erg, kelvin, s

from synthesizer.emission_models import TemplateEmission
from synthesizer.emission_models.attenuation import PowerLaw
from synthesizer.emission_models.dust.emission import Blackbody
from synthesizer.grid import Grid, Template

# Get the grid which we'll need for extraction
grid_dir = "../../../../tests/test_grid"
grid_name = "test_grid"
grid = Grid(grid_name, grid_dir=grid_dir)

# Make a fake template for the demo
template = Template(
    lam=grid.lam, lnu=np.random.rand(*grid.lam.shape) * erg / s / Hz
)

template_model = TemplateEmission(template, emitter="stellar")
print(template_model)
|================================= EmissionModel: template =================================|
|-------------------------------------------------------------------------------------------|
|  TEMPLATE (stellar)                                                                       |
|-------------------------------------------------------------------------------------------|
|Generation model:                                                                          |
|  Emission generation model: <synthesizer.grid.Template object at 0x7fe168f02a10>          |
|  Save emission: True                                                                      |
|===========================================================================================|

AttenuatedEmission

Attenuated emission is any emission that has been attenuated by dust. An attenuated model takes a dust_curve (any AttenuationLaw transformer), a model to apply the dust attenuation to (apply_to), and optionally an optical depth (tau_v, which can either be a value, array, or a string denoting an attribute on the emitter from which to extract it, if omitted the optical depth will be extracted from the tau_v attribute on the emitter.

Here we create a simple Intrinsic emission model to which we apply the dust attenuation.

[2]:
from synthesizer.emission_models import AttenuatedEmission, IntrinsicEmission

intrinsic = IntrinsicEmission(grid, fesc=0.1, fesc_ly_alpha=1.0)

attenuated = AttenuatedEmission(
    emitter="stellar",
    dust_curve=PowerLaw(slope=-1),
    tau_v=0.5,
    apply_to=intrinsic,
)
print(attenuated)
|========================================= EmissionModel: attenuated =========================================|
|-------------------------------------------------------------------------------------------------------------|
|  FULL_TRANSMITTED (stellar)                                                                                 |
|-------------------------------------------------------------------------------------------------------------|
|Extraction model:                                                                                            |
|  Grid: test_grid                                                                                            |
|  Extract key: transmitted                                                                                   |
|  Use velocity shift: False                                                                                  |
|  Save emission: True                                                                                        |
|-------------------------------------------------------------------------------------------------------------|
|  NEBULAR_LINE_NO_FESC (stellar)                                                                             |
|-------------------------------------------------------------------------------------------------------------|
|Extraction model:                                                                                            |
|  Grid: test_grid                                                                                            |
|  Extract key: linecont                                                                                      |
|  Use velocity shift: False                                                                                  |
|  Save emission: False                                                                                       |
|-------------------------------------------------------------------------------------------------------------|
|  NEBULAR_CONTINUUM (stellar)                                                                                |
|-------------------------------------------------------------------------------------------------------------|
|Extraction model:                                                                                            |
|  Grid: test_grid                                                                                            |
|  Extract key: nebular_continuum                                                                             |
|  Use velocity shift: False                                                                                  |
|  Save emission: True                                                                                        |
|-------------------------------------------------------------------------------------------------------------|
|  TRANSMITTED (stellar)                                                                                      |
|-------------------------------------------------------------------------------------------------------------|
|Transformer model:                                                                                           |
|  Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.ProcessedFraction'>          |
|  Apply to: full_transmitted                                                                                 |
|  Save emission: True                                                                                        |
|  Fixed parameters:                                                                                          |
|    - fesc: 0.1                                                                                              |
|-------------------------------------------------------------------------------------------------------------|
|  NEBULAR_LINE (stellar)                                                                                     |
|-------------------------------------------------------------------------------------------------------------|
|Transformer model:                                                                                           |
|  Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.EscapedFraction'>            |
|  Apply to: nebular_line_no_fesc                                                                             |
|  Save emission: True                                                                                        |
|  Fixed parameters:                                                                                          |
|    - fesc_ly_alpha: 1.0                                                                                     |
|-------------------------------------------------------------------------------------------------------------|
|  NEBULAR_COMBINED (stellar)                                                                                 |
|-------------------------------------------------------------------------------------------------------------|
|Combination model:                                                                                           |
|  Combine models: nebular_line, nebular_continuum                                                            |
|  Save emission: False                                                                                       |
|-------------------------------------------------------------------------------------------------------------|
|  NEBULAR (stellar)                                                                                          |
|-------------------------------------------------------------------------------------------------------------|
|Transformer model:                                                                                           |
|  Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.ProcessedFraction'>          |
|  Apply to: nebular_combined                                                                                 |
|  Save emission: True                                                                                        |
|  Fixed parameters:                                                                                          |
|    - fesc: 0.1                                                                                              |
|-------------------------------------------------------------------------------------------------------------|
|  REPROCESSED (stellar)                                                                                      |
|-------------------------------------------------------------------------------------------------------------|
|Combination model:                                                                                           |
|  Combine models: nebular, transmitted                                                                       |
|  Save emission: True                                                                                        |
|-------------------------------------------------------------------------------------------------------------|
|  ESCAPED (stellar)                                                                                          |
|-------------------------------------------------------------------------------------------------------------|
|Transformer model:                                                                                           |
|  Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.EscapedFraction'>            |
|  Apply to: full_transmitted                                                                                 |
|  Save emission: True                                                                                        |
|  Fixed parameters:                                                                                          |
|    - fesc: 0.1                                                                                              |
|-------------------------------------------------------------------------------------------------------------|
|  INTRINSIC (stellar)                                                                                        |
|-------------------------------------------------------------------------------------------------------------|
|Combination model:                                                                                           |
|  Combine models: escaped, reprocessed                                                                       |
|  Save emission: True                                                                                        |
|  Fixed parameters:                                                                                          |
|    - fesc: 0.1                                                                                              |
|-------------------------------------------------------------------------------------------------------------|
|  ATTENUATED (stellar)                                                                                       |
|-------------------------------------------------------------------------------------------------------------|
|Transformer model:                                                                                           |
|  Transformer: <class 'synthesizer.emission_models.transformers.dust_attenuation.PowerLaw'>                  |
|  Apply to: intrinsic                                                                                        |
|  Save emission: True                                                                                        |
|  Fixed parameters:                                                                                          |
|    - tau_v: 0.5                                                                                             |
|=============================================================================================================|

DustEmission

Dust emission is the reemited emission from the dust distribution due to the attenuation of another emission source. A dust emission model defines the generation of a spectra from a generator (e.g. Blackbody or Greybody, see the dust emission model docs) and it its scaling using an energy balance approach.

[3]:
from synthesizer.emission_models import DustEmission

dust_model = DustEmission(
    dust_emission_model=Blackbody(50 * kelvin),
    dust_lum_intrinsic=intrinsic,
    dust_lum_attenuated=attenuated,
    emitter="stellar",
)
print(dust_model)
|============================================ EmissionModel: dust_emission ===========================================|
|---------------------------------------------------------------------------------------------------------------------|
|  FULL_TRANSMITTED (stellar)                                                                                         |
|---------------------------------------------------------------------------------------------------------------------|
|Extraction model:                                                                                                    |
|  Grid: test_grid                                                                                                    |
|  Extract key: transmitted                                                                                           |
|  Use velocity shift: False                                                                                          |
|  Save emission: True                                                                                                |
|---------------------------------------------------------------------------------------------------------------------|
|  NEBULAR_LINE_NO_FESC (stellar)                                                                                     |
|---------------------------------------------------------------------------------------------------------------------|
|Extraction model:                                                                                                    |
|  Grid: test_grid                                                                                                    |
|  Extract key: linecont                                                                                              |
|  Use velocity shift: False                                                                                          |
|  Save emission: False                                                                                               |
|---------------------------------------------------------------------------------------------------------------------|
|  NEBULAR_CONTINUUM (stellar)                                                                                        |
|---------------------------------------------------------------------------------------------------------------------|
|Extraction model:                                                                                                    |
|  Grid: test_grid                                                                                                    |
|  Extract key: nebular_continuum                                                                                     |
|  Use velocity shift: False                                                                                          |
|  Save emission: True                                                                                                |
|---------------------------------------------------------------------------------------------------------------------|
|  TRANSMITTED (stellar)                                                                                              |
|---------------------------------------------------------------------------------------------------------------------|
|Transformer model:                                                                                                   |
|  Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.ProcessedFraction'>                  |
|  Apply to: full_transmitted                                                                                         |
|  Save emission: True                                                                                                |
|  Fixed parameters:                                                                                                  |
|    - fesc: 0.1                                                                                                      |
|---------------------------------------------------------------------------------------------------------------------|
|  NEBULAR_LINE (stellar)                                                                                             |
|---------------------------------------------------------------------------------------------------------------------|
|Transformer model:                                                                                                   |
|  Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.EscapedFraction'>                    |
|  Apply to: nebular_line_no_fesc                                                                                     |
|  Save emission: True                                                                                                |
|  Fixed parameters:                                                                                                  |
|    - fesc_ly_alpha: 1.0                                                                                             |
|---------------------------------------------------------------------------------------------------------------------|
|  NEBULAR_COMBINED (stellar)                                                                                         |
|---------------------------------------------------------------------------------------------------------------------|
|Combination model:                                                                                                   |
|  Combine models: nebular_line, nebular_continuum                                                                    |
|  Save emission: False                                                                                               |
|---------------------------------------------------------------------------------------------------------------------|
|  NEBULAR (stellar)                                                                                                  |
|---------------------------------------------------------------------------------------------------------------------|
|Transformer model:                                                                                                   |
|  Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.ProcessedFraction'>                  |
|  Apply to: nebular_combined                                                                                         |
|  Save emission: True                                                                                                |
|  Fixed parameters:                                                                                                  |
|    - fesc: 0.1                                                                                                      |
|---------------------------------------------------------------------------------------------------------------------|
|  REPROCESSED (stellar)                                                                                              |
|---------------------------------------------------------------------------------------------------------------------|
|Combination model:                                                                                                   |
|  Combine models: nebular, transmitted                                                                               |
|  Save emission: True                                                                                                |
|---------------------------------------------------------------------------------------------------------------------|
|  ESCAPED (stellar)                                                                                                  |
|---------------------------------------------------------------------------------------------------------------------|
|Transformer model:                                                                                                   |
|  Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.EscapedFraction'>                    |
|  Apply to: full_transmitted                                                                                         |
|  Save emission: True                                                                                                |
|  Fixed parameters:                                                                                                  |
|    - fesc: 0.1                                                                                                      |
|---------------------------------------------------------------------------------------------------------------------|
|  INTRINSIC (stellar)                                                                                                |
|---------------------------------------------------------------------------------------------------------------------|
|Combination model:                                                                                                   |
|  Combine models: escaped, reprocessed                                                                               |
|  Save emission: True                                                                                                |
|  Fixed parameters:                                                                                                  |
|    - fesc: 0.1                                                                                                      |
|---------------------------------------------------------------------------------------------------------------------|
|  ATTENUATED (stellar)                                                                                               |
|---------------------------------------------------------------------------------------------------------------------|
|Transformer model:                                                                                                   |
|  Transformer: <class 'synthesizer.emission_models.transformers.dust_attenuation.PowerLaw'>                          |
|  Apply to: intrinsic                                                                                                |
|  Save emission: True                                                                                                |
|  Fixed parameters:                                                                                                  |
|    - tau_v: 0.5                                                                                                     |
|---------------------------------------------------------------------------------------------------------------------|
|  DUST_EMISSION (stellar)                                                                                            |
|---------------------------------------------------------------------------------------------------------------------|
|Generation model:                                                                                                    |
|  Emission generation model: <synthesizer.emission_models.dust.emission.Blackbody object at 0x7fe168f01570>          |
|  Dust luminosity: intrinsic - attenuated                                                                            |
|  Save emission: True                                                                                                |
|=====================================================================================================================|