Commit 75cfc797 authored by Caillat Michel's avatar Caillat Michel
Browse files

Merge branch 'master' of https://gitlab.obspm.fr/caillat/yafits

parents 9aa3dc85 490151f6
body{
width : 1440px;
margin-left : auto;
margin-right : auto;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
h1, h2, h3, h4, h5 {color: #272727;text-align: left;}
......@@ -9,6 +12,12 @@ h2 {font-size: 1.75em; margin: 30px 0 15px 0;}
h3 {font-size: 1.25em;margin: 30px 0 15px 0;}
h4 {font-size: 1em; margin: 30px 0 15px 0;}
.navbar-title{
border-bottom: 1px solid #f0e6e6;
background-color: #FFFFFF;
margin-bottom : 1em;
}
.map {
height: 512px;
width: 512px;
......@@ -156,8 +165,7 @@ padding-top : 0.5em;
}
.col .chart-title{
padding-left : 750px;
margin-bottom : 2em;
margin-left : -80px;
}
.hidden{
......@@ -210,8 +218,10 @@ padding-top : 0.5em;
}
.cube-infos{
font-size:15px;
color: black;
/*font-size:15px;
color: black;*/
text-align : center;
width : 100%;
}
.img-configuration select{
......
......@@ -82,7 +82,8 @@
<%}%>
</div>
</div>
<nav class="navbar navbar-light" style="background-color: #FFFFFF;">
<div><div id="cubeInfos" class="cube-infos"></div></div>
<nav class="navbar navbar-light navbar-title">
<button class="navbar-toggler" type="button"
data-toggle="collapse" data-target="#navbarToggleExternalContent"
aria-controls="navbarToggleExternalContent" aria-expanded="false"
......@@ -92,20 +93,19 @@
<!--<div><a id="jupyter" href="#" target="_blank"><img src="../jupyter.png" style="width:30px; height:30px" title="jupyter"/></a></div>-->
<a href="#" class="btn btn-link btn-sm" onclick="viewIn3D(); return false;"> Show 3D model </a>
<div><a href="http://artemix.obspm.fr/fits/browse" target="_blank" class="btn btn-link btn-sm">Show Fits file browser</a></div>
<div id="cubeInfos" class="cube-infos"></div>
<div><a id='showFITSHEADER' href='#'>Show FITS header</a></div>
<img src="../samphub.png" class="samp-img"
data-toggle="collapse" data-target="#sampRegistry" title="Transfer data to another application with SAMP protocol"
aria-controls="sampRegistry" aria-expanded="false" aria-label="Toggle navigation"/>
</nav>
</div>
<div>
<div class="container chart-container">
<div class="row">
<div class="col">
<div id="external_mouse_position_1" class="external_mouse_position"></div>
</div>
<div class="col">
<div id="debug_jpk"></div>
<div id="spectrum_info_title" class="chart-title"></div>
</div>
</div>
<div class="row">
......@@ -131,6 +131,11 @@
<div class="col">
<div id="external_mouse_position_2" class="external_mouse_position"></div>
</div>
<div class="col">
<div class="chart-title">
<span id="chart_title"></span>
</div>
</div>
</div>
<div class="row">
<div class="col chart-img">
......@@ -143,13 +148,6 @@
<div id="publish_summedpixelsspectrum"></div>
</div>
</div>
<div class="row">
<div class="col">
<div class="chart-title">
<span id="chart_title"></span>
</div>
</div>
</div>
</div>
<div class="container chart-container hidden">
......@@ -274,7 +272,7 @@
var EXIT = function () { console.log(arguments.callee.name + ": exiting."); };
const PLOT_WIDTH = 780;
const PLOT_RATIO = "65%";
const PLOT_COLOR ="#F5F101";
const PLOT_COLOR = "#F5F101";
<%if (useSAMP) {%>
var sAMPPublisher = null;
......@@ -317,6 +315,46 @@
}
/**
Returns index of slice to be displayed
plotData : spectrum
x : x position clicked on graph
*/
function computeSliceIndex(plotData, x){
var rlen = plotData.x.length;
switch (_ctype3) {
case 'FREQ':
if (_cdelt3 > 0) {
var forigin = plotData.x[rlen - 1];
var deltaf = plotData.x[0] - plotData.x[1];
}
else {
var forigin = plotData.x[0];
var deltaf = plotData.x[1] - plotData.x[0];
}
break;
case 'VRAD':
case 'WAVE':
case 'WAVN':
case 'AWAV':
if (_cdelt3 > 0) {
var forigin = plotData.x[0];
var deltaf = plotData.x[1] - plotData.x[0];
}
else {
var forigin = plotData.x[rlen - 1];
var deltaf = plotData.x[0] - plotData.x[1];
}
break;
default:
console.log("This should not happen");
}
return phys2Index(x, forigin, deltaf);
}
/**
calculate the value displayed as title of summed average spectrum
avgSpectrum array is reversed if data are radial velocities and
......@@ -363,9 +401,9 @@
lambda = null;
if (_origin.startsWith("GILDAS")){
if (_origin.startsWith("GILDAS")) {
lambda = speedOfLight / _restfreq;
}else{
} else {
lambda = speedOfLight / _crval3;
}
......@@ -373,12 +411,12 @@
step1 = 2 * kb * omega / (lambda * lambda);
let result = step1 / 1e-26;
let result = step1 / 1e-26;
return result;
}
function kelvinPerJansky() {
let jperk = janskyPerKelvin();
let jperk = janskyPerKelvin();
let result = 1. / jperk;
return result;
}
......@@ -387,6 +425,10 @@
return arcsec / 3600;
}
function degToArcsec(deg) {
return deg * 3600;
}
function degToRad(deg) {
return deg * (Math.PI / 180);
}
......@@ -1357,6 +1399,45 @@
return _relayoutTriggeredBy;
}
this.clickAction = function(event){
console.log("A click occurred on the spectrum : enter");
switch (_ctype3) {
case 'FREQ':
if (_cdelt3 > 0) {
var forigin = plotData.x[rlen - 1];
var deltaf = plotData.x[0] - plotData.x[1];
}
else {
var forigin = plotData.x[0];
var deltaf = plotData.x[1] - plotData.x[0];
}
break;
case 'VRAD':
case 'WAVE':
case 'WAVN':
case 'AWAV':
if (_cdelt3 > 0) {
var forigin = plotData.x[0];
var deltaf = plotData.x[1] - plotData.x[0];
}
else {
var forigin = plotData.x[rlen - 1];
var deltaf = plotData.x[0] - plotData.x[1];
}
break;
default:
console.log("This should not happen");
}
var sliceIndex = phys2Index(event.xAxis[0].value, forigin, deltaf);
// Display slice at index sliceIndex
sliceViewer.display(sliceIndex);
sliceViewer.setFluxDensityInPopup(event.yAxis[0].value);
this.series[1].update(getPoint(event.xAxis[0].value, true));
}
/*
** Let's initialize the plot.
*/
......@@ -1424,10 +1505,7 @@
if (typeof iDEC === 'undefined') {
iDEC = Math.floor(_naxis2 / 2);
}
/*console.log("### loading signal");
console.log(document.getElementById('loading'));
console.log(document.getElementById('loading'));*/
// recupère le spectre
$.post("", { "method": "getSpectrum", "relFITSFilePath": _relFITSFilePath, "iRA": iRA, "iDEC": iDEC, "iFREQ0": 0, "iFREQ1": _naxis3 - 1 }).done(
/*
......@@ -1452,6 +1530,7 @@
let rlen = xData.length;
var plotData = JSON.parse(JSON.stringify(_frequencyPlot));
var self = this;
for (var i = 0; i < rlen; i++) {
let tmp = linearTabulator(_crval3, _cdelt3, _crpix3, i + 1);
if (getCunit3() in unitFactor) {
......@@ -1562,13 +1641,14 @@
highData.push([plotData.x[i], plotData.y[i]]);
}
let getPoint = function (x) {
let getPoint = function (x, visible) {
return {
type: 'scatter',
name: '',
showInLegend: false,
visible : visible,
marker: {
radius: 1
radius: 5
},
data: [{
x: x,
......@@ -1580,10 +1660,10 @@
spectrumChart = Highcharts.chart('spectrum', {
title: {
text: toptitle
text: ''
},
chart: {
type : 'area',
type: 'area',
width: PLOT_WIDTH,
height: PLOT_RATIO,
animation: false,
......@@ -1599,37 +1679,7 @@
click: function (event) {
console.log("A click occurred on the spectrum : enter");
switch (_ctype3) {
case 'FREQ':
if (_cdelt3 > 0) {
var forigin = plotData.x[rlen - 1];
var deltaf = plotData.x[0] - plotData.x[1];
}
else {
var forigin = plotData.x[0];
var deltaf = plotData.x[1] - plotData.x[0];
}
break;
case 'VRAD':
case 'WAVE':
case 'WAVN':
case 'AWAV':
if (_cdelt3 > 0) {
var forigin = plotData.x[0];
var deltaf = plotData.x[1] - plotData.x[0];
}
else {
var forigin = plotData.x[rlen - 1];
var deltaf = plotData.x[0] - plotData.x[1];
}
break;
default:
console.log("This should not happen");
}
var sliceIndex = phys2Index(event.xAxis[0].value, forigin, deltaf);
let sliceIndex = computeSliceIndex(plotData, event.xAxis[0].value);
// Display slice at index sliceIndex
sliceViewer.display(sliceIndex);
sliceViewer.setFluxDensityInPopup(event.yAxis[0].value);
......@@ -1686,36 +1736,50 @@
// result can be NaN if _bmin/_bmaj not available
// then nothing to display
if(!isNaN(kpj)){
label = " <br/> " + Number(this.value * kpj ).toExponential(2) + " K";
if (!isNaN(kpj)) {
label = " <br/> " + Number(this.value * kpj).toExponential(2) + " K";
}
document.getElementById("debug_jpk").innerHTML = "Jy per K : "+ Number(janskyPerKelvin()).toExponential(4);
document.getElementById("spectrum_info_title").innerHTML = "<span>" + Number(degToArcsec(_bmin)).toFixed(2) + "' x " + "</span>" +
"<span>" + Number(degToArcsec(_bmaj)).toFixed(2) + "', " + "</span>" +
"<span>"+"PA "+ Number(_bpa).toFixed(1) + "°" + "</span>"+
"<span>, " + Number(janskyPerKelvin()).toExponential(2) + " Jy/K</span> ";
return Number(this.value).toExponential(2) + label;
}
}
},
plotOptions: {
series: {
cursor : 'pointer',
step: true,
color: PLOT_COLOR,
animation: {
duration: 0
},
lineWidth: 1
lineWidth: 1,
events: {
click: function (event) {
console.log("A click occurred on the LINE : enter");
let sliceIndex = computeSliceIndex(plotData, event.point.x);
// Display slice at index sliceIndex
sliceViewer.display(sliceIndex);
sliceViewer.setFluxDensityInPopup(event.point.y);
this.chart.series[1].update(getPoint(event.point.x));
}
}
},
marker: {
radius: 0
}
},
tooltip: {
formatter: function () {
let label = '( ' + this.x.toFixed(4) + ', ' + this.y.toFixed(4) + ') ';
if(!isNaN(kpj)){
label = label + ", " + Number(this.y * kpj ).toExponential(2) + " K";
}
return label;
}
formatter: function () {
let label = '( ' + this.x.toFixed(4) + ', ' + this.y.toFixed(4) + ') ';
if (!isNaN(kpj)) {
label = label + ", " + Number(this.y * kpj).toExponential(2) + " K";
}
return label;
}
},
series: [
{
......@@ -1727,7 +1791,7 @@
radius: 0
}
}, getPoint(_frequencyMarker.x)
}, getPoint(_frequencyMarker.x, false)
]
});
sliceViewer.setFluxDensityInPopup(plotData.y[ifrequencyMarker]);
......@@ -1771,9 +1835,10 @@
let _averageSpectrum = null;
var toptitle = function (value, unit, vmin, vmax) {
return value.toExponential(4) +
" (" + unit + "), vmin = " +
vmin.toFixed(4) + " , vmax = " + vmax.toFixed(4);
return value.toExponential(2) +
unit + ", vmin = " +
vmin.toFixed(2) + " "+ "km/s" +" , vmax = " +
vmax.toFixed(2) + " " + "km/s";
}
this.setAverageSpectrum = function (averageSpectrum) {
......@@ -1822,17 +1887,17 @@
if (_instrume == "SITELLE") {
xtitle = _ctype3 + " (" + getCunit3() + ")";
ytitle = "FLUX (" + summedPixelsSpectrumUnit(header["BUNIT"]) + ")";
toptitle_unit = "ergs / s / cm^2";
toptitle_unit = "ergs/s/cm^2";
}
else if (_origin.startsWith("CASA")) {
xtitle = "Velocity (km/s) - " + _specsys;
ytitle = "Int. flux density (" + summedPixelsSpectrumUnit(_bunit) + ")";
toptitle_unit = "Jy . km / s";
toptitle_unit = "Jy.km/s";
}
else if (_origin.startsWith("GILDAS")) {
xtitle = "Velocity (km/s)"
ytitle = "Int. flux density (" + summedPixelsSpectrumUnit(_bunit) + ")"
toptitle_unit = "Jy . km / s";
toptitle_unit = "Jy.km/s";
}
else if (_instrume == "MUSE") {
xtitle = _ctype3 + " (" + getCunit3() + ")";
......@@ -1881,7 +1946,7 @@
text: ''
},
chart: {
type : 'area',
type: 'area',
animation: false,
width: PLOT_WIDTH,
height: PLOT_RATIO,
......@@ -1956,8 +2021,8 @@
return '( ' + this.x.toFixed(4) + ', ' + this.y.toFixed(4) + ')';
}
},
series: [
{color: PLOT_COLOR,}
series: [
{ color: PLOT_COLOR, }
]
});
......@@ -2320,7 +2385,6 @@
if (_naxis4) {
FITSSummary += ' - NAXIS4 = <strong>' + _naxis4 + '</strong>';
}
FITSSummary += " <a id='showFITSHEADER' href='#'> etc.</a>";
$("#cubeInfos").html(FITSSummary);
$("cubeInfos").css('font-family: monospace; font-size=x-small');
$('#showFITSHEADER').click(function () { FITSHDR.show() });
......@@ -2454,9 +2518,9 @@
summedPixelsSpectrumViewer.plot(0, width - 1, 0, height - 1);
$('#rccap').click(function () { console.log("### click"); sliceViewer.refresh() });
$('#rccap').click(function () { sliceViewer.refresh() });
console.log('$.post("", {"method": "RADECRangeInDegrees", "relFITSFilePath": relFITSFilePath}).done(function (resp) { : exiting');
console.log('$.post("", {"method": "RADECRangeInDegrees", "relFITSFilePath": relFITSFilePath}).done(function (resp) { : exiting');
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment