File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,7 +79,16 @@ def __init__(
7979 )
8080
8181 self .preloads = preloads
82- self ._xp = xp
82+
83+ self .use_jax = xp is not np
84+
85+ @property
86+ def _xp (self ):
87+ if self .use_jax :
88+ import jax .numpy as jnp
89+
90+ return jnp
91+ return np
8392
8493 @property
8594 def profile_visibilities (self ) -> aa .Visibilities :
Original file line number Diff line number Diff line change @@ -72,7 +72,15 @@ def __init__(
7272 f"in the tracer (make sure your tracer's point source name is the same the dataset name."
7373 )
7474
75- self ._xp = xp
75+ self .use_jax = xp is not np
76+
77+ @property
78+ def _xp (self ):
79+ if self .use_jax :
80+ import jax .numpy as jnp
81+
82+ return jnp
83+ return np
7684
7785 @property
7886 def data (self ):
Original file line number Diff line number Diff line change @@ -125,7 +125,15 @@ def __init__(
125125 except exc .PointExtractionException :
126126 self .time_delays = None
127127
128- self ._xp = xp
128+ self .use_jax = xp is not np
129+
130+ @property
131+ def _xp (self ):
132+ if self .use_jax :
133+ import jax .numpy as jnp
134+
135+ return jnp
136+ return np
129137
130138 @property
131139 def model_obj (self ):
Original file line number Diff line number Diff line change @@ -47,7 +47,15 @@ def __init__(
4747
4848 self .initial_triangles = initial_triangles
4949
50- self ._xp = xp
50+ self .use_jax = xp is not np
51+
52+ @property
53+ def _xp (self ):
54+ if self .use_jax :
55+ import jax .numpy as jnp
56+
57+ return jnp
58+ return np
5159
5260 # noinspection PyPep8Naming
5361 @classmethod
You can’t perform that action at this time.
0 commit comments