Model¶
-
class
ehtim.model.
Model
(ra=17.761122472222223, dec=- 28.992189444444445, pa=0.0, polrep='stokes', pol_prim=None, rf=230000000000.0, source='SgrA', mjd=51544, time=0.0)[source]¶ A model with analytic representations in the image and visibility domains.
Attributes:
-
N_models
()[source]¶ Return the number of model components
Args:
- Returns
number of model components
- Return type
(int)
-
add_blurred_crescent
(F0=1.0, d=2.424068405547068e-10, alpha=4.848136811094136e-11, fr=0.0, fo=0.0, ff=0.0, phi=0.0, x0=0.0, y0=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add a circular disk model that is blurred with a circular Gaussian kernel.
- Parameters
F0 (float) – The total flux of the disk (Jy)
d (float) – The diameter (radians)
alpha (float) – The blurring (FWHM of Gaussian convolution) (radians)
fr (float) – Fractional radius of the inner subtracted disk with respect to the radius of the outer disk
fo (float) – Fractional offset of the inner disk from the center of the outer disk
ff (float) – Fractional brightness of the inner disk
phi (float) – angle of offset of the inner disk
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
- Returns
Updated Model
- Return type
(Model)
-
add_blurred_disk
(F0=1.0, d=2.424068405547068e-10, alpha=4.848136811094136e-11, x0=0.0, y0=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add a circular disk model that is blurred with a circular Gaussian kernel.
-
add_circ_gauss
(F0=1.0, FWHM=2.424068405547068e-10, x0=0.0, y0=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add a circular Gaussian model.
-
add_crescent
(F0=1.0, d=2.424068405547068e-10, fr=0.0, fo=0.0, ff=0.0, phi=0.0, x0=0.0, y0=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add a crescent model.
- Parameters
F0 (float) – The total flux of the disk (Jy)
d (float) – The diameter (radians)
fr (float) – Fractional radius of the inner subtracted disk with respect to the radius of the outer disk
fo (float) – Fractional offset of the inner disk from the center of the outer disk
ff (float) – Fractional brightness of the inner disk
phi (float) – angle of offset of the inner disk
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
- Returns
Updated Model
- Return type
(Model)
-
add_disk
(F0=1.0, d=2.424068405547068e-10, x0=0.0, y0=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add a circular disk model.
-
add_gauss
(F0=1.0, FWHM_maj=2.424068405547068e-10, FWHM_min=2.424068405547068e-10, PA=0.0, x0=0.0, y0=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add an anisotropic Gaussian model.
- Parameters
F0 (float) – The total flux of the Gaussian (Jy)
FWHM_maj (float) – The FWHM of the Gaussian major axis (radians)
FWHM_min (float) – The FWHM of the Gaussian minor axis (radians)
PA (float) – Position angle of the major axis, east of north (radians)
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
- Returns
Updated Model
- Return type
(Model)
-
add_mring
(F0=1.0, d=2.424068405547068e-10, x0=0.0, y0=0.0, beta_list=None, beta_list_pol=None, beta_list_cpol=None)[source]¶ Add a ring model with azimuthal brightness variations determined by a Fourier mode expansion. For details, see Eq. 18-20 of https://arxiv.org/abs/1907.04329
- Parameters
F0 (float) – The total flux of the ring (Jy), which is also beta_0.
d (float) – The diameter (radians)
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
beta_list (list) – List of complex Fourier coefficients, [beta_1, beta_2, …]. Negative indices are determined by the condition beta_{-m} = beta_m*. Indices are all scaled by F0 = beta_0, so they are dimensionless.
- Returns
Updated Model
- Return type
(Model)
-
add_point
(F0=1.0, x0=0.0, y0=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add a point source model.
-
add_ring
(F0=1.0, d=2.424068405547068e-10, x0=0.0, y0=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add a ring model with infinitesimal thickness.
-
add_stretched_mring
(F0=1.0, d=2.424068405547068e-10, x0=0.0, y0=0.0, beta_list=None, beta_list_pol=None, beta_list_cpol=None, stretch=1.0, stretch_PA=0.0)[source]¶ Add a stretched ring model with azimuthal brightness variations determined by a Fourier mode expansion. For details, see Eq. 18-20 of https://arxiv.org/abs/1907.04329
- Parameters
F0 (float) – The total flux of the ring (Jy), which is also beta_0.
d (float) – The diameter (radians)
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
beta_list (list) – List of complex Fourier coefficients, [beta_1, beta_2, …]. Negative indices are determined by the condition beta_{-m} = beta_m*. Indices are all scaled by F0 = beta_0, so they are dimensionless.
stretch (float) – The stretch to apply (1.0 = no stretch)
stretch_PA (float) – Position angle of the stretch, east of north (radians)
- Returns
Updated Model
- Return type
(Model)
-
add_stretched_ring
(F0=1.0, d=2.424068405547068e-10, x0=0.0, y0=0.0, stretch=1.0, stretch_PA=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add a stretched ring model with infinitesimal thickness.
- Parameters
- Returns
Updated Model
- Return type
(Model)
-
add_stretched_thick_mring
(F0=1.0, d=2.424068405547068e-10, alpha=4.848136811094136e-11, x0=0.0, y0=0.0, beta_list=None, beta_list_pol=None, beta_list_cpol=None, stretch=1.0, stretch_PA=0.0)[source]¶ Add a ring model with azimuthal brightness variations determined by a Fourier mode expansion and thickness determined by circular Gaussian convolution. For details, see Eq. 18-20 of https://arxiv.org/abs/1907.04329 The Gaussian convolution calculation is a trivial generalization of Appendix G of https://iopscience.iop.org/article/10.3847/2041-8213/ab0e85/pdf
- Parameters
F0 (float) – The total flux of the ring (Jy), which is also beta_0.
d (float) – The ring diameter (radians)
alpha (float) – The ring thickness (FWHM of Gaussian convolution) (radians)
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
beta_list (list) – List of complex Fourier coefficients, [beta_1, beta_2, …]. Negative indices are determined by the condition beta_{-m} = beta_m*. Indices are all scaled by F0 = beta_0, so they are dimensionless.
stretch (float) – The stretch to apply (1.0 = no stretch)
stretch_PA (float) – Position angle of the stretch, east of north (radians)
- Returns
Updated Model
- Return type
(Model)
-
add_stretched_thick_mring_floor
(F0=1.0, d=2.424068405547068e-10, alpha=4.848136811094136e-11, ff=0.0, x0=0.0, y0=0.0, beta_list=None, beta_list_pol=None, beta_list_cpol=None, stretch=1.0, stretch_PA=0.0)[source]¶ Add a ring model with azimuthal brightness variations determined by a Fourier mode expansion and thickness determined by circular Gaussian convolution. For details, see Eq. 18-20 of https://arxiv.org/abs/1907.04329 The Gaussian convolution calculation is a trivial generalization of Appendix G of https://iopscience.iop.org/article/10.3847/2041-8213/ab0e85/pdf
- Parameters
F0 (float) – The total flux of the ring (Jy), which is also beta_0.
d (float) – The ring diameter (radians)
alpha (float) – The ring thickness (FWHM of Gaussian convolution) (radians)
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
beta_list (list) – List of complex Fourier coefficients, [beta_1, beta_2, …]. Negative indices are determined by the condition beta_{-m} = beta_m*. Indices are all scaled by F0 = beta_0, so they are dimensionless.
stretch (float) – The stretch to apply (1.0 = no stretch)
stretch_PA (float) – Position angle of the stretch, east of north (radians)
- Returns
Updated Model
- Return type
(Model)
-
add_stretched_thick_ring
(F0=1.0, d=2.424068405547068e-10, alpha=4.848136811094136e-11, x0=0.0, y0=0.0, stretch=1.0, stretch_PA=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add a ring model with finite thickness, determined by circular Gaussian convolution of a thin ring. For details, see Appendix G of https://iopscience.iop.org/article/10.3847/2041-8213/ab0e85/pdf
- Parameters
F0 (float) – The total flux of the ring (Jy)
d (float) – The ring diameter (radians)
alpha (float) – The ring thickness (FWHM of Gaussian convolution) (radians)
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
stretch (float) – The stretch to apply (1.0 = no stretch)
stretch_PA (float) – Position angle of the stretch, east of north (radians)
- Returns
Updated Model
- Return type
(Model)
-
add_thick_mring
(F0=1.0, d=2.424068405547068e-10, alpha=4.848136811094136e-11, x0=0.0, y0=0.0, beta_list=None, beta_list_pol=None, beta_list_cpol=None)[source]¶ Add a ring model with azimuthal brightness variations determined by a Fourier mode expansion and thickness determined by circular Gaussian convolution. For details, see Eq. 18-20 of https://arxiv.org/abs/1907.04329 The Gaussian convolution calculation is a trivial generalization of Appendix G of https://iopscience.iop.org/article/10.3847/2041-8213/ab0e85/pdf
- Parameters
F0 (float) – The total flux of the ring (Jy), which is also beta_0.
d (float) – The ring diameter (radians)
alpha (float) – The ring thickness (FWHM of Gaussian convolution) (radians)
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
beta_list (list) – List of complex Fourier coefficients, [beta_1, beta_2, …]. Negative indices are determined by the condition beta_{-m} = beta_m*. Indices are all scaled by F0 = beta_0, so they are dimensionless.
- Returns
Updated Model
- Return type
(Model)
-
add_thick_mring_Gfloor
(F0=1.0, d=2.424068405547068e-10, alpha=4.848136811094136e-11, ff=0.0, FWHM=2.424068405547068e-10, x0=0.0, y0=0.0, beta_list=None, beta_list_pol=None, beta_list_cpol=None)[source]¶ Add a ring model with azimuthal brightness variations determined by a Fourier mode expansion, thickness determined by circular Gaussian convolution, and a floor The floor is a circular Gaussian, with size FWHM For details, see Eq. 18-20 of https://arxiv.org/abs/1907.04329 The Gaussian convolution calculation is a trivial generalization of Appendix G of https://iopscience.iop.org/article/10.3847/2041-8213/ab0e85/pdf
- Parameters
F0 (float) – The total flux of the model
d (float) – The ring diameter (radians)
alpha (float) – The ring thickness (FWHM of Gaussian convolution) (radians)
FWHM (float) – The Gaussian FWHM
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
ff (float) – The fraction of the total flux in the floor
beta_list (list) – List of complex Fourier coefficients, [beta_1, beta_2, …]. Negative indices are determined by the condition beta_{-m} = beta_m*. Indices are all scaled by F0 = beta_0, so they are dimensionless.
- Returns
Updated Model
- Return type
(Model)
-
add_thick_mring_floor
(F0=1.0, d=2.424068405547068e-10, alpha=4.848136811094136e-11, ff=0.0, x0=0.0, y0=0.0, beta_list=None, beta_list_pol=None, beta_list_cpol=None)[source]¶ Add a ring model with azimuthal brightness variations determined by a Fourier mode expansion, thickness determined by circular Gaussian convolution, and a floor The floor is a blurred disk, with diameter d and blurred FWHM alpha For details, see Eq. 18-20 of https://arxiv.org/abs/1907.04329 The Gaussian convolution calculation is a trivial generalization of Appendix G of https://iopscience.iop.org/article/10.3847/2041-8213/ab0e85/pdf
- Parameters
F0 (float) – The total flux of the ring (Jy), which is also beta_0.
d (float) – The ring diameter (radians)
alpha (float) – The ring thickness (FWHM of Gaussian convolution) (radians)
x0 (float) – The x-coordinate (radians)
y0 (float) – The y-coordinate (radians)
ff (float) – The fraction of the total flux in the floor
beta_list (list) – List of complex Fourier coefficients, [beta_1, beta_2, …]. Negative indices are determined by the condition beta_{-m} = beta_m*. Indices are all scaled by F0 = beta_0, so they are dimensionless.
- Returns
Updated Model
- Return type
(Model)
-
add_thick_ring
(F0=1.0, d=2.424068405547068e-10, alpha=4.848136811094136e-11, x0=0.0, y0=0.0, pol_frac=0.0, pol_evpa=0.0, cpol_frac=0.0)[source]¶ Add a ring model with finite thickness, determined by circular Gaussian convolution of a thin ring. For details, see Appendix G of https://iopscience.iop.org/article/10.3847/2041-8213/ab0e85/pdf
-
blur_circ
(fwhm)[source]¶ Return a new model, equal to the current one convolved with a circular Gaussian kernel
-
centroid
(pol=None)[source]¶ Compute the location of the image centroid (corresponding to the polarization pol) Note: This quantity is only well defined for total intensity
- Parameters
pol (str) – The polarization for which to find the image centroid
- Returns
centroid positions (x0,y0) in radians
- Return type
(np.array)
-
copy
()[source]¶ Return a copy of the Model object.
Args:
- Returns
copy of the Model.
- Return type
(Model)
-
make_image
(fov, npix, polrep='stokes', pol_prim=None, pulse=<function trianglePulse2D>, time=0.0)[source]¶ Sample the model onto a square image.
- Parameters
fov (float) – the field of view of each axis in radians
npix (int) – the number of pixels on each axis
ra (float) – The source Right Ascension in fractional hours
dec (float) – The source declination in fractional degrees
rf (float) – The image frequency in Hz
source (str) – The source name
polrep (str) – polarization representation, either ‘stokes’ or ‘circ’
pol_prim (str) – The default image: I,Q,U or V for Stokes, RR,LL,LR,RL for Circular
pulse (function) – The function convolved with the pixel values for continuous image.
mjd (int) – The integer MJD of the image
time (float) – The observing time of the image (UTC hours)
- Returns
an image object
- Return type
(Image)
-
observe
(array, tint, tadv, tstart, tstop, bw, mjd=None, timetype='UTC', polrep_obs=None, elevmin=10.0, elevmax=85.0, no_elevcut_space=False, fix_theta_GMST=False, add_th_noise=True, opacitycal=True, ampcal=True, phasecal=True, dcal=True, frcal=True, rlgaincal=True, stabilize_scan_phase=False, stabilize_scan_amp=False, jones=False, inv_jones=False, tau=0.1, taup=0.1, gainp=0.1, gain_offset=0.1, dterm_offset=0.05, rlratio_std=0.0, rlphase_std=0.0, seed=False, **kwargs)[source]¶ Generate baselines from an array object and observe the image.
- Parameters
array (Array) – an array object containing sites with which to generate baselines
tint (float) – the scan integration time in seconds
tadv (float) – the uniform cadence between scans in seconds
tstart (float) – the start time of the observation in hours
tstop (float) – the end time of the observation in hours
bw (float) – the observing bandwidth in Hz
mjd (int) – the mjd of the observation, if set as different from the image mjd
timetype (str) – how to interpret tstart and tstop; either ‘GMST’ or ‘UTC’
elevmin (float) – station minimum elevation in degrees
elevmax (float) – station maximum elevation in degrees
no_elevcut_space (bool) – if True, do not apply elevation cut to orbiters
polrep_obs (str) – ‘stokes’ or ‘circ’ sets the data polarimetric representation
fix_theta_GMST (bool) – if True, stops earth rotation to sample fixed u,v
sgrscat (bool) – if True, the visibilites will be blurred by the Sgr A* kernel
add_th_noise (bool) – if True, baseline-dependent thermal noise is added
opacitycal (bool) – if False, time-dependent gaussian errors are added to opacities
ampcal (bool) – if False, time-dependent gaussian errors are added to station gains
phasecal (bool) – if False, time-dependent station-based random phases are added
frcal (bool) – if False, feed rotation angle terms are added to Jones matrices.
dcal (bool) – if False, time-dependent gaussian errors added to Jones matrices D-terms.
stabilize_scan_phase (bool) – if True, random phase errors are constant over scans
stabilize_scan_amp (bool) – if True, random amplitude errors are constant over scans
jones (bool) – if True, uses Jones matrix to apply mis-calibration effects otherwise uses old formalism without D-terms
inv_jones (bool) – if True, applies estimated inverse Jones matrix (not including random terms) to calibrate data
tau (float) – the base opacity at all sites, or a dict giving one opacity per site
taup (float) – the fractional std. dev. of the random error on the opacities
gainp (float) – the fractional std. dev. of the random error on the gains or a dict giving one std. dev. per site
gain_offset (float) – the base gain offset at all sites, or a dict giving one gain offset per site
dterm_offset (float) – the base std. dev. of random additive error at all sites, or a dict giving one std. dev. per site
rlratio_std (float) – the fractional std. dev. of the R/L gain offset or a dict giving one std. dev. per site
rlphase_std (float) – std. dev. of R/L phase offset, or a dict giving one std. dev. per site a negative value samples from uniform
seed (int) – seeds the random component of noise added. DO NOT set to 0!
- Returns
an observation object
- Return type
(Obsdata)
-
observe_same
(obs_in, add_th_noise=True, sgrscat=False, ttype=False, opacitycal=True, ampcal=True, phasecal=True, dcal=True, frcal=True, rlgaincal=True, stabilize_scan_phase=False, stabilize_scan_amp=False, neggains=False, jones=False, inv_jones=False, tau=0.1, taup=0.1, gain_offset=0.1, gainp=0.1, dterm_offset=0.05, rlratio_std=0.0, rlphase_std=0.0, caltable_path=None, seed=False, **kwargs)[source]¶ Observe the image on the same baselines as an existing observation object and add noise.
- Parameters
obs_in (Obsdata) – the existing observation
add_th_noise (bool) – if True, baseline-dependent thermal noise is added
opacitycal (bool) – if False, time-dependent gaussian errors are added to opacities
ampcal (bool) – if False, time-dependent gaussian errors are added to station gains
phasecal (bool) – if False, time-dependent station-based random phases are added
frcal (bool) – if False, feed rotation angle terms are added to Jones matrices.
dcal (bool) – if False, time-dependent gaussian errors added to D-terms.
stabilize_scan_phase (bool) – if True, random phase errors are constant over scans
stabilize_scan_amp (bool) – if True, random amplitude errors are constant over scans
neggains (bool) – if True, force the applied gains to be <1 meaning that you have overestimated your telescope’s performance
jones (bool) – if True, uses Jones matrix to apply mis-calibration effects
inv_jones (bool) – if True, applies estimated inverse Jones matrix (not including random terms) to a priori calibrate data
tau (float) – the base opacity at all sites, or a dict giving one opacity per site
taup (float) – the fractional std. dev. of the random error on the opacities
gainp (float) – the fractional std. dev. of the random error on the gains or a dict giving one std. dev. per site
gain_offset (float) – the base gain offset at all sites, or a dict giving one gain offset per site
dterm_offset (float) – the base std. dev. of random additive error at all sites, or a dict giving one std. dev. per site
rlratio_std (float) – the fractional std. dev. of the R/L gain offset or a dict giving one std. dev. per site
rlphase_std (float) – std. dev. of R/L phase offset, or a dict giving one std. dev. per site a negative value samples from uniform
caltable_path (string) – The path and prefix of a saved caltable
seed (int) – seeds the random component of the noise terms. DO NOT set to 0!
- Returns
an observation object
- Return type
(Obsdata)
-
observe_same_nonoise
(obs, **kwargs)[source]¶ Observe the model on the same baselines as an existing observation, without noise.
-
sample_grad_uv
(u, v, pol='I', fit_pol=False, fit_cpol=False, fit_leakage=False, jonesdict=None)[source]¶ Sample model visibility gradient on the specified u and v coordinates wrt all model parameters
-
sample_graduv_uv
(u, v, pol='I', jonesdict=None)[source]¶ Sample model visibility gradient on the specified u and v coordinates wrt (u,v)
-
sample_uv
(u, v, polrep_obs='Stokes', pol='I', jonesdict=None)[source]¶ Sample model visibility on the specified u and v coordinates
-
sample_xy
(x, y, psize=4.848136811094136e-12, pol='I')[source]¶ Sample model image on the specified x and y coordinates
-
switch_polrep
(polrep_out='stokes', pol_prim_out=None)[source]¶ Return a new model with the polarization representation changed :param polrep_out: the polrep of the output data :type polrep_out: str :param pol_prim_out: The default image: I,Q,U or V for Stokes, RR,LL,LR,RL for circ :type pol_prim_out: str
- Returns
new Model object with potentially different polrep
- Return type
(Model)
-
-
ehtim.model.
blur_circ_1model
(model_type, params, fwhm)[source]¶ Blur a single model, returning new model type and associated parameters