TimeOnSource

From CASA Guides
Revision as of 16:10, 11 July 2013 by Thunter (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Return to Analysis Utilities

It is useful to know how much time you spent integrating on source, not including the atmospheric calibration, pointing calibration and sideband ratio calibration. This function computes this value for all fields or each specified field. Flagging is ignored. It then searches for the inter-subscan latency, corrects for it, and prints revised values. It returns an extensive dictionary which includes an item ('minutes_on_science') for the total time spent on science targets, i.e. those scans with intent = OBSERVE_TARGET. It also computes the time spent integrating on source as a percentage of the total elapsed (clock) time of the ms. For convenience, timeOnSource and TimeOnSource are synonyms.

Note: The inter-subscan latency is primarily an ALMA issue, and the calculation used here may not be correct for other telescopes.

# In CASA
au.timeOnSource(help=True)
Usage: timeOnSource(ms,field='',includeLatency=False,verbose=True,help=False,vm='')
  Returns a list of durations (in sec) on the fields specified, attempting
  to detect and account for inter-subscan latency, unless includeLatency=T
  in which case it will return the total time from start to end of scan.
  Fields can be specified by a single name or ID, or a list of IDs: '2,3,4'.
  To speed things up, a ValueMapping instance can be passed in through vm."

Examples

Here is an example of running it with minimal output to the screen.

# In CASA
mydict = au.timeOnSource('X3c1.ms',verbose=F)
Ignoring spectral window [0, 25, 26, 27, 28, 29, 30, 31, 32, 33] because it is WVR related
OBSERVE_TARGET scans =  [9, 13, 18, 22, 27, 31, 36]
Clock time = 101.80 min, Total time = 71.3 min,  science time = 48.4 min
Latency removed: Total time = 60.0 min,   science time = 40.1 min

Here is an example of running it with full output to the screen:

# In CASA
mydict = au.timeOnSource('X3c1.ms')
Running ValueMapping... (this may take a minute)
Ignoring spectral window [0, 25, 26, 27, 28, 29, 30, 31, 32, 33] because it is WVR related
Non-CalAtmosphere, Non-CalPointing, Non-CalSideband scans:
Total time on scan (including inter-subscan latency):
Source  0 = Field  0 = 3c279: 65.7 sec = 1.1 min (1 scan: [5], 2 subscans)
Source  1 = Field  1 = Titan: 66.8 sec = 1.1 min (1 scan: [4], 2 subscans)
Source  2 = Field  2 = TW Hya: 2903.0 sec = 48.4 min (7 scans: [9, 13, 18, 22, 27, 31, 36], 80 subscans)
Source  3 = Field  3 = J1147-382=QSO: 262.7 sec = 4.4 min (4 scans: [8, 16, 25, 34], 8 subscans)
Source  4 = Field  4 = J1037-295=QSO: 981.5 sec = 16.4 min (7 scans: [11, 15, 20, 24, 29, 33, 38], 28 subscans)
OBSERVE_TARGET scans =  [9, 13, 18, 22, 27, 31, 36]
Clock time = 101.80 min, Total time = 71.3 min,  science time = 48.4 min

My attempt to detect and account for inter-subscan latency:
Source  0 = Field  0 = 3c279: 58.7 sec = 1.0 min (1 scan: [5], 2 subscans)
Source  1 = Field  1 = Titan: 59.9 sec = 1.0 min (1 scan: [4], 2 subscans)
Source  2 = Field  2 = TW Hya: 2407.2 sec = 40.1 min (7 scans: [9, 13, 18, 22, 27, 31, 36], 80 subscans)
Source  3 = Field  3 = J1147-382=QSO: 234.9 sec = 3.9 min (4 scans: [8, 16, 25, 34], 8 subscans)
Source  4 = Field  4 = J1037-295=QSO: 839.2 sec = 14.0 min (7 scans: [11, 15, 20, 24, 29, 33, 38], 28 subscans)
Latency removed: Total time = 60.0 min,   science time = 40.1 min

Here is the dictionary returned:

{0: {'field_ids': [0],
     'minutes_on_source': 0.97860000928242996,
     'minutes_on_source_with_latency': 1.0944000085194905,
     'num_of_fields': 1,
     'num_of_scans': 1,
     'num_of_subscans': [2],
     'scans': [5],
     'source_name': '3c279'},
 1: {'field_ids': [1],
     'minutes_on_source': 0.99779998461405439,
     'minutes_on_source_with_latency': 1.1135999997456869,
     'num_of_fields': 1,
     'num_of_scans': 1,
     'num_of_subscans': [2],
     'scans': [4],
     'source_name': 'Titan'},
 2: {'field_ids': [2],
     'minutes_on_source': 40.119599183400474,
     'minutes_on_source_with_latency': 48.384000015258792,
     'num_of_fields': 1,
     'num_of_scans': 7,
     'num_of_subscans': [1, 16, 13, 16, 13, 16, 5],
     'scans': [9, 13, 18, 22, 27, 31, 36],
     'source_name': 'TW Hya'},
 3: {'field_ids': [3],
     'minutes_on_source': 3.9143999894460042,
     'minutes_on_source_with_latency': 4.3776000022888182,
     'num_of_fields': 1,
     'num_of_scans': 4,
     'num_of_subscans': [2, 2, 2, 2],
     'scans': [8, 16, 25, 34],
     'source_name': 'J1147-382=QSO'},
 4: {'field_ids': [4],
     'minutes_on_source': 13.985999981562296,
     'minutes_on_source_with_latency': 16.358400026957195,
     'num_of_fields': 1,
     'num_of_scans': 7,
     'num_of_subscans': [4, 4, 4, 4, 4, 4, 4],
     'scans': [11, 15, 20, 24, 29, 33, 38],
     'source_name': 'J1037-295=QSO'},
 'clock_time': 101.80159999290481,
 'minutes_on_science': 40.119599183400474,
 'minutes_on_science_with_latency': 48.384000015258792,
 'num_of_sources': 5,
 'percentage_time_on_science': 39.409595906347896,
 'source_ids': [0, 1, 2, 3, 4]}