def UnpackTrackerPointingData(f): ''' Extracts tracker registers relevant to online and offline pointing. Calibration values (offsets and multiplicative constants) are from gcp/control/conf/spt/cal. ''' if f.type != core.G3FrameType.GcpSlow: return t = TrackerPointing() t.time = [tm for tm in f['antenna0']['tracker']['utc'][0]] t.scu_temp = numpy.asarray(f['antenna0']['scu']['temp']) t.features = core.IntVector([f['array']['frame']['features'].value]) t.encoder_off_x = numpy.asarray( [f['antenna0']['tracker']['encoder_off'][0]], dtype=numpy.double) t.encoder_off_y = numpy.asarray( [f['antenna0']['tracker']['encoder_off'][1]], dtype=numpy.double) t.tilts_x = numpy.asarray(f['antenna0']['tracker']['tilt_xy_avg'][0], dtype=numpy.double) t.tilts_y = numpy.asarray(f['antenna0']['tracker']['tilt_xy_avg'][1], dtype=numpy.double) t.refraction = numpy.asarray(f['antenna0']['tracker']['refraction'][0], dtype=numpy.double) t.horiz_mount_x = numpy.asarray(f['antenna0']['tracker']['horiz_mount'][0]) t.horiz_mount_y = numpy.asarray(f['antenna0']['tracker']['horiz_mount'][1]) t.horiz_off_x = numpy.asarray(f['antenna0']['tracker']['horiz_off'][0]) t.horiz_off_y = numpy.asarray(f['antenna0']['tracker']['horiz_off'][1]) t.linsens_avg_l1 = numpy.asarray( f['antenna0']['tracker']['linear_sensor_avg'][0]) t.linsens_avg_l2 = numpy.asarray( f['antenna0']['tracker']['linear_sensor_avg'][1]) t.linsens_avg_r1 = numpy.asarray( f['antenna0']['tracker']['linear_sensor_avg'][2]) t.linsens_avg_r2 = numpy.asarray( f['antenna0']['tracker']['linear_sensor_avg'][3]) t.telescope_temp = numpy.asarray( [f['array']['weather']['airTemperature'].value]) t.telescope_pressure = numpy.asarray( [f['array']['weather']['pressure'].value]) f['TrackerPointing'] = t p = core.G3MapVectorDouble() p['tilts'] = numpy.asarray(f['antenna0']['tracker']['tilts'], dtype=numpy.double) p['flexure'] = numpy.asarray(f['antenna0']['tracker']['flexure'], dtype=numpy.double) p['fixedCollimation'] = numpy.asarray( f['antenna0']['tracker']['fixedCollimation'], dtype=numpy.double) f['OnlinePointingModel'] = p
def UnpackTrackerData(f, rewrite_source_from_feature_bits=True): ''' Extracts tracker status information to frame into the TrackerStatus key, along with the observation processing handled by UnpackTrackerMinimal. If rewrite_source_from_feature_bits is True (the default), will try to rewrite source names if DecryptFeatureBit() has been run and either "elnod", "calibrator", or "noise" is present in the feature bit list to that value. ''' if f.type != core.G3FrameType.GcpSlow: return UnpackTrackerMinimal(f, rewrite_source_from_feature_bits) t = TrackerStatus() # List comprehensions are due to funny business with G3VectorFrameObject t.time = [tm for tm in f['antenna0']['tracker']['utc'][0]] # Measured values t.az_pos = numpy.asarray(f['antenna0']['tracker']['actual'][0]) t.el_pos = numpy.asarray(f['antenna0']['tracker']['actual'][1]) # XXX units for rates seem to be wrong. I think this is in encoder counts t.az_rate = numpy.asarray(f['antenna0']['tracker']['actual_rates'][0], dtype=float) t.el_rate = numpy.asarray(f['antenna0']['tracker']['actual_rates'][1], dtype=float) # Expected values t.az_command = numpy.asarray(f['antenna0']['tracker']['expected'][0]) t.el_command = numpy.asarray(f['antenna0']['tracker']['expected'][1]) t.az_rate_command = numpy.asarray( f['antenna0']['tracker']['expected_rates'][0], dtype=float) t.el_rate_command = numpy.asarray( f['antenna0']['tracker']['expected_rates'][1], dtype=float) # Status params if isinstance(f['antenna0']['tracker']['state'][0], core.G3String): # If state is all zero (LACKING), for example due to an ACU glitch, # the ARC reader may decide that the 8-bit array field is a string. # Treat it as one. t.state = [ TrackerState(0) for s in f['antenna0']['tracker']['inControl'][0] ] else: t.state = [ TrackerState(s) for s in f['antenna0']['tracker']['state'][0] ] t.acu_seq = f['antenna0']['tracker']['acu_seq'][0] t.in_control = core.BoolVector(f['antenna0']['tracker']['inControl'][0]) t.in_control_int = core.IntVector(f['antenna0']['tracker']['inControl'][0]) t.scan_flag = core.BoolVector(f['antenna0']['tracker']['scan_flag'][0]) t.lst = numpy.asarray(f['antenna0']['tracker']['lst'][0], dtype=float) t.source_acquired = numpy.asarray( f['antenna0']['tracker']['off_source'][0]) t.source_acquired_threshold = numpy.asarray( f['antenna0']['tracker']['source_acquired_threshold']) t.tracker_mode = numpy.asarray(f['antenna0']['tracker']['mode'][0]) t.tracker_lacking = numpy.asarray(f['antenna0']['tracker']['lacking'][0]) t.time_status = numpy.asarray(f['antenna0']['tracker']['time_status'][0]) try: t.schedule_name = numpy.asarray( f['antenna0']['tracker']['schedule_name'].value) except AttributeError: t.schedule_name = numpy.asarray(''.join( [chr(x) for x in f['antenna0']['tracker']['schedule_name']])) f['TrackerStatus'] = t