Skip to content

models

shiftFourier(Utable, Vtable, wl, C_in, x0, y0)

Apply an image-plane shift as a Fourier-space phasor.

Parameters:

Name Type Description Default
Utable array - like

U baseline coordinates.

required
Vtable array - like

V baseline coordinates.

required
wl array - like

Wavelengths.

required
C_in array - like

Input complex visibility.

required
x0 float

Image-plane x shift in radians.

required
y0 float

Image-plane y shift in radians.

required

Returns:

Type Description
ndarray

Shifted complex visibility.

Source code in src/amical/analysis/models.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def shiftFourier(Utable, Vtable, wl, C_in, x0, y0):
    """Apply an image-plane shift as a Fourier-space phasor.

    Parameters
    ----------
    Utable : array-like
        U baseline coordinates.
    Vtable : array-like
        V baseline coordinates.
    wl : array-like
        Wavelengths.
    C_in : array-like
        Input complex visibility.
    x0 : float
        Image-plane x shift in radians.
    y0 : float
        Image-plane y shift in radians.

    Returns
    -------
    numpy.ndarray
        Shifted complex visibility.
    """
    u = Utable / wl
    v = Vtable / wl
    C_out = C_in * np.exp(-2j * np.pi * (u * x0 + v * y0))
    return C_out

visBinary(Utable, Vtable, Lambda, param)

Compute the complex visibility of an unresolved binary.

Parameters:

Name Type Description Default
Utable array_like

U baseline coordinates.

required
Vtable array_like

V baseline coordinates.

required
Lambda array_like

Wavelengths.

required
param dict

Binary parameters: separation sep in milliarcseconds, magnitude difference dm, and position angle theta in degrees.

required

Returns:

Type Description
ndarray

Complex binary visibility. Returns NaN values when dm is negative.

Source code in src/amical/analysis/models.py
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
def visBinary(Utable, Vtable, Lambda, param):
    """Compute the complex visibility of an unresolved binary.

    Parameters
    ----------
    Utable : array_like
        U baseline coordinates.
    Vtable : array_like
        V baseline coordinates.
    Lambda : array_like
        Wavelengths.
    param : dict
        Binary parameters: separation ``sep`` in milliarcseconds, magnitude
        difference ``dm``, and position angle ``theta`` in degrees.

    Returns
    -------
    numpy.ndarray
        Complex binary visibility. Returns NaN values when ``dm`` is negative.
    """
    sep = mas2rad(param["sep"])
    dm = param["dm"]
    theta = np.deg2rad(90 - param["theta"])

    if dm < 0:
        return np.array([np.nan] * len(Lambda))
    f1 = 1
    f2 = f1 / 2.5**dm
    ftot = f1 + f2

    rel_f1 = f1 / ftot
    rel_f2 = f2 / ftot

    p_s1 = {"x0": 0, "y0": 0}
    p_s2 = {"x0": sep * np.cos(theta), "y0": sep * np.sin(theta)}
    s1 = rel_f1 * visPointSource(Utable, Vtable, Lambda, p_s1)
    s2 = rel_f2 * visPointSource(Utable, Vtable, Lambda, p_s2)
    C_centered = s1 + s2
    return C_centered

visBinary_res(Utable, Vtable, Lambda, param)

Compute the complex visibility of a binary with a resolved primary.

Parameters:

Name Type Description Default
Utable array_like

U baseline coordinates.

required
Vtable array_like

V baseline coordinates.

required
Lambda array_like

Wavelengths.

required
param dict

Binary parameters: separation sep and primary diameter diam in milliarcseconds, magnitude difference dm, and position angle theta in degrees. A zero diam models the primary as unresolved.

required

Returns:

Type Description
ndarray

Complex binary visibility. Returns NaN values when dm is negative.

Source code in src/amical/analysis/models.py
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
def visBinary_res(Utable, Vtable, Lambda, param):
    """Compute the complex visibility of a binary with a resolved primary.

    Parameters
    ----------
    Utable : array_like
        U baseline coordinates.
    Vtable : array_like
        V baseline coordinates.
    Lambda : array_like
        Wavelengths.
    param : dict
        Binary parameters: separation ``sep`` and primary diameter ``diam`` in
        milliarcseconds, magnitude difference ``dm``, and position angle
        ``theta`` in degrees. A zero ``diam`` models the primary as unresolved.

    Returns
    -------
    numpy.ndarray
        Complex binary visibility. Returns NaN values when ``dm`` is negative.
    """
    sep = mas2rad(param["sep"])
    dm = param["dm"]
    theta = np.deg2rad(90 - param["theta"])
    diam = param["diam"]

    if dm < 0:
        return np.array([np.nan] * len(Lambda))
    f1 = 1
    f2 = f1 / 2.5**dm
    ftot = f1 + f2

    rel_f1 = f1 / ftot
    rel_f2 = f2 / ftot

    if diam == 0:
        p_s1 = {"x0": 0, "y0": 0}
    else:
        p_s1 = {"diam": diam, "x0": 0, "y0": 0}
    p_s2 = {"x0": sep * np.cos(theta), "y0": sep * np.sin(theta)}

    if diam == 0:
        s1 = rel_f1 * visPointSource(Utable, Vtable, Lambda, p_s1)
    else:
        s1 = rel_f1 * visUniformDisk(Utable, Vtable, Lambda, p_s1)
    s2 = rel_f2 * visPointSource(Utable, Vtable, Lambda, p_s2)
    C_centered = s1 + s2
    return C_centered

visClumpDebrisDisk(Utable, Vtable, Lambda, param)

Compute the complex visibility of a clumpy debris disk.

Parameters:

Name Type Description Default
Utable array - like

U baseline coordinates.

required
Vtable array - like

V baseline coordinates.

required
Lambda array - like

Wavelengths.

required
param dict

Model parameters: majorAxis and thickness in milliarcseconds; x0 and y0 in radians; incl and posang in degrees; star-to-disk contrast cr; clump diameter d_clump in milliarcseconds; and clump flux percentage cr_clump.

required

Returns:

Type Description
ndarray

Complex visibility of the star, debris disk, and clump.

Source code in src/amical/analysis/models.py
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
def visClumpDebrisDisk(Utable, Vtable, Lambda, param):
    """Compute the complex visibility of a clumpy debris disk.

    Parameters
    ----------
    Utable : array-like
        U baseline coordinates.
    Vtable : array-like
        V baseline coordinates.
    Lambda : array-like
        Wavelengths.
    param : dict
        Model parameters: ``majorAxis`` and ``thickness`` in milliarcseconds;
        ``x0`` and ``y0`` in radians; ``incl`` and ``posang`` in degrees;
        star-to-disk contrast ``cr``; clump diameter ``d_clump`` in
        milliarcseconds; and clump flux percentage ``cr_clump``.

    Returns
    -------
    numpy.ndarray
        Complex visibility of the star, debris disk, and clump.
    """
    from scipy import special

    majorAxis = mas2rad(param["majorAxis"]) * 2
    inclination = np.deg2rad(param["incl"])
    posang = np.deg2rad(param["posang"])
    thickness = mas2rad(param["thickness"])
    cr_star = param["cr"]
    x0 = param["x0"]
    y0 = param["y0"]

    minorAxis = majorAxis * np.cos(inclination)

    # majorAxis = majorAxis_c * np.cos(inclination) - minorAxis_c * np.sin(inclination)
    # minorAxis = -majorAxis_c * np.sin(inclination) + minorAxis_c * np.cos(inclination)

    u = Utable / Lambda
    v = Vtable / Lambda

    r = np.sqrt(
        ((u * np.sin(posang) + v * np.cos(posang)) * majorAxis) ** 2
        + ((u * np.cos(posang) - v * np.sin(posang)) * minorAxis) ** 2
    )

    d_clump = mas2rad(param["d_clump"])
    cr_clump = param["cr_clump"] / 100.0

    x1 = 0
    y1 = majorAxis * np.cos(inclination)
    x_clump = (x1 * np.cos(posang) - y1 * np.sin(posang)) / 2.0
    y_clump = (x1 * np.sin(posang) + y1 * np.cos(posang)) / 2.0

    p_clump = {"fwhm": d_clump, "x0": x_clump, "y0": y_clump}

    C_clump = visGaussianDisk(Utable, Vtable, Lambda, p_clump)

    C_centered = special.j0(np.pi * r)
    C_shifted = shiftFourier(Utable, Vtable, Lambda, C_centered, x0, y0)
    C = C_shifted * visGaussianDisk(
        Utable, Vtable, Lambda, {"fwhm": thickness, "x0": 0.0, "y0": 0.0}
    )

    fstar = cr_star
    fdisk = 1
    total_flux = fstar + fdisk

    f_clump = cr_clump * total_flux
    f_debrisdisk = (1 - cr_clump) * total_flux

    rel_star = fstar / total_flux
    rel_disk = fdisk / total_flux

    p_s1 = {"x0": x0, "y0": y0}
    s1 = rel_star * visPointSource(Utable, Vtable, Lambda, p_s1)
    s2 = rel_disk * C
    deb_disk = s1 + s2
    return f_debrisdisk * deb_disk + f_clump * C_clump

visEllipticalDisk(Utable, Vtable, Lambda, param)

Compute the complex visibility of an elliptical thick ring.

Parameters:

Name Type Description Default
Utable array - like

U baseline coordinates.

required
Vtable array - like

V baseline coordinates.

required
Lambda array - like

Wavelengths.

required
param dict

Model parameters: majorAxis and thickness in milliarcseconds, incl and posang in degrees, star-to-disk contrast cr, and position values x0 and y0. The latter are used directly for the ring shift and are converted from milliarcseconds for the stellar term.

required

Returns:

Type Description
ndarray

Complex visibility of the star and elliptical ring.

Source code in src/amical/analysis/models.py
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
def visEllipticalDisk(Utable, Vtable, Lambda, param):
    """Compute the complex visibility of an elliptical thick ring.

    Parameters
    ----------
    Utable : array-like
        U baseline coordinates.
    Vtable : array-like
        V baseline coordinates.
    Lambda : array-like
        Wavelengths.
    param : dict
        Model parameters: ``majorAxis`` and ``thickness`` in milliarcseconds,
        ``incl`` and ``posang`` in degrees, star-to-disk contrast ``cr``, and
        position values ``x0`` and ``y0``. The latter are used directly for the
        ring shift and are converted from milliarcseconds for the stellar term.

    Returns
    -------
    numpy.ndarray
        Complex visibility of the star and elliptical ring.
    """
    from scipy import special

    majorAxis = mas2rad(param["majorAxis"]) * 2
    inclination = np.deg2rad(param["incl"])
    posang = np.deg2rad(param["posang"])
    thickness = mas2rad(param["thickness"])
    cr_star = param["cr"]
    x0 = param["x0"]
    y0 = param["y0"]

    minorAxis = majorAxis * np.cos(inclination)

    u = Utable / Lambda
    v = Vtable / Lambda

    r = np.sqrt(
        ((u * np.sin(posang) + v * np.cos(posang)) * majorAxis) ** 2
        + ((u * np.cos(posang) - v * np.sin(posang)) * minorAxis) ** 2
    )

    C_centered = special.j0(np.pi * r)
    C_shifted = shiftFourier(Utable, Vtable, Lambda, C_centered, x0, y0)
    C = C_shifted * visGaussianDisk(
        Utable, Vtable, Lambda, {"fwhm": thickness, "x0": 0.0, "y0": 0.0}
    )

    fstar = cr_star
    fdisk = 1
    total_flux = fstar + fdisk

    rel_star = fstar / total_flux
    rel_disk = fdisk / total_flux

    p_s1 = {"x0": mas2rad(x0), "y0": mas2rad(y0)}
    s1 = rel_star * visPointSource(Utable, Vtable, Lambda, p_s1)
    s2 = rel_disk * C
    return s1 + s2

visGaussianDisk(Utable, Vtable, Lambda, param)

Compute the complex visibility of a Gaussian disk.

Parameters:

Name Type Description Default
Utable array - like

U baseline coordinates.

required
Vtable array - like

V baseline coordinates.

required
Lambda array - like

Wavelengths.

required
param dict

Model parameters fwhm, x0, and y0 in radians.

required

Returns:

Type Description
ndarray

Complex visibility of the shifted Gaussian disk.

Source code in src/amical/analysis/models.py
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
def visGaussianDisk(Utable, Vtable, Lambda, param):
    """Compute the complex visibility of a Gaussian disk.

    Parameters
    ----------
    Utable : array-like
        U baseline coordinates.
    Vtable : array-like
        V baseline coordinates.
    Lambda : array-like
        Wavelengths.
    param : dict
        Model parameters ``fwhm``, ``x0``, and ``y0`` in radians.

    Returns
    -------
    numpy.ndarray
        Complex visibility of the shifted Gaussian disk.
    """
    u = Utable / Lambda
    v = Vtable / Lambda

    fwhm = param["fwhm"]
    x0 = param["x0"]
    y0 = param["y0"]

    r2 = ((np.pi**2) * (u**2 + v**2) * (fwhm**2)) / (4.0 * np.log(2.0))
    C_centered = np.exp(-r2)

    # Deplacement du plan image
    C = shiftFourier(Utable, Vtable, Lambda, C_centered, x0, y0)
    return C

visPointSource(Utable, Vtable, Lambda, param)

Compute the complex visibility of a point source.

Parameters:

Name Type Description Default
Utable array - like

U baseline coordinates.

required
Vtable array - like

V baseline coordinates.

required
Lambda array - like

Wavelengths.

required
param dict

Model parameters x0 and y0 in radians.

required

Returns:

Type Description
ndarray

Complex visibility of the shifted point source.

Source code in src/amical/analysis/models.py
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
def visPointSource(Utable, Vtable, Lambda, param):
    """Compute the complex visibility of a point source.

    Parameters
    ----------
    Utable : array-like
        U baseline coordinates.
    Vtable : array-like
        V baseline coordinates.
    Lambda : array-like
        Wavelengths.
    param : dict
        Model parameters ``x0`` and ``y0`` in radians.

    Returns
    -------
    numpy.ndarray
        Complex visibility of the shifted point source.
    """
    C_centered = np.ones(np.size(Utable))
    C = shiftFourier(Utable, Vtable, Lambda, C_centered, param["x0"], param["y0"])
    return C

visUniformDisk(Utable, Vtable, Lambda, param)

Compute the complex visibility of a uniform disk.

Parameters:

Name Type Description Default
Utable array - like

U baseline coordinates.

required
Vtable array - like

V baseline coordinates.

required
Lambda array - like

Wavelengths.

required
param dict

Model parameters: diam, x0, and y0 in milliarcseconds.

required

Returns:

Type Description
ndarray

Complex visibility of the shifted uniform disk.

Source code in src/amical/analysis/models.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def visUniformDisk(Utable, Vtable, Lambda, param):
    """Compute the complex visibility of a uniform disk.

    Parameters
    ----------
    Utable : array-like
        U baseline coordinates.
    Vtable : array-like
        V baseline coordinates.
    Lambda : array-like
        Wavelengths.
    param : dict
        Model parameters: ``diam``, ``x0``, and ``y0`` in milliarcseconds.

    Returns
    -------
    numpy.ndarray
        Complex visibility of the shifted uniform disk.
    """
    from scipy import special

    u = Utable / Lambda
    v = Vtable / Lambda

    diam = mas2rad(param["diam"])

    r = np.sqrt(u**2 + v**2)

    C_centered = 2 * special.j1(np.pi * r * diam) / (np.pi * r * diam)
    C = shiftFourier(
        Utable, Vtable, Lambda, C_centered, mas2rad(param["x0"]), mas2rad(param["y0"])
    )
    return C