diff --git a/src/synthesizer/emission_models/agn/models.py b/src/synthesizer/emission_models/agn/models.py index 0ec9c969e..cc7c4499a 100644 --- a/src/synthesizer/emission_models/agn/models.py +++ b/src/synthesizer/emission_models/agn/models.py @@ -13,6 +13,7 @@ """ +from synthesizer import exceptions from synthesizer.emission_models.base_model import BlackHoleEmissionModel @@ -287,6 +288,12 @@ def __init__( **kwargs """ + # Ensure the sum of covering fractions is less than 1 + if covering_fraction_nlr + covering_fraction_blr > 1: + raise exceptions.InconsistentArguments( + "The sum of the covering fractions must be less than 1." + ) + # Create the child models nlr = NLRTransmittedEmission( grid=nlr_grid, @@ -345,6 +352,12 @@ def __init__( fraction of the BLR). Default is 0.1. **kwargs """ + # Ensure the sum of covering fractions is less than 1 + if covering_fraction_nlr + covering_fraction_blr > 1: + raise exceptions.InconsistentArguments( + "The sum of the covering fractions must be less than 1." + ) + BlackHoleEmissionModel.__init__( self, grid=grid, @@ -494,6 +507,12 @@ def __init__( **kwargs """ + # Ensure the sum of covering fractions is less than 1 + if covering_fraction_nlr + covering_fraction_blr > 1: + raise exceptions.InconsistentArguments( + "The sum of the covering fractions must be less than 1." + ) + # Create the child models disc = DiscEmission( nlr_grid=nlr_grid, diff --git a/src/synthesizer/emission_models/agn/unified_agn.py b/src/synthesizer/emission_models/agn/unified_agn.py index 509b6fe50..184ff477d 100644 --- a/src/synthesizer/emission_models/agn/unified_agn.py +++ b/src/synthesizer/emission_models/agn/unified_agn.py @@ -23,6 +23,7 @@ import numpy as np from unyt import deg +from synthesizer import exceptions from synthesizer.emission_models.base_model import BlackHoleEmissionModel from synthesizer.sed import Sed @@ -157,6 +158,12 @@ def __init__( **kwargs: Any additional keyword arguments to pass to the BlackHoleEmissionModel. """ + # Ensure the sum of covering fractions is less than 1 + if covering_fraction_nlr + covering_fraction_blr > 1: + raise exceptions.InconsistentArguments( + "The sum of the covering fractions must be less than 1." + ) + # Get the incident istropic disc emission model self.disc_incident_isotropic = self._make_disc_incident_isotropic( nlr_grid,