def write(self, save_name): # The easy part, just write it out! self.veltyp = oifits.OI_ARRAY("VELTYP", "UNKNOWN") self.oif.array = self.oiarray self.oif.target = self.oitarget self.oif.wavelength = self.wavs self.oif.vis2 = self.oivis2 #self.oif.vis = self.oivis self.oif.t3 = self.oit3 # Add in vis array self.oif.vis = np.array([]) # some extra keywords we'd like to hold onto self.oif.avparang = self.parang self.oif.parang_range = self.parang_range self.oif.covariance = self.covariance print(self.oif.wavelength) print(type(self.oif.wavelength)) #from future.utils import iteritems #print(iteritems(self.oif.wavelength)) self.oif.save(self.datapath + save_name) # Check f = oifits.open(self.datapath + save_name) #print "0th t3phi:", f.t3[0].t3phi #print "0th t3amp:", f.t3[0].t3amp return self.datapath + save_name
def dummytables(self): # There are some oifits extensions that are not used by NRMers, so we # fill them with dummy entries here. station1 = station1=["Dummy Table","Dummy Table",0,0.45,[10.,20.,30.]] stations=[station1] self.array=oifits.OI_ARRAY("GEOCENTRIC",np.array([10.,20.,30.]),stations=stations) self.oiarray={self.arrname:self.array} self.station=self.oiarray[self.arrname].station[0] #will be used later
easty *= -1 # Calculate a "north" unit vector by crossing east and arrayxyz northx = -easty * arrayz northy = eastx * arrayz northz = easty * arrayx - arrayy * eastx northmag = sqrt(northx * northx + northy * northy + northz * northz) northx /= northmag northy /= northmag northz /= northmag data = np.genfromtxt('baseline_data.txt', usecols=(0, 3, 4), dtype=[('name', 'U2'), ('E', 'f8'), ('N', 'f8')]) stations = [] for sta_name, E, N in data: staxyz = [N * northx + E * eastx, N * northy + E * easty, N * northz] if 'U' in sta_name: diameter = 8.2 else: diameter = 1.8 stations.append((sta_name, sta_name, -1, diameter, staxyz)) array = oifits.OI_ARRAY('GEOCENTRIC', arrxyz, stations) oifitsobj = oifits.oifits() oifitsobj.array['VLTI'] = array oifitsobj.save('VLTI-array.fits')