diff --git a/js/speccy.js b/js/speccy.js index ce292811b375c030a0d8f976e64c0a46979c6491..1decb9f7351aaa30f48a0ec134bd439e4a8d757b 100644 --- a/js/speccy.js +++ b/js/speccy.js @@ -512,6 +512,10 @@ function plotData() { var xsize = canvas.width; var ysize = canvas.height; + ctx.fillStyle = "white"; + ctx.rect(0, 0, canvas.width, canvas.height); + ctx.fill(); + ctx.stroke(); ctx.font = "14px Arial"; ctx.textAlign="center"; @@ -521,9 +525,6 @@ function plotData() { var dx2_inv = (xsize-padx)*(1.+znow)/(x1-x0); // ctx.clearRect (0 ,0,canvas.width, canvas.height); - ctx.fillStyle = "white"; - ctx.rect(0, 0, canvas.width, canvas.height); - ctx.fill(); ctx.fillStyle = "black"; ctx.strokeStyle = "#000000"; @@ -1111,7 +1112,11 @@ function writePipeInfo(){ { switch (keynames[i]) { case "PLATE": document.getElementById("pipeParams_PLATE" ).innerHTML = keyvals[i]; break; - case "MJD": document.getElementById("pipeParams_MJD" ).innerHTML = keyvals[i]; break; + case "MJD": + var el = document.getElementById("pipeParams_MJD"); + el.innerHTML = keyvals[i]; + el.title = convertMJDtoDate(keyvals[i]).toISOString().split('T')[0]; + break; case "FIBERID": document.getElementById("pipeParams_FIBERID" ).innerHTML = keyvals[i]; break; case "RUN2D": document.getElementById("pipeParams_RUN2D" ).innerHTML = keyvals[i]; break; case "PLUG_RA": document.getElementById("pipeParams_PLUG_RA" ).innerHTML = keyvals[i]; ra = Number(keyvals[i]); break; @@ -1245,7 +1250,10 @@ document.body.addEventListener('mousedown', function (evt){ String.fromCharCode(955,8338), String.fromCharCode(955,7523), String.fromCharCode(955), lobs,String.fromCharCode(8491),lrest,String.fromCharCode(8491),flux, String.fromCharCode(215)+"10"+String.fromCharCode(8315,185,8311)+" erg cm"+String.fromCharCode(8315,178) +" s"+ String.fromCharCode(8315,185) + " " + String.fromCharCode(8491,8315,185), AB); - ctx.clearRect (xsize-47.*padx2, ysize-0.6*pady, xsize, ysize); +// ctx.clearRect (xsize-47.*padx2, ysize-0.6*pady, xsize, ysize); + ctx.fillStyle = "white"; + ctx.fillRect (xsize-47.*padx2, ysize-0.6*pady, xsize, ysize); + ctx.fillStyle = "black"; ctx.fillText(str, xsize-23.*padx2, ysize-0.2*pady); } } @@ -1324,3 +1332,19 @@ function downloadPng(){ document.getElementById("downloader").href = document.getElementById("myCanvas").toDataURL("image/png").replace(/^data:image\/[^;]/, 'data:application/octet-stream'); } + +// from https://github.com/stevebest/julian +function convertJDtoDate(jd) { + const DAY_IN_MS = 86400000; + const UNIX_EPOCH_JULIAN_DATE = 2440587.5; + return new Date((Number(jd) - UNIX_EPOCH_JULIAN_DATE) * DAY_IN_MS); +}; + +function convertMJDtoDate(mjd) { + const DAY_IN_MS = 86400000; + const UNIX_EPOCH_JULIAN_DATE = 2440587.5; + const MJD_TO_JD = 2400000.5; + return new Date((Number(mjd) + MJD_TO_JD - UNIX_EPOCH_JULIAN_DATE) * DAY_IN_MS); +}; + + diff --git a/speccy.html b/speccy.html index 0171099ab480c41ad6951693e6e98a49f0ebf6cf..e02e75ce115f409cd71b044604f33823a3021f2c 100644 --- a/speccy.html +++ b/speccy.html @@ -199,7 +199,7 @@ <label title="High level of certainty for both redshift and classification"><input type="radio" name="z_conf_person" onchange="writeVIinfo()" value="3" checked>3</label> <label title="Uncertain redshift, certain classification" ><input type="radio" name="z_conf_person" onchange="writeVIinfo()" value="2" >2</label> <label title="Uncertain redshift and classification" ><input type="radio" name="z_conf_person" onchange="writeVIinfo()" value="1" >1</label> - <label title="No inspection, Bad, Unplugged etc" ><input type="radio" name="z_conf_person" onchange="writeVIinfo()" value="0" >0 (No Vote)</label> + <label title="No vote" ><input type="radio" name="z_conf_person" onchange="writeVIinfo()" value="0" >0</label> </td> @@ -226,7 +226,7 @@ CLASS_PERSON: </td> <td colspan="1"> - <input type="radio" name="class_person" onchange="writeVIinfo()" value="NONE" >NONE + <input type="radio" name="class_person" onchange="writeVIinfo()" value="NONE" title="No vote (0), Bad spectrum (1), No signal (2), Continuum only (3)" >NONE <input type="radio" name="class_person" onchange="writeVIinfo()" value="STAR" id="class_person_star" >STAR <input type="radio" name="class_person" onchange="writeVIinfo()" value="GALAXY" id="class_person_galaxy">GALAXY <input type="radio" name="class_person" onchange="writeVIinfo()" value="QSO" id="class_person_qso" >QSO @@ -296,35 +296,36 @@ <p id="inspectInBrowser"></p> -<a href="#" id="downloader" onclick="downloadPng()" download="spectrum.png"><button type="button">Download as png</button></a> +<a href="#" id="downloader" onclick="downloadPng()" download="spectrum.png"><button type="button">Save current view as as .png</button></a> <hr> <h4>Usage:</h4> <p><blockquote><samp>http://erosita-bhm.mpe.mpg.de/speccy/speccy.html?specfile={URL}</samp></blockquote> (substitute URL of a valid speccy file)<br> - * The cursor (arrow) keys move the template in redshift and normalisation<br> - * To zoom into a region: click and hold the right mouse button at one corner of the region of interest, - then drag the pointer to the opposite corner of the region where you then release the right button - (visual feedback is not yet available). <br> - * Left-clicking the button displayes the coordinates of the pointer position at the time of the click. <br> - * Please send comments, complaints and suggestions to <a href="mailto:dwelly@mpe.mpg.de">dwelly@mpe.mpg.de</a>. + + <ul> + <li>The cursor (arrow) keys move the template in redshift and normalisation</li> + <li>To zoom into a region: click and hold the right mouse button at one corner of the region of interest, + then drag the pointer to the opposite corner of the region where you then release the right button + (visual feedback is not yet available). </li> + <li> Left-clicking the button displays the coordinates of the pointer position at the time of the click in the bottom right hand of the spectrum plot. </li> + <li> Plots of the current spectral view can be saved directly as .png files using the 'Save current view as as .png' button. </li> + <li> Please send comments, complaints and suggestions to <a href="mailto:dwelly@mpe.mpg.de">dwelly@mpe.mpg.de</a></li> </p> <h4>Speccy File format:</h4> <p> - These are plain ASCII text files.<br> - Header entries are prefixed by a hash and contain "key = value" pairs.<br> - Main body should contain five comma-separated columns + Speccy expects plain ASCII text files as input.<br> + Header entries are prefixed by a hash and contain "key = value" pairs. e.g. '# PLATE = 1234'<br> + The main body of the speccy file should contain five comma-separated columns (with all fluxes in units 10<sup>-17</sup> erg cm<sup>-2</sup> s<sup>-1</sup> Å<sup>-1</sup>): </p> <blockquote><samp>Observed Vacuum Wavelength (Å), Flux, FluxError, SkyFlux, ModelFlux</samp></blockquote> <p> - Template files should contain just two comma-separated columns: + Template files must contain two comma-separated columns: </p> <blockquote><samp>Rest-frame Vacuum Wavelength (Å), ModelFlux (F<sub>λ</sub>)</samp></blockquote> -<p> - Here is a script that can be used to convert a plateful of eBOSS spectra from "spPlate*"+"spZbest*"+"spZall*" format into speccy format:<br> - <a href="http://www.mpe.mpg.de/~tdwelly/speccy/convert_sdss_plate_to_speccy.csh"> convert_sdss_plate_to_speccy.csh</a> -</p> + +<p> Note. Therefore a normal Speccy spectrum file can be used as a template</p> <hr> @@ -386,6 +387,7 @@ <hr> <h4>Emission/absorption line list:</h4> +These are the lines that are plotted over the spectra. <table id="tableLinelist"> <tr> <th>Line Name</th>