getTsysFromSysCal

Return to directory of Todd's CASA extensions

This function reads the Tsys values from SysCal.xml table of the specified ASDM into a dictionary keyed by antenna ID, spw, scan, and pol (0 or 1). Note: the order of parameters was changed on 2014-09-15. See also getMedianTsysForChannel.

See also replaceTsysScanFromSQLD.

Usage:

au.getTsysFromSysCal(asdm, sqld=None, median=False, verbose=True, channel=None)
  • asdm: the path to the original ASDM (containing Scan.xml and SpectralWindow.xml).
  • sqld: the path to the SysCal.xml table (or its parent directory, which could simply be the path to an ASDM). If an sqld path is not specified, then assume it is the one inside the ASDM. Note: The reason you might need to specify both the path to the SysCal.xml table and the ASDM is because the original usage of this function was to read values from an independent SysCal.xml file regenerated by offline casapy-telcal.
  • median: if True, then compute and return a dictionary containing only the medians on a per-spw/antenna/scan/pol and global basis
  • channel: use the value only from the one specified channel (typically 0..127)

Examples:

1. Retrieve a full dictionary of Tsys values:
CASA <16>: mydict=au.getTsysFromSysCal('uid___A002_X6de43a_X8d','uid___A002_X6de43a_X8d')
  Found  2  scans in Scan.xml
  Found  44  Tsys rows in SysCal.xml

2. Learn which spws have Tsys measurements for antenna 0: CASA <17>: mydict[0].keys() Out[17]: [1, 3, 5, 7]

3. Learn the baseband number (on a scale of 1..4) corresponding to spw 7:
CASA <38>: mydict[3][7]['baseband']
  Out[38]: 4

4. Get the median Tsys for antenna 3, spw 9, scan 10, pol 0:
CASA <16>: au.getTsysFromSysCal('../rawdata/uid___A002_X856bb8_X79a7',median=True)[3][9][10][0]['median']
  Found  19  scans in Scan.xml
  Found  160  Tsys rows in SysCal.xml
  Out[16]: 81.684662008590749

5. Get the median over the whole dataset:
CASA <8>: au.getTsysFromSysCal('../rawdata/uid___A002_X856bb8_X79a7',median=True)['median']
  Found  19  scans in Scan.xml
  Found  160  Tsys rows in SysCal.xml
  Out[8]: 54.293945332045887

6. Get a dictionary of all the medians:
CASA <3>: au.getTsysFromSysCal('../rawdata/uid___A002_X856bb8_X79a7',median=True)          
  Found  19  scans in Scan.xml
  Found  160  Tsys rows in SysCal.xml
  Out[3]: 
{0: {9: {3: {0: {'median': 74.953240723715695},
             1: {'median': 76.036418788098672},
             'median': 75.407619743898039},
         6: {0: {'median': 66.430245332946683},
             1: {'median': 67.921025237198791},
             'median': 66.97763623961734},
         10: {0: {'median': 70.420594229044895},
              1: {'median': 71.594766853603886},
              'median': 70.856570820497751},
         15: {0: {'median': 68.11998681748824},
              1: {'median': 69.654347389666867},
              'median': 68.69858173990724},
         'median': 69.576999524823719},
     11: {3: {0: {'median': 60.939238905152706},
              1: {'median': 57.827470665761503},
              'median': 59.284247738051235},
          6: {0: {'median': 55.935010339429184},
              1: {'median': 52.543290718119685},
              'median': 54.270603393148811},
          10: {0: {'median': 58.504803314362988},
               1: {'median': 54.833492042531162},
               'median': 56.691716510698157},
          15: {0: {'median': 56.861512603355237},
               1: {'median': 53.713396805673625},
               'median': 55.278713824201489},
          'median': 56.680174443319942},
     13: {3: {0: {'median': 43.855012948464555},
              1: {'median': 40.453357557680533},
              'median': 41.353300505919371},
          6: {0: {'median': 41.800865072911989},
              1: {'median': 38.132188599768057},
              'median': 39.11519536519188},
          10: {0: {'median': 43.03602285665805},
               1: {'median': 39.078747230877028},
               'median': 40.101930509512343},
          15: {0: {'median': 42.155383175577001},
               1: {'median': 38.666046233211532},
               'median': 39.587639438508859},
          'median': 40.468493871106212},
     15: {3: {0: {'median': 43.98173217856889},
              1: {'median': 43.526584840532841},
              'median': 43.671414829959041},
          6: {0: {'median': 42.046405718086632},
              1: {'median': 40.946634541664743},
              'median': 41.243495881407092},
          10: {0: {'median': 42.992704146608837},
               1: {'median': 41.947759079386394},
               'median': 42.231965746035868},
          15: {0: {'median': 42.160237692188289},
               1: {'median': 41.55436645663643},
               'median': 41.712725938800901},
          'median': 42.324921678307433},
     'median': 50.294158344433932},
 1: {9: {3: {0: {'median': 96.778900744992754},
             1: {'median': 83.409030637799333},
             'median': 85.810462655191174},
         6: {0: {'median': 89.100865190170083},
             1: {'median': 74.371281921646556},
             'median': 76.676601599813196},
         10: {0: {'median': 92.571661646445335},
              1: {'median': 78.448708242116595},
              'median': 80.759916128648882},
         15: {0: {'median': 89.457927700645072},
              1: {'median': 75.310583893296155},
              'median': 77.586983731043418},
         'median': 80.548582680971094},
     11: {3: {0: {'median': 61.201690616641166},
              1: {'median': 59.356837713710185},
              'median': 60.298318465164485},
          6: {0: {'median': 56.352143651926546},
              1: {'median': 53.501919531805648},
              'median': 55.159395821841962},
          10: {0: {'median': 58.430384898926192},
               1: {'median': 56.25586345876804},
               'median': 57.40757055934413},
          15: {0: {'median': 56.46139665726875},
               1: {'median': 54.167160105098752},
               'median': 55.364534065098468},
          'median': 57.272367424135254},
     13: {3: {0: {'median': 49.164653249543207},
              1: {'median': 43.487199678699767},
              'median': 46.336861941375815},
          6: {0: {'median': 45.250501567132005},
              1: {'median': 40.387348844811797},
              'median': 42.958219066125849},
          10: {0: {'median': 46.595591590843298},
               1: {'median': 41.646161730513271},
               'median': 44.073598510984354},
          15: {0: {'median': 45.382632599142298},
               1: {'median': 40.537307967447852},
               'median': 42.964596394105314},
          'median': 43.990820847551035},
     15: {3: {0: {'median': 47.914773327085143},
              1: {'median': 46.091448656539811},
              'median': 46.877638636187612},
          6: {0: {'median': 44.387485620107057},
              1: {'median': 42.798021821481832},
              'median': 43.484120312120588},
          10: {0: {'median': 45.490202692469438},
               1: {'median': 44.047715803462658},
               'median': 44.677726508357026},
          15: {0: {'median': 44.49313253722724},
               1: {'median': 42.973975517334708},
               'median': 43.649677415105572},
          'median': 44.681230368763117},
     'median': 51.846219496447972},
 2: {9: {3: {0: {'median': 95.534822894116445},
             1: {'median': 90.186572972534805},
             'median': 91.782595665482148},
         6: {0: {'median': 82.258695785468944},
             1: {'median': 81.377565615975897},
             'median': 81.889984527861742},
         10: {0: {'median': 91.864372790214546},
              1: {'median': 85.917873572443511},
              'median': 87.700276142639922},
         15: {0: {'median': 86.161971385248876},
              1: {'median': 83.656813053780098},
              'median': 84.750777569369021},
         'median': 85.899825205030567},
     11: {3: {0: {'median': 60.541516524567271},
              1: {'median': 66.328670254792456},
              'median': 63.627428075886122},
          6: {0: {'median': 55.3370738665758},
              1: {'median': 60.975414656024583},
              'median': 58.136109282368416},
          10: {0: {'median': 58.030357252522919},
               1: {'median': 63.604891972677009},
               'median': 60.884236041667876},
          15: {0: {'median': 56.977248259006807},
               1: {'median': 62.256852959955893},
               'median': 59.703783014465174},
          'median': 60.653958941416867},
     13: {3: {0: {'median': 51.332777423303455},
              1: {'median': 49.675554458616652},
              'median': 49.974678496225344},
          6: {0: {'median': 45.35522861502335},
              1: {'median': 47.167416483460229},
              'median': 46.509860623336181},
          10: {0: {'median': 51.32042243508792},
               1: {'median': 48.387375754516441},
               'median': 48.861170066399652},
          15: {0: {'median': 47.122925881196011},
               1: {'median': 47.836040782163749},
               'median': 47.592983130253216},
          'median': 48.204922686872933},
     15: {3: {0: {'median': 46.298062722196306},
              1: {'median': 50.675667845319808},
              'median': 49.734762262742507},
          6: {0: {'median': 43.658602858842798},
              1: {'median': 48.081952865790775},
              'median': 47.252933404659423},
          10: {0: {'median': 45.043080772494079},
               1: {'median': 49.263001195209441},
               'median': 48.388205505769477},
          15: {0: {'median': 44.434268501873781},
               1: {'median': 48.706126193405645},
               'median': 47.842623570348763},
          'median': 47.800731249793145},
     'median': 55.014201811037971},
 3: {9: {3: {0: {'median': 86.07222502056689},
             1: {'median': 85.446100124317752},
             'median': 85.795785245248936},
         6: {0: {'median': 80.76811069223433},
             1: {'median': 75.697139478166235},
             'median': 76.013219901246515},
         10: {0: {'median': 81.684662008590749},
              1: {'median': 80.630437616729978},
              'median': 80.806789538863285},
         15: {0: {'median': 79.700886134725465},
              1: {'median': 78.429132509366923},
              'median': 78.559234050561685},
         'median': 79.687205877113286},
     11: {3: {0: {'median': 66.589634858427132},
              1: {'median': 67.080104826673562},
              'median': 66.916007871654188},
          6: {0: {'median': 63.222402823956124},
              1: {'median': 60.648287731769443},
              'median': 61.637986079397024},
          10: {0: {'median': 63.686701041328774},
               1: {'median': 64.010199056436946},
               'median': 63.998715847411013},
          15: {0: {'median': 62.404085426350335},
               1: {'median': 62.485828388903343},
               'median': 62.457653364648991},
          'median': 63.781759348326801},
     13: {3: {0: {'median': 51.521282068365068},
              1: {'median': 51.916324771152873},
              'median': 51.78656039749896},
          6: {0: {'median': 46.684279983808963},
              1: {'median': 49.138828439262817},
              'median': 47.970073598286447},
          10: {0: {'median': 50.141772467924376},
               1: {'median': 50.603730172513963},
               'median': 50.447165437411215},
          15: {0: {'median': 49.747616143588758},
               1: {'median': 50.057560199028742},
               'median': 49.918268128435997},
          'median': 50.200649970774904},
     15: {3: {0: {'median': 52.09895449129435},
              1: {'median': 54.181194286139728},
              'median': 53.534555690050254},
          6: {0: {'median': 46.839028607426812},
              1: {'median': 51.405456411092359},
              'median': 49.861425784617239},
          10: {0: {'median': 50.693100241061323},
               1: {'median': 52.803029730617709},
               'median': 52.142389546872025},
          15: {0: {'median': 50.191837871465289},
               1: {'median': 52.205579179463811},
               'median': 51.514613102263596},
          'median': 51.701846433811482},
     'median': 58.903720894692171},
 4: {9: {3: {0: {'median': 86.306312848340895},
             1: {'median': 83.699414848263345},
             'median': 84.921622130164224},
         6: {0: {'median': 76.42241842900259},
             1: {'median': 74.089953913372781},
             'median': 75.133903197030634},
         10: {0: {'median': 80.469236283371401},
              1: {'median': 77.56322050211331},
              'median': 78.807183415685444},
         15: {0: {'median': 78.251056769162574},
              1: {'median': 75.979516532718378},
              'median': 76.990047060230268},
         'median': 78.338961098464949},
     11: {3: {0: {'median': 64.100480222895953},
              1: {'median': 64.945585385821644},
              'median': 64.279619502275708},
          6: {0: {'median': 58.095446127734299},
              1: {'median': 59.026964701038182},
              'median': 58.293637602909527},
          10: {0: {'median': 60.202066602861379},
               1: {'median': 61.219430830985971},
               'median': 60.365072610252909},
          15: {0: {'median': 58.921252240658433},
               1: {'median': 59.744143718155328},
               'median': 59.058684657583726},
          'median': 60.888974898909687},
     13: {3: {0: {'median': 48.126645439277553},
              1: {'median': 44.945643480186796},
              'median': 46.343312008175459},
          6: {0: {'median': 45.273692794587518},
              1: {'median': 41.548372360081459},
              'median': 43.15284801809851},
          10: {0: {'median': 46.208394640153564},
               1: {'median': 42.605971078593065},
               'median': 44.129321588192632},
          15: {0: {'median': 45.763471288847882},
               1: {'median': 42.034383063682554},
               'median': 43.671589510156025},
          'median': 44.244765498392837},
     15: {3: {0: {'median': 45.988748482169029},
              1: {'median': 44.944883482224611},
              'median': 45.894839273276055},
          6: {0: {'median': 42.940820934770656},
              1: {'median': 41.729378647692904},
              'median': 42.848987539972867},
          10: {0: {'median': 43.764238229077989},
               1: {'median': 42.734151236213101},
               'median': 43.677330464052737},
          15: {0: {'median': 43.207877754889665},
               1: {'median': 42.031028518847364},
               'median': 43.091736681642544},
          'median': 44.363476476669732},
     'median': 56.130516661830853},
 5: {9: {3: {0: {'median': 99.908645036142502},
             1: {'median': 85.657628198436626},
             'median': 91.388221448495045},
         6: {0: {'median': 92.746516207250608},
             1: {'median': 75.593642769434467},
             'median': 83.421151892446545},
         10: {0: {'median': 96.088428809225064},
              1: {'median': 80.199522343644617},
              'median': 86.983775389426512},
         15: {0: {'median': 94.054857538510674},
              1: {'median': 77.954539018349848},
              'median': 85.218829406364819},
         'median': 87.841705882899277},
     11: {3: {0: {'median': 63.889119810721546},
              1: {'median': 61.274607867798082},
              'median': 62.763424423512205},
          6: {0: {'median': 58.320710751333564},
              1: {'median': 55.978737017827711},
              'median': 57.349161157768549},
          10: {0: {'median': 60.959973284707829},
               1: {'median': 58.330171126194585},
               'median': 59.872717277824322},
          15: {0: {'median': 59.696535522982529},
               1: {'median': 57.144759339824212},
               'median': 58.652002805978512},
          'median': 60.1448011756639},
     13: {3: {0: {'median': 46.552188230421692},
              1: {'median': 44.205865351749026},
              'median': 45.496095806821671},
          6: {0: {'median': 43.925899920069639},
              1: {'median': 41.683257373564444},
              'median': 42.976931938856481},
          10: {0: {'median': 45.104979448976138},
               1: {'median': 42.924559733207552},
               'median': 44.173877764760334},
          15: {0: {'median': 44.509899241793249},
               1: {'median': 42.209967226523247},
               'median': 43.483128547002565},
          'median': 43.968649246226477},
     15: {3: {0: {'median': 48.906672554090633},
              1: {'median': 47.233959295282801},
              'median': 48.08577118931025},
          6: {0: {'median': 46.024799577405147},
              1: {'median': 44.547454674441752},
              'median': 45.289214013638244},
          10: {0: {'median': 47.383086477743532},
               1: {'median': 45.823005620302638},
               'median': 46.601646636514218},
          15: {0: {'median': 46.743953840738499},
               1: {'median': 45.088847382023332},
               'median': 45.881108175164115},
          'median': 46.327754296257595},
     'median': 54.13866591873947},
 6: {9: {3: {0: {'median': 84.621891633553105},
             1: {'median': 82.020757192815239},
             'median': 83.414697504048547},
         6: {0: {'median': 75.665732039671298},
             1: {'median': 73.125423757538442},
             'median': 74.492825623987642},
         10: {0: {'median': 79.613768385884228},
              1: {'median': 77.131235791742625},
              'median': 78.543240765505544},
         15: {0: {'median': 77.267038053438455},
              1: {'median': 75.310265637829758},
              'median': 76.44083279313368},
         'median': 77.410193075812003},
     11: {3: {0: {'median': 65.627517509874664},
              1: {'median': 65.478232001455822},
              'median': 65.520599229360755},
          6: {0: {'median': 59.560409427214452},
              1: {'median': 59.362096918918901},
              'median': 59.401524713298599},
          10: {0: {'median': 62.227012646603796},
               1: {'median': 62.023390804342526},
               'median': 62.071854386067919},
          15: {0: {'median': 60.788594009836942},
               1: {'median': 60.728482422334466},
               'median': 60.750316204478473},
          'median': 62.057186503142617},
     13: {3: {0: {'median': 44.123350282322221},
              1: {'median': 28.44379430671426},
              'median': 39.291583574889387},
          6: {0: {'median': 41.334811508413893},
              1: {'median': 25.898140415739011},
              'median': 36.436705201965445},
          10: {0: {'median': 42.550340372286385},
               1: {'median': 26.842873994228356},
               'median': 37.556463298403784},
          15: {0: {'median': 42.073242468777707},
               1: {'median': 26.167912837950009},
               'median': 37.016471739320103},
          'median': 37.951379331816788},
     15: {3: {0: {'median': 47.358893166300106},
              1: {'median': 48.973611403552312},
              'median': 48.23411986553311},
          6: {0: {'median': 44.471628032258067},
              1: {'median': 46.060454421927759},
              'median': 45.302870556529065},
          10: {0: {'median': 45.721838013372682},
               1: {'median': 47.211417913626946},
               'median': 46.479446712879067},
          15: {0: {'median': 45.144298415563426},
               1: {'median': 46.520099859151813},
               'median': 45.854611943142672},
          'median': 46.606777034610701},
     'median': 55.907924225408991},
 7: {9: {3: {0: {'median': 88.272421403299006},
             1: {'median': 84.275420139554114},
             'median': 85.467755854724174},
         6: {0: {'median': 79.213978561939101},
             1: {'median': 75.411771602551454},
             'median': 77.140518977823916},
         10: {0: {'median': 83.554320590812139},
              1: {'median': 79.404554524746828},
              'median': 80.786017017406834},
         15: {0: {'median': 81.072453647045705},
              1: {'median': 77.197263066496987},
              'median': 78.810621461354344},
         'median': 79.769900555214662},
     11: {3: {0: {'median': 65.522635306675653},
              1: {'median': 61.738121611261342},
              'median': 64.480566978611847},
          6: {0: {'median': 61.218617236806324},
              1: {'median': 57.132326188329593},
              'median': 59.488918625621416},
          10: {0: {'median': 63.261329624516989},
               1: {'median': 59.226878727234457},
               'median': 61.84985241096124},
          15: {0: {'median': 62.24067598371262},
               1: {'median': 58.163039674777878},
               'median': 60.564159293250256},
          'median': 61.693469087259572},
     13: {3: {0: {'median': 53.115826429860704},
              1: {'median': 45.036337014021356},
              'median': 50.651860706775373},
          6: {0: {'median': 51.637084723266852},
              1: {'median': 42.955993782423121},
              'median': 48.986400434831822},
          10: {0: {'median': 52.378291724363763},
               1: {'median': 43.901203780711128},
               'median': 49.810427272829813},
          15: {0: {'median': 51.914112546770426},
               1: {'median': 43.350346883486417},
               'median': 49.381498909044154},
          'median': 49.379043802078229},
     15: {3: {0: {'median': 50.753437096463287},
              1: {'median': 44.1303064504867},
              'median': 48.897292965764827},
          6: {0: {'median': 48.911865781755907},
              1: {'median': 42.150915215060195},
              'median': 47.059246109015},
          10: {0: {'median': 49.774833814041934},
               1: {'median': 42.95678991682157},
               'median': 47.933817145027533},
          15: {0: {'median': 49.360156691615032},
               1: {'median': 42.439664681095451},
               'median': 47.460968844542933},
          'median': 47.719983131333684},
     'median': 56.333379282337816},
 8: {9: {3: {0: {'median': 85.861605488106022},
             1: {'median': 84.625630996088063},
             'median': 84.936108788445694},
         6: {0: {'median': 76.011952024049947},
             1: {'median': 75.595537403954523},
             'median': 75.638844789401986},
         10: {0: {'median': 80.666575563263791},
              1: {'median': 79.387487294582343},
              'median': 79.819710322152005},
         15: {0: {'median': 78.079654988128681},
              1: {'median': 76.893548510059333},
              'median': 77.2593607753508},
         'median': 78.034212716292359},
     11: {3: {0: {'median': 61.806197677285653},
              1: {'median': 64.522935803615837},
              'median': 62.568021731733836},
          6: {0: {'median': 56.733980394893919},
              1: {'median': 59.007736627283464},
              'median': 57.201670862236575},
          10: {0: {'median': 59.097785534185334},
               1: {'median': 61.512586763101766},
               'median': 59.670776969197746},
          15: {0: {'median': 57.806308429856202},
               1: {'median': 60.187278628425759},
               'median': 58.310869878054731},
          'median': 60.632114113206825},
     13: {3: {0: {'median': 43.025077863939529},
              1: {'median': 42.559367336643177},
              'median': 42.706391304068575},
          6: {0: {'median': 40.807855056474622},
              1: {'median': 40.361305369833374},
              'median': 40.49035581517883},
          10: {0: {'median': 41.802929617456599},
               1: {'median': 41.31456867901278},
               'median': 41.475126930977325},
          15: {0: {'median': 41.262814676310725},
               1: {'median': 40.785557256870874},
               'median': 40.929236934835259},
          'median': 41.479337474685806},
     15: {3: {0: {'median': 45.03656509660378},
              1: {'median': 43.925074877755179},
              'median': 44.412213180468157},
          6: {0: {'median': 42.644155056339351},
              1: {'median': 41.461349381143805},
              'median': 42.003960999068681},
          10: {0: {'median': 43.730758417815949},
               1: {'median': 42.523325438665672},
               'median': 43.044113196838438},
          15: {0: {'median': 43.1445394279257},
               1: {'median': 42.119883115153911},
               'median': 42.568764150201531},
          'median': 43.031508618699405},
     'median': 54.445745682171292},
 9: {9: {3: {0: {'median': 83.362098820606661},
             1: {'median': 78.711788413401734},
             'median': 80.520848243836241},
         6: {0: {'median': 74.678472101537523},
             1: {'median': 69.626949322113802},
             'median': 70.865347886744502},
         10: {0: {'median': 78.682739732589539},
              1: {'median': 74.027822235891023},
              'median': 75.722274426080745},
         15: {0: {'median': 76.557633199464675},
              1: {'median': 71.998180794013876},
              'median': 73.123651157797042},
         'median': 74.182589732195055},
     11: {3: {0: {'median': 62.348317849803479},
              1: {'median': 60.800442898972385},
              'median': 61.601263622520904},
          6: {0: {'median': 56.680564637220741},
              1: {'median': 55.059907055360505},
              'median': 55.837599346748561},
          10: {0: {'median': 59.377448934679812},
               1: {'median': 57.870091784754095},
               'median': 58.56698772924922},
          15: {0: {'median': 58.229861645638422},
               1: {'median': 56.570612749919839},
               'median': 57.324880930739937},
          'median': 58.596222971485588},
     13: {3: {0: {'median': 46.545576614163579},
              1: {'median': 45.315116718432989},
              'median': 45.599546278042325},
          6: {0: {'median': 43.838058693254091},
              1: {'median': 42.580929063645641},
              'median': 42.921918219830523},
          10: {0: {'median': 45.09402784285939},
               1: {'median': 43.948443067737237},
               'median': 44.207429064639278},
          15: {0: {'median': 44.806638130267189},
               1: {'median': 43.425997106659231},
               'median': 43.826113477966253},
          'median': 44.186689485954901},
     15: {3: {0: {'median': 43.385415646138213},
              1: {'median': 49.386217249094905},
              'median': 47.592146164523669},
          6: {0: {'median': 41.042582526705765},
              1: {'median': 46.403309625886621},
              'median': 44.740560947159935},
          10: {0: {'median': 41.940570094936227},
               1: {'median': 47.839771665602257},
               'median': 46.08220922674608},
          15: {0: {'median': 41.609873591839261},
               1: {'median': 47.326169974760909},
               'median': 45.507776318654848},
          'median': 45.123348533038524},
     'median': 53.427189562389387},
 'median': 54.293945332045887}

-- ToddHunter - 2014-04-09
Topic revision: r5 - 2015-04-15, 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