simpa icon indicating copy to clipboard operation
simpa copied to clipboard

Background definition + get_value_for_wavelength causes problems for optical simulations outside of 450 - 1000 nm

Open RecurvedBow opened this issue 1 year ago • 1 comments

Describe the bug Commonly, the background of the tissue volume is defined as: background_dictionary[Tags.MOLECULE_COMPOSITION] = TISSUE_LIBRARY.constant(1e-4, 1e-4, 0.9)

Because this function uses CONSTANT_ABSORBER_ARBITRARY, the background tissue is defined for only the wavelengths 450 nm and 1000 nm. If we run an optical MCX simulation with a wavelength outside of it, it will fail.

Specify a priority (low, medium, high) medium

To Reproduce Define any tissue with the background settings and run a optical MCX simulation with a wavelength outside of 450 nor 1000, for example with 400.

Current Behavior Upon running simulate(pipeline, settings, device), an error is raised:

> volumes = self.create_simulation_volume()
> structure_properties = structure.properties_for_wavelength(wavelength)
> return self.molecule_composition.get_properties_for_wavelength(wavelength)
> (molecule.volume_fraction * molecule.spectrum.get_value_for_wavelength(wavelength))
ValueError: The given wavelength (300) is not within the range of the spectrum (450 - 1000)

Expected behavior The simulation successfully runs.

Additional context To fix this, increase this wavelength range or add an min wavelength and max wavelength argument to TISSUE_LIBRARY.constant().

RecurvedBow avatar Jul 24 '24 13:07 RecurvedBow

This is related to #310

kdreher avatar Jul 26 '24 12:07 kdreher