Skip to content

Commit

Permalink
Pipeline instrument arguments (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlovell authored Feb 12, 2025
2 parents b7f0e61 + 636f7e6 commit 901044d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/synthesizer/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from unyt import unyt_array

from synthesizer import check_openmp, exceptions
from synthesizer.instruments import Instrument, InstrumentCollection
from synthesizer.instruments.filters import FilterCollection
from synthesizer.pipeline.pipeline_io import PipelineIO
from synthesizer.pipeline.pipeline_utils import (
Expand Down Expand Up @@ -147,8 +148,9 @@ def __init__(
Args:
emission_model (EmissionModel): The emission model to use for the
pipeline.
instruments (list): A list of Instrument objects to use for the
pipeline.
instruments (Instrument, InstrumentCollection): Either a singular
Instrument object, or an InstrumentCollection containing
multiple Instrument objects.
nthreads (int): The number of threads to use for shared memory
parallelism. Default is 1.
comm (MPI.Comm): The MPI communicator to use for MPI parallelism.
Expand All @@ -162,7 +164,15 @@ def __init__(

# Attach all the attributes we need to know what to do
self.emission_model = emission_model
self.instruments = instruments

# Check if it's a single instrument
if isinstance(instruments, Instrument):
# mock up an InstrumentCollection
collection = InstrumentCollection()
collection.add_instruments(self, instruments)
self.instruments = collection
else:
self.instruments = instruments

# Set verbosity
self.verbose = verbose
Expand Down

0 comments on commit 901044d

Please sign in to comment.