diff --git a/yafitss/DataBlock.py b/yafitss/DataBlock.py index d72506e1ecaadc4e2c94bddceebd02be18f2ee05..b8da97f3361e7e18da37dcd0d84cae62bcf5375e 100644 --- a/yafitss/DataBlock.py +++ b/yafitss/DataBlock.py @@ -221,12 +221,36 @@ class DataBlock: try: hdu_list = fits.open(absFITSFilePath) + self.__logger.debug("Opened {absFITSFilePath}") + # MUSE detecttion. + data_index = "PRIMARY" + primary_header = hdu_list[data_index].header + if "EXTEND" in primary_header and \ + primary_header["EXTEND"] and \ + "ORIGIN" in primary_header and \ + primary_header["INSTRUME"].strip() == "MUSE" and \ + "DATA" in hdu_list : + data_index = "DATA" + self.__header = hdu_list[data_index].header + self.__header["ORIGIN"] = primary_header["ORIGIN"].strip() + self.__header["INSTRUME"] = primary_header["INSTRUME"].strip() + self.__header["TELESCOP"] = primary_header["TELESCOP"].strip() + self.__header["OBSERVER"] = primary_header["OBSERVER"].strip() + self.__header["CDELT1"] = self.__header["CD1_1"]; + self.__header["CDELT2"] = self.__header["CD2_2"]; + self.__header["CDELT3"] = self.__header["CD3_3"]; + self.__header["RADESYS"] = primary_header["RADECSYS"].strip(); + self.__header["DATE-OBS"] = primary_header["DATE"].strip(); + self.__header["DATE"] = primary_header["DATE"].strip(); + self.__logger.debug("We are in MUSE") + else: + self.__header = hdu_list[data_index].header - numDims = len(hdu_list[0].data.shape) + numDims = len(hdu_list[data_index].data.shape) if numDims == 4: - self.__data = da.from_array(hdu_list[0].data[0],chunks=(hdu_list[0].data[0].shape[0], 128, 128)) #hdu_list[0].data[0] + self.__data = da.from_array(hdu_list[data_index].data[0], chunks = (hdu_list[data_index].data[0].shape[0], 128, 128)) elif numDims == 3: - self.__data = da.from_array(hdu_list[0].data,chunks=(hdu_list[0].data.shape[0], 128, 128)) #hdu_list[0].data[0] + self.__data = da.from_array(hdu_list[data_index].data, chunks = (hdu_list[data_index].data.shape[0], 128, 128)) else: self.__logger.debug("Unacceptable value of numDims: %s" % numDims) @@ -235,7 +259,6 @@ class DataBlock: self.__sliceMargin = da.from_array(np.nan * np.ones(shape=(shp[1], shp[1] - shp[2])), chunks=(128, 128)) elif shp[1] < shp[2]: self.__sliceMargin = da.from_array(np.nan * np.ones(shape=(shp[2] - shp[1], shp[2])), chunks=(128, 128)) - self.__header = hdu_list[0].header # # Header "normalization" @@ -395,6 +418,8 @@ class DataBlock: cdelt = 0.0 elif self.__header["INSTRUME"] == "SITELLE": cdelt = 1.0 + elif self.__header["INSTRUME"] == "MUSE": + cdelt = 1.0 else: cdelt = 0.0 diff --git a/yafitsv/views/olqv.ejs b/yafitsv/views/olqv.ejs index 8ddaffa9ad810fda92cab2f5eb936fa755115e56..f424faeb64058beaba3dfa5b2291ce245107a030 100644 --- a/yafitsv/views/olqv.ejs +++ b/yafitsv/views/olqv.ejs @@ -1119,7 +1119,7 @@ var SAMPPNGPublishControl = (function (Control) { return speedOfLight / frequency; } - let unitFactor = {"M/S": 1.0, "KM/S": 1000., "HZ": 1.0, "MHZ": 1000000., "GHZ" : 1.e+9, "NM": 1.e-09, "CM-1": 1}; + let unitFactor = {"M/S": 1.0, "KM/S": 1000., "HZ": 1.0, "MHZ": 1000000., "GHZ" : 1.e+9, "NM": 1.e-09, "CM-1": 1, "ANGSTROM": 1}; let defaultOutputUnit = {"FREQ" : "GHZ", "VRAD" : "KM/S", "VOPT" : "KM/S", "STOKES" : "_"}; /* @@ -1152,7 +1152,11 @@ var SAMPPNGPublishControl = (function (Control) { ytitle = "Flux density (" + _bunit + ")"; toptitle = ""; } - + else if (_instrume == "MUSE") { + xtitle = _ctype3 + " (" + _cunit3 + ")"; + ytitle = "FLUX (" + _bunit + ")"; + toptitle = ""; + } console.log("toptitle="+toptitle+", xtitle="+xtitle+", ytitle="+ytitle); let _relFITSFilePath = relFITSFilePath; @@ -1337,6 +1341,7 @@ var SAMPPNGPublishControl = (function (Control) { case 'WAVE': case 'WAVN': + case 'AWAV': ifrequencyMarker = i; break; @@ -1372,6 +1377,7 @@ var SAMPPNGPublishControl = (function (Control) { alert(resp.data["message"]); return; } + var xData = new Array(resp.data["result"].length); // Draw x-axis in Frequencies (plot on top right) @@ -1408,6 +1414,7 @@ var SAMPPNGPublishControl = (function (Control) { case 'WAVE': case 'WAVN': + case 'AWAV': xData[i] = tmp; break; @@ -1440,6 +1447,7 @@ var SAMPPNGPublishControl = (function (Control) { case 'WAVE': case 'WAVN': + case 'AWAV': plotData.y = resp.data["result"]; break; @@ -1520,6 +1528,7 @@ var SAMPPNGPublishControl = (function (Control) { case 'VRAD': case 'WAVE': case 'WAVN' : + case 'AWAV' : if (_cdelt3 > 0) { var forigin = plotData.x[0]; var deltaf = plotData.x[1]-plotData.x[0]; @@ -1656,6 +1665,11 @@ var SAMPPNGPublishControl = (function (Control) { ytitle = "Int. flux density (" + summedPixelsSpectrumUnit(_bunit) + ")" toptitle_unit = "Jy . km / s"; } + else if (_instrume == "MUSE") { + xtitle = _ctype3 + " (" + _cunit3 + ")"; + ytitle = "Int. flux)"; + toptitle_unit = ""; + } /* ** The layout utilized to display the spectrum of summed values on each slice. @@ -1843,6 +1857,9 @@ var SAMPPNGPublishControl = (function (Control) { cdelt3prim = _cdelt3; } } + else if (_instrume == "MUSE") { + cdelt3prim = 1; + } var plotData = JSON.parse(JSON.stringify(_frequencyPlot)); @@ -1872,6 +1889,7 @@ var SAMPPNGPublishControl = (function (Control) { case 'WAVE': case 'WAVN': + case 'AWAV' : if ( _cdelt3 > 0 ) { xData[i] = tmp; } @@ -1900,6 +1918,7 @@ var SAMPPNGPublishControl = (function (Control) { case 'VRAD': case 'WAVE': case 'WAVN': + case 'AWAV': averageSpectrum = averageSpectrum.map(function(x) {return x* unitRescale(summedPixelsSpectrumUnit(_bunit))}); if (_cdelt3 > 0) { plotData.y = averageSpectrum; @@ -2044,6 +2063,7 @@ var SAMPPNGPublishControl = (function (Control) { case 'VRAD' : case 'WAVE': case 'WAVN' : + case 'AWAV': if (_cdelt3 > 0) { sliceViewer.updateSummedSlices(imin, imax); }