oimodeler / oimodeler

Tools to model optical Interferometry data
GNU General Public License v3.0
15 stars 3 forks source link

[Bug][0.85_beta] uvPlot fails for oifits file with multiple rows of ['T3PHI'] or ['VIS2DATA'] in oifits #71

Open LvHaastere opened 2 weeks ago

LvHaastere commented 2 weeks ago

Example data (Published result in JMMC archive) 2013-02-16_SCI_HD100453_oiDataCalib.fits.zip

After loading + filter data: data_pio_only.dataInfo

Output:

[[{'arr': 'OI_VIS2', 'idx': 5, 'nB': (6, 3), 'data': ['VIS2DATA']},
  {'arr': 'OI_VIS2', 'idx': 6, 'nB': (6, 3), 'data': ['VIS2DATA']},
  {'arr': 'OI_T3', 'idx': 7, 'nB': (4, 3), 'data': ['T3PHI']},
  {'arr': 'OI_T3', 'idx': 8, 'nB': (4, 3), 'data': ['T3PHI']}]]

fig, ax1 = plt.subplots(1,1, subplot_kw=dict(projection='oimAxes'),figsize=(8,8)) ax1.uvplot(data_pio_only) plt.show()

Errorcode:

`AttributeError Traceback (most recent call last) Input In [7], in 1 fig, ax1 = plt.subplots(1,1, subplot_kw=dict(projection='oimAxes'),figsize=(8,8)) ----> 2 ax1.uvplot(data_pio_only2) 4 plt.show()

File ~/oimPlots.py:995, in oimAxes.uvplot(self, oifits, kwargs) 994 def uvplot(self, oifits, kwargs): --> 995 uvPlot(oifits, axe=self, **kwargs)

File ~/oimPlots.py:159, in uvPlot(oifitsList, arrname, unit, stringunitformat, color, maxi, grid, gridcolor, fontsize, xytitle, showLegend, showColorbar, colorTab, axe, title, cunit, legendkwargs, **kwargs) 157 ,, ui,vi = getBaselineLengthAndPA(datai,arr=arrname, squeeze=False, returnUV=True) 158 for iext in range(len(ui)): --> 159 wlii = getWlFromOifits(datai,arr=arrname,extver=iext+1) 160 nB=ui[iext].size 161 ucoord.extend(ui[iext])

File ~/oimUtils.py:679, in getWlFromOifits(oifits, arr, extver, returnBand) 676 else: 677 TypeError(f"No extver in {arr}") --> 679 insname=arr.header['INSNAME'] 681 oiwls = np.array([di for di in oifits if di.name == "OI_WAVELENGTH"]) 682 oiwls_insname = np.array([oiwli.header['INSNAME'] for oiwli in oiwls])

AttributeError: 'str' object has no attribute 'header'`

LvHaastere commented 2 weeks ago

Code (Jupyter): For bug reproduction HD100453_uvplot_bug.ipynb.zip