simulator
- class simulator[source]
Tool for simulation
simulator provides a unified interface for simulation of telescope processing. It can create a MeasurementSet from scratch or read in an existing MeasurementSet, it can predict synthesis data onto the (u,v) coordinates or single dish data onto (ra,dec) points, and it can corrupt this data through Gaussian errors, an atmospheric model, or through specific errors residing in (anti-) calibration tables.
In the observing phase, simulator creates a MeasurementSet and calculates uvw values. You first make a simulator tool, with the name of the MeasurementSet that you wish to construct. Next you use the various set methods to set up the observing (antenna locations, sources, spectral windows, etc.). Then you call the observe method for each observing scan you wish to make, or observemany to create several scans. You specify the source name, spectral window name, and observing times. After this, you have a MeasurementSet that is complete but visibilities=0.
In the prediction phase, you fill a MeasurementSet (either one newly created or a pre-existing one, perhaps from a real telescope) with data from a model or componentlist, and then corrupt the measurements (if desired).
NOTE: sm.predict assumes model image units are Jy/pixel, and in fact will overwrite the brightness units of the image itself!
The ft function of the imager tool can also be used to calculate the model visibility for a model image or componentmodels.
To apply errors, first set up the various effects using the relevant set methods, and then call corrupt.
Some important details: - One call to observe generates one scan (all rows have the same SCAN_NUMBER). - The start and stop times specified to observe need not be contiguous and so one can simulate antenna drive times or other gaps. - Currently there is only a rudimentary method to calculate patterns of observing (mosaicing), since it is easy to do this via sequences of calls of observe, or simutil::calcpointings, or the simobserve task - The heavy duty columns (DATA, FLAG, IMAGING_WEIGHT, etc. are tiled. New tiles are generated for each scan. Thus the TSM files will not get very large. - predict(incremental=False) calculates new visibilities and replaces the DATA column, - predict(incremental=True) calculates new visibilities, adds them to the DATA column - predict for any value of incremental then sets CORRECTED_DATA equal to DATA, and MODEL_DATA to 1
Methods Summary
Close tools and write data to disk.
Add errors specified by the set functions (such as noise, gains, polarization leakage, bandpass, etc) to the visibility data.
Close tools and write data to disk.
Returns the name of the attached MeasurementSet.
Observe a given source with a given spectral window for the specified times, including start, stop, integration, and gap times.
Observe given sources with a given spectral window for the specified times, including start, stop, integration, and gap times.
Set various system parameters from which the thermal (ie, random
A simulator tool can either operate on an existing MeasurementSet, predicting and/or corrupting data on the existing uvw coordinates
A simulator tool can either operate on an existing MeasurementSet, predicting and/or corrupting data on the existing uvw coordinates - to do that open the MS with sm.openfromms(msname) or it can be used to create a new MeasurementSet from descriptions of the array configuration and the observational parameters.
Predict astronomical data from an image.
Reset the visibility corruption terms: this means that corrupt introduces no errors.
Arrange for corruption by existing cal tables, in a manner exactly analogous to calibrater.setapply.
Set autocorrelation weight
Set the level of bandpass errors.
Set the positions of the antennas.
This setup tool function selects which data are to be used subsequently.
Specify feed parameters.
Set one or more observed fields, including name and coordinates.
Set the level of gain errors.
Set the level of polarization leakage between feeds.
Data are flagged for two conditions:
Set mosaic fields by internally invoking setfield multiple times.
Set various system parameters from which the thermal (ie, random
Set options for predict.
Corrupt phase by the parallactic angle
Set the pointing error from a calpointing table
Set the seed for the random number generator
Set one or more spectral windows for the observations, including starting frequency, number of channels, channel increment and resolution, and stokes parameters observed.
This method sets values to be used in sm.observe.
Set up for corruption by the atmosphere - attenuation and increase in noise.
Set the voltage pattern model (and hence, the primary beam) used for a Telecope.
Create a simulator tool.
Writes a summary of the currently set properties to the default logger.
This function returns the string ‘Simulator’.
- corrupt()[source]
Add errors specified by the set functions (such as noise, gains, polarization leakage, bandpass, etc) to the visibility data. The errors are applied to the DATA and CORRECTED_DATA columns.
Note that corrupt handles only visibility-plane effects, not image-plane effects such as pointing errors and voltage patterns, which get applied in predict. Note, the function applies errors to both cross- and auto-correlation data; The auto-correlation data are corrupted properly only for the thermalnoise set by setnoise.
- observe(sourcename='', spwname='', starttime='0s', stoptime='3600s', add_observation=False, state_sig=True, state_ref=False, state_cal=0.0, state_load=0.0, state_sub_scan=0, state_obs_mode='OBSERVE_TARGET.ON_SOURCE', observer='CASA simulator', project='CASA simulation')[source]
Observe a given source with a given spectral window for the specified times, including start, stop, integration, and gap times.
If usehourangle=False (set with settimes), the start and stop times are referenced to referencetime.
If userhourangle=True, starttime/stoptime are interpreted as startha/stopha, the start and stop times are calculated such that the start time is later than the reference time, but less than one day later, and the hour angles refer to the first source observed.
setconfig, setspwindow, setfeed, and setfield must be run before observe can be run.
See also sm.observemany
Parameters
sourcename (string='')
- Name of source or field (must be specified)spwname (string='')
- Unique user-supplied name for this spectral windowstarttime (variant='0s')
- Start time referenced to referencetime, or start hour anglestoptime (variant='3600s')
- Stop time referenced to referencetime, or stop hour angleadd_observation (bool=False)
- Add a new line to the OBSERVATION subtable for this callstate_sig (bool=True)
- a new line will be added to STATE if the following don’t matchstate_ref (bool=False)
state_cal (double=0.0)
state_load (double=0.0)
state_sub_scan (int=0)
state_obs_mode (string='OBSERVE_TARGET.ON_SOURCE')
observer (string='CASA simulator')
project (string='CASA simulation')
Returns
bool
- observemany(sourcenames='', spwname='', starttimes=['0s'], stoptimes=['3600s'], directions=[''], add_observation=False, state_sig=True, state_ref=False, state_cal=0.0, state_load=0.0, state_sub_scan=0, state_obs_mode='OBSERVE\\_TARGET#ON\\_SOURCE', observer='CASA simulator', project='CASA simulation')[source]
Observe given sources with a given spectral window for the specified times, including start, stop, integration, and gap times.
If usehourangle=False (set with settimes), the start and stop times are referenced to referencetime.
If userhourangle=True, starttime/stoptime are interpreted as startha/stopha, the start and stop times are calculated such that the start time is later than the reference time, but less than one day later, and the hour angles refer to the first source observed.
See also sm.observe
Parameters
sourcenames (stringVec='')
- Name of sourcesspwname (string='')
- Unique user-supplied name for this spectral windowstarttimes (stringVec=['0s'])
- Start times referenced to referencetime, or start hour anglestoptimes (stringVec=['3600s'])
- Stop time referenced to referencetime, or stop hour angledirections (stringVec=[''])
add_observation (bool=False)
- Add a new line to the OBSERVATION subtable for this callstate_sig (bool=True)
- a new line will be added to STATE if the following don’t matchstate_ref (bool=False)
state_cal (double=0.0)
state_load (double=0.0)
state_sub_scan (int=0)
state_obs_mode (string='OBSERVE\_TARGET#ON\_SOURCE')
observer (string='CASA simulator')
project (string='CASA simulation')
Returns
bool
- oldsetnoise(mode='calculate', table='', simplenoise='0.0Jy', antefficiency=0.8, correfficiency=0.85, spillefficiency=0.85, tau=0.1, trx=50, tatmos=230.0, tcmb=2.7)[source]
Set various system parameters from which the thermal (ie, random additive) noise level will be calculated.
For mode=simplenoise, one specifies the standard deviation for the noise to be added to real and imaginary parts of the visibility.
For mode=calculate, the noise will vary with dish diameter, antenna efficiency, system temperature, opacity, sky temperature, etc. The noise will increase with the airmass if tau is greater than zero. The noise is calculated according to the Brown Equation (ie, R.L. Brown’s calculation of MMA sensitivity, 3Oct95):
dS = 4*sqrt(2) *( T_rx*exp(-tau_atm) + T_atm*( exp(tau_atm) - epsilon_l + T_cmb) ) *epsilon_q *epsilon_a *pi *D^2 *sqrt(dnu*dt)
Parameters
mode (string='calculate')
- Mode of operation. String: ‘simplenoise’|’calculate’table (string='')
- Name of noise table - not currently implementedsimplenoise (variant='0.0Jy')
- Level of noise (if mode=simplenoise)antefficiency (double=0.8)
- antenna efficiencycorrefficiency (double=0.85)
- Correlation efficiencyspillefficiency (double=0.85)
- Forward spillover efficiencytau (double=0.1)
- Atmospheric Opacitytrx (double=50)
- Receiver temp (ie, all non-atmospheric Tsys contributions) [K]tatmos (double=230.0)
- (Physical, not Brightness) Temperature of atmosphere [K]tcmb (double=2.7)
- Temperature of cosmic microwave background [K]
Returns
bool
- open(ms='')[source]
A simulator tool can either operate on an existing MeasurementSet, predicting and/or corrupting data on the existing uvw coordinates
– to do that open the MS with sm.openfromms(msname).
or it can be used to create a new MeasurementSet from descriptions of the array configuration and the observational parameters
– to create a new MS, use this method sm.open(msname).
You will also need to run setconfig, setfield, setspw, setspwindow, setfeed, and settimes.
Creating the actual (empty) MS is accomplished with sm.observe. Data can be subsequently sm.predict-ed and sm.corrupt-ed.
NOTE: sm.predict assumes the model image units are Jy/pixel, and in fact will overwrite the brightness units of the image itself!
Parameters
ms (string='')
- MeasurementSet to be created
Returns
bool
Examples
In this example, we read in the antenna coordinates from an ASCII file, and simulate a single-pointing VLA observation with a calibrator. Note that no primary beam attenuation will be applied (see sm.setvp). tabname = 'VLAC.LOCAL.TAB' asciifile = 'VLAC.LOCAL.STN' mytab=table.create() mytab.fromascii(tabname, asciifile); xx=[]; yy:=[]; zz:=[]; diam:=[]; xx = mytab.getcol('X'); yy = mytab.getcol('Y'); zz = mytab.getcol('Z'); diam = mytab.getcol('DIAM'); # sm.open('NEW1.ms') # do configuration posvla = me.observatory('vla'); # me.observatory('ALMA') also works! sm.setconfig(telescopename='VLA', x=xx, y=yy, z=zz, dishdiameter=diam, mount='alt-az', antname='VLA', coordsystem='local', referencelocation=posvla); # Initialize the spectral windows sm.setspwindow(spwname='CBand', freq='5GHz', deltafreq='50MHz', freqresolution='50MHz', nchannels=1, stokes='RR RL LR LL'); sm.setspwindow(spwname='LBand', freq='1.420GHz', deltafreq='3.2MHz', freqresolution='3.2MHz', nchannels=32, stokes='RR LL'); # Initialize the source and calibrater sm.setfield(sourcename='My cal', sourcedirection=['J2000','00h0m0.0','+45.0.0.000'], calcode='A'); sm.setfield(sourcename='My source', sourcedirection=['J2000','01h0m0.0','+47.0.0.000']); sm.setlimits(shadowlimit=0.001, elevationlimit='8.0deg'); sm.setauto(autocorrwt=0.0); sm.settimes(integrationtime='10s', usehourangle=F, referencetime=me.epoch('utc', 'today')); sm.observe('My cal', 'LBand', starttime='0s', stoptime='300s'); sm.observe('My source', 'LBand', starttime='310s', stoptime='720s'); sm.observe('My cal', 'CBand', starttime='720s', stoptime='1020s'); sm.observe('My source', 'CBand', starttime='1030s', stoptime='1500s'); sm.setdata(spwid=1, fieldid=1); sm.predict(imagename='M31.MOD'); sm.setdata(spwid=2, fieldid=2); sm.predict(imagename='BigLBand.MOD'); sm.close();
- openfromms(ms='')[source]
A simulator tool can either operate on an existing MeasurementSet, predicting and/or corrupting data on the existing uvw coordinates - to do that open the MS with sm.openfromms(msname) or it can be used to create a new MeasurementSet from descriptions of the array configuration and the observational parameters. - to create a new MS, use sm.open(msname).
NOTE: sm.predict assumes the model image units are Jy/pixel, and in fact will overwrite the brightness units of the image itself!
Parameters
ms (string='')
- MeasurementSet to be processed
Returns
bool
Examples
sm.openfromms('3C273XC1.MS'); sm.predict('3C273XC1.imagename'); sm.setnoise(simplenoise='10mJy'); sm.setgain(interval='100s', amplitude=0.01); sm.corrupt(); sm.close();
- predict(imagename='', complist='', incremental=False)[source]
Predict astronomical data from an image. The (u,v) coordinates already exist, either from a MeasurementSet we have read in or by generating the MeasurementSet coordinates and empty data through smobserve. This method calculates visibilities for those coordinates.
predict(incremental=False) calculates new visibilities and replaces the DATA column, - predict(incremental=True) calculates new visibilities, adds them to the DATA column - predict for any value of incremental then sets CORRECTED_DATA equal to DATA, and MODEL_DATA to 1 - predict assumes model image units are Jy/pixel, and in fact will overwrite the brightness units of the image itself! - treatment of primary beam depends critically on parameters set in sm.setvp() and sm.setoptions(ftmachine) - see help sm.setvp for details. For componentlists, if sm.setvp() is run prior to predict, then the spectral variation of each component in the componentlist will include the multiplicative term of the beam value for each channel frequency. So a flat spectrum component will show the frequency variation of the beam in the predicted visibilities.
Parameters
imagename (stringVec='')
- Name of image from which to predict visibilitiescomplist (string='')
- Name of component listincremental (bool=False)
- Add this model to the existing Data Visibilities?
Returns
bool
- reset()[source]
Reset the visibility corruption terms: this means that corrupt introduces no errors.
- setapply(table='', type='B', t=0.0, field='', interp='aipslin', calwt=False, spwmap=[-1], opacity=0.0)[source]
Arrange for corruption by existing cal tables, in a manner exactly analogous to calibrater.setapply.
Parameters
table (string='')
- Calibration table nametype (string='B')
- Component typet (double=0.0)
- Interpolation interval (seconds)field (variant='')
- Select on fieldinterp (string='aipslin')
- Interpolation type (in time)calwt (bool=False)
- Calibrate weights?spwmap (intVec=[-1])
- Spectral windows to applyopacity (double=0.0)
- Array-wide zenith opacity (for type=’TOPAC’)
Returns
bool
- setauto(autocorrwt=0.0)[source]
Set autocorrelation weight
Parameters
autocorrwt (double=0.0)
- Weight to assign autocorrelations (0=none)
Returns
bool
- setbandpass(mode='calculate', table='', interval='3600s', amplitude=[0.0])[source]
Set the level of bandpass errors. The error distributions are normal, mean zero, with the variances as specified. (Not yet implemented).
Parameters
mode (string='calculate')
- Mode of operation. String: ‘calculate’|’table’table (string='')
- Name of tableinterval (variant='3600s')
- Coherence interval e.g. ‘1h’amplitude (doubleVec=[0.0])
- Variances errors in amplitude and phase
Returns
bool
- setconfig(telescopename='VLA', x=[0], y=[0], z=[0], dishdiameter=[0], offset=[0], mount=['ALT-AZ'], antname=['A'], padname=['P'], coordsystem='global', referencelocation='ALMA')[source]
Set the positions of the antennas. - The name of the telescope will control which voltage pattern is applied to the data (see sm.setvp for details). - The diameter(s) will be written to the antenna subtable but ONLY affect the calculated visibilities in sm.predict if telescope=ALMA,ACA,OVRO, *and* ftmachine=mosaic (see sm.setvp for details). - simutil::readantenna can be used to read an antenna config. file which includes many existing observatories. see help for the simobserve task, or the example below
Parameters
telescopename (string='VLA')
- Name of the telescope we are simulating (determines VP)x (doubleVec=[0])
- Vector of x values of all antennas [m]y (doubleVec=[0])
- Vector of y values of all antennas [m]z (doubleVec=[0])
- Vector of z values of all antennas [m]dishdiameter (doubleVec=[0])
- Vector of diameters of all antennas [m]offset (doubleVec=[0])
- Vector of offset of all antennas [m]mount (stringVec=['ALT-AZ'])
- Vector of mount types of all antennas (recognized mounts are ‘ALT-AZ’, ‘EQUATORIAL’, ‘X-Y’, ‘ORBITING’, ‘BIZARRE’antname (stringVec=['A'])
- Vector of names of all antennaspadname (stringVec=['P'])
- Vector of names of pads or stationscoordsystem (string='global')
- Coordinate system of antenna positions [x,y,z], possibilities are ‘global’, ‘local’ , ‘longlat’referencelocation (variant='ALMA')
- Reference location [required for local coords] Position Measure of Coordinates of array location. E.g me.position(‘ITRF’, ‘30.5deg’, -20.2deg’, 6000km’) or me.observatory(‘ALMA’)
Returns
bool
Examples
# known antenna configurations are stored in the data repository, # for historical reasons under "alma" even though this includes all # known observatories: configdir=casa.values()[0]['data']+"/alma/simmos/" # please look in that directory if your observatory is present. # if so, simutil can be used to read the file: from simutil import simutil # a simutil must be instantiated to use most methods u=simutil() x,y,z,d,padnames,telescope,posobs = u.readantenna(configdir+"vla.a.cfg") # note that readantenna converts the positions to earth-centered # global, from whatever format is in the configuration file, so # coordsystem="global" should be used in setconfig sm.setconfig(telescopename=telescope, x=x, y=y, z=z, dishdiameter=d.tolist(), mount=['alt-az'], antname=padnames, coordsystem='global', referencelocation=pospbs);
- setdata(spwid=[0], fieldid=[0], msselect='')[source]
This setup tool function selects which data are to be used subsequently. After invocation of setdata, only the selected data are operated on.
Parameters
spwid (intVec=[0])
- Spectral Window Ids (0 relative) to selectfieldid (intVec=[0])
- Field Ids (0 relative) to selectmsselect (string='')
- TAQL select string applied as a logical “and” with the other selections
Returns
bool
- setfeed(mode='', x=[0], y=[0], pol=['R'])[source]
Specify feed parameters. At this moment, you only have the choice between ’perfect R L’ and ’perfect X Y’ (i.e., you cannot invent your own corrupted feeds yet). Doesn’t need to be run if you want perfect R and L feeds.
Parameters
mode (string='')
- Mode for specifying feed parameters (currently, perfect only)x (doubleVec=[0])
- Some very secretive feed array parameter xy (doubleVec=[0])
- Some more very secretive feed array parameter ypol (stringVec=['R'])
Returns
bool
- setfield(sourcename='SOURCE', sourcedirection='', calcode='', distance='0m')[source]
Set one or more observed fields, including name and coordinates. Can be invoked multiple times for a complex observation. Must be invoked at least once before sm.observe.
If the distance to the object is set then the phase term includes a curvature for the near-field effect at the center of the image.
Parameters
sourcename (string='SOURCE')
- Name of source or field (must be specified)sourcedirection (variant='')
- Direction Measure of Coordinates of source to be observed. E.g me.direction(‘J2000’, ‘30.5deg’,’-20.2deg’).calcode (string='')
- Calibration codedistance (variant='0m')
- Distance to the object
Returns
bool
Examples
sm.setconfig(telescopename=telescope, x=x, y=y, z=z, dishdiameter=d.tolist(), mount=['alt-az'], antname=padnames, coordsystem='global', referencelocation=pospbs); sm.setspwindow(spwname='XBAND', freq='8GHz', deltafreq='50MHz', freqresolution='50MHz', nchannels=1, stokes='RR LL'); dir0 = me.direction('B1950', '16h00m0.0', '50d0m0.000') sm.setfield(sourcename='SIMU1', sourcedirection=dir0); sm.settimes(integrationtime="10s", usehourangle=True, referencetime=me.epoch('TAI', "2012/01/01/00:00:00")) sm.observe(sourcename='SIMU1', spwname='XBAND', starttime='0s', stoptime='3600s')
- setgain(mode='fbm', table='', interval='10s', amplitude=[0.01])[source]
Set the level of gain errors. Gain drift is implemented as fractional brownian motion with rms amplitude as specified. Interval is not currently used.
Parameters
mode (string='fbm')
- Mode of operation. String: ‘fbm’table (string='')
- Optional name of table to writeinterval (variant='10s')
- timescale for gain variations NOT USEDamplitude (doubleVec=[0.01])
- amplitude scale (RMS) for gain variations [real,imag] or scalar
Returns
bool
- setleakage(mode='constant', table='', amplitude=[0.01], offset=[0.0])[source]
Set the level of polarization leakage between feeds. Currently, no time dependence is available.
Parameters
mode (string='constant')
- Mode of operation. String: ‘constant’table (string='')
- Optional name of table to writeamplitude (doubleVec=[0.01])
- Magnitude of pol leakage [real,imag]offset (doubleVec=[0.])
- Meam of pol leakage [real,imag]
Returns
bool
- setlimits(shadowlimit=1e-06, elevationlimit='10deg')[source]
Data are flagged for two conditions:
Below elevation limit: If either of the antennas point below the specified elevation limit then the data are flagged. The elevation is calculated correctly for antennas at different locations (such as occurs in VLBI).
Shadowing: If one antenna shadows another such that the fractional (geometric) blockage is greater than the specified limit then the data are flagged. No correction for blockage is made for shadowed but non-flagged points.
Parameters
shadowlimit (double=1e-6)
- Maximum fraction of geometrically shadowed area before flagging occurselevationlimit (variant='10deg')
- Minimum elevation angle before flagging occurs
Returns
bool
- setmosaicfield(sourcename='SOURCE', calcode='', fieldcenter='', xmosp=1, ymosp=1, mosspacing='1arcsec', distance='0m')[source]
Set mosaic fields by internally invoking setfield multiple times. Currently only handle a rectangular mosaicing pattern. Either setfield or setmosaicfield must be invoked at least once before observe.
If the distance to the object is set then the phase term includes a curvature for the near-field effect at the center of the image.
Parameters
sourcename (string='SOURCE')
- Name of source or field (must be specified).calcode (string='')
- Calibration codefieldcenter (variant='')
- Coordinates of mosaic field centerxmosp (int=1)
- Number of mosaic pointing in horizontal directionymosp (int=1)
- Number of mosaic pointing in vertical directionmosspacing (variant='1arcsec')
- Spacing between mosaic pointingsdistance (variant='0m')
- Distance to the object
Returns
bool
Examples
sm.setconfig(telescopename='VLA', x=xx, y=yy, z=zz, dishdiameter=diam, mount='alt-az', antname='VLA', coordsystem='local', referencelocation=dm.observatory('vla')); sm.setspwindow(spwname='XBAND', freq='8GHz', deltafreq='50MHz', freqresolution='50MHz', nchannels=1, stokes='RR LL'); dir0 = me.direction('B1950', '16h00m0.0', '50d0m0.000') sm.setmosaicfield(sourcename='SIMU1', fieldcenter=dir0, xmosp=2, ymosp=2, mosspacing='154.5arcsec'); sm.settimes(integrationtime='10s'); sm.observe('SIMU1_1', 'XBAND', starttime='0s', stoptime='100s'); sm.observe('SIMU1_2', 'XBAND', starttime='110s', stoptime='210s'); sm.observe('SIMU1_3', 'XBAND', starttime='220s', stoptime='320s'); sm.observe('SIMU1_4', 'XBAND', starttime='330s', stoptime='430s');
- setnoise(mode='simplenoise', table='', simplenoise='0.1Jy', pground='560mbar', relhum=20.0, altitude='5000m', waterheight='200m', pwv='1mm', tatmos=250.0, tau=0.1, antefficiency=0.8, spillefficiency=0.85, correfficiency=0.88, trx=50, tground=270.0, tcmb=2.73, OTF=True, senscoeff=0.0, rxtype=0)[source]
Set various system parameters from which the thermal (ie, random additive) noise level will be calculated.
For mode=simplenoise, one specifies the standard deviation “sigma” for the noise to be added to real and imaginary parts of the visibility. The noise in amplitude per visibility is approximately “sigma” although it is not Gaussian (see Thompson, Moran, and Swenson fig. 6.9) and the point source noise in a Stokes I image will approximately be sigma/sqrt(n_pol * n_baselines * n_integrations * n_chan), where n_pol are the number of polarizations in the MS (typically 2), and n_integrations are the number of correlator integration times in the MS (~ track time / int. time)
For mode=tsys-atm or tsys-manual, the noise will vary with dish diameter, antenna efficiency, system temperature, opacity, sky temperature, etc. The noise will increase with the airmass if tau is greater than zero. The noise is calculated according to the Brown Equation (ie, R.L. Brown’s calculation of MMA sensitivity, 3Oct95):
dS = 4*sqrt(2) *( T_rx*exp(-tau_atm) + T_atm*( exp(tau_atm) - epsilon_l + T_cmb) ) *epsilon_q *epsilon_a *pi *D^2 *sqrt(dnu*dt)
For mode=tsys-atm, the sky brightness temperature is calculated using an atmospheric model created for the user-input PWV. For mode=tsys-manual, the user specifies the sky brightness temperature manually.
Parameters
mode (string='simplenoise')
- Mode of operation.table (string='')
- Name of optional cal table to write (if OTF=False)simplenoise (variant='0.1Jy')
- Level of noise if not calculated by amtpground (variant='560mbar')
- Ground pressure for ATM model (if tsys-atm)relhum (double=20.0)
- ground relative humidity for ATM model (if tsys-atm)altitude (variant='5000m')
- site altitude for ATM model (if tsys-atm)waterheight (variant='200m')
- Height of water layer for ATM model (if tsys-atm)pwv (variant='1mm')
- Precipitable Water Vapor ATM model (if tsys-atm)tatmos (double=250.0)
- Temperature of atmosphere [K] (if tsys-manual)tau (double=0.1)
- Zenith Atmospheric Opacity (if tsys-manual)antefficiency (double=0.8)
- Antenna efficiencyspillefficiency (double=0.85)
- Forward spillover efficiencycorrefficiency (double=0.88)
- Correlation efficiencytrx (double=50)
- Receiver temp (ie, all non-atmospheric Tsys contributions) [K]tground (double=270.0)
- Temperature of ground/spill [K]tcmb (double=2.73)
- Temperature of cosmic microwave background [K]OTF (bool=True)
- calculate noise on-the-fly (WARNING: only experts with high-RAM machines should use False)senscoeff (double=0.)
- sensitivity constant (1./sqrt(2) for interferometer [default]; 1. for total power)rxtype (int=0)
- Receiver type; 0=2SB, 1=DSB e.g. ALMA B9
Returns
bool
- setoptions(ftmachine='ft', cache=0, tile=16, gridfunction='SF', location='ALMA', padding=1.3, facets=1, maxdata=2000.0, wprojplanes=1)[source]
Set options for predict. See also imager help.
To simulate single dish data, use gridft=SD and gridfunction=PB.
To invoke primary beam convolution in the uv domain, use ftmachine=”mosaic”. This is the only option that allows heterogeneous array simulation - see the example below and help sm.setvp for more details.
Parameters
ftmachine (string='ft')
- Fourier transform machine. Possibilities are ‘ft’, ‘sd’, ‘mosaic’cache (int=0)
- Size of gridding cache in complex pixelstile (int=16)
- Size of a gridding tile in pixels (in 1 dimension)gridfunction (string='SF')
- Gridding function. String: ‘SF’|’BOX’|’PB’location (variant='ALMA')
- Location used in phase rotations. Position Measure of Coordinates of array location. E.g me.position(‘ITRF’, ‘30.5deg’, ‘-20.2deg’, ‘6000km’) or me.observatory(‘ALMA’)padding (double=1.3)
- Padding factor in image plane (>=1.0)facets (int=1)
- Number of facetsmaxdata (double=2000.0)
- Maximum data to write to a single TSM file (MB)wprojplanes (int=1)
- Number of projection planes when using wproject as the ft-machine
Returns
bool
Examples
# set some options sm.setoptions(cache=10000000, tile=32, gridfunction='BOX', me.location('vla')) # set ftmachine to invoke uv-domain primary beam convolution, and use that # to simulate a heterogeneous ALMA 7m+12m array. from simutil import simutil u=simutil() configdir=casa.values()[0]['data']+"/alma/simmos/" x,y,z,d,padnames,telescope,posobs = u.readantenna(configdir+"alma.cycle5.1.cfg") x2,y2,z2,d2,padnames2,telescope2,posobs2 = u.readantenna(configdir+"aca.cycle5.cfg") sm.open("new.het.alma.ms") sm.setconfig(telescopename="ALMA", x=np.append(x,x2),y=np.append(y,y2),z=np.append(z,z2), dishdiameter=np.append(d,d2), mount=['alt-az'], padname=np.append(padnames,padnames2).tolist(), coordsystem='global', referencelocation=posobs) sm.setspwindow(spwname="band1", freq="330GHz", deltafreq="1GHz",freqresolution="1GHz",nchannels=1,stokes='XX YY') sm.setfeed(mode='perfect X Y',pol=['']) sm.setlimits(shadowlimit=0.01, elevationlimit='10deg') sm.setauto(0.0) sm.setfield(sourcename="src1", sourcedirection="ICRS 10:00:00.00 -23.01.22", calcode="OBJ", distance='0m') sm.setfield(sourcename="src2", sourcedirection="ICRS 10:00:00.00 -23.01.32", calcode="OBJ", distance='0m') sm.settimes(integrationtime="10s", usehourangle=True, referencetime=me.epoch('TAI', "2012/01/01/00:00:00")) etime="600s" sm.observe(sourcename="src1", spwname="band1", starttime=qa.mul(-1,qa.quantity(etime)), stoptime=qa.quantity(0,"s")); sm.observe(sourcename="src2", spwname="band1", starttime=qa.quantity(0,"s"), stoptime=qa.quantity(etime)); sm.setoptions(ftmachine="mosaic") sm.predict(imagename="point.ra10.image") sm.done()
- setpa(mode='calculate', table='', interval='10s')[source]
Corrupt phase by the parallactic angle
Parameters
mode (string='calculate')
- Mode of operation. String: ‘calculate’|’table’table (string='')
- Name of tableinterval (variant='10s')
- Interval for parallactic angle application, e.g. ’10s’
Returns
bool
- setpointingerror(epjtablename='', applypointingoffsets=False, dopbcorrection=False)[source]
Set the pointing error from a calpointing table
Parameters
epjtablename (string='')
- Name of a table that has E-Jones errors for Pointingapplypointingoffsets (bool=False)
- Apply pointing offsetsdopbcorrection (bool=False)
- apply primary beam correction
Returns
bool
- setseed(seed=185349251)[source]
Set the seed for the random number generator
Parameters
seed (int=185349251)
- Seed
Returns
bool
- setspwindow(spwname='XBAND', freq='8.0e9Hz', deltafreq='50e6Hz', freqresolution='50.e6Hz', refcode='TOPO', nchannels=1, stokes='RR LL')[source]
Set one or more spectral windows for the observations, including starting frequency, number of channels, channel increment and resolution, and stokes parameters observed. Can be invoked multiple times for a complex observation. Must be invoked at least once before observe.
Parameters
spwname (string='XBAND')
- Unique user-supplied name for this spectral windowfreq (variant='8.0e9Hz')
- Starting frequencydeltafreq (variant='50e6Hz')
- Frequency increment per channelfreqresolution (variant='50.e6Hz')
- Frequency resolution per channelrefcode (string='TOPO')
- Spectral reference code e.g. LSRK, TOPO, BARYnchannels (int=1)
- Number of channelsstokes (string='RR LL')
- Stokes types to simulate
Returns
bool
Examples
To simulate a two spectral window (or two IF's in VLA jargon) data set, use setpwid as follows (here we are simulating 16 channels, 50MHz wide channel for each spectral window) sm.setspwindow(spwname='CBAND', freq='2GHz', deltafreq='50MHz', freqresolution='50MHz', nchannels=16, stokes='RR LL'); sm.setspwindow(spwname='SBAND', freq='5GHz', deltafreq='50MHz', freqresolution='50MHz', nchannels=16, stokes='RR LL'); Note that the spwname is used in observe to determine which spectral window to use.
- settimes(integrationtime='10s', usehourangle=True, referencetime='50000.0d')[source]
This method sets values to be used in sm.observe.
If usehourangle=False, the start and stop times in sm.observe are referenced to referencetime.
If usehourangle=True, then in sm.observe, starttime/stoptime will be interpreted as startha/stopha. In that case, the start and stop times are calculated such that the start time is later than the reference time, but less than one day later. The hour angles refer to the first source observed.
Parameters
integrationtime (variant='10s')
- Integration timeusehourangle (bool=True)
- Use starttime/stoptime as hour angles - else they are referenced to referencetimereferencetime (variant='50000.0d')
- Reference time for starttime and stoptime. Epoch Measure . E.g me.epoch(‘UTC’, ‘50000.0d’)
Returns
bool
- settrop(mode='screen', table='', pwv=3.0, deltapwv=0.15, beta=1.1, windspeed=7.0, simint=-1.0)[source]
Set up for corruption by the atmosphere - attenuation and increase in noise.
Parameters
mode (string='screen')
- Mode of operation - screen or individual antennastable (string='')
- Name of optional cal table to writepwv (double=3.0)
- total precipitable water vapour in mmdeltapwv (double=0.15)
- RMS PWV fluctuations as a fraction of PWV parameterbeta (double=1.1)
- exponent of fractional brownian motionwindspeed (double=7.)
- wind speed for screen type corruption (m/s)simint (double=-1.)
- simulation time step interval (s)
Returns
bool
- setvp(dovp=True, usedefaultvp=True, vptable='', dosquint=True, parangleinc='360deg', skyposthreshold='180deg', pblimit=0.01)[source]
Set the voltage pattern model (and hence, the primary beam) used for a Telecope. There are currently two ways to set the voltage pattern: by using the extensive list of defaults which the system knows about, or by creating a voltage pattern description with the vpmanager. If you are simulating a telescope which doesn’t yet exist, you will need to supply a model voltage pattern using the vpmanager.
sm.predict behavior depends critically on the parameters here, and the ftmachine parameter set in sm.setoptions
sm.predict will always query the vpmanager for a primary beam/VP pattern. if usedefaultvp==True, it will reset the vpmanager first, so that the PB obtained will be the default for the given telescope name if usedefaultvp==False, it will check whether vptable is set, and if so, load that table into the vpmanager and use the beams therein. if usedefaultvp==False and vptable is not set, it will use whatever is already set in the vpmanager (see example below for overriding a default telescope beam).
What sm.predict does with the obtained PB depends on the ftmachine and dovp parameters:
if ftmachine==”mosaic”: - a message “Performing Mosaic Gridding” indicates that one is using uv domain convolution for simulating from images. - if the primary beam returned by the vpmanager is ALMA, ACA, or OVRO, heterogeneous gridding will be invoked, and the dish diameter set in sm.setconfig, or already in the antenna subtable, will be used to convolve sky model images. for ALMA or ACA, dish diameter =12m will use a 10.7m Airy pattern, and dish diameter =7m will use a 6.25m Airy pattern. see help sm.setoptions for an example. - otherwise the PB returned by the vpmanager will be used. - heterogeneous simulation only works at present from a sky model image, NOT from sky model components. If you want to simulate a heterogeneous array, please add components to an image using ia.modify, and don’t specify a component list in sm.predict. Homogeneous array simulation from component lists works fine. - IF dovp=True, the primary beam returned by the vpmanager will be used to convolve sky model components. This is not automatically invoked by ftmachine=”mosaic”, but needs to be set explicitly with sm.setvp() if you are simulating from components in addition to or instead of sky model images.
if ftmachine==”ft” (the default): - a message “Synthesis Gridding” indicates that if requested with dovp==True, image domain PB convolution will be used. - if dovp==True, the primary beam returned by the vpmanager will be used to convolve sky model components and images.
Parameters
dovp (bool=True)
- Multiply by the voltage pattern (ie, primary beam) when simulatingusedefaultvp (bool=True)
- Look up the default VP for this telescope and frequency?vptable (string='')
- If usedefaultvp is False, provide a VP Table made with vpmanagerdosquint (bool=True)
- Activate the beam squint in the VP modelparangleinc (variant='360deg')
- Parallactice angle increment for squint applicationskyposthreshold (variant='180deg')
- Position threshold on the sky for feed arrays ??pblimit (double=1.0e-2)
- Primary beam limit to use in feed arrays ?
Returns
bool
Examples
# use the default primary beam in subsequent sm.predict (according to # whatever telescope name was set in sm.setconfig) sm.setvp(dovp=True, usedefaultvp=True) sm.predict(imagename="point.ra10.image",complist="point.cl") # use an alternate VP table e.g. of the format created by vpmanager: sm.setvp(dovp=True, usedefaultvp=False, vptable='MyAlternateVLAPBModel.TAB', dosquint=F); sm.predict(imagename="point.ra10.image",complist="point.cl") # set a VP and then use it overridding the default # (if telescope="NGVLA" was used previously in setconfig, # or if an MS was loaded with observatory name = "NGVLA") vp.setpbairy(telescope="NGVLA",dishdiam="10m",maxrad="5deg") sm.setvp(dovp=True,usedefaultvp=False) sm.predict(imagename="point.ra10.image",complist="point.cl")