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 Greybody
from synthesizer.grid import Grid, Template
# Get the grid which we'll need for extraction
grid_name = "test_grid"
grid = Grid(grid_name)
# 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 0x7f14d45b9510> |
| 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___INTRINSIC_REPROCESSED_TRANSMITTED (stellar) |
|-------------------------------------------------------------------------------------------------------------|
|Extraction model: |
| Grid: test_grid |
| Extract key: transmitted |
| Use velocity shift: False |
| Save emission: True |
|-------------------------------------------------------------------------------------------------------------|
| ____INTRINSIC_REPROCESSED_NEBULAR_LINE_NO_FESC (stellar) |
|-------------------------------------------------------------------------------------------------------------|
|Extraction model: |
| Grid: test_grid |
| Extract key: linecont |
| Use velocity shift: False |
| Save emission: False |
|-------------------------------------------------------------------------------------------------------------|
| ___INTRINSIC_REPROCESSED_NEBULAR_CONTINUUM (stellar) |
|-------------------------------------------------------------------------------------------------------------|
|Extraction model: |
| Grid: test_grid |
| Extract key: nebular_continuum |
| Use velocity shift: False |
| Save emission: True |
|-------------------------------------------------------------------------------------------------------------|
| ___INTRINSIC_REPROCESSED_TRANSMITTED_INCIDENT (stellar) |
|-------------------------------------------------------------------------------------------------------------|
|Extraction model: |
| Grid: test_grid |
| Extract key: incident |
| Use velocity shift: False |
| Save emission: True |
|-------------------------------------------------------------------------------------------------------------|
| __INTRINSIC_REPROCESSED_TRANSMITTED (stellar) |
|-------------------------------------------------------------------------------------------------------------|
|Transformer model: |
| Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.ProcessedFraction'> |
| Apply to: full___intrinsic_reprocessed_transmitted |
| Save emission: True |
| Fixed parameters: |
| - fesc: 0.1 |
|-------------------------------------------------------------------------------------------------------------|
| ___INTRINSIC_REPROCESSED_NEBULAR_LINE (stellar) |
|-------------------------------------------------------------------------------------------------------------|
|Transformer model: |
| Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.EscapedFraction'> |
| Apply to: ____intrinsic_reprocessed_nebular_line_no_fesc |
| Save emission: True |
| Fixed parameters: |
| - fesc_ly_alpha: 1.0 |
|-------------------------------------------------------------------------------------------------------------|
| __INTRINSIC_REPROCESSED_NEBULAR (stellar) |
|-------------------------------------------------------------------------------------------------------------|
|Combination model: |
| Combine models: ___intrinsic_reprocessed_nebular_line, ___intrinsic_reprocessed_nebular_continuum |
| Save emission: True |
|-------------------------------------------------------------------------------------------------------------|
| _INTRINSIC_REPROCESSED (stellar) |
|-------------------------------------------------------------------------------------------------------------|
|Combination model: |
| Combine models: __intrinsic_reprocessed_nebular, __intrinsic_reprocessed_transmitted |
| Save emission: True |
|-------------------------------------------------------------------------------------------------------------|
| ESCAPED (stellar) |
|-------------------------------------------------------------------------------------------------------------|
|Transformer model: |
| Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.EscapedFraction'> |
| Apply to: ___intrinsic_reprocessed_transmitted_incident |
| Save emission: True |
| Fixed parameters: |
| - fesc: 0.1 |
|-------------------------------------------------------------------------------------------------------------|
| INTRINSIC (stellar) |
|-------------------------------------------------------------------------------------------------------------|
|Combination model: |
| Combine models: escaped, _intrinsic_reprocessed |
| Save emission: True |
|-------------------------------------------------------------------------------------------------------------|
| 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 |
|=============================================================================================================|
/tmp/ipykernel_8643/2932095944.py:3: RuntimeWarning:
IntrinsicEmission requires a reprocessed model. We'll create one for you
with the label '_intrinsic_reprocessed'. If you want to use a different
reprocessed model, please pass your own to the reprocessed argument.
intrinsic = IntrinsicEmission(grid, fesc=0.1, fesc_ly_alpha=1.0)
/tmp/ipykernel_8643/2932095944.py:3: RuntimeWarning:
ReprocessedEmission requires a nebular model. We'll create one for you with
the label '__intrinsic_reprocessed_nebular'. If you want to use a different
nebular model, please pass your own to the nebular argument.
intrinsic = IntrinsicEmission(grid, fesc=0.1, fesc_ly_alpha=1.0)
/tmp/ipykernel_8643/2932095944.py:3: RuntimeWarning:
NebularEmission requires a nebular line model. We'll create one for you with
the label '___intrinsic_reprocessed_nebular_line'. If you want to use a
different nebular line model, please pass your own to the nebular_line
argument.
intrinsic = IntrinsicEmission(grid, fesc=0.1, fesc_ly_alpha=1.0)
/tmp/ipykernel_8643/2932095944.py:3: RuntimeWarning:
NebularEmission requires a nebular continuum model. We'll create one for you
with the label '___intrinsic_reprocessed_nebular_continuum'. If you want to
use a different nebular continuum model, please pass your own to the
nebular_continuum argument.
intrinsic = IntrinsicEmission(grid, fesc=0.1, fesc_ly_alpha=1.0)
/tmp/ipykernel_8643/2932095944.py:3: RuntimeWarning:
ReprocessedEmission requires a transmitted model. We'll create one for you
with the label '__intrinsic_reprocessed_transmitted'. If you want to use a
different transmitted model, please pass your own to the transmitted
argument.
intrinsic = IntrinsicEmission(grid, fesc=0.1, fesc_ly_alpha=1.0)
/tmp/ipykernel_8643/2932095944.py:3: RuntimeWarning:
TransmittedEmission requires an incident emission model. We'll create one
with the label '___intrinsic_reprocessed_transmitted_incident'. If you want
to use a different incident model, please pass your own to the incident
argument.
intrinsic = IntrinsicEmission(grid, fesc=0.1, fesc_ly_alpha=1.0)
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=Greybody(30 * kelvin, emissivity=2.0),
dust_lum_intrinsic=intrinsic,
dust_lum_attenuated=attenuated,
emitter="stellar",
)
print(dust_model)
|=========================================== EmissionModel: dust_emission ===========================================|
|--------------------------------------------------------------------------------------------------------------------|
| FULL___INTRINSIC_REPROCESSED_TRANSMITTED (stellar) |
|--------------------------------------------------------------------------------------------------------------------|
|Extraction model: |
| Grid: test_grid |
| Extract key: transmitted |
| Use velocity shift: False |
| Save emission: True |
|--------------------------------------------------------------------------------------------------------------------|
| ____INTRINSIC_REPROCESSED_NEBULAR_LINE_NO_FESC (stellar) |
|--------------------------------------------------------------------------------------------------------------------|
|Extraction model: |
| Grid: test_grid |
| Extract key: linecont |
| Use velocity shift: False |
| Save emission: False |
|--------------------------------------------------------------------------------------------------------------------|
| ___INTRINSIC_REPROCESSED_NEBULAR_CONTINUUM (stellar) |
|--------------------------------------------------------------------------------------------------------------------|
|Extraction model: |
| Grid: test_grid |
| Extract key: nebular_continuum |
| Use velocity shift: False |
| Save emission: True |
|--------------------------------------------------------------------------------------------------------------------|
| ___INTRINSIC_REPROCESSED_TRANSMITTED_INCIDENT (stellar) |
|--------------------------------------------------------------------------------------------------------------------|
|Extraction model: |
| Grid: test_grid |
| Extract key: incident |
| Use velocity shift: False |
| Save emission: True |
|--------------------------------------------------------------------------------------------------------------------|
| __INTRINSIC_REPROCESSED_TRANSMITTED (stellar) |
|--------------------------------------------------------------------------------------------------------------------|
|Transformer model: |
| Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.ProcessedFraction'> |
| Apply to: full___intrinsic_reprocessed_transmitted |
| Save emission: True |
| Fixed parameters: |
| - fesc: 0.1 |
|--------------------------------------------------------------------------------------------------------------------|
| ___INTRINSIC_REPROCESSED_NEBULAR_LINE (stellar) |
|--------------------------------------------------------------------------------------------------------------------|
|Transformer model: |
| Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.EscapedFraction'> |
| Apply to: ____intrinsic_reprocessed_nebular_line_no_fesc |
| Save emission: True |
| Fixed parameters: |
| - fesc_ly_alpha: 1.0 |
|--------------------------------------------------------------------------------------------------------------------|
| __INTRINSIC_REPROCESSED_NEBULAR (stellar) |
|--------------------------------------------------------------------------------------------------------------------|
|Combination model: |
| Combine models: ___intrinsic_reprocessed_nebular_line, ___intrinsic_reprocessed_nebular_continuum |
| Save emission: True |
|--------------------------------------------------------------------------------------------------------------------|
| _INTRINSIC_REPROCESSED (stellar) |
|--------------------------------------------------------------------------------------------------------------------|
|Combination model: |
| Combine models: __intrinsic_reprocessed_nebular, __intrinsic_reprocessed_transmitted |
| Save emission: True |
|--------------------------------------------------------------------------------------------------------------------|
| ESCAPED (stellar) |
|--------------------------------------------------------------------------------------------------------------------|
|Transformer model: |
| Transformer: <class 'synthesizer.emission_models.transformers.escape_fraction.EscapedFraction'> |
| Apply to: ___intrinsic_reprocessed_transmitted_incident |
| Save emission: True |
| Fixed parameters: |
| - fesc: 0.1 |
|--------------------------------------------------------------------------------------------------------------------|
| INTRINSIC (stellar) |
|--------------------------------------------------------------------------------------------------------------------|
|Combination model: |
| Combine models: escaped, _intrinsic_reprocessed |
| Save emission: True |
|--------------------------------------------------------------------------------------------------------------------|
| 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.Greybody object at 0x7f14d45ba650> |
| Dust luminosity: intrinsic - attenuated |
| Save emission: True |
|====================================================================================================================|