when I open a *.fits file in OIFitsExplorer, I obtain a structure as in the figure.
How can I get data only from GRAVITY_SC_P1 in oifits python3 module?
I access the data as follows:
target = "Zeta_Ori"
for infile in sys.argv[1:]:
obj = oifits.open(infile)
obj.info()
outfile = os.path.basename(infile).replace("fits", "dat")
fout = open("dat_vis/" + outfile, "w")
for vis2 in obj.vis2:
if vis2.target.target == target:
fout.write("# %s\n" % (vis2))
fout.write("# %s\n" % (vis2.target))
t1 = astropy.time.Time(vis2.timeobs, scale='utc', format='datetime')
t2 = t1.tdb
for i in range(len(vis2.wavelength.eff_wave)):
if vis2.vis2data[i] != "--":
fout.write("%22.8f %32.16e %32.16e %32.16e %32.16e %32.16e %32.16e %8s\n" % (t2.jd, vis2.ucoord, vis2.vcoord, vis2.wavelength.eff_wave[i], vis2.wavelength.eff_band[i], vis2.vis2data[i], vis2.vis2err[i], str(vis2.station[0])[:2]+str(vis2.station[1])[:2]))
fout.close()
However, the data are from all four "subdirectories" (INSNAME), not only from a chosen one. How to select data with a given INSNAME? Thank you