Obsdata¶
-
class
ehtim.obsdata.
Obsdata
(ra, dec, rf, bw, datatable, tarr, scantable=None, polrep='stokes', source='SgrA', mjd=51544, timetype='UTC', ampcal=True, phasecal=True, opacitycal=True, dcal=True, frcal=True, trial_speedups=False)[source]¶ A polarimetric VLBI observation of visibility amplitudes and phases (in Jy).
-
tarr
¶ The array of telescope data with datatype DTARR
- Type
numpy.recarray
-
data
¶ the basic data with datatype DTPOL_STOKES or DTPOL_CIRC
- Type
numpy.recarray
-
scantable
¶ The array of scan information
- Type
numpy.recarray
-
amp
¶ An array of (averaged) visibility amplitudes
- Type
numpy.recarray
-
bispec
¶ An array of (averaged) bispectra
- Type
numpy.recarray
-
cphase
¶ An array of (averaged) closure phases
- Type
numpy.recarray
-
cphase_diag
¶ An array of (averaged) diagonalized closure phases
- Type
numpy.recarray
-
camp
¶ An array of (averaged) closure amplitudes
- Type
numpy.recarray
-
logcamp
¶ An array of (averaged) log closure amplitudes
- Type
numpy.recarray
-
logcamp_diag
¶ An array of (averaged) diagonalized log closure amps
- Type
numpy.recarray
-
add_all
(avg_time=0, return_type='rec', count='max', debias=True, snrcut=0.0, err_type='predicted', num_samples=1000, round_s=0.1)[source]¶ Adds tables of all all averaged derived quantities self.amp,self.bispec,self.cphase,self.camp,self.logcamp
- Parameters
avg_time (float) – closure amplitude averaging timescale
return_type – data frame (‘df’) or recarray (‘rec’)
debias (bool) – If True, debias the closure amplitude
count (str) – If ‘min’, return minimal set of closure quantities, if ‘max’ return all closure quantities
err_type (str) – ‘predicted’ or ‘measured’
num_samples – number of bootstrap (re)samples if measuring error
round_s (float) – accuracy of datetime object in seconds
snrcut (float) – flag closure amplitudes with snr lower than this
-
add_amp
(avg_time=0, scan_avg=False, debias=True, err_type='predicted', return_type='rec', round_s=0.1, snrcut=0.0)[source]¶ Adds attribute self.amp: aan amplitude table with incoherently averaged amplitudes
- Parameters
avg_time (float) – incoherent integration time in seconds
scan_avg (bool) – if True, average over scans in self.scans instead of intime
debias (bool) – if True then apply debiasing
err_type (str) – ‘predicted’ or ‘measured’
return_type – data frame (‘df’) or recarray (‘rec’)
round_s (float) – accuracy of datetime object in seconds
snrcut (float) – flag amplitudes with snr lower than this
-
add_bispec
(avg_time=0, return_type='rec', count='max', snrcut=0.0, err_type='predicted', num_samples=1000, round_s=0.1, uv_min=False)[source]¶ Adds attribute self.bispec: bispectra table with bispectra averaged for dt
- Parameters
avg_time (float) – bispectrum averaging timescale
return_type – data frame (‘df’) or recarray (‘rec’)
count (str) – If ‘min’, return minimal set of bispectra, if ‘max’ return all bispectra up to reordering
err_type (str) – ‘predicted’ or ‘measured’
num_samples – number of bootstrap (re)samples if measuring error
round_s (float) – accuracy of datetime object in seconds
snrcut (float) – flag bispectra with snr lower than this
-
add_camp
(avg_time=0, return_type='rec', ctype='camp', count='max', debias=True, snrcut=0.0, err_type='predicted', num_samples=1000, round_s=0.1)[source]¶ Adds attribute self.camp or self.logcamp: closure amplitudes table
- Parameters
avg_time (float) – closure amplitude averaging timescale
return_type – data frame (‘df’) or recarray (‘rec’)
ctype (str) – The closure amplitude type (‘camp’ or ‘logcamp’)
debias (bool) – If True, debias the closure amplitude
count (str) – If ‘min’, return minimal set of amplitudes, if ‘max’ return all closure amplitudes up to inverses
err_type (str) – ‘predicted’ or ‘measured’
num_samples – number of bootstrap (re)samples if measuring error
round_s (float) – accuracy of datetime object in seconds
snrcut (float) – flag closure amplitudes with snr lower than this
-
add_cphase
(avg_time=0, return_type='rec', count='max', snrcut=0.0, err_type='predicted', num_samples=1000, round_s=0.1, uv_min=False)[source]¶ Adds attribute self.cphase: cphase table averaged for dt
- Parameters
avg_time (float) – closure phase averaging timescale
return_type – data frame (‘df’) or recarray (‘rec’)
count (str) – If ‘min’, return minimal set of phases, if ‘max’ return all closure phases up to reordering
err_type (str) – ‘predicted’ or ‘measured’
num_samples – number of bootstrap (re)samples if measuring error
round_s (float) – accuracy of datetime object in seconds
snrcut (float) – flag closure phases with snr lower than this
-
add_cphase_diag
(avg_time=0, return_type='rec', vtype='vis', count='min', snrcut=0.0, err_type='predicted', num_samples=1000, round_s=0.1, uv_min=False)[source]¶ Adds attribute self.cphase_diag: cphase_diag table averaged for dt
- Parameters
avg_time (float) – closure phase averaging timescale
return_type – data frame (‘df’) or recarray (‘rec’)
vtype (str) – Visibility type (e.g., ‘vis’, ‘llvis’, ‘rrvis’, etc.)
count (str) – If ‘min’, return minimal set of phases, If ‘max’ return all closure phases up to reordering
err_type (str) – ‘predicted’ or ‘measured’
num_samples – number of bootstrap (re)samples if measuring error
round_s (float) – accuracy of datetime object in seconds
snrcut (float) – flag closure phases with snr lower than this
-
add_fractional_noise
(frac_noise, debias=False)[source]¶ Add a constant fraction of amplitude at quadrature to thermal noise. Effectively imposes a maximal signal-to-noise ratio. !! this operation is not currently tracked and should be applied with extreme caution!!
-
add_leakage_noise
(Dterm_amp=0.1, min_noise=0.01, debias=False)[source]¶ Add estimated systematic noise from leakage at quadrature to thermal noise. Requires cross-hand visibilities. !! this operation is not currently tracked and should be applied with extreme caution!!
-
add_logcamp
(avg_time=0, return_type='rec', ctype='camp', count='max', debias=True, snrcut=0.0, err_type='predicted', num_samples=1000, round_s=0.1)[source]¶ Adds attribute self.logcamp: closure amplitudes table
- Parameters
avg_time (float) – closure amplitude averaging timescale
return_type – data frame (‘df’) or recarray (‘rec’)
ctype (str) – The closure amplitude type (‘camp’ or ‘logcamp’)
debias (bool) – If True, debias the closure amplitude
count (str) – If ‘min’, return minimal set of amplitudes, if ‘max’ return all closure amplitudes up to inverses
err_type (str) – ‘predicted’ or ‘measured’
num_samples – number of bootstrap (re)samples if measuring error
round_s (float) – accuracy of datetime object in seconds
snrcut (float) – flag closure amplitudes with snr lower than this
-
add_logcamp_diag
(avg_time=0, return_type='rec', count='min', snrcut=0.0, debias=True, err_type='predicted', num_samples=1000, round_s=0.1)[source]¶ Adds attribute self.logcamp_diag: logcamp_diag table averaged for dt
- Parameters
avg_time (float) – diagonal log closure amplitude averaging timescale
return_type – data frame (‘df’) or recarray (‘rec’)
debias (bool) – If True, debias the diagonal log closure amplitude
count (str) – If ‘min’, return minimal set of amplitudes, If ‘max’ return all diagonal log closure amplitudes up to inverses
err_type (str) – ‘predicted’ or ‘measured’
num_samples – number of bootstrap (re)samples if measuring error
round_s (float) – accuracy of datetime object in seconds
snrcut (float) – flag diagonal log closure amplitudes with snr lower than this
-
add_scans
(info='self', filepath='', dt=0.0165, margin=0.0001, split_subarray=False)[source]¶ Compute scans and add self.scans to Obsdata object.
-
avg_coherent
(inttime, scan_avg=False, moving=False)[source]¶ Coherently average data along u,v tracks in chunks of length inttime (sec)
-
avg_incoherent
(inttime, scan_avg=False, debias=True, err_type='predicted')[source]¶ Incoherently average data along u,v tracks in chunks of length inttime (sec)
- Parameters
- Returns
Obsdata object containing averaged data
- Return type
(Obsdata)
-
bispectra
(vtype='vis', mode='all', count='min', timetype=False, uv_min=False, snrcut=0.0)[source]¶ Return a recarray of the equal time bispectra.
- Parameters
vtype (str) – The visibilty type from which to assemble bispectra (‘vis’, ‘qvis’, ‘uvis’,’vvis’,’rrvis’,’lrvis’,’rlvis’,’llvis’)
mode (str) – If ‘time’, return phases in a list of equal time arrays, if ‘all’, return all phases in a single array
count (str) – If ‘min’, return minimal set of bispectra, if ‘max’ return all bispectra up to reordering
timetype (str) – ‘GMST’ or ‘UTC’
uv_min (float) – flag baselines shorter than this before forming closure quantities
snrcut (float) – flag bispectra with snr lower than this
- Returns
A recarray of the bispectra values with datatype DTBIS
- Return type
(numpy.recarry)
-
bispectra_tri
(site1, site2, site3, vtype='vis', timetype=False, snrcut=0.0, method='from_maxset', bs=[], force_recompute=False)[source]¶ Return complex bispectrum over time on a triangle (1-2-3).
- Parameters
site1 (str) – station 1 name
site2 (str) – station 2 name
site3 (str) – station 3 name
vtype (str) – The visibilty type from which to assemble bispectra (‘vis’,’qvis’,’uvis’,’vvis’,’pvis’)
timetype (str) – ‘UTC’ or ‘GMST’
snrcut (float) – flag bispectra with snr lower than this
method (str) – ‘from_maxset’ (old, default), ‘from_vis’ (new, more robust)
bs (list) – optionally pass in the precomputed, time-sorted bispectra
force_recompute (bool) – if True, recompute bispectra instead of using saved data
- Returns
A recarray of the bispectra on this triangle with datatype DTBIS
- Return type
(numpy.recarry)
-
c_amplitudes
(vtype='vis', mode='all', count='min', ctype='camp', debias=True, timetype=False, snrcut=0.0)[source]¶ Return a recarray of the equal time closure amplitudes.
- Parameters
vtype (str) – The visibilty type from which to assemble closure amplitudes (‘vis’,’qvis’,’uvis’,’vvis’,’pvis’)
ctype (str) – The closure amplitude type (‘camp’ or ‘logcamp’)
mode (str) – If ‘time’, return amplitudes in a list of equal time arrays, if ‘all’, return all amplitudes in a single array
count (str) – If ‘min’, return minimal set of amplitudes, if ‘max’ return all closure amplitudes up to inverses
debias (bool) – If True, debias the closure amplitude
timetype (str) – ‘GMST’ or ‘UTC’
snrcut (float) – flag closure amplitudes with snr lower than this
- Returns
A recarray of the closure amplitudes with datatype DTCAMP
- Return type
(numpy.recarry)
-
c_log_amplitudes_diag
(vtype='vis', mode='all', count='min', debias=True, timetype=False, snrcut=0.0)[source]¶ Return a recarray of the equal time diagonalized log closure amplitudes.
- Parameters
vtype (str) – The visibilty type (‘vis’,’qvis’,’uvis’,’vvis’,’pvis’) From which to assemble closure amplitudes
ctype (str) – The closure amplitude type (‘camp’ or ‘logcamp’)
mode (str) – If ‘time’, return amplitudes in a list of equal time arrays, If ‘all’, return all amplitudes in a single array
count (str) – If ‘min’, return minimal set of amplitudes, If ‘max’ return all closure amplitudes up to inverses
debias (bool) – If True, debias the closure amplitude - The individual visibility amplitudes are always debiased.
timetype (str) – ‘GMST’ or ‘UTC’
snrcut (float) – flag closure amplitudes with snr lower than this
- Returns
A recarray of diagonalized closure amps with datatype DTLOGCAMPDIAG
- Return type
(numpy.recarry)
-
c_phases
(vtype='vis', mode='all', count='min', ang_unit='deg', timetype=False, uv_min=False, snrcut=0.0)[source]¶ Return a recarray of the equal time closure phases.
- Parameters
vtype (str) – The visibilty type from which to assemble closure phases (‘vis’,’qvis’,’uvis’,’vvis’,’pvis’)
mode (str) – If ‘time’, return phases in a list of equal time arrays, if ‘all’, return all phases in a single array
count (str) – If ‘min’, return minimal set of phases, if ‘max’ return all closure phases up to reordering
ang_unit (str) – If ‘deg’, return closure phases in degrees, else return in radians
timetype (str) – ‘UTC’ or ‘GMST’
uv_min (float) – flag baselines shorter than this before forming closure quantities
snrcut (float) – flag bispectra with snr lower than this
- Returns
A recarray of the closure phases with datatype DTCPHASE
- Return type
(numpy.recarry)
-
c_phases_diag
(vtype='vis', count='min', ang_unit='deg', timetype=False, uv_min=False, snrcut=0.0)[source]¶ Return a recarray of the equal time diagonalized closure phases.
- Parameters
vtype (str) – The visibilty type (‘vis’,’qvis’,’uvis’,’vvis’,’pvis’) from which to assemble closure phases
count (str) – If ‘min’, return minimal set of phases, If ‘min-cut0bl’ return minimal set after flagging zero-baselines
ang_unit (str) – If ‘deg’, return closure phases in degrees, else return in radians
timetype (str) – ‘UTC’ or ‘GMST’
uv_min (float) – flag baselines shorter than this before forming closure quantities
snrcut (float) – flag bispectra with snr lower than this
- Returns
- A recarray of diagonalized closure phases (datatype DTCPHASEDIAG),
along with associated triangles and transformation matrices
- Return type
(numpy.recarry)
-
camp_quad
(site1, site2, site3, site4, vtype='vis', ctype='camp', debias=True, timetype=False, snrcut=0.0, method='from_maxset', camps=[], force_recompute=False)[source]¶ Return closure phase over time on a quadrange (1-2)(3-4)/(1-4)(2-3).
- Parameters
site1 (str) – station 1 name
site2 (str) – station 2 name
site3 (str) – station 3 name
site4 (str) – station 4 name
vtype (str) – The visibilty type from which to assemble closure amplitudes (‘vis’,’qvis’,’uvis’,’vvis’,’pvis’)
ctype (str) – The closure amplitude type (‘camp’ or ‘logcamp’)
debias (bool) – If True, debias the closure amplitude
timetype (str) – ‘UTC’ or ‘GMST’
snrcut (float) – flag closure amplitudes with snr lower than this
method (str) – ‘from_maxset’ (old, default), ‘from_vis’ (new, more robust)
camps (list) – optionally pass in the time-sorted, precomputed camps
force_recompute (bool) – if True, do not use save closure amplitude data
- Returns
A recarray of the closure amplitudes with datatype DTCAMP
- Return type
(numpy.recarry)
-
chisq
(im_or_mov, dtype='vis', pol='I', ttype='nfft', mask=[], **kwargs)[source]¶ Give the reduced chi^2 of the observation for the specified image and datatype.
- Parameters
im_or_mov (Image or Movie) – image or movie object on which to test chi^2
dtype (str) – data type of chi^2 (e.g., ‘vis’, ‘amp’, ‘bs’, ‘cphase’)
pol (str) – polarization type (‘I’, ‘Q’, ‘U’, ‘V’, ‘LL’, ‘RR’, ‘LR’, or ‘RL’
mask (arr) – mask of same dimension as im.imvec
ttype (str) – “fast” or “nfft” or “direct”
fft_pad_factor (float) – zero pad the image to (fft_pad_factor * image size) in FFT
conv_func ('str') – The convolving function for gridding; ‘gaussian’, ‘pill’,’cubic’
p_rad (int) – The pixel radius for the convolving function
order ('str') – Interpolation order for sampling the FFT
systematic_noise (float) – adds a fractional systematic noise tolerance to sigmas
snrcut (float) – a snr cutoff for including data in the chi^2 sum
debias (bool) – if True then apply debiasing to amplitudes/closure amplitudes
weighting (str) – ‘natural’ or ‘uniform’
systematic_cphase_noise (float) – a value in degrees to add to closure phase sigmas
cp_uv_min (float) – flag short baselines before forming closure quantities
maxset (bool) – if True, use maximal set instead of minimal for closure quantities
- Returns
image chi^2
- Return type
(float)
-
cleanbeam
(npix, fov, pulse=<function trianglePulse2D>)[source]¶ Make an image of the observation clean beam.
-
copy
()[source]¶ Copy the observation object.
Args:
- Returns
a copy of the Obsdata object.
- Return type
(Obsdata)
-
cphase_tri
(site1, site2, site3, vtype='vis', ang_unit='deg', timetype=False, snrcut=0.0, method='from_maxset', cphases=[], force_recompute=False)[source]¶ Return closure phase over time on a triangle (1-2-3).
- Parameters
site1 (str) – station 1 name
site2 (str) – station 2 name
site3 (str) – station 3 name
vtype (str) – The visibilty type from which to assemble closure phases (e.g., ‘vis’,’qvis’,’uvis’,’vvis’,’pvis’)
ang_unit (str) – If ‘deg’, return closure phases in degrees, else return in radians
timetype (str) – ‘GMST’ or ‘UTC’
snrcut (float) – flag bispectra with snr lower than this
method (str) – ‘from_maxset’ (old, default), ‘from_vis’ (new, more robust)
cphases (list) – optionally pass in the precomputed time-sorted cphases
force_recompute (bool) – if True, do not use save closure phase tables
- Returns
A recarray of the closure phases with datatype DTCPHASE
- Return type
(numpy.recarry)
-
data_conj
()[source]¶ Make a data array including all conjugate baselines.
Args:
- Returns
a copy of the Obsdata.data table including all conjugate baselines.
- Return type
(numpy.recarray)
-
deblur
()[source]¶ Deblur the observation obs by dividing by the Sgr A* scattering kernel.
Args:
- Returns
a new deblurred observation object.
- Return type
(Obsdata)
-
dirtybeam
(npix, fov, pulse=<function trianglePulse2D>, weighting='uniform')[source]¶ Make an image of the observation dirty beam.
- Parameters
- Returns
an Image object with the dirty beam.
- Return type
(Image)
-
dirtyimage
(npix, fov, pulse=<function trianglePulse2D>, weighting='uniform')[source]¶ Make the observation dirty image (direct Fourier transform).
- Parameters
- Returns
an Image object with dirty image.
- Return type
(Image)
-
estimate_noise_rescale_factor
(max_diff_sec=0.0, min_num=10, median_snr_cut=0, count='max', vtype='vis', print_std=False)[source]¶ Estimate a constant noise rescaling factor on all baselines, times, and polarizations. Uses pairwise differences of closure phases relative to the expected scatter. This is useful for AIPS data, which has a missing factor relating ‘weights’ to noise.
- Parameters
max_diff_sec (float) – The maximum difference of adjacent closure phases (in seconds) If 0, auto-estimates to twice the median scan length.
min_num (int) – The minimum number of closure phase differences for a triangle to be included in the set of estimators.
median_snr_cut (float) – Do not include a triangle if its median SNR is below this
count (str) – If ‘min’, use minimal set of phases, if ‘max’ use all closure phases up to reordering
vtype (str) – Visibility type (e.g., ‘vis’, ‘llvis’, ‘rrvis’, etc.)
print_std (bool) – Whether or not to print the std dev. for each closure triangle.
- Returns
The rescaling factor.
- Return type
(float)
-
filter_subscan_dropouts
(perc=0, return_type='rec')[source]¶ Filtration to drop data and ensure that we only average parts with same timestamp. Potentially this could reduce risk of non-closing errors.
-
find_amt_fractional_noise
(im, dtype='vis', target=1.0, debias=False, maxiter=200, ftol=1e-20, gtol=1e-20)[source]¶ Returns the amount of fractional sys error necessary to make the image have a chisq close to the targeted value (1.0)
-
fit_beam
(weighting='uniform', units='rad')[source]¶ Fit a Gaussian to the dirty beam and return the parameters (fwhm_maj, fwhm_min, theta).
-
fit_gauss
(flux=1.0, fittype='amp', paramguess=4.848136811094136e-10, 4.848136811094136e-10, 0.0)[source]¶ Fit a gaussian to either Stokes I complex visibilities or Stokes I visibility amplitudes.
-
flag_UT_range
(UT_start_hour=0.0, UT_stop_hour=0.0, flag_type='all', flag_what='', output='kept')[source]¶ Flag data points within a certain UT range
- Parameters
- Returns
a observation object with flagged data points removed
- Return type
(Obsdata)
-
flag_anomalous
(field='snr', max_diff_seconds=100, robust_nsigma_cut=5, output='kept')[source]¶ Flag anomalous data points
- Parameters
- Returns
a observation object with flagged data points removed
- Return type
(Obsdata)
-
flag_elev
(elev_min=0.0, elev_max=90, output='kept')[source]¶ Flag visibilities for which either station is outside a stated elevation range
-
flag_high_sigma
(sigma_cut=0.005, sigma_type='sigma', output='kept')[source]¶ Flag high sigma (thermal noise on Stoke I) data points
-
flag_large_fractional_pol
(max_fractional_pol=1.0, output='kept')[source]¶ Flag visibilities for which the fractional polarization is above a specified threshold
-
flag_uvdist
(uv_min=0.0, uv_max=1000000000000.0, output='kept')[source]¶ Flag data points outside a given uv range
-
flags_from_file
(flagfile, flag_type='station')[source]¶ Flagging data based on csv file
- Parameters
flagfile – path to csv file with mjds of flagging start / stop time, and optionally baseline / stations
- Returns
a observation object with flagged data points removed
- Return type
(Obsdata)
-
getClosestScan
(time, splitObs=None)[source]¶ Split observation by scan and grab scan closest to timestamp
- Parameters
time (float) – Time (GMST) you want to find the scan closest to
splitObs – a list of Obsdata objects, output from split_obs, to save time
-
make_hdulist
(force_singlepol=False, polrep_out='circ')[source]¶ Returns an hdulist in the same format as in a saved .uvfits file. :param force_singlepol: if ‘R’ or ‘L’, will interpret stokes I field as ‘RR’ or ‘LL’ :type force_singlepol: str :param polrep_out: ‘circ’ or ‘stokes’: how data should be stored in the uvfits file :type polrep_out: str
- Returns
hdulist (astropy.io.fits.HDUList)
-
plot_bl
(site1, site2, field, debias=False, ang_unit='deg', timetype=False, axis=False, rangex=False, rangey=False, snrcut=0.0, color=0.11764705882352941, 0.5647058823529412, 1.0, marker='o', markersize=3, label=None, grid=True, ebar=True, axislabels=True, legend=False, show=True, export_pdf='')[source]¶ Plot a field over time on a baseline site1-site2.
- Parameters
site1 (str) – station 1 name
site2 (str) – station 2 name
field (str) – y-axis field (from FIELDS)
debias (bool) – If True, debias amplitudes.
ang_unit (str) – phase unit ‘deg’ or ‘rad’
timetype (str) – ‘GMST’ or ‘UTC’
axis (matplotlib.axes.Axes) – add plot to this axis
rangex (list) – [xmin, xmax] x-axis limits
rangey (list) – [ymin, ymax] y-axis limits
color (str) – color for scatterplot points
marker (str) – matplotlib plot marker
markersize (int) – size of plot markers
label (str) – plot legend label
grid (bool) – Plot gridlines if True
ebar (bool) – Plot error bars if True
axislabels (bool) – Show axis labels if True
legend (bool) – Show legend if True
show (bool) – Display the plot if true
export_pdf (str) – path to pdf file to save figure
- Returns
Axes object with data plot
- Return type
(matplotlib.axes.Axes)
-
plot_camp
(site1, site2, site3, site4, vtype='vis', ctype='camp', camps=[], force_recompute=False, debias=False, timetype=False, snrcut=0.0, axis=False, rangex=False, rangey=False, color=0.11764705882352941, 0.5647058823529412, 1.0, marker='o', markersize=3, label=None, grid=True, ebar=True, axislabels=True, legend=False, show=True, export_pdf='')[source]¶ Plot closure amplitude over time on a quadrangle (1-2)(3-4)/(1-4)(2-3).
- Parameters
site1 (str) – station 1 name
site2 (str) – station 2 name
site3 (str) – station 3 name
site4 (str) – station 4 name
vtype (str) – The visibilty type from which to assemble closure amplitudes (‘vis’,’qvis’,’uvis’,’vvis’,’pvis’)
ctype (str) – The closure amplitude type (‘camp’ or ‘logcamp’)
camps (list) – optionally pass in camps so they don’t have to be recomputed
force_recompute (bool) – if True, recompute camps instead of using stored data
snrcut (float) – flag closure amplitudes with snr lower than this
debias (bool) – If True, debias the closure amplitude
timetype (str) – ‘GMST’ or ‘UTC’
axis (matplotlib.axes.Axes) – amake_cdd plot to this axis
rangex (list) – [xmin, xmax] x-axis limits
rangey (list) – [ymin, ymax] y-axis limits
color (str) – color for scatterplot points
marker (str) – matplotlib plot marker
markersize (int) – size of plot markers
label (str) – plot legend label
grid (bool) – Plot gridlines if True
ebar (bool) – Plot error bars if True
axislabels (bool) – Show axis labels if True
legend (bool) – Show legend if True
show (bool) – Display the plot if True
export_pdf (str) – path to pdf file to save figure
- Returns
Axes object with data plot
- Return type
(matplotlib.axes.Axes)
-
plot_cphase
(site1, site2, site3, vtype='vis', cphases=[], force_recompute=False, ang_unit='deg', timetype=False, snrcut=0.0, axis=False, rangex=False, rangey=False, color=0.11764705882352941, 0.5647058823529412, 1.0, marker='o', markersize=3, label=None, grid=True, ebar=True, axislabels=True, legend=False, show=True, export_pdf='')[source]¶ Plot a closure phase over time on a triangle site1-site2-site3.
- Parameters
site1 (str) – station 1 name
site2 (str) – station 2 name
site3 (str) – station 3 name
vtype (str) – The visibilty type from which to assemble closure phases (‘vis’,’qvis’,’uvis’,’vvis’,’pvis’)
cphases (list) – optionally pass in the prcomputed, time-sorted closure phases
force_recompute (bool) – if True, do not use stored closure phase able
snrcut (float) – flag closure amplitudes with snr lower than this
ang_unit (str) – phase unit ‘deg’ or ‘rad’
timetype (str) – ‘GMST’ or ‘UTC’
axis (matplotlib.axes.Axes) – add plot to this axis
rangex (list) – [xmin, xmax] x-axis limits
rangey (list) – [ymin, ymax] y-axis limits
color (str) – color for scatterplot points
marker (str) – matplotlib plot marker
markersize (int) – size of plot markers
label (str) – plot legend label
grid (bool) – Plot gridlines if True
ebar (bool) – Plot error bars if True
axislabels (bool) – Show axis labels if True
legend (bool) – Show legend if True
show (bool) – Display the plot if True
export_pdf (str) – path to pdf file to save figure
- Returns
Axes object with data plot
- Return type
(matplotlib.axes.Axes)
-
plotall
(field1, field2, conj=False, debias=False, tag_bl=False, ang_unit='deg', timetype=False, axis=False, rangex=False, rangey=False, xscale='linear', yscale='linear', color=0.11764705882352941, 0.5647058823529412, 1.0, marker='o', markersize=3, label=None, snrcut=0.0, grid=True, ebar=True, axislabels=True, legend=False, show=True, export_pdf='')[source]¶ Plot two fields against each other.
- Parameters
field1 (str) – x-axis field (from FIELDS)
field2 (str) – y-axis field (from FIELDS)
conj (bool) – Plot conjuage baseline data points if True
debias (bool) – If True, debias amplitudes.
tag_bl (bool) – if True, label each baseline
ang_unit (str) – phase unit ‘deg’ or ‘rad’
timetype (str) – ‘GMST’ or ‘UTC’
axis (matplotlib.axes.Axes) – add plot to this axis
xscale (str) – ‘linear’ or ‘log’ y-axis scale
yscale (str) – ‘linear’ or ‘log’ y-axis scale
rangex (list) – [xmin, xmax] x-axis limits
rangey (list) – [ymin, ymax] y-axis limits
color (str) – color for scatterplot points
marker (str) – matplotlib plot marker
markersize (int) – size of plot markers
label (str) – plot legend label
snrcut (float) – flag closure amplitudes with snr lower than this
grid (bool) – Plot gridlines if True
ebar (bool) – Plot error bars if True
axislabels (bool) – Show axis labels if True
legend (bool) – Show legend if True
show (bool) – Display the plot if true
export_pdf (str) – path to pdf file to save figure
- Returns
Axes object with data plot
- Return type
(matplotlib.axes.Axes)
-
polchisq
(im, dtype='pvis', ttype='nfft', pol_trans=True, mask=[], **kwargs)[source]¶ Give the reduced chi^2 for the specified image and polarimetric datatype.
- Parameters
im (Image) – image to test polarimetric chi^2
dtype (str) – data type of polarimetric chi^2 (‘pvis’,’m’,’pbs’)
pol (str) – polarization type (‘I’, ‘Q’, ‘U’, ‘V’, ‘LL’, ‘RR’, ‘LR’, or ‘RL’
mask (arr) – mask of same dimension as im.imvec
ttype (str) – if “fast” or “nfft” or “direct”
pol_trans (bool) – True for I,m,chi, False for IQU
fft_pad_factor (float) – zero pad the image to (fft_pad_factor * image size) in FFT
conv_func ('str') – The convolving function for gridding; ‘gaussian’, ‘pill’,’cubic’
p_rad (int) – The pixel radius for the convolving function
order ('str') – Interpolation order for sampling the FFT
systematic_noise (float) – adds a fractional systematic noise tolerance to sigmas
snrcut (float) – a snr cutoff for including data in the chi^2 sum
debias (bool) – if True then apply debiasing to amplitudes/closure amplitudes
weighting (str) – ‘natural’ or ‘uniform’
systematic_cphase_noise (float) – value in degrees to add to closure phase sigmas
cp_uv_min (float) – flag short baselines before forming closure quantities
maxset (bool) – if True, use maximal set instead of minimal for closure quantities
- Returns
image chi^2
- Return type
(float)
-
recompute_uv
()[source]¶ Recompute u,v points using observation times and metadata
Args:
- Returns
New Obsdata object containing the same data with recomputed u,v points
- Return type
(Obsdata)
-
reorder_baselines
(trial_speedups=False)[source]¶ Reorder baselines to match uvfits convention, based on the telescope array ordering
-
reorder_baselines_trial_speedups
()[source]¶ Reorder baselines to match uvfits convention, based on the telescope array ordering
-
reorder_tarr_sefd
(reorder_baselines=True)[source]¶ Reorder the telescope array by SEFD minimal to maximum.
-
reorder_tarr_snr
(reorder_baselines=True)[source]¶ Reorder the telescope array by median SNR maximal to minimal.
-
res
()[source]¶ Return the nominal resolution (1/longest baseline) of the observation in radians.
Args:
- Returns
normal array resolution in radians
- Return type
(float)
-
rescale_noise
(noise_rescale_factor=1.0)[source]¶ Rescale the thermal noise on all Stokes parameters by a constant factor. This is useful for AIPS data, which has a missing factor relating ‘weights’ to noise.
-
rescale_zbl
(totflux, uv_max, debias=True)[source]¶ Rescale the short baselines to a new level of total flux.
-
reweight
(uv_radius, weightdist=1.0)[source]¶ Reweight the sigmas based on the local density of uv points
-
save_oifits
(fname, flux=1.0)[source]¶ Save visibility data to oifits. Polarization data is NOT saved.
-
save_txt
(fname)[source]¶ Save visibility data to a text file.
- Parameters
fname (str) – path to output text file
-
save_uvfits
(fname, force_singlepol=False, polrep_out='circ')[source]¶ Save visibility data to uvfits file. :param fname: path to output uvfits file. :type fname: str :param force_singlepol: if ‘R’ or ‘L’, will interpret stokes I field as ‘RR’ or ‘LL’ :type force_singlepol: str :param polrep_out: ‘circ’ or ‘stokes’: how data should be stored in the uvfits file :type polrep_out: str
-
sourcevec
()[source]¶ Return the source position vector in geocentric coordinates at 0h GMST.
Args:
- Returns
normal vector pointing to source in geocentric coordinates (m)
- Return type
(numpy.array)
-
split_obs
(t_gather=0.0, scan_gather=False)[source]¶ Split single observation into multiple observation files, one per scan..
- Parameters
t_gather (float) – Grouping timescale (in seconds). 0.0 indicates no grouping.
scan_gather – If true, gather data into scans
-
switch_polrep
(polrep_out='stokes', allow_singlepol=True, singlepol_hand='R')[source]¶ Return a new observation with the polarization representation changed
- Parameters
polrep_out (str) – the polrep of the output data
allow_singlepol (bool) – If True, treat single-polarization data as Stokes I when converting from ‘circ’ polrep to ‘stokes’
singlepol_hand (str) – ‘R’ or ‘L’; determines which parallel-hand is assumed when converting ‘stokes’ to ‘circ’ if only I is present
- Returns
new Obsdata object with potentially different polrep
- Return type
(Obsdata)
-
tlist
(conj=False, t_gather=0.0, scan_gather=False)[source]¶ Group the data in a list of equal time observation datatables.
-
unpack
(fields, mode='all', ang_unit='deg', debias=False, conj=False, timetype=False)[source]¶ Unpack the data for the whole observation .
- Parameters
fields (list) – list of unpacked quantities from availalbe quantities in FIELDS
mode (str) – ‘all’ returns all data in single table, ‘time’ groups output by equal time, ‘bl’ groups by baseline
ang_unit (str) – ‘deg’ for degrees and ‘rad’ for radian phases
debias (bool) – True to debias visibility amplitudes
conj (bool) – True to include conjugate baselines
timetype (str) – ‘GMST’ or ‘UTC’ changes what is returned for ‘time’
- Returns
unpacked numpy array with data in fields requested
- Return type
(numpy.recarray)
-
unpack_bl
(site1, site2, fields, ang_unit='deg', debias=False, timetype=False)[source]¶ Unpack the data over time on the selected baseline site1-site2.
- Parameters
site1 (str) – First site name
site2 (str) – Second site name
fields (list) – list of unpacked quantities from available quantities in FIELDS
ang_unit (str) – ‘deg’ for degrees and ‘rad’ for radian phases
debias (bool) – True to debias visibility amplitudes
timetype (str) – ‘GMST’ or ‘UTC’ changes what is returned for ‘time’
- Returns
unpacked numpy array with data in fields requested
- Return type
(numpy.recarray)
-
unpack_dat
(data, fields, conj=False, ang_unit='deg', debias=False, timetype=False)[source]¶ Unpack the data in a passed data recarray.
- Parameters
data (numpy.recarray) – data recarray of format DTPOL_STOKES or DTPOL_CIRC
fields (list) – list of unpacked quantities from availalbe quantities in FIELDS
conj (bool) – True to include conjugate baselines
ang_unit (str) – ‘deg’ for degrees and ‘rad’ for radian phases
debias (bool) – True to debias visibility amplitudes
timetype (str) – ‘GMST’ or ‘UTC’ changes what is returned for ‘time’
- Returns
unpacked numpy array with data in fields requested
- Return type
(numpy.recarray)
-
-
ehtim.obsdata.
load_maps
(arrfile, obsspec, ifile, qfile=0, ufile=0, vfile=0, src='SgrA', mjd=51544, ampcal=False, phasecal=False)[source]¶ Read an observation from a maps text file and return an Obsdata object.
- Parameters
arrfile (str) – path to input array file
obsspec (str) – path to input obs spec file
ifile (str) – path to input Stokes I data file
qfile (str) – path to input Stokes Q data file
ufile (str) – path to input Stokes U data file
vfile (str) – path to input Stokes V data file
src (str) – source name
mjd (int) – integer observation MJD
ampcal (bool) – True if amplitude calibrated
phasecal (bool) – True if phase calibrated
- Returns
Obsdata object loaded from file
- Return type
obs (Obsdata)
-
ehtim.obsdata.
load_obs
(fname, polrep='stokes', flipbl=False, remove_nan=False, force_singlepol=None, channel=<built-in function all>, IF=<built-in function all>, allow_singlepol=True, flux=1.0, obsspec=None, ifile=None, qfile=None, ufile=None, vfile=None, src='SgrA', mjd=51544, ampcal=False, phasecal=False)[source]¶ Smart obs read-in, detects file type and loads appropriately.
- Parameters
fname (str) – path to input text file
polrep (str) – load data as either ‘stokes’ or ‘circ’
flipbl (bool) – flip baseline phases if True.
remove_nan (bool) – True to remove nans from missing polarizations
polrep – load data as either ‘stokes’ or ‘circ’
force_singlepol (str) – ‘R’ or ‘L’ to load only 1 polarization
channel (list) – list of channels to average in the import. channel=all averages all
IF (list) – list of IFs to average in the import. IF=all averages all IFS
flux (float) – normalization total flux
obsspec (str) – path to input obs spec file
ifile (str) – path to input Stokes I data file
qfile (str) – path to input Stokes Q data file
ufile (str) – path to input Stokes U data file
vfile (str) – path to input Stokes V data file
src (str) – source name
mjd (int) – integer observation MJD
ampcal (bool) – True if amplitude calibrated
phasecal (bool) – True if phase calibrated
- Returns
Obsdata object loaded from file
- Return type
obs (Obsdata)
-
ehtim.obsdata.
load_oifits
(fname, flux=1.0)[source]¶ Load data from an oifits file. Does NOT currently support polarization.
-
ehtim.obsdata.
load_uvfits
(fname, flipbl=False, remove_nan=False, force_singlepol=None, channel=<built-in function all>, IF=<built-in function all>, polrep='stokes', allow_singlepol=True, ignore_pzero_date=True, trial_speedups=False)[source]¶ Load observation data from a uvfits file.
- Parameters
fname (str or HDUList) – path to input text file or HDUList object
flipbl (bool) – flip baseline phases if True.
remove_nan (bool) – True to remove nans from missing polarizations
polrep (str) – load data as either ‘stokes’ or ‘circ’
force_singlepol (str) – ‘R’ or ‘L’ to load only 1 polarization
channel (list) – list of channels to average in the import. channel=all averages all
IF (list) – list of IFs to average in the import. IF=all averages all IFS
remove_nan – whether or not to remove entries with nan data
ignore_pzero_date (bool) – if True, ignore the offset parameters in DATE field TODO: what is the correct behavior per AIPS memo 117?
- Returns
Obsdata object loaded from file
- Return type
obs (Obsdata)