def _get_measures(self, info): # Create the local instances of the measures and quanta tools meLoc = casac.measures() qaLoc = casac.quanta() # Initialize the measures dictionary and the position and # position_keywords variables measures = dict() position = info['position'] position_keywords = info['position_keywords'] rf = position_keywords['MEASINFO']['Ref'] for row, ant in enumerate(info['name']): if not info['flag_row'][row]: p = position[0, row] pk = position_keywords['QuantumUnits'][0] v0 = qaLoc.quantity(p, pk) p = position[1, row] pk = position_keywords['QuantumUnits'][1] v1 = qaLoc.quantity(p, pk) p = position[2, row] pk = position_keywords['QuantumUnits'][2] v2 = qaLoc.quantity(p, pk) measures[ant] = meLoc.position(rf=rf, v0=v0, v1=v1, v2=v2) # Delete the local instances of the measures and quanta tools del qaLoc del meLoc # Return the measures return measures
def _get_latlongrad(self, info, measures): # Create the local instance of the quanta tool qaLoc = casac.quanta() # Get the radii, longitudes, and latitudes radii = dict() longs = dict() lats = dict() for ant in info['name']: value = measures[ant]['m2']['value'] unit = measures[ant]['m2']['unit'] quantity = qaLoc.quantity(value, unit) convert = qaLoc.convert(quantity, 'm') radii[ant] = qaLoc.getvalue(convert) value = measures[ant]['m0']['value'] unit = measures[ant]['m0']['unit'] quantity = qaLoc.quantity(value, unit) convert = qaLoc.convert(quantity, 'rad') longs[ant] = qaLoc.getvalue(convert) value = measures[ant]['m1']['value'] unit = measures[ant]['m1']['unit'] quantity = qaLoc.quantity(value, unit) convert = qaLoc.convert(quantity, 'rad') lats[ant] = qaLoc.getvalue(convert) # Delete the local instance of the quanta tool del qaLoc # Return the tuple containing the radius, longitude, and # latitude python dictionaries return radii, longs, lats