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

add the project yafitsv and create docker-compose to stablish the communication

parent 6d151dc0
node_modules
npm-debug.log
# Git
.git
.gitignore
version: '3'
services:
yafitsv:
build: ./yafitsv
ports:
- "3021:3000"
volumes:
- "/datartemix/ALMA:/home/partemix/dataroot"
- "/obs/partemix/dckr/yafitsv/log:/home/partemix/log"
environment:
- PORT=3000
command: ./yafitsv/bin/www
links:
- yafitss
yafitss:
build: ./yafitss
ports:
- "4251:4251"
volumes:
- "/datartemix/ALMA:/home/partemix/dataroot"
- "/obs/partemix/dckr/yafitss/log:/home/partemix/log"
command: python ./yafitss/serverWsgi.michel.py --port 4251
tty: true
......@@ -79,14 +79,14 @@ RUN mkdir /home/partemix/log
RUN mkdir -p /home/partemix/yafitss
# Put the application files and module requirements in place.
COPY ./yafitss/serverWsgi.michel.py /home/partemix/yafitss
COPY ./yafitss/dataManager_michel.py /home/partemix/yafitss
COPY ./yafitss/requirements.txt /home/partemix/yafitss
COPY ./serverWsgi.michel.py /home/partemix/yafitss
COPY ./dataManager_michel.py /home/partemix/yafitss
COPY ./requirements.txt /home/partemix/yafitss
# python modules required by yafitss have to be installed
RUN pip install -r /home/partemix/yafitss/requirements.txt
# ./yafitss/serverWsgi.michel will be listening at 4250
EXPOSE 4250
# ./yafitss/serverWsgi.michel will be listening at 4251
EXPOSE 4251
......@@ -549,7 +549,7 @@ def main(argv):
print ("Bad command")
sys.exit(2)
port = 4250
port = 4251
for opt, arg in opts:
if opt in ('-p', '--port'):
port = int(arg)
......
node_modules/**
public/*.fits
nohup.out
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
# The version of nodejs
FROM node:9
WORKDIR /home/partemix/
COPY ./package*.json /home/partemix/yafitsv/
RUN npm install
#------------------------------------------------------------#
# #
# partemix related stuff #
# #
#------------------------------------------------------------#
# Create some directories expected by the application.
# The root directory of the PNG files (read/write). It'll have to be bound to an host directory.
RUN mkdir -p /home/partemix/dataroot/PNG
# The directory for log files (read/write). It'll have to be bound to an host directory.
RUN mkdir /home/partemix/log
#create link for the server PNG directory
RUN ln -sf /home/partemix/dataroot/PNG /home/partemix/yafitsv/png
# copy app source to image _after_ npm install so that
# application code changes don't bust the docker cache of npm install step
COPY . /home/partemix/yafitsv/
EXPOSE 3000
%% Cell type:code id: tags:
``` python
import png
import h5py
```
%% Cell type:code id: tags:
``` python
```
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var index = require('./routes/index');
var users = require('./routes/users');
var olqv = require('./routes/olqv');
var fitsBrowser = require('./routes/fitsBrowser');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'png')));
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
//app.use("/", index);
app.use('/browse', fitsBrowser);
app.use('/browse/getEntries', fitsBrowser);
app.use('/visit', olqv);
app.use('/users', users);
app.use('/', olqv);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
res.status(err.status || 500);
res.render('error');
});
console.log("Ready to serve!");
module.exports = app;
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('testpolymaps:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
This diff is collapsed.
{
"name": "testpolymaps",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.18.2",
"cookie-parser": "~1.4.3",
"debug": "~2.6.9",
"ejs": "~2.5.7",
"express": "~4.15.5",
"fs": "0.0.1-security",
"morgan": "~1.9.0",
"node-png": "^0.4.3",
"request": "^2.88.0",
"serve-favicon": "~2.4.5",
"uuid": "^3.3.2"
}
}
<hr>
Welcome to the collection of public FITS files copied from the ALMA Science Archive and hosted by the <a href="http://artemix.obspm.fr" target="_blank">ARTEMIX project</a>.
<hr>
/*
** A class to build an HTML table containing the header of a FITS table presented in certain way
** and control its visibility.
**
** @itsDIV the div which will contain the FITS header table.
** @itsFITSHeaders a dictionary Key:Value containing the FITS header.
**
*/
function ENTER(msg) {
console.log(msg + " : entering");
};
function EXIT(msg) {
console.log(msg + " : exiting");
};
/*
** The constructor.
** Expects two parameters :
**
** @itsDIV a reference to a div which will contain the tabular presentation of the FITS header.
** @itsFITSHeader a reference to the FITS Header to be displayed.
*/
function FITSHeaderTable( itsDIV, itsFITSHeader ) {
ENTER("function FITSHeaderTable( itsDIV, itsFITSHeader )");
itsDIV.id="FITSHeaderWrapper";
itsDIV.class="overlay";
itsDIV.style="overflow:scroll";
let _innerHTML = "<a href=\"javascript:void(0)\" class=\"closebtn\" id=\"hideFITSHEADER\" >&times;</a>";
_innerHTML += "<div class=\"overlay-content\">";
_innerHTML += "<div id=\"FITSHeaderParent\">";
_innerHTML += "<div id=\"FITSHeaderTable\" class=\"scrollWrapper\">";
_innerHTML += "<table></table>";
_innerHTML += "</div";
_innerHTML += "</div";
_innerHTML += "</div";
itsDIV.innerHTML = _innerHTML;
this.show = function() {
_show();
};
var _show = function() {
itsDIV.style.height = "100%";
};
this.hide = function() {
_hide();
};
var _hide = function() {
itsDIV.style.height = "0%";
}
$("#hideFITSHEADER").click(function(e) {_hide();});
let _historyKeywords_ = ["DATE", "ORIGIN", "BLOCKED"];
let _describingObservationKeywords_ = ["DATE-OBS","TELESCOP", "INSTRUME", "OBSERVER", "EQUINOX","EPOCH"];
let _mandatoryKeywords_ = ["SIMPLE", "BITPIX", "NAXIS", "NAXIS1", "NAXIS2", "NAXIS3", "NAXIS4"];
let _beamSizeKeywords_ = ["BMIN", "BMAJ", "BPA"];
let _restFrqKeywords_ = ["RESTFRQ"];
let _arrayKeywords_ = ["BSCALE", "BZERO", "BUNIT", "BLANK", "CTYPE1", "CTYPE2", "CTYPE3", "CTYPE4", "CRPIX1", "CRPIX2", "CRPIX3", "CRPIX4", "CRVAL1", "CRVAL2", "CRVAL3", "CRVAL4", "CDELT1", "CDELT2", "CDELT3", "CDELT4", "CROTA1", "CROTA2", "CROTA3", "CROTA3", "CUNIT1", "CUNIT2", "CUNIT3", "CUNIT4", "DATAMIN", "DATAMAX"];
let _obsGeoKeywords_ = ["OBSGEO-X", "OBSGEO-Y", "OBSGEO-Z", "OBSRA", "OBSDEC"];
let _keywordsByRegex = function(header, re) {
var kw, result = [];
for (kw in header) {
if (kw.match(re) && header.hasOwnProperty(kw)) {
result[result.length] = kw;
}
}
return result.sort();
}
let _extractKeywords = function(keywords, header) {
var result=[];
for (var mk in keywords) {
if (keywords[mk] in header) {
result[keywords[mk]] = header[keywords[mk]];
delete header[keywords[mk]];
}
}
return result.sort();
}
let _populate = function (h) {
var t = $('#FITSHeaderTable > table');
t.empty();
t.append('<tr><td><span>OBJECT: ' + h["OBJECT"] + '</span></td></tr>');
t.append('<tr><td>--------</td><td>----------</td></tr>');
/* History keywords */
var mks = _extractKeywords(_historyKeywords_, h);
for (var mk in mks) {
t.append('<tr><td><span>' + mk + '</span></td><td><span>' + mks[mk] + '</span></td></tr>');
}
t.append('<tr><td>--------</td><td>----------</td></tr>');
/* describing observation keywords */
var mks = _extractKeywords(_describingObservationKeywords_, h);
for (var mk in mks) {
t.append('<tr><td><span>' + mk + '</span></td><td><span>' + mks[mk] + '</span></td></tr>');
}
t.append('<tr><td>--------</td><td>----------</td></tr>');
/* The rest frequency */
var mks = _extractKeywords(_restFrqKeywords_, h);
for (var mk in mks) {
t.append('<tr><td><span>' + mk + '</span></td><td><span>' + mks[mk] + '</span></td></tr>');
}
t.append('<tr><td>--------</td><td>----------</td></tr>');
/* The mandatory keywords */
var mks = _extractKeywords(_mandatoryKeywords_, h);
for (var mk in mks) {
t.append('<tr><td><span>' + mk + '</span></td><td><span>' + mks[mk] + '</span></td></tr>');
}
t.append('<tr><td>--------</td><td>----------</td></tr>');
/* The beam size keywords */
var mks = _extractKeywords(_beamSizeKeywords_, h);
for (var mk in mks) {
t.append('<tr><td><span>' + mk + '</span></td><td><span>' + mks[mk] + '</span></td></tr>');
}
t.append('<tr><td>--------</td><td>----------</td></tr>');
/* The array keywords */
var mks = _extractKeywords(_arrayKeywords_, h);
for (var mk in mks) {
t.append('<tr><td><span>' + mk + '</span></td><td><span>' + mks[mk] + '</span></td></tr>');
}
t.append('<tr><td>--------</td><td>----------</td></tr>');
/* The geographic location of the observation (m) */
var mks = _extractKeywords(_obsGeoKeywords_, h);
for (var mk in mks) {
t.append('<tr><td><span>' + mk + '</span></td><td><span>' + mks[mk] + '</span></td></tr>');
}
t.append('<tr><td>--------</td><td>----------</td></tr>');
/* The PC keywords */
var PCKeywords = _keywordsByRegex(h, /PC\d\d/);
var mks = _extractKeywords(PCKeywords, h);
for (var mk in mks) {
t.append('<tr><td><span>' + mk + '</span></td><td><span>' + mks[mk] + '</span></td></tr>');
}
t.append('<tr><td>--------</td><td>----------</td></tr>');
/* The rest */
kws=[];
for (var kw in h) {
kws[kws.length] = kw;
}
/* is listed by alphabetical order */
kws = kws.sort();
for (i = 0; i < kws.length; i++) {
t.append('<tr><td><span>' + kws[i] + '</span></td><td><span>' + h[kws[i]] + '</span></td></tr>');
}
}
var hclone = $.extend({}, itsFITSHeader);
_populate(hclone);
EXIT("function FITSHeaderTable( itsDIV, h)");
};
/*
** A set of classes and function definitions utilized by the
** differents flavours of OLQV viewers.
**
** Author : M. Caillat
** Date : 06th December 2018
*/
/*
** A class to convert a right ascension expressed in decimal degree into an integer value expressing a pixel index.
*/
let RADDtoPixelConverter = function(radd0, radd1, rapix0, rapix1) {
console.log("let RADDtoPixelConverter = function(radd0, radd1, rapix0, rapix1) { : entering");
let _radd0 = radd0;
let _rapix0 = rapix0;
let _slope = (rapix1 - rapix0) / (radd1 - radd0);
console.log("_radd0 = " + _radd0 + ", _rapix0 = " + _rapix0);
this.convert = function(radd) {
return _rapix0 + (radd - _radd0) * _slope;
}
console.log("let RADDtoPixelConverter = function(radd0, radd1, rapix0, rapix1) { : exiting");
};
/*
** A class to convert a declination expressed in decimal degree into an integer value expressing a pixel index.
*/
let DECDDtoPixelConverter = function(decdd0, decdd1, decpix0, decpix1) {
let _decdd0 = decdd0;
let _decpix0 = decpix0;
let _slope = (decpix1 - decpix0) / (decdd1 - decdd0);
this.convert = function(decdd) {
return _decpix0 + (decdd - _decdd0) * _slope;
}
};
/*
** 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.toFixed(3);
};
/*
** 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.toFixed(3));
};
/*
** 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))