11from collections .abc import Callable
2- from typing import Any , get_args
2+ from typing import Any
33
44import numpy as np
55from pydantic import Field , model_validator
99from microsim .schema .backend import NumpyAPI
1010from microsim .schema .spectrum import Spectrum
1111
12+ from ._distributions ._base import Renderable , RenderableType
1213from ._distributions .cosem import CosemLabel
1314from ._distributions .direct import FixedArrayTruth
1415from ._distributions .matslines import MatsLines
1516from .fluorophore import Fluorophore
1617
17- Distribution = MatsLines | CosemLabel | FixedArrayTruth
18- DistributionTypes = get_args ( Distribution )
19-
18+ AnyDistribution = MatsLines | CosemLabel | FixedArrayTruth | RenderableType
19+ # TODO: this feels like an unDRY hack
20+ DistributionTypes = MatsLines | CosemLabel | FixedArrayTruth | Renderable
2021
2122# This is a placeholder fluorophore for when no fluorophore is specified
2223# it has broad excitation and emission spectra, high extinction coefficient.
3435
3536
3637class FluorophoreDistribution (SimBaseModel ):
37- distribution : Distribution = Field (... )
38+ distribution : AnyDistribution = Field (union_mode = "left_to_right" )
3839 fluorophore : Fluorophore = MOCK_FLUOR
3940 # either a scalar that will be multiplied by the distribution
4041 # (e.g. to increase/decrease concentration of fluorophore)
@@ -47,7 +48,7 @@ def __hash__(self) -> int:
4748
4849 def cache_path (self ) -> tuple [str , ...] | None :
4950 if hasattr (self .distribution , "cache_path" ):
50- return self .distribution .cache_path ()
51+ return self .distribution .cache_path () # type: ignore [no-any-return]
5152 return None
5253
5354 def render (self , space : xrDataArray , xp : NumpyAPI | None = None ) -> xrDataArray :
0 commit comments