Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/simulator.py: 51%
158 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:10 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:10 +0000
1# This file was automatically generated by SWIG (http://www.swig.org).
2# Version 3.0.12
3#
4# Do not make changes to this file unless you know what you are doing--modify
5# the SWIG interface file instead.
7from sys import version_info as _swig_python_version_info
8if _swig_python_version_info >= (2, 7, 0):
9 def swig_import_helper():
10 import importlib
11 pkg = __name__.rpartition('.')[0]
12 mname = '.'.join((pkg, '_simulator')).lstrip('.')
13 try:
14 return importlib.import_module(mname)
15 except ImportError:
16 return importlib.import_module('_simulator')
17 _simulator = swig_import_helper()
18 del swig_import_helper
19elif _swig_python_version_info >= (2, 6, 0):
20 def swig_import_helper():
21 from os.path import dirname
22 import imp
23 fp = None
24 try:
25 fp, pathname, description = imp.find_module('_simulator', [dirname(__file__)])
26 except ImportError:
27 import _simulator
28 return _simulator
29 try:
30 _mod = imp.load_module('_simulator', fp, pathname, description)
31 finally:
32 if fp is not None:
33 fp.close()
34 return _mod
35 _simulator = swig_import_helper()
36 del swig_import_helper
37else:
38 import _simulator
39del _swig_python_version_info
41try:
42 _swig_property = property
43except NameError:
44 pass # Python < 2.2 doesn't have 'property'.
46try:
47 import builtins as __builtin__
48except ImportError:
49 import __builtin__
51def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
52 if (name == "thisown"):
53 return self.this.own(value)
54 if (name == "this"):
55 if type(value).__name__ == 'SwigPyObject':
56 self.__dict__[name] = value
57 return
58 method = class_type.__swig_setmethods__.get(name, None)
59 if method:
60 return method(self, value)
61 if (not static):
62 if _newclass:
63 object.__setattr__(self, name, value)
64 else:
65 self.__dict__[name] = value
66 else:
67 raise AttributeError("You cannot add attributes to %s" % self)
70def _swig_setattr(self, class_type, name, value):
71 return _swig_setattr_nondynamic(self, class_type, name, value, 0)
74def _swig_getattr(self, class_type, name):
75 if (name == "thisown"):
76 return self.this.own()
77 method = class_type.__swig_getmethods__.get(name, None)
78 if method:
79 return method(self)
80 raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
83def _swig_repr(self):
84 try:
85 strthis = "proxy of " + self.this.__repr__()
86 except __builtin__.Exception:
87 strthis = ""
88 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
90try:
91 _object = object
92 _newclass = 1
93except __builtin__.Exception:
94 class _object:
95 pass
96 _newclass = 0
98class simulator(_object):
99 """Proxy of C++ casac::simulator class."""
101 __swig_setmethods__ = {}
102 __setattr__ = lambda self, name, value: _swig_setattr(self, simulator, name, value)
103 __swig_getmethods__ = {}
104 __getattr__ = lambda self, name: _swig_getattr(self, simulator, name)
105 __repr__ = _swig_repr
107 def __init__(self):
108 """__init__(self) -> simulator"""
109 this = _simulator.new_simulator()
110 try:
111 self.this.append(this)
112 except __builtin__.Exception:
113 self.this = this
115 def open(self, *args, **kwargs):
116 """
117 open(self, _ms) -> bool
121 Summary:
122 Construct a simulator tool and create a new MeasurementSet
124 Description:
127 A simulator tool can either operate on an existing MeasurementSet,
128 predicting and/or corrupting data on the existing uvw coordinates
130 -- to do that open the MS with sm.openfromms(msname).
132 or it can be used to create a new MeasurementSet from descriptions of
133 the array configuration and the observational parameters
135 -- to create a new MS, use this method sm.open(msname).
137 You will also need to run setconfig, setfield, setspw, setspwindow,
138 setfeed, and settimes.
140 Creating the actual (empty) MS is accomplished with sm.observe.
141 Data can be subsequently sm.predict-ed and sm.corrupt-ed.
143 NOTE: sm.predict assumes the model image units are Jy/pixel, and
144 in fact will overwrite the brightness units of the image itself!
147 Input Parameters:
148 ms MeasurementSet to be created
150 Example:
152 In this example, we read in the antenna coordinates from an ASCII file,
153 and simulate a single-pointing VLA observation with a calibrator.
154 Note that no primary beam attenuation will be applied (see sm.setvp).
156 tabname = 'VLAC.LOCAL.TAB'
157 asciifile = 'VLAC.LOCAL.STN'
158 mytab=table.create()
159 mytab.fromascii(tabname, asciifile);
160 xx=[]; yy:=[]; zz:=[]; diam:=[];
161 xx = mytab.getcol('X');
162 yy = mytab.getcol('Y');
163 zz = mytab.getcol('Z');
164 diam = mytab.getcol('DIAM');
165 #
166 sm.open('NEW1.ms')
167 # do configuration
168 posvla = me.observatory('vla'); # me.observatory('ALMA') also works!
169 sm.setconfig(telescopename='VLA', x=xx, y=yy, z=zz, dishdiameter=diam,
170 mount='alt-az', antname='VLA',
171 coordsystem='local', referencelocation=posvla);
173 # Initialize the spectral windows
174 sm.setspwindow(spwname='CBand', freq='5GHz',
175 deltafreq='50MHz',
176 freqresolution='50MHz',
177 nchannels=1,
178 stokes='RR RL LR LL');
179 sm.setspwindow(spwname='LBand', freq='1.420GHz',
180 deltafreq='3.2MHz',
181 freqresolution='3.2MHz',
182 nchannels=32,
183 stokes='RR LL');
185 # Initialize the source and calibrater
186 sm.setfield(sourcename='My cal',
187 sourcedirection=['J2000','00h0m0.0','+45.0.0.000'],
188 calcode='A');
189 sm.setfield(sourcename='My source',
190 sourcedirection=['J2000','01h0m0.0','+47.0.0.000']);
192 sm.setlimits(shadowlimit=0.001, elevationlimit='8.0deg');
193 sm.setauto(autocorrwt=0.0);
195 sm.settimes(integrationtime='10s', usehourangle=F,
196 referencetime=me.epoch('utc', 'today'));
198 sm.observe('My cal', 'LBand', starttime='0s', stoptime='300s');
199 sm.observe('My source', 'LBand', starttime='310s', stoptime='720s');
200 sm.observe('My cal', 'CBand', starttime='720s', stoptime='1020s');
201 sm.observe('My source', 'CBand', starttime='1030s', stoptime='1500s');
203 sm.setdata(spwid=1, fieldid=1);
204 sm.predict(imagename='M31.MOD');
205 sm.setdata(spwid=2, fieldid=2);
206 sm.predict(imagename='BigLBand.MOD');
207 sm.close();
209 --------------------------------------------------------------------------------
211 """
212 return _simulator.simulator_open(self, *args, **kwargs)
215 def openfromms(self, *args, **kwargs):
216 """
217 openfromms(self, _ms) -> bool
221 Summary:
222 Construct a simulator tool using an already existing MS
224 Description:
227 A simulator tool can either operate on an existing MeasurementSet,
228 predicting and/or corrupting data on the existing uvw coordinates
229 - to do that open the MS with sm.openfromms(msname)
230 or it can be used to create a new MeasurementSet from descriptions of
231 the array configuration and the observational parameters.
232 - to create a new MS, use sm.open(msname).
234 NOTE: sm.predict assumes the model image units are Jy/pixel, and in
235 fact will overwrite the brightness units of the image itself!
238 Input Parameters:
239 ms MeasurementSet to be processed
241 Example:
243 sm.openfromms('3C273XC1.MS');
244 sm.predict('3C273XC1.imagename');
245 sm.setnoise(simplenoise='10mJy');
246 sm.setgain(interval='100s', amplitude=0.01);
247 sm.corrupt();
248 sm.close();
250 --------------------------------------------------------------------------------
252 """
253 return _simulator.simulator_openfromms(self, *args, **kwargs)
256 def close(self):
257 """
258 close(self) -> bool
262 Summary:
263 Close the simulator tool
265 Description:
268 Close tools and write data to disk. This is a synonym for done.
271 --------------------------------------------------------------------------------
273 """
274 return _simulator.simulator_close(self)
277 def done(self):
278 """
279 done(self) -> bool
283 Summary:
284 Close the simulator tool
286 Description:
289 Close tools and write data to disk. This is a synonym for done.
292 --------------------------------------------------------------------------------
294 """
295 return _simulator.simulator_done(self)
298 def name(self):
299 """
300 name(self) -> string
304 Summary:
305 Provide the name of the attached MeasurementSet
307 Description:
310 Returns the name of the attached MeasurementSet.
313 --------------------------------------------------------------------------------
315 """
316 return _simulator.simulator_name(self)
319 def summary(self):
320 """
321 summary(self) -> bool
325 Summary:
326 Summarize the current state
328 Description:
331 Writes a summary of the currently set properties to the default logger.
334 --------------------------------------------------------------------------------
336 """
337 return _simulator.simulator_summary(self)
340 def type(self):
341 """
342 type(self) -> string
346 Summary:
347 Return the type of this tool
349 Description:
352 This function returns the string `Simulator'. It is used so that in a
353 script, you can make sure this variable is a simulator tool.
356 --------------------------------------------------------------------------------
358 """
359 return _simulator.simulator_type(self)
362 def settimes(self, *args, **kwargs):
363 """
364 settimes(self, _integrationtime, _usehourangle, _referencetime) -> bool
368 Summary:
369 Set integration time, etc.
371 Description:
374 This method sets values to be used in sm.observe.
376 If usehourangle=False, the start and stop times in sm.observe are
377 referenced to referencetime.
379 If usehourangle=True, then in sm.observe, starttime/stoptime will be
380 interpreted as startha/stopha.
381 In that case, the start and stop times are calculated such that the
382 start time is later than the reference time, but less than one day
383 later. The hour angles refer to the first source observed.
386 Input Parameters:
387 integrationtime Integration time
388 usehourangle Use starttime/stoptime as hour angles - else they are referenced to referencetime
389 referencetime Reference time for starttime and stoptime. Epoch Measure . E.g me.epoch('UTC', '50000.0d')
391 --------------------------------------------------------------------------------
393 """
394 return _simulator.simulator_settimes(self, *args, **kwargs)
397 def observe(self, *args, **kwargs):
398 """
399 observe(self, _sourcename, _spwname, _starttime, _stoptime, _add_observation, _state_sig, _state_ref, _state_cal, _state_load, _state_sub_scan, _state_obs_mode, _observer, _project) -> bool
403 Summary:
404 Observe a given configuration
406 Description:
409 Observe a given source with a given spectral window for the specified
410 times, including start, stop, integration, and gap times.
412 If usehourangle=False (set with settimes), the start and stop times
413 are referenced to referencetime.
415 If userhourangle=True, starttime/stoptime are interpreted as
416 startha/stopha, the start and stop times are calculated such that the
417 start time is later than the reference time, but less than one day
418 later, and the hour angles refer to the first source observed.
420 setconfig, setspwindow, setfeed, and setfield must
421 be run before observe can be run.
423 See also sm.observemany
426 Input Parameters:
427 sourcename Name of source or field (must be specified)
428 spwname Unique user-supplied name for this spectral window
429 starttime Start time referenced to referencetime, or start hour angle
430 stoptime Stop time referenced to referencetime, or stop hour angle
431 add_observation Add a new line to the OBSERVATION subtable for this call
432 state_sig a new line will be added to STATE if the following don't match
433 state_ref
434 state_cal
435 state_load
436 state_sub_scan
437 state_obs_mode
438 observer
439 project
441 --------------------------------------------------------------------------------
443 """
444 return _simulator.simulator_observe(self, *args, **kwargs)
447 def observemany(self, *args, **kwargs):
448 """
449 observemany(self, _sourcenames, _spwname, _starttimes, _stoptimes, _directions, _add_observation, _state_sig, _state_ref, _state_cal, _state_load, _state_sub_scan, _state_obs_mode, _observer, _project) -> bool
453 Summary:
454 Observe a given configuration
456 Description:
459 Observe given sources with a given spectral window for the specified
460 times, including start, stop, integration, and gap times.
462 If usehourangle=False (set with settimes), the start and stop times
463 are referenced to referencetime.
465 If userhourangle=True, starttime/stoptime are interpreted as
466 startha/stopha, the start and stop times are calculated such that the
467 start time is later than the reference time, but less than one day
468 later, and the hour angles refer to the first source observed.
470 See also sm.observe
473 Input Parameters:
474 sourcenames Name of sources
475 spwname Unique user-supplied name for this spectral window
476 starttimes Start times referenced to referencetime, or start hour angle
477 stoptimes Stop time referenced to referencetime, or stop hour angle
478 directions
479 add_observation Add a new line to the OBSERVATION subtable for this call
480 state_sig a new line will be added to STATE if the following don't match
481 state_ref
482 state_cal
483 state_load
484 state_sub_scan
485 state_obs_mode
486 observer
487 project
489 --------------------------------------------------------------------------------
491 """
492 return _simulator.simulator_observemany(self, *args, **kwargs)
495 def setlimits(self, *args, **kwargs):
496 """
497 setlimits(self, _shadowlimit, _elevationlimit) -> bool
501 Summary:
502 Set limits for observing
504 Description:
507 Data are flagged for two conditions:
509 - Below elevation limit: If either of the antennas point below the
510 specified elevation limit then the data are flagged. The elevation is
511 calculated correctly for antennas at different locations (such as
512 occurs in VLBI).
514 - Shadowing: If one antenna shadows another such that the fractional
515 (geometric) blockage is greater than the specified limit then the data
516 are flagged. No correction for blockage is made for shadowed but
517 non-flagged points.
520 Input Parameters:
521 shadowlimit Maximum fraction of geometrically shadowed area before flagging occurs
522 elevationlimit Minimum elevation angle before flagging occurs
524 --------------------------------------------------------------------------------
526 """
527 return _simulator.simulator_setlimits(self, *args, **kwargs)
530 def setauto(self, *args, **kwargs):
531 """
532 setauto(self, _autocorrwt) -> bool
536 Summary:
537 Set autocorrelation weight
539 Description:
544 Input Parameters:
545 autocorrwt Weight to assign autocorrelations (0=none)
547 --------------------------------------------------------------------------------
549 """
550 return _simulator.simulator_setauto(self, *args, **kwargs)
553 def setconfig(self, *args, **kwargs):
554 """
555 setconfig(self, _telescopename, _x, _y, _z, _dishdiameter, _offset, _mount, _antname, _padname, _coordsystem, _referencelocation) -> bool
559 Summary:
560 Set the antenna configuration
562 Description:
565 Set the positions of the antennas.
566 - The name of the telescope will control which voltage pattern
567 is applied to the data (see sm.setvp for details).
568 - The diameter(s) will be written to the antenna subtable but
569 ONLY affect the calculated visibilities in sm.predict if
570 telescope=ALMA,ACA,OVRO, *and* ftmachine=mosaic
571 (see sm.setvp for details).
572 - simutil::readantenna can be used to read an antenna config. file
573 which includes many existing observatories.
574 see help for the simobserve task, or the example below
577 Input Parameters:
578 telescopename Name of the telescope we are simulating (determines VP)
579 x Vector of x values of all antennas [m]
580 y Vector of y values of all antennas [m]
581 z Vector of z values of all antennas [m]
582 dishdiameter Vector of diameters of all antennas [m]
583 offset Vector of offset of all antennas [m]
584 mount Vector of mount types of all antennas (recognized mounts are 'ALT-AZ', 'EQUATORIAL', 'X-Y', 'ORBITING', 'BIZARRE'
585 antname Vector of names of all antennas
586 padname Vector of names of pads or stations
587 coordsystem Coordinate system of antenna positions [x,y,z], possibilities are 'global', 'local' , 'longlat'
588 referencelocation 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')
590 Example:
592 # known antenna configurations are stored in the data repository,
593 # for historical reasons under 'alma' even though this includes all
594 # known observatories:
595 configdir=casa.values()[0]['data']+'/alma/simmos/'
597 # please look in that directory if your observatory is present.
598 # if so, simutil can be used to read the file:
599 from simutil import simutil
600 # a simutil must be instantiated to use most methods
601 u=simutil()
602 x,y,z,d,padnames,telescope,posobs = u.readantenna(configdir+'vla.a.cfg')
604 # note that readantenna converts the positions to earth-centered
605 # global, from whatever format is in the configuration file, so
606 # coordsystem='global' should be used in setconfig
607 sm.setconfig(telescopename=telescope, x=x, y=y, z=z,
608 dishdiameter=d.tolist(),
609 mount=['alt-az'], antname=padnames,
610 coordsystem='global', referencelocation=pospbs);
612 --------------------------------------------------------------------------------
614 """
615 return _simulator.simulator_setconfig(self, *args, **kwargs)
618 def setfeed(self, *args, **kwargs):
619 """
620 setfeed(self, _mode, _x, _y, _pol) -> bool
624 Summary:
625 Set the feed parameters
627 Description:
630 Specify feed parameters. At this moment, you only have the choice
631 between 'perfect R L' and 'perfect X Y' (i.e., you cannot invent
632 your own corrupted feeds yet). Doesn't need to be run if you want
633 perfect R and L feeds.
636 Input Parameters:
637 mode Mode for specifying feed parameters (currently, perfect only)
638 x Some very secretive feed array parameter x
639 y Some more very secretive feed array parameter y
640 pol
642 --------------------------------------------------------------------------------
644 """
645 return _simulator.simulator_setfeed(self, *args, **kwargs)
648 def setfield(self, *args, **kwargs):
649 """
650 setfield(self, _sourcename, _sourcedirection, _calcode, _distance) -> bool
654 Summary:
655 Set one or more observed fields
657 Description:
660 Set one or more observed fields, including name and coordinates.
661 Can be invoked multiple times for a complex observation.
662 Must be invoked at least once before sm.observe.
664 If the distance to the object is set then the phase term includes a
665 curvature for the near-field effect at the center of the image.
668 Input Parameters:
669 sourcename Name of source or field (must be specified)
670 sourcedirection Direction Measure of Coordinates of source to be observed. E.g me.direction('J2000', '30.5deg','-20.2deg').
671 calcode Calibration code
672 distance Distance to the object
674 Example:
676 sm.setconfig(telescopename=telescope, x=x, y=y, z=z,
677 dishdiameter=d.tolist(),
678 mount=['alt-az'], antname=padnames,
679 coordsystem='global', referencelocation=pospbs);
681 sm.setspwindow(spwname='XBAND', freq='8GHz', deltafreq='50MHz',
682 freqresolution='50MHz', nchannels=1, stokes='RR
683 LL');
684 dir0 = me.direction('B1950', '16h00m0.0', '50d0m0.000')
685 sm.setfield(sourcename='SIMU1', sourcedirection=dir0);
686 sm.settimes(integrationtime='10s', usehourangle=True,
687 referencetime=me.epoch('TAI', '2012/01/01/00:00:00'))
688 sm.observe(sourcename='SIMU1', spwname='XBAND',
689 starttime='0s', stoptime='3600s')
691 --------------------------------------------------------------------------------
693 """
694 return _simulator.simulator_setfield(self, *args, **kwargs)
697 def setmosaicfield(self, *args, **kwargs):
698 """
699 setmosaicfield(self, _sourcename, _calcode, _fieldcenter, _xmosp, _ymosp, _mosspacing, _distance) -> bool
703 Summary:
704 Set observed mosaic fields
706 Description:
709 Set mosaic fields by internally invoking setfield multiple times.
710 Currently only handle a rectangular mosaicing pattern. Either
711 setfield or setmosaicfield must be invoked at least once before
712 observe.
714 If the distance to the object is set then the phase term includes a
715 curvature for the near-field effect at the center of the image.
718 Input Parameters:
719 sourcename Name of source or field (must be specified).
720 calcode Calibration code
721 fieldcenter Coordinates of mosaic field center
722 xmosp Number of mosaic pointing in horizontal direction
723 ymosp Number of mosaic pointing in vertical direction
724 mosspacing Spacing between mosaic pointings
725 distance Distance to the object
727 Example:
729 sm.setconfig(telescopename='VLA', x=xx, y=yy, z=zz, dishdiameter=diam,
730 mount='alt-az', antname='VLA',
731 coordsystem='local', referencelocation=dm.observatory('vla'));
733 sm.setspwindow(spwname='XBAND', freq='8GHz', deltafreq='50MHz',
734 freqresolution='50MHz', nchannels=1, stokes='RR
735 LL');
736 dir0 = me.direction('B1950', '16h00m0.0', '50d0m0.000')
737 sm.setmosaicfield(sourcename='SIMU1', fieldcenter=dir0,
738 xmosp=2, ymosp=2, mosspacing='154.5arcsec');
739 sm.settimes(integrationtime='10s');
740 sm.observe('SIMU1_1', 'XBAND', starttime='0s', stoptime='100s');
741 sm.observe('SIMU1_2', 'XBAND', starttime='110s', stoptime='210s');
742 sm.observe('SIMU1_3', 'XBAND', starttime='220s', stoptime='320s');
743 sm.observe('SIMU1_4', 'XBAND', starttime='330s', stoptime='430s');
745 --------------------------------------------------------------------------------
747 """
748 return _simulator.simulator_setmosaicfield(self, *args, **kwargs)
751 def setspwindow(self, *args, **kwargs):
752 """
753 setspwindow(self, _spwname, _freq, _deltafreq, _freqresolution, _refcode, _nchannels, _stokes) -> bool
757 Summary:
758 Set one or more spectral windows
760 Description:
763 Set one or more spectral windows for the observations, including
764 starting frequency, number of channels, channel increment and
765 resolution, and stokes parameters observed. Can be invoked
766 multiple times for a complex observation. Must be invoked at
767 least once before observe.
770 Input Parameters:
771 spwname Unique user-supplied name for this spectral window
772 freq Starting frequency
773 deltafreq Frequency increment per channel
774 freqresolution Frequency resolution per channel
775 refcode Spectral reference code e.g. LSRK, TOPO, BARY
776 nchannels Number of channels
777 stokes Stokes types to simulate
779 Example:
781 To simulate a two spectral window (or two IF's in VLA jargon) data
782 set, use setpwid as follows (here we are simulating 16 channels, 50MHz
783 wide channel for each spectral window)
786 sm.setspwindow(spwname='CBAND', freq='2GHz', deltafreq='50MHz',
787 freqresolution='50MHz', nchannels=16, stokes='RR LL');
789 sm.setspwindow(spwname='SBAND', freq='5GHz', deltafreq='50MHz',
790 freqresolution='50MHz', nchannels=16, stokes='RR LL');
793 Note that the spwname is used in observe to determine which spectral window
794 to use.
796 --------------------------------------------------------------------------------
798 """
799 return _simulator.simulator_setspwindow(self, *args, **kwargs)
802 def setdata(self, *args, **kwargs):
803 """
804 setdata(self, _spwid, _fieldid, _msselect) -> bool
808 Summary:
809 Set the data parameters selection for subsequent processing
811 Description:
814 This setup tool function selects which data are to be used
815 subsequently. After invocation of setdata, only the selected data are
816 operated on.
819 Input Parameters:
820 spwid Spectral Window Ids (0 relative) to select
821 fieldid Field Ids (0 relative) to select
822 msselect TAQL select string applied as a logical 'and' with the other selections
824 --------------------------------------------------------------------------------
826 """
827 return _simulator.simulator_setdata(self, *args, **kwargs)
830 def predict(self, *args, **kwargs):
831 """
832 predict(self, _imagename, _complist, _incremental) -> bool
836 Summary:
837 Predict astronomical data from an image or components
839 Description:
842 Predict astronomical data from an image. The (u,v) coordinates
843 already exist, either from a MeasurementSet we have read in or by
844 generating the MeasurementSet coordinates and empty data through
845 smobserve. This method calculates visibilities for those
846 coordinates.
848 - predict(incremental=False) calculates new visibilities and
849 replaces the DATA column,
850 - predict(incremental=True) calculates new visibilities, adds
851 them to the DATA column
852 - predict for any value of incremental then sets CORRECTED_DATA
853 equal to DATA, and MODEL_DATA to 1
854 - predict assumes model image units are Jy/pixel, and in fact
855 will overwrite the brightness units of the image itself!
856 - treatment of primary beam depends critically on parameters set in
857 sm.setvp() and sm.setoptions(ftmachine) - see help sm.setvp for
858 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.
862 Input Parameters:
863 imagename Name of image from which to predict visibilities
864 complist Name of component list
865 incremental Add this model to the existing Data Visibilities?
867 --------------------------------------------------------------------------------
869 """
870 return _simulator.simulator_predict(self, *args, **kwargs)
873 def setoptions(self, *args, **kwargs):
874 """
875 setoptions(self, _ftmachine, _cache, _tile, _gridfunction, _location, _padding, _facets, _maxdata, _wprojplanes) -> bool
879 Summary:
880 Set various processing options
882 Description:
885 Set options for predict. See also imager help.
887 To simulate single dish data, use gridft=SD and gridfunction=PB.
889 To invoke primary beam convolution in the uv domain, use
890 ftmachine='mosaic'. This is the only option that allows
891 heterogeneous array simulation - see the example below and
892 help sm.setvp for more details.
895 Input Parameters:
896 ftmachine Fourier transform machine. Possibilities are 'ft', 'sd', 'mosaic'
897 cache Size of gridding cache in complex pixels
898 tile Size of a gridding tile in pixels (in 1 dimension)
899 gridfunction Gridding function. String: 'SF'|'BOX'|'PB'
900 location 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')
901 padding Padding factor in image plane (>=1.0)
902 facets Number of facets
903 maxdata Maximum data to write to a single TSM file (MB)
904 wprojplanes Number of projection planes when using wproject as the ft-machine
906 Example:
908 # set some options
909 sm.setoptions(cache=10000000, tile=32, gridfunction='BOX', me.location('vla'))
912 # set ftmachine to invoke uv-domain primary beam convolution, and use that
913 # to simulate a heterogeneous ALMA 7m+12m array.
914 from simutil import simutil
915 u=simutil()
916 configdir=casa.values()[0]['data']+'/alma/simmos/'
917 x,y,z,d,padnames,telescope,posobs = u.readantenna(configdir+'alma.cycle5.1.cfg')
918 x2,y2,z2,d2,padnames2,telescope2,posobs2 = u.readantenna(configdir+'aca.cycle5.cfg')
920 sm.open('new.het.alma.ms')
921 sm.setconfig(telescopename='ALMA',
922 x=np.append(x,x2),y=np.append(y,y2),z=np.append(z,z2),
923 dishdiameter=np.append(d,d2),
924 mount=['alt-az'], padname=np.append(padnames,padnames2).tolist(),
925 coordsystem='global', referencelocation=posobs)
926 sm.setspwindow(spwname='band1', freq='330GHz',
927 deltafreq='1GHz',freqresolution='1GHz',nchannels=1,stokes='XX YY')
928 sm.setfeed(mode='perfect X Y',pol=[''])
929 sm.setlimits(shadowlimit=0.01, elevationlimit='10deg')
930 sm.setauto(0.0)
931 sm.setfield(sourcename='src1',
932 sourcedirection='ICRS 10:00:00.00 -23.01.22',
933 calcode='OBJ', distance='0m')
934 sm.setfield(sourcename='src2',
935 sourcedirection='ICRS 10:00:00.00 -23.01.32',
936 calcode='OBJ', distance='0m')
937 sm.settimes(integrationtime='10s', usehourangle=True,
938 referencetime=me.epoch('TAI', '2012/01/01/00:00:00'))
939 etime='600s'
940 sm.observe(sourcename='src1', spwname='band1',
941 starttime=qa.mul(-1,qa.quantity(etime)),
942 stoptime=qa.quantity(0,'s'));
943 sm.observe(sourcename='src2', spwname='band1',
944 starttime=qa.quantity(0,'s'),
945 stoptime=qa.quantity(etime));
946 sm.setoptions(ftmachine='mosaic')
947 sm.predict(imagename='point.ra10.image')
948 sm.done()
950 --------------------------------------------------------------------------------
952 """
953 return _simulator.simulator_setoptions(self, *args, **kwargs)
956 def setvp(self, *args, **kwargs):
957 """
958 setvp(self, _dovp, _usedefaultvp, _vptable, _dosquint, _parangleinc, _skyposthreshold, _pblimit) -> bool
962 Summary:
963 Set the voltage pattern model for subsequent processing
965 Description:
968 Set the voltage pattern model (and hence, the primary beam) used
969 for a Telecope. There are currently two ways to set the voltage
970 pattern: by using the extensive list of defaults which the system
971 knows about, or by creating a voltage pattern description with
972 the vpmanager. If you are
973 simulating a telescope which doesn't yet exist, you will need to
974 supply a model voltage pattern using
975 the vpmanager.
977 sm.predict behavior depends critically on the parameters here, and
978 the ftmachine parameter set in sm.setoptions
980 sm.predict will always query the vpmanager for a primary beam/VP pattern.
981 if usedefaultvp==True, it will reset the vpmanager first, so that
982 the PB obtained will be the default for the given telescope name
983 if usedefaultvp==False, it will check whether vptable is set, and if so,
984 load that table into the vpmanager and use the beams therein.
985 if usedefaultvp==False and vptable is not set, it will use whatever is
986 already set in the vpmanager (see example below for overriding a
987 default telescope beam).
989 What sm.predict does with the obtained PB depends on the ftmachine and
990 dovp parameters:
992 if ftmachine=='mosaic':
993 - a message 'Performing Mosaic Gridding' indicates that one is using
994 uv domain convolution for simulating from images.
995 - if the primary beam returned by the vpmanager is ALMA, ACA, or OVRO,
996 heterogeneous gridding will be invoked, and the dish diameter set
997 in sm.setconfig, or already in the antenna subtable, will be used
998 to convolve sky model images.
999 for ALMA or ACA, dish diameter =12m will use a 10.7m Airy pattern,
1000 and dish diameter =7m will use a 6.25m Airy pattern.
1001 see help sm.setoptions for an example.
1002 - otherwise the PB returned by the vpmanager will be used.
1003 - heterogeneous simulation only works at present from a sky model
1004 image, NOT from sky model components. If you want to simulate a
1005 heterogeneous array, please add components to an image using
1006 ia.modify, and don't specify a component list in sm.predict.
1007 Homogeneous array simulation from component lists works fine.
1008 - IF dovp=True, the primary beam returned by the vpmanager will
1009 be used to convolve sky model components. This is not automatically
1010 invoked by ftmachine='mosaic', but needs to be set explicitly with
1011 sm.setvp() if you are simulating from components in addition to or
1012 instead of sky model images.
1014 if ftmachine=='ft' (the default):
1015 - a message 'Synthesis Gridding' indicates that if requested with
1016 dovp==True, image domain PB convolution will be used.
1017 - if dovp==True, the primary beam returned by the vpmanager will be
1018 used to convolve sky model components and images.
1022 Input Parameters:
1023 dovp Multiply by the voltage pattern (ie, primary beam) when simulating
1024 usedefaultvp Look up the default VP for this telescope and frequency?
1025 vptable If usedefaultvp is false, provide a VP Table made with vpmanager
1026 dosquint Activate the beam squint in the VP model
1027 parangleinc Parallactice angle increment for squint application
1028 skyposthreshold Position threshold on the sky for feed arrays ??
1029 pblimit Primary beam limit to use in feed arrays ?
1031 Example:
1033 # use the default primary beam in subsequent sm.predict (according to
1034 # whatever telescope name was set in sm.setconfig)
1035 sm.setvp(dovp=True, usedefaultvp=True)
1036 sm.predict(imagename='point.ra10.image',complist='point.cl')
1038 # use an alternate VP table e.g. of the format created by vpmanager:
1039 sm.setvp(dovp=True, usedefaultvp=False, vptable='MyAlternateVLAPBModel.TAB', dosquint=F);
1040 sm.predict(imagename='point.ra10.image',complist='point.cl')
1042 # set a VP and then use it overridding the default
1043 # (if telescope='NGVLA' was used previously in setconfig,
1044 # or if an MS was loaded with observatory name = 'NGVLA')
1045 vp.setpbairy(telescope='NGVLA',dishdiam='10m',maxrad='5deg')
1046 sm.setvp(dovp=True,usedefaultvp=False)
1047 sm.predict(imagename='point.ra10.image',complist='point.cl')
1049 --------------------------------------------------------------------------------
1051 """
1052 return _simulator.simulator_setvp(self, *args, **kwargs)
1055 def corrupt(self):
1056 """
1057 corrupt(self) -> bool
1061 Summary:
1062 Corrupt the data with visibility errors
1064 Description:
1067 Add errors specified by the set* functions (such as noise, gains,
1068 polarization leakage, bandpass, etc) to the visibility data. The
1069 errors are applied to the DATA and CORRECTED_DATA columns.
1071 Note that corrupt handles only
1072 visibility-plane effects, not image-plane effects such as pointing
1073 errors and voltage patterns, which get applied in predict. Note, the
1074 function applies errors to both cross- and auto-correlation data; The
1075 auto-correlation data are corrupted properly only for the thermalnoise
1076 set by setnoise.
1079 Example:
1081 sm,openfromms('3C273XC1.MS');
1082 sm.predict('3C273XC1.FAKE.IMAGE');
1083 sm.setnoise( mode='simplenoise', simplenoise='0.1Jy');
1084 sm.setpa( mode='calculate');
1085 sm.corrupt();
1087 --------------------------------------------------------------------------------
1089 """
1090 return _simulator.simulator_corrupt(self)
1093 def reset(self):
1094 """
1095 reset(self) -> bool
1099 Summary:
1100 Reset the corruption terms
1102 Description:
1105 Reset the visibility corruption terms: this means that corrupt
1106 introduces no errors.
1109 --------------------------------------------------------------------------------
1111 """
1112 return _simulator.simulator_reset(self)
1115 def setbandpass(self, *args, **kwargs):
1116 """
1117 setbandpass(self, _mode, _table, _interval, _amplitude) -> bool
1121 Summary:
1122 Set the bandpasses
1124 Description:
1127 Set the level of bandpass errors. The error distributions are normal, mean
1128 zero, with the variances as specified. (Not yet implemented).
1131 Input Parameters:
1132 mode Mode of operation. String: 'calculate'|'table'
1133 table Name of table
1134 interval Coherence interval e.g. '1h'
1135 amplitude Variances errors in amplitude and phase
1137 --------------------------------------------------------------------------------
1139 """
1140 return _simulator.simulator_setbandpass(self, *args, **kwargs)
1143 def setapply(self, *args, **kwargs):
1144 """
1145 setapply(self, _table, _type, _t, _field, _interp, _calwt, _spwmap, _opacity) -> bool
1149 Summary:
1150 Arrange for corruption by existing cal tables
1152 Description:
1155 Arrange for corruption by existing cal tables, in a manner
1156 exactly analogous to calibrater.setapply.
1159 Input Parameters:
1160 table Calibration table name
1161 type Component type
1162 t Interpolation interval (seconds)
1163 field Select on field
1164 interp Interpolation type (in time)
1165 calwt Calibrate weights?
1166 spwmap Spectral windows to apply
1167 opacity Array-wide zenith opacity (for type='TOPAC')
1169 --------------------------------------------------------------------------------
1171 """
1172 return _simulator.simulator_setapply(self, *args, **kwargs)
1175 def setgain(self, *args, **kwargs):
1176 """
1177 setgain(self, _mode, _table, _interval, _amplitude) -> bool
1181 Summary:
1182 Set the gains
1184 Description:
1187 Set the level of gain errors. Gain drift is implemented as
1188 fractional brownian motion with rms amplitude as specified.
1189 Interval is not currently used.
1193 Input Parameters:
1194 mode Mode of operation. String: 'fbm'
1195 table Optional name of table to write
1196 interval timescale for gain variations NOT USED
1197 amplitude amplitude scale (RMS) for gain variations [real,imag] or scalar
1199 --------------------------------------------------------------------------------
1201 """
1202 return _simulator.simulator_setgain(self, *args, **kwargs)
1205 def settrop(self, *args, **kwargs):
1206 """
1207 settrop(self, _mode, _table, _pwv, _deltapwv, _beta, _windspeed, _simint) -> bool
1211 Summary:
1212 Set tropospheric gain corruptions
1214 Description:
1217 Set up for corruption by the atmosphere - attenuation and increase in
1218 noise.
1221 Input Parameters:
1222 mode Mode of operation - screen or individual antennas
1223 table Name of optional cal table to write
1224 pwv total precipitable water vapour in mm
1225 deltapwv RMS PWV fluctuations *as a fraction of PWV parameter*
1226 beta exponent of fractional brownian motion
1227 windspeed wind speed for screen type corruption (m/s)
1228 simint simulation time step interval (s)
1230 --------------------------------------------------------------------------------
1232 """
1233 return _simulator.simulator_settrop(self, *args, **kwargs)
1236 def setpointingerror(self, *args, **kwargs):
1237 """
1238 setpointingerror(self, _epjtablename, _applypointingoffsets, _dopbcorrection) -> bool
1242 Summary:
1243 Set the Pointing error
1245 Description:
1248 Set the pointing error from a calpointing table
1251 Input Parameters:
1252 epjtablename Name of a table that has E-Jones errors for Pointing
1253 applypointingoffsets Apply pointing offsets
1254 dopbcorrection apply primary beam correction
1256 --------------------------------------------------------------------------------
1258 """
1259 return _simulator.simulator_setpointingerror(self, *args, **kwargs)
1262 def setleakage(self, *args, **kwargs):
1263 """
1264 setleakage(self, _mode, _table, _amplitude, _offset) -> bool
1268 Summary:
1269 Set the polarization leakage
1271 Description:
1274 Set the level of polarization leakage between feeds.
1275 Currently, no time dependence is available.
1278 Input Parameters:
1279 mode Mode of operation. String: 'constant'
1280 table Optional name of table to write
1281 amplitude Magnitude of pol leakage [real,imag]
1282 offset Meam of pol leakage [real,imag]
1284 --------------------------------------------------------------------------------
1286 """
1287 return _simulator.simulator_setleakage(self, *args, **kwargs)
1290 def oldsetnoise(self, *args, **kwargs):
1291 """
1292 oldsetnoise(self, _mode, _table, _simplenoise, _antefficiency, _correfficiency, _spillefficiency, _tau, _trx, _tatmos, _tcmb) -> bool
1296 Summary:
1297 Set the noise level fixed sigma (mode=simplenoise) or Brown's equation (mode=calculate) OBSOLETE VERSION
1299 Description:
1302 Set various system parameters from which the thermal (ie, random
1303 additive) noise level will be calculated.
1305 For mode=simplenoise, one specifies the standard deviation for the
1306 noise to be added to real and imaginary parts of the visibility.
1308 For mode=calculate, the noise will vary with dish diameter,
1309 antenna efficiency, system temperature, opacity, sky temperature,
1310 etc. The noise will increase with the airmass if tau is greater
1311 than zero. The noise is calculated according to the Brown
1312 Equation (ie, R.L. Brown's calculation of MMA sensitivity,
1313 3Oct95):
1315 ``dS = 4*sqrt(2) *( T_rx*exp(-tau_atm) +
1316 T_atm*( exp(tau_atm) - epsilon_l + T_cmb) )
1317 *epsilon_q *epsilon_a *pi *D^2 *sqrt(dnu*dt)``
1320 Input Parameters:
1321 mode Mode of operation. String: 'simplenoise'|'calculate'
1322 table Name of noise table - not currently implemented
1323 simplenoise Level of noise (if mode=simplenoise)
1324 antefficiency antenna efficiency
1325 correfficiency Correlation efficiency
1326 spillefficiency Forward spillover efficiency
1327 tau Atmospheric Opacity
1328 trx Receiver temp (ie, all non-atmospheric Tsys contributions) [K]
1329 tatmos (Physical, not Brightness) Temperature of atmosphere [K]
1330 tcmb Temperature of cosmic microwave background [K]
1332 --------------------------------------------------------------------------------
1334 """
1335 return _simulator.simulator_oldsetnoise(self, *args, **kwargs)
1338 def setnoise(self, *args, **kwargs):
1339 """
1340 setnoise(self, _mode, _table, _simplenoise, _pground, _relhum, _altitude, _waterheight, _pwv, _tatmos, _tau, _antefficiency, _spillefficiency, _correfficiency, _trx, _tground, _tcmb, _OTF, _senscoeff, _rxtype) -> bool
1344 Summary:
1345 Set the noise level fixed sigma (mode=simplenoise) or Brown's equation using the ATM model for frequency-dependent atmospheric opacity (mode=tsys-atm) or Brown's equation, manually specifying the zenith opacity (constant across the band) and atmospheric temperature (mode=tsys-manual)
1347 Description:
1350 Set various system parameters from which the thermal (ie, random
1351 additive) noise level will be calculated.
1353 For mode=simplenoise, one specifies the standard deviation 'sigma'
1354 for the noise to be added to real and imaginary parts of the visibility.
1355 The noise in amplitude per visibility is approximately 'sigma' although
1356 it is not Gaussian (see Thompson, Moran, and Swenson fig. 6.9)
1357 and the point source noise in a Stokes I image will approximately be
1358 sigma/sqrt(n_pol * n_baselines * n_integrations * n_chan),
1359 where n_pol are the number of polarizations in the MS (typically 2),
1360 and n_integrations are the number of correlator integration times
1361 in the MS (~ track time / int. time)
1363 For mode=tsys-atm or tsys-manual, the noise will vary with dish
1364 diameter, antenna efficiency, system temperature, opacity, sky
1365 temperature, etc. The noise will increase with the airmass if tau
1366 is greater than zero. The noise is calculated according to the
1367 Brown Equation (ie, R.L. Brown's calculation of MMA sensitivity,
1368 3Oct95):
1370 ``dS = 4*sqrt(2) *( T_rx*exp(-tau_atm) +
1371 T_atm*( exp(tau_atm) - epsilon_l + T_cmb) )
1372 *epsilon_q *epsilon_a *pi *D^2 *sqrt(dnu*dt)``
1374 For mode=tsys-atm, the sky brightness temperature is calculated
1375 using an atmospheric model created for the user-input PWV. For
1376 mode=tsys-manual, the user specifies the sky brightness temperature
1377 manually.
1380 Input Parameters:
1381 mode Mode of operation.
1382 table Name of optional cal table to write (if OTF=False)
1383 simplenoise Level of noise if not calculated by amt
1384 pground Ground pressure for ATM model (if tsys-atm)
1385 relhum ground relative humidity for ATM model (if tsys-atm)
1386 altitude site altitude for ATM model (if tsys-atm)
1387 waterheight Height of water layer for ATM model (if tsys-atm)
1388 pwv Precipitable Water Vapor ATM model (if tsys-atm)
1389 tatmos Temperature of atmosphere [K] (if tsys-manual)
1390 tau Zenith Atmospheric Opacity (if tsys-manual)
1391 antefficiency Antenna efficiency
1392 spillefficiency Forward spillover efficiency
1393 correfficiency Correlation efficiency
1394 trx Receiver temp (ie, all non-atmospheric Tsys contributions) [K]
1395 tground Temperature of ground/spill [K]
1396 tcmb Temperature of cosmic microwave background [K]
1397 OTF calculate noise on-the-fly (WARNING: only experts with high-RAM machines should use False)
1398 senscoeff sensitivity constant (1./sqrt(2) for interferometer [default]; 1. for total power)
1399 rxtype Receiver type; 0=2SB, 1=DSB e.g. ALMA B9
1401 --------------------------------------------------------------------------------
1403 """
1404 return _simulator.simulator_setnoise(self, *args, **kwargs)
1407 def setpa(self, *args, **kwargs):
1408 """
1409 setpa(self, _mode, _table, _interval) -> bool
1413 Summary:
1414 Corrupt phase by the parallactic angle
1416 Description:
1419 Corrupt phase by the parallactic angle
1422 Input Parameters:
1423 mode Mode of operation. String: 'calculate'|'table'
1424 table Name of table
1425 interval Interval for parallactic angle application, e.g. '10s'
1427 --------------------------------------------------------------------------------
1429 """
1430 return _simulator.simulator_setpa(self, *args, **kwargs)
1433 def setseed(self, *args, **kwargs):
1434 """
1435 setseed(self, _seed) -> bool
1439 Summary:
1440 Set the seed for the random number generator
1442 Description:
1448 Input Parameters:
1449 seed Seed
1451 --------------------------------------------------------------------------------
1453 """
1454 return _simulator.simulator_setseed(self, *args, **kwargs)
1456 __swig_destroy__ = _simulator.delete_simulator
1457 __del__ = lambda self: None
1458simulator_swigregister = _simulator.simulator_swigregister
1459simulator_swigregister(simulator)
1461# This file is compatible with both classic and new-style classes.