From b1e9daeb18e757094b1f62eff4cf0d65bead204f Mon Sep 17 00:00:00 2001 From: Marshall Perrin Date: Sat, 30 Nov 2024 08:41:25 -0500 Subject: [PATCH] allow astropy Quantities in calc_datacube wavelengths --- poppy/instrument.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/poppy/instrument.py b/poppy/instrument.py index 33e57df3..20fe8de6 100644 --- a/poppy/instrument.py +++ b/poppy/instrument.py @@ -318,6 +318,9 @@ def calc_datacube(self, wavelengths, *args, **kwargs): else: raise ValueError("Maximum number of wavelengths exceeded. " "Cannot be more than 10,000.") + # Handle astropy Quantities, if needed + if isinstance(wavelengths, units.Quantity): + wavelengths = wavelengths.to_value(units.meter) # Set up cube and initialize structure based on PSF at first wavelength poppy_core._log.info("Starting multiwavelength data cube calculation.")