simplify unique models check in datasets_to_dict
@@ -17,9 +17,7 @@ def datasets_to_dict(datasets, path, prefix, overwrite):
overwrite datasets FITS files
"""
unique_models = []
- unique_backgrounds = []
datasets_dictlist = []
-
for dataset in datasets:
filename = path / f"{prefix}_data_{dataset.name}.fits"
dataset.write(filename, overwrite)
@@ -30,14 +28,8 @@ def datasets_to_dict(datasets, path, prefix, overwrite):
if model not in unique_models:
unique_models.append(model)
- try:
- if dataset.background_model not in unique_backgrounds:
- unique_backgrounds.append(dataset.background_model)
- except AttributeError:
- pass
-
datasets_dict = {"datasets": datasets_dictlist}
- components_dict = models_to_dict(unique_models + unique_backgrounds)
+ components_dict = models_to_dict(unique_models)
return datasets_dict, components_dict
