Commit d6619aab authored by Caillat Michel's avatar Caillat Michel
Browse files

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

parents be1824d3 6d2a2ccb
......@@ -125,3 +125,4 @@ RUN ls -l /home/partemix/anaconda3/pkgs/matplotlib-3.0.3-py37h5429711_0/lib/
# ./yafitss/serverWsgi.michel will be listening at 4251
EXPOSE 4251
......@@ -80,3 +80,4 @@ COPY --chown=partemix:partemix . /home/partemix/yafitsv
RUN ls -l /home/partemix/yafitsv
EXPOSE 3000
......@@ -181,6 +181,9 @@ function unitRescale(unit) {
** and returns the sum multiplied by a coefficient coeff.
*/
function sumArr(arr, i0, i1, coeff) {
console.log("SumArr");
console.log(arr);
console.log("i0 : "+i0 + " , i1 : " + i1 + " coeff : "+ coeff);
i0 = Math.max(0, i0);
i1 = Math.min(arr.length-1, i1);
......
/*
** A set of classes and function definitions utilized by the
** differents flavours of OLQV viewers.
**
** Author : M. Caillat
** Date : 06th December 2018
*/
/*
** Converts a decimal number expected to represent an angle in degree
** into a string expressing a right ascension ( H:M:S)
*/
let DecDeg2HMS = function(deg,sep=':'){
//if(any(deg< 0 | deg>360)){stop('All deg values should be 0<=d<=360')}
//if (deg < 0)
//deg[deg < 0] = deg[deg < 0] + 360
HRS = Math.floor(deg/15);
MIN = Math.floor((deg/15 - HRS) * 60);
SEC = (deg/15 - HRS - MIN/60) * 3600;
SEC = Math.floor(SEC*1000) / 1000.;
return HRS+sep+MIN+sep+SEC;
};
/*
** Converts a decimal number expected to represent an angle in degree
** into a string expressing a declination ( D:M:S)
*/
let DecDeg2DMS = function(deg,sep=':'){
let sign = deg < 0 ? '-':'+';
deg = Math.abs(deg)
let DEG = Math.floor(deg)
let MIN = Math.floor((deg - DEG) * 60)
let SEC = (deg - DEG - MIN/60) * 3600
SEC = Math.floor(SEC*1000.) / 1000.;
if (SEC < 0.) SEC = 0.; if (SEC > 60) SEC = 60.;
return(sign + DEG + ':' + MIN + ':' + SEC );
};
/*
** A class to convert pixels into a string expressing a right ascension.
**
** The constructor establishes the transformation pixels -> HMS
** with the given parameter ra0pix, ra1pix ( interval in pixels )
** and ra0, ra1 ( the same interval in decimal degrees)
*/
function raLabelFormatter (ra0pix, ra1pix, ra0, ra1) {
let _ra0pix = ra0pix;
let _ra1pix = ra1pix;
let _ra0 = ra0;
let _ra1 = ra1;
let _slope = ((_ra1 - _ra0) / (_ra1pix - _ra0pix))
/*
** Returns the string representation of a RA in HMS given its input value in pixels.
*/
this.format = function(rapix) {
let res = _ra0 + (rapix - _ra0pix) * _slope;
return DecDeg2HMS(res);
}
};
/*
** A class to convert pixels into a string expressing a declination.
**
** The constructor establishes the transformation pixels -> DMS
** with the given parameter dec0pix, dec1pix ( interval in pixels )
** and dec0, dec1 ( the same interval in decimal degrees)
*/
function decLabelFormatter (dec0pix, dec1pix, dec0, dec1) {
let _dec0pix = dec0pix;
let _dec1pix = dec1pix;
let _dec0 = dec0;
let _dec1 = dec1;
let _slope = ((_dec1 - _dec0) / (_dec1pix - _dec0pix))
this.format = function(decpix) {
let res = _dec0 + (decpix - _dec0pix) * _slope;
return DecDeg2DMS(res);
}
};
body{
width : 1440px;
}
h1, h2, h3, h4, h5 {color: #272727;text-align: left;}
h1 {font-size: 2.25em;}
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;}
.map {
height: 512px;
width: 512px;
}
#loading {
display: block;
position: absolute;
top: 0;
left: 0;
z-index: 100;
/*width: 100vw;
height: 100vh;*/
width: 100vw;
height: 1200px;
background-color: rgba(192, 192, 192, 0.5);
background-image: url("../MnyxU.gif");
background-repeat: no-repeat;
background-position: center;
}
#info {
z-index: 1;
opacity: 0;
position: absolute;
top: 100%;
left: 0;
margin: 0;
background: rgba(0,60,136,0.7);
color: white;
border: 0;
transition: opacity 100ms ease-in;
}
.marker {
width: 16px;
height: 16px;
border: 1px solid #088;
border-radius: 8px;
background-color: #0FF;
opacity: 0.5;
}
.ol-popup {
position: absolute;
background-color: white;
-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
padding: 10px;
border-radius: 10px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 150px;
font-size: 10px;
}
.ol-popup:after, .ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.ol-popup-closer:after {
content: "x";
}
th, td {
padding: 0px;
margin: 0px;
font-size: 16px;
height: 20px;
}
.list-group{
flex-direction: row;
}
.map:-moz-full-screen {
height: 100%;
}
.map:-webkit-full-screen {
height: 100%;
}
.map:-ms-fullscreen {
height: 100%;
}
.map:fullscreen {
height: 100%;
}
.samp-publish-png {
top: 65px;
left: .5em;
display:none;
}
.ol-touch .samp-publish-png {
top: 80px
}
.chart-container{
max-width:100%;
}
/*
.chart-container > .row{
padding-top : 0.5em;
}*/
.chart-container > .row > .chart-img{
max-width : 550px;
padding-left : 5px;
padding-right : 0px;
}
.chart-container > .row > .chart-plot{
max-width : 100%;
padding-left : 0;
/*padding-top : 5em;*/
}
.col .chart-title{
padding-left : 750px;
margin-bottom : 2em;
}
.hidden{
display : none;
}
.highcharts-graph.zone-0 {
stroke: #f7a35c;
}
.highcharts-area.zone-0 {
fill: #f7a35c;
}
.btn-control:hover{
background-color: #dadcdd;
}
.btn-control{
width : 90px;
}
.external_mouse_position{
height : 1.5em;
}
#sampRegistry button{
display: inline-block;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: 1px solid
transparent;
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
border-radius: .25rem;
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.samp-img{
width:30px;
height:30px;
cursor: pointer;
}
.cube-infos{
font-size:15px;
color: black;
}
.img-configuration select{
display : inline-block;
width : auto;
}
.img-configuration .list-group-item:last-child{
margin-bottom: auto;
border-bottom-right-radius: 0%;
border-bottom-left-radius: 0%;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<script>
function parse(value, pat){
var result = value.match(pat);
if (result) result = result.map(function(elem, index){if (index > 0) return Number(elem); else return elem;});
return result;
}
function RAtoString(RA) {
return RA.hour+"h"+RA.minute+"m"+RA.second+"s";
}
function RAtoDecimalDegree(RA) {
return RA.hour * 15 + RA.minute / 4 + RA.second / 240;
}
function checkRA(RAText) {
let pat;
let result;
var RA = {hour:0 , minute:0 , second:0, degree: 0 };
value = RAText;
pat = /(\d{1,2})[hH:\s]\s*(\d{1,2})[mM:\s]\s*(\d{1,2}(\.\d+)?)[sS]?/;
result = parse(value, pat);
if (result &&
(result[1] < 24) &&
(result[2] < 60) &&
(result[3] < 60)) {
console.log(result);
RA.hour = result[1];
RA.minute = result[2];
RA.second = result[3];
RA.decdegree = RA.hour * 15 + RA.minute / 4 + RA.second / 240;
return RA;
}
else {
pat = /(\d{1,3})\.(\d+)/;
result = parse(value, pat);
if (result) {
RA.decdegree = parseFloat(value);
RA.hour = Math.floor(RA.decdegree/15);
RA.minute = Math.floor((RA.decdegree/15 - RA.hour) * 60);
RA.second = (RA.decdegree/15 - RA.hour - RA.minute/60) * 3600;
RA.second = Math.floor(RA.second * 1000) / 1000.;
return RA;
}
else {
alert("Wrong input for RA. Valid symbols for hours : [hH: ], minutes : [mM: ] and seconds : [sS]");
console.log("Wrong input for RA");
return null;
}
}
};
function DECtoString(DEC) {
return (DEC.negative?'-':'')+DEC.degree+"\xB0"+DEC.arcminute+"'"+DEC.arcsecond+"\"";
}
function DECtoDecimalDegree(DEC) {
var result = DEC.degree + DEC.arcminute / 60. + DEC.arcsecond / 3600.
if ( DEC.negative ) result = -result;
return result;
}
function checkDEC(DECText) {
let pat;
let result;
var DEC = {negative: false, degree: 0, arcminute: 0, arcsecond:0};
value = DECText.trim();
pat = /-?(\d{1,2})[dD\xB0:\s]\s*(\d{1,2})['mM:\s]\s*(\d{1,2}(\.\d+)?)[s"]?/;
result = parse(value, pat);
if (result &&
((result[1] == 90 && result[2] == 0 && result[3] == 0) ||
(result[1] < 90 && result[2] < 60 && result[3] < 60))) {
if (result[0][0] == '-') {
DEC.negative=true;
}
DEC.degree = result[1];
DEC.minute = result[2];
DEC.second = result[3];
DEC.decdegree = DEC.degree + DEC.minute / 60. + DEC.second / 3600. * (DEC.negative ? -1:1);
return DEC;
}
else {
console.log(value);
pat = /(-)?(\d{1,3})\.(\d+)?/;
result = parse(value, pat);
console.log(JSON.stringify(result));
if ( result ) {
var i0 = 0;
console.log("---->" + result[0][0]);
if (result[0][0] == '-') {
i0 = 1;
DEC.negative = DEC.decdegree < 0.0;
}
DEC.decdegree = parseFloat(value.substring(i0)) * (DEC.negative ? -1 : 1) ;
console.log("---->" + DEC.decdegree);
DEC.degree = Math.abs(Math.floor(DEC.decdegree));
DEC.minute = Math.floor((DEC.decdegree - DEC.degree) * 60);
DEC.second = (DEC.decdegree - DEC.degree - DEC.minute/60) * 3600;
if (DEC.second < 0.) DEC.second = 0.; if (DEC.second > 60) DEC.second = 60.;
return DEC;
}
else {
alert("Wrong input for DEC. Valid symbols for degrees : [\xB0dD: ], minutes : [mM': ] and seconds : [sS\"]");
console.log("Wrong input for DEC");
return null;
}
}
};
function checkRADEC(RAText, DECText) {
return {'RA': checkRA(), 'DEC': checkDEC()};
};
var markers = [];
var new_markers = [];
var activate_markers = function(sliceViewer) {
$('#text_of_markers').bind('input propertychange', function() {
$("#place_markers").attr('disabled', true);
});
$("#parse_text_of_markers").click(function() {
new_markers = parse_text_of_markers();
});
$("#refresh_markers_display").click(function() {
sliceViewer.deleteMarkers(sliceViewer.getAllMarkers());
sliceViewer.addMarkers(new_markers);
});
$("#clear_markers").click(function() {
$("#text_of_markers").val('');
sliceViewer.deleteMarkers(sliceViewer.getAllMarkers());
})
$("#refresh_markers_display").attr('disabled', true);
};
var enable_place_markers = function() {
$("#refresh_markers_display").attr('disabled', false);
};
var parse_text_of_markers = function() {
new_markers = [];
var content = $("#text_of_markers").val();
var lines = content.split(/\r|\r\n|\n/);
for (var i = 0; i < lines.length; i++) {
let line = lines[i].trim();
if (line.length > 0) {
var fields=line.split(",");
if (fields.length < 2) {
alert("Line '"+line+"' looks incomplete");
return(false);
}
var RA = null;
var DEC = null;
if ((RA = checkRA(fields[0])) && (DEC = checkDEC(fields[1]))) {
new_markers.push({"RAInDD": RA.decdegree, "DECInDD": DEC.decdegree,"id": (fields.length==3)?fields[2]:""});
}
else {
return(false);
}
}
}
enable_place_markers();
console.log(JSON.stringify(new_markers, 0, 4));
return new_markers;
}
/*
** Append data associated with a marker to the text_of_markers textarea.
** The data are RA , DEC and optionally an identifying string id.
** RA and DEC must be expressed in the forms hour:minute:second.second for 'RA' and degree:minute:second.second for DEC.
** E.g. RA = 20:34:24.178, DEC = +6:54:46.222
*/
var appendMarker = function(RA, DEC, id=null) {
ta = $("#text_of_markers");
ta.val(ta.val()+ RA + ", " +DEC + (id ? id : "") + "\n");
}
</script>
<!--<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#ModalMarkersForm">
Markers
</button>-->
<!-- Modal HTML Markup -->
<div id="ModalMarkersForm" class="modal fade">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title">Markers</h1>
</div>
<div class="modal-body">
<form role="form" method="POST" action="">
<input type="hidden" name="_token" value="">
<div class="form-group">
<label class="control-label">Enter one set RA,DEC[,Id] per line in the text area.</label>
<div>
<textarea class="form-control" rows="5" id="text_of_markers"></textarea>
</div>
</div>
<div class="form-group">
<div>
<button type="button" class="btn btn-success" id="parse_text_of_markers">Check</button>
</div>
</div>
<div class="form-group">
<div>
<button type="button" class="btn btn-success" id="clear_markers">Clear</button>
</div>
</div>
<div class="form-group">
<div>
<button type="button" class="btn btn-success" id="refresh_markers_display">Refresh display</button>
</div>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
Supports Markdown
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