getALMAFluxForMS

Return to directory of Todd's CASA extensions

Runs getALMAFlux for all fields in a measurement set. Uses the date of the measurement set in the calls to searchFlux. It looks first for dates in the past, and then for dates in the future (up to the number of days since the most recent past measurement). It uses the closest observation, and returns a dictionary of results keyed by field name. It also prints out a suitable setjy command using the spectral index and flux density at a reference frequency. If not present, it appends ".split" onto the vis to avoid mistakes when pasting into the script generator.

Usage:

au.getALMAFluxForMS(vis, field=None, frequency=None, verbose=False, 
        searchAdjacentNames=False, server='', dayWindow=0, showplot=False, 
        plotfile='', intent='CALIBRATE', spw='', silent=False, lowbandFlux=None, 
        highbandFlux=None,  lowbandFrequency=None, highbandFrequency=None,
        lowbandUncertainty=None, highbandUncertainty=None,
        lowbandDate=None, highbandDate=None, referenceFrequency=None,
        referenceFlux=Non)
Inputs:
  • frequency: frequency to use (default=first TDM or FDM spw), floating point value in Hz or GHz, or string with units at end ('GHz/MHz/kHz/Hz')
  • field: list of field IDs or field names (instead of all of them, which is the default)
  • searchAdjacentNames: pass this option to searchFlux
  • server: pass this string to au.searchFlux (name of xmlrpc database URL) can be 'internal', 'external' or full URL
  • dayWindow: if non-negative, then process all measurements within this many days of the first measurement found (per band)
  • showplot: if True, plot the data with errorbars and model
  • plotfile: if specified, and showplot=True, then produce a png file
  • intent: if field is not specified, use sources with this intent
  • spw: if specified, then restrict the mean frequency determination to that single spw (or a list)

The following parameters allow you to use a recent measurement in one band along with the best spectral index derived from the catalog to compute the flux density
  • referenceFrequency: use catalog to get spectral index, then interpolate from this freq
  • referenceFlux: use catalog to get spectral index, then interpolate from this measurement

The following parameters allow you to use a different measurement from what is in the catalog:
  • lowbandFlux: recently measured value to use instead of the database value (Jy)
  • highbandFlux: recently measured value to use instead of the database value (Jy)
  • lowbandFrequency: frequency of lowbandFlux (GHz or Hz)
  • highbandFrequency: frequency of highbandFlux (GHz or Hz)
  • lowbandUncertainty: uncertainty of lowbandFlux (Jy)
  • highbandUncertainty: uncertainty of highbandFlux (Jy)
  • lowbandDate: date for lowbandFlux ('YYYYMMDD')
  • highbandDate: date for highbandFlux ('YYYYMMDD')

Returns:
  • a dictionary, keyed by field name, with each value being a dictionary containing six fields: 'frequency', 'fluxDensity', and 'fluxDensityUncertainty', 'spectralIndex', 'spectralIndexUncertainty', and 'meanAge'.

Example:

 
CASA <2>: au.getALMAFluxForMS('uid___A002_X916b15_X1716.ms')
Working on field 1 of 3: 0 = J0825+0309
Using Band 3 measurement: 1.740 +- 0.110 (age=298 days) 103.5 GHz
Using Band 3 measurement: 1.840 +- 0.140 (age=298 days) 91.5 GHz
Using Band 7 measurement: 0.500 +- 0.040 (age=1660 days) 352.7 GHz
Median Monte-Carlo result for 103.490000 = 1.694802 +- 0.182613 (scaled MAD = 0.182334)
Error-weighted fit: Slope: -0.990+-0.099  Flux D. @ 103.490GHz: 1.691+-0.183 Jy
   Un-weighted fit: Slope: -0.986         Flux D. @ 103.490GHz: 1.681 Jy
Median Monte-Carlo result for 236.375000 = 0.747387 +- 0.098746 (scaled MAD = 0.096717)
Result using spectral index of -0.990 for 236.375000 GHz = 0.768001 +- 0.098746 Jy
WARNING: the mean time separation between the target date and the flux monitoring observations is 752 days
WARNING: the time separation between the Band 3 and 7 measurements is 1362 days
Working on field 2 of 3: 1 = J0854+2006
Using Band 3 measurement: 4.900 +- 0.150 (age=24 days) 103.5 GHz
Using Band 3 measurement: 5.200 +- 0.130 (age=24 days) 91.5 GHz
Using Band 7 measurement: 3.060 +- 0.300 (age=24 days) 343.5 GHz
Median Monte-Carlo result for 103.490000 = 4.927136 +- 0.217424 (scaled MAD = 0.217067)
Error-weighted fit: Slope: -0.402+-0.009  Flux D. @ 103.490GHz: 4.930+-0.217 Jy
   Un-weighted fit: Slope: -0.397         Flux D. @ 103.490GHz: 4.927 Jy
Median Monte-Carlo result for 236.375000 = 3.530919 +- 0.562654 (scaled MAD = 0.545927)
Result using spectral index of -0.402 for 236.375000 GHz = 3.514612 +- 0.562654 Jy
WARNING: the mean time separation between the target date and the flux monitoring observations is 24 days
Working on field 3 of 3: 2 = J0914+0245
Using Band 3 measurement: 0.380 +- 0.020 (age=298 days) 103.5 GHz
Using Band 3 measurement: 0.420 +- 0.030 (age=298 days) 91.5 GHz
Using Band 7 measurement: 0.240 +- 0.030 (age=1077 days) 343.2 GHz
Median Monte-Carlo result for 103.490000 = 0.387283 +- 0.037003 (scaled MAD = 0.036650)
Error-weighted fit: Slope: -0.407+-0.056  Flux D. @ 103.490GHz: 0.387+-0.037 Jy
   Un-weighted fit: Slope: -0.407         Flux D. @ 103.490GHz: 0.390 Jy
Median Monte-Carlo result for 236.375000 = 0.276413 +- 0.057592 (scaled MAD = 0.054892)
Result using spectral index of -0.407 for 236.375000 GHz = 0.271509 +- 0.057592 Jy
WARNING: the mean time separation between the target date and the flux monitoring observations is 557 days
WARNING: the time separation between the Band 3 and 7 measurements is 779 days
setjy('uid___A002_X916b15_X1716.ms.split',
      standard='manual', field='J0825+0309', spix=-0.990199,
      reffreq='236.375000GHz', fluxdensity=[0.768001,0,0,0])
setjy('uid___A002_X916b15_X1716.ms.split',
      standard='manual', field='J0914+0245', spix=-0.407019,
      reffreq='236.375000GHz', fluxdensity=[0.271509,0,0,0])
setjy('uid___A002_X916b15_X1716.ms.split',
      standard='manual', field='J0854+2006', spix=-0.402335,
      reffreq='236.375000GHz', fluxdensity=[3.514612,0,0,0])
  Out[2]: 
{'J0825+0309': {'fluxDensity': 0.76800081868836778,
                'fluxDensityUncertainty': 0.098745509964083267,
                'frequency': 236375000000.052,
                'meanAge': 752.0,
                'spectralIndex': -0.99019916729004287,
                'spectralIndexUncertainty': 0.098700114137257045},
 'J0854+2006': {'fluxDensity': 3.5146122430263675,
                'fluxDensityUncertainty': 0.56265351909486616,
                'frequency': 236375000000.052,
                'meanAge': 24.0,
                'spectralIndex': -0.40233452230870281,
                'spectralIndexUncertainty': 0.0093292796998320892},
 'J0914+0245': {'fluxDensity': 0.27150924108129382,
                'fluxDensityUncertainty': 0.057592412051347165,
                'frequency': 236375000000.052,
                'meanAge': 557.66666666666663,
                'spectralIndex': -0.40701894814064643,
                'spectralIndexUncertainty': 0.055979438505616506}}

-- ToddHunter - 2013-10-21
Topic revision: r12 - 2014-11-06, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback