Survey

class ehtim.survey.ParameterSet(paramset, params_fixed={})[source]
paramset

dict containing single parameter set. Each key in dict becomes its own attribute

Type

dict

params_fixed

dict containing non-varying parameters. Each key in dict becomes its own attribute

Type

dict

outfile

base of outfile with 7 digit index of pset added to it

Type

str

obs

observation object from input uvfits file, generated by load_data()

Type

Obsdata

zbl_tot

flux on ALMA-APEX baseline, generated in preimcal()

Type

float

obs_sc_init

original observation with systematic noise added, reverse taper applied, and extended flux removed

Type

Obsdata

obs_sc

obs_sc_init after all rounds of self-calibration

Type

Obsdata

initimg

prior/initial image

Type

Image

im_out

final reconstructed image

Type

Image

im_addcmp

final reconstructed image with extended flux added back in

Type

Image

obs_sc_addcmp

original observation self-calibrated with im_addcmp

Type

Obsdata

caltab

final calibration table associated with im_out

Type

Caltable

init_img()[source]

Creates initial/prior image. Only gaussian prior option at present, but creates prior attritubute self.initimg using self.zbl and self.prior_fwhm

Args:

Returns:

load_data()[source]

Loads in uvfits file from self.infile into eht-imaging obs object and averages using self.avg_time Creates self.obs

Args:

Returns:

make_img()[source]

Reconstructs image with specified parameters (data weights, amount of self-cal, etc) described in paramset dict Creates attributes self.im_out containing the final image and self.caltab containing a corresponding calibration table object for the final image

Args:

Returns:

output_results()[source]

Outputs all requested files pertaining to final image

Args:

Returns:

preimcal()[source]

Applies pre-imaging calibration to self.obs. This includes flagging sites with no measurements, rescaling short baselines so only compact flux is being imaged, applying a u-v taper, and adding extra sys noise. Creates self.obs_sc which will have self-cal applied in future steps and self.obs_sc_init which is a copy of the initial preimcal observation

Args:

Returns:

run()[source]

Run imaging pipeline for one parameter set.

Args:

Returns:

save_params()[source]

Saves a csv file with parameter set details

Args:

Returns:

save_statistics()[source]

Saves a csv file with the following statistics: chi^2 closure phase, logcamp, vis wrt the original observation chi^2 vis wrt to original observation with self-cal to final image applied chi^2 closure phase, logcamp, vis wrt the original observation with sys noise and self-cal applied

Args:

Returns:

ehtim.survey.create_params_fixed(infile, outfile_base, outpath, ground_truth_img='None', save_imgsums=False, save_uvfits=True, save_pdf=False, save_stats=True, save_caltab=True, nproc=1, backend='multiprocessing', ttype='nfft', overwrite=False, selfcal=True, gaintol=[0.02, 0.2], niter_static=3, blurfrac=1, maxit=100, stop=0.0001, fov=128, npixels=64, reverse_taper_uas=5, uv_zblcut=100000000.0, SEFD_error_budget={'AA': 0.1, 'AX': 0.1, 'GL': 0.1, 'LM': 0.1, 'MG': 0.1, 'MM': 0.1, 'PV': 0.1, 'SW': 0.1})[source]

Create a dict for all non-varying survery parameters

Parameters
  • infile (str) – path to input uvfits observation file

  • outfile_base (str) – name of base filename for all outputs

  • outpath (str) – path to directory where all outputs should be stored

  • ground_truth_img (str) – if applicable, path to ground truth fits file

  • save_imgsums (bool) – save summary pdf for each image

  • save_uvfits (bool) – save final self-cal observation to uvfits file

  • save_pdf (bool) – save pdf of each image

  • save_stats (bool) – save csv file containing statistics for each image

  • save_caltab (bool) – save a calibration table for each image

  • nproc (int) – number of parallel processes

  • backend (str) – either ‘multiprocessing’ or ‘ray’

  • ttype (str) – “fast” or “nfft” or “direct”

  • overwrite (bool) – if True, write over existing files with same names - else, skip parameter set

  • selfcal (bool) – perform self-calibration steps during imaging

  • gaintol (array) – tolerance for gains to be under/over unity respectively during self-cal

  • niter_static (int) – number of iterations for each imaging step

  • blurfrac (int) – factor to blur initial image between iterations

  • maxit (int) – maximum number of iterations if image does not converge

  • stop (float) – convergence criterion for imaging

  • fov (int) – image field of view in uas

  • npixels (int) – number of image pixels

  • reverse_taper_uas (int) – fwhm of gassuain in uas to reverse taper observation

  • uv_zblcut (float) – maximum uv-distance to which is considered short baseline flux

  • SEFD_error_budget (dict) – SEFD percentage error for each station

Returns

dict containing all non-varying survery parameters

Return type

(dict)

ehtim.survey.create_survey_psets(zbl=[0.6], sys_noise=[0.02], avg_time=['scan'], prior_fwhm=[40], sc_phase=[0], xdw_phase=[10], sc_ap=[0], xdw_ap=[1], amp=[0.2], cphase=[1], logcamp=[1], simple=[1], l1=[1], tv=[1], tv2=[1], flux=[1], epsilon_tv=[1e-10])[source]

Create a dataframe given all survey parameters. Default values will create an example dataframe but these values should be adjusted for each specific observation

Parameters
  • zbl (array) – compact flux value (Jy)

  • sys_noise (array) – percent addition of systematic noise

  • avg_time (array) – in seconds or ‘scan’ for scan averaging

  • prior_fwhm (array) – fwhm of gaussian prior in uas

  • sc_phase (array) – number of iterations to perform phase-only self-cal

  • xdw_phase (array) – multiplicative factor for data weights after one round of phase-only self-cal

  • sc_ap (array) – number of iterations to perform amp+phase self-cal

  • xdw_ap (array) – multiplicative factor for data weights after one round of amp+phase self-cal

  • amp (array) – data weight to be placed on amplitudes

  • cphase (array) – data weight to be placed on closure phases

  • logcamp (array) – data weight to be placed on log closure amplitudes

  • simple (array) – regularizer weight for relative entropy, favoring similarity to prior image

  • l1 (array) – regularizer weight for l1 norm, favoring image sparsity

  • tv (array) – regularizer weight for total variation, favoring sharp edges

  • tv2 (array) – regularizer weight for total squared variation, favoring smooth edges

  • flux (array) – regularizer weight for total flux density, favoring final images with flux close to zbl

  • epsilon_tv (array) – epsilon value used in definition of total variation - rarely need to change this

Returns

pandas DataFrame containing all combination of parameter sets along with index values

Return type

(DataFrame)

ehtim.survey.run_pset(pset, system_kwargs, params_fixed)[source]

Run imaging for one parameter set. Not to be used individually, but called in map function for run_survey

Args:

pset (dict): A dict containing single parameter set params_fixed (dict): A dict containing non-varying parameters

Returns:

ehtim.survey.run_survey(psets, params_fixed)[source]

Run survey for all parameter sets using paramsurvey

Parameters
  • psets (DataFrame) – A pandas DataFrame containing all parameter sets

  • params_fixed (dict) – A dict containing non-varying parameters

Returns: