From 56a38e58294614db162b3ef413a05ef1619737f9 Mon Sep 17 00:00:00 2001 From: Bastien Carreres Date: Wed, 21 Feb 2024 09:42:50 -0500 Subject: [PATCH] debug sct_model --- snsim/generators.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/snsim/generators.py b/snsim/generators.py index 5b64a0d..f14f631 100644 --- a/snsim/generators.py +++ b/snsim/generators.py @@ -708,22 +708,24 @@ def _add_print(self): def _add_effects(self): effects = [] - if self._params['sct_model'] == 'G10': - if (len(self.sim_sources['model_name']) > 1 - or self.sim_sources['model_name'][0] not in ['salt2', 'salt3']): - raise ValueError('G10 cannot be used') - effects.append({ - 'source': sct.G10(snc.get_source( - name=self.sim_sources['model_name'][0], - version=self.sim_sources['model_version'][0])), - 'frame': 'rest', - 'name': 'G10_' - }) - elif self._params['sct_model'] in ['C11_0', 'C11_1', 'C11_2']: - effects.append({'source': sct.C11(), - 'frame': 'rest', - 'name': 'C11_' - }) + # Add scattering model if needed + if 'sct_model' in self._params: + if self._params['sct_model'] == 'G10': + if (len(self.sim_sources['model_name']) > 1 + or self.sim_sources['model_name'][0] not in ['salt2', 'salt3']): + raise ValueError('G10 cannot be used') + effects.append({ + 'source': sct.G10(snc.get_source( + name=self.sim_sources['model_name'][0], + version=self.sim_sources['model_version'][0])), + 'frame': 'rest', + 'name': 'G10_' + }) + elif self._params['sct_model'] in ['C11_0', 'C11_1', 'C11_2']: + effects.append({'source': sct.C11(), + 'frame': 'rest', + 'name': 'C11_' + }) return effects def _update_header(self):