Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tom Dwelly
speccy
Commits
5686af9b
Commit
5686af9b
authored
Jul 08, 2021
by
Tom Dwelly
Browse files
Now switching on spectrum type (SDSS-IV or SDSS-V)
parent
b3436058
Changes
4
Hide whitespace changes
Inline
Side-by-side
js/speccy.js
View file @
5686af9b
...
...
@@ -2,7 +2,7 @@
@licstart The following is the entire license notice for the
JavaScript code in this page.
Copyright (C) 2015
,
201
6
Tom Dwelly
Copyright (C) 2015
-
20
2
1 Tom Dwelly
The JavaScript code in this page is free software: you can
redistribute it and/or modify it under the terms of the GNU
...
...
@@ -36,7 +36,7 @@ var specfile = "";
//var submit_button = 0;
var
submit_button
=
1
;
//var submit_php = 'http://erosita-bhm.mpe.mpg.de/efeds_vi/receive_vi.php';
var
submit_php
=
'
../efeds_vi/receive_vi.php
'
;
var
submit_php
=
'
../efeds_vi/receive_vi.php
'
;
// TODO
var
lambdaArray
=
[];
var
fluxArray
=
[];
var
fluxerrArray
=
[];
...
...
@@ -55,6 +55,8 @@ var padx1 = 50;
var
padx2
=
10
;
var
padx
=
padx1
+
padx2
;
var
pady
=
50
;
var
mode
=
"
SDSS4
"
;
var
specfile_slug
=
""
;
//var xsize = canvas.width;
//var ysize = canvas.height;
...
...
@@ -168,6 +170,38 @@ canvas.oncontextmenu = function() {
return
false
;
}
function
interpSpecfileUrl
(
url
){
if
(
url
.
match
(
"
sdssv_vi
"
)
)
{
// TODO make this more robust - switch on MJD?
mode
=
"
SDSS5
"
;
}
// get the tail of the specfile filename and save it
const
temp
=
url
.
split
(
"
/
"
);
const
temp2
=
temp
[
temp
.
length
-
1
].
split
(
"
.
"
);
//console.log(url);
//console.log(temp2[0]);
specfile_slug
=
temp2
[
0
];
}
function
updateFromMode
(
)
{
if
(
mode
==
"
SDSS5
"
)
{
var
el
=
document
.
getElementById
(
"
th_plate
"
);
el
.
setAttribute
(
"
title
"
,
"
SDSS-V Field ID
"
);
el
.
innerHTML
=
"
Field
"
;
var
el
=
document
.
getElementById
(
"
th_fiberid
"
);
el
.
setAttribute
(
"
title
"
,
"
SDSS-V Catalogid
"
);
el
.
innerHTML
=
"
Catalogid
"
;
var
el
=
document
.
getElementById
(
"
th_target_bitmask
"
);
el
.
setAttribute
(
"
title
"
,
"
SDSS-V SDSSV_BOSS_TARGET0 targeting bitmask
"
);
el
.
innerHTML
=
"
SDSSV_BOSS_TARGET0
"
;
submit_php
=
'
../sdssv_vi/receive_vi.php
'
;
}
}
function
startUpTasks
()
{
interpURL
();
...
...
@@ -201,6 +235,8 @@ function interpURL ()
var
str
=
par_name
+
"
=
"
+
par_val
;
if
(
par_name
==
"
SPECFILE
"
)
{
specfile
=
par_val
;
var
mode
=
interpSpecfileUrl
(
specfile
);
// this allows switching between SDSS-IV and -V views
updateFromMode
(
mode
);
}
else
if
(
par_name
==
"
Z
"
)
{
//control the initial redshift that the model is plotted at
znow
=
Number
(
par_val
);
...
...
@@ -664,15 +700,17 @@ function plotData() {
// write the plate-mjd-fiberid in the top left hand corner
{
var
plate
=
parseInt
(
document
.
getElementById
(
"
pipeParams_PLATE
"
).
innerHTML
);
var
mjd
=
parseInt
(
document
.
getElementById
(
"
pipeParams_MJD
"
).
innerHTML
);
var
fiberid
=
parseInt
(
document
.
getElementById
(
"
pipeParams_FIBERID
"
).
innerHTML
);
var
run2d
=
document
.
getElementById
(
"
pipeParams_RUN2D
"
).
innerHTML
;
var
str_plate
=
(
plate
<
10000
?
(
"
0000
"
+
plate
).
slice
(
-
4
)
:
(
"
00000
"
+
plate
).
slice
(
-
5
));
// var plate = parseInt(document.getElementById("pipeParams_PLATE").innerHTML);
// var mjd = parseInt(document.getElementById("pipeParams_MJD").innerHTML);
// var fiberid = parseInt(document.getElementById("pipeParams_FIBERID").innerHTML);
var
run2d
=
keyvals
[
keynames
.
indexOf
(
'
RUN2D
'
)];
// var run2d = document.getElementById("pipeParams_RUN2D").innerHTML;
// var str_plate = (plate < 10000 ? ("0000" + plate).slice(-4) : ("00000" + plate).slice(-5));
ctx
.
font
=
"
18px Arial
"
;
ctx
.
textAlign
=
"
left
"
;
ctx
.
beginPath
();
var
str_label
=
str_plate
+
"
-
"
+
mjd
+
"
-
"
+
(
"
0000
"
+
fiberid
).
slice
(
-
4
)
+
"
(
"
+
run2d
+
"
)
"
;
//var str_label = str_plate + "-" + mjd + "-" + ("0000" + fiberid).slice(-4) + " (" + run2d + ")";
var
str_label
=
specfile_slug
.
replace
(
'
spec-
'
,
''
)
+
"
(
"
+
run2d
+
"
)
"
;
ctx
.
fillText
(
str_label
,
5.0
+
xsize
*
0.005
,
10.0
+
ysize
*
0.01
);
ctx
.
stroke
();
ctx
.
closePath
();
...
...
@@ -1006,6 +1044,9 @@ function submitVIinfo(){
var
is_interesting
=
$
(
'
#isInteresting
'
).
is
(
"
:checked
"
);
var
run1d
=
"
-
"
;
var
run2d
=
"
-
"
;
var
field
=
'
-
'
;
// new for SDSS-V
var
designid
=
'
-
'
;
var
catalogid
=
'
-
'
;
for
(
var
i
=
0
;
i
<
nkeys
;
i
++
)
{
switch
(
keynames
[
i
])
{
...
...
@@ -1017,6 +1058,10 @@ function submitVIinfo(){
case
"
Z
"
:
zpipe
=
keyvals
[
i
];
break
;
case
"
RUN1D
"
:
run1d
=
keyvals
[
i
];
break
;
case
"
RUN2D
"
:
run2d
=
keyvals
[
i
];
break
;
case
"
FIELD
"
:
field
=
keyvals
[
i
];
break
;
case
"
DESIGNID
"
:
designid
=
keyvals
[
i
];
break
;
case
"
CATALOGID
"
:
catalogid
=
keyvals
[
i
];
break
;
}
}
...
...
@@ -1041,6 +1086,9 @@ function submitVIinfo(){
FD
.
append
(
"
RUN2D
"
,
run2d
);
FD
.
append
(
"
ISINTERESTING
"
,
is_interesting
);
FD
.
append
(
"
ISBLAGN
"
,
is_blagn
);
FD
.
append
(
"
FIELD
"
,
field
);
FD
.
append
(
"
DESIGNID
"
,
designid
);
FD
.
append
(
"
CATALOGID
"
,
catalogid
);
// // -----------------------------
...
...
@@ -1098,6 +1146,9 @@ function writeVIinfo(){
var
is_interesting
=
$
(
'
#isInteresting
'
).
is
(
"
:checked
"
);
var
str_is_blagn
=
""
;
var
str_is_interesting
=
""
;
var
field
=
-
1
;
// new for SDSS-V
var
designid
=
0
;
var
catalogid
=
0
;
// console.log(is_blagn);
// console.log(is_interesting);
...
...
@@ -1111,13 +1162,17 @@ function writeVIinfo(){
case
"
PLUG_RA
"
:
ra
=
keyvals
[
i
];
break
;
case
"
PLUG_DEC
"
:
dec
=
keyvals
[
i
];
break
;
case
"
Z
"
:
zpipe
=
keyvals
[
i
];
break
;
case
"
FIELD
"
:
field
=
keyvals
[
i
];
break
;
case
"
DESIGNID
"
:
designid
=
keyvals
[
i
];
break
;
case
"
CATALOGID
"
:
catlogid
=
keyvals
[
i
];
break
;
}
}
if
(
is_blagn
==
true
)
{
str_is_blagn
=
"
BLAGN!
"
;}
if
(
is_interesting
==
true
)
{
str_is_interesting
=
"
Interesting!
"
;}
str
=
sprintf
(
"
SDSSOBJECT %5d %5d %4d %12.7f %12.7f %10s %.7g %3s
\"
%8s
\"
\"
%s
\"
\"
%s
\"
%s%s
\n
"
,
str
=
sprintf
(
"
SDSSOBJECT %5d %5d %4d %12.7f %12.7f %10s %.7g %3s
\"
%8s
\"
\"
%s
\"
\"
%s
\"
%s%s
\n
%d %d %011d
"
,
plate
,
mjd
,
fiberid
,
ra
,
dec
,
zpipe
,
znow
,
z_conf_person
,
class_person
,
issue
,
comments
,
str_is_blagn
,
str_is_interesting
);
class_person
,
issue
,
comments
,
str_is_blagn
,
str_is_interesting
,
field
,
designid
,
catalogid
);
outbox
.
value
=
str
;
}
...
...
@@ -1131,16 +1186,16 @@ function writePipeInfo(){
for
(
var
i
=
0
;
i
<
nkeys
;
i
++
)
{
switch
(
keynames
[
i
])
{
case
"
PLATE
"
:
document
.
getElementById
(
"
pipeParams_PLATE
"
).
innerHTML
=
keyvals
[
i
];
break
;
case
"
PLATE
"
:
if
(
mode
==
"
SDSS4
"
)
{
document
.
getElementById
(
"
pipeParams_PLATE
"
).
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
"
FIBERID
"
:
if
(
mode
==
"
SDSS4
"
)
{
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
;
case
"
PLUG_DEC
"
:
document
.
getElementById
(
"
pipeParams_PLUG_DEC
"
).
innerHTML
=
keyvals
[
i
];
dec
=
Number
(
keyvals
[
i
]
);
break
;
case
"
PLUG_RA
"
:
ra
=
Number
.
parseFloat
(
keyvals
[
i
]);
document
.
getElementById
(
"
pipeParams_PLUG_RA
"
).
innerHTML
=
ra
.
toFixed
(
7
);
break
;
case
"
PLUG_DEC
"
:
dec
=
Number
.
parseFloat
(
keyvals
[
i
]);
document
.
getElementById
(
"
pipeParams_PLUG_DEC
"
).
innerHTML
=
dec
.
toFixed
(
6
);
break
;
case
"
Z
"
:
document
.
getElementById
(
"
pipeParams_Z
"
).
innerHTML
=
precise
(
keyvals
[
i
],
7
);
break
;
case
"
Z_ERR
"
:
document
.
getElementById
(
"
pipeParams_Z_ERR
"
).
innerHTML
=
precise
(
keyvals
[
i
],
3
);
break
;
case
"
CLASS
"
:
document
.
getElementById
(
"
pipeParams_CLASS
"
).
innerHTML
=
keyvals
[
i
];
break
;
...
...
@@ -1151,9 +1206,19 @@ function writePipeInfo(){
keyvals
[
i
],
keyvals
[
i
]);
document
.
getElementById
(
"
pipeParams_ZWARNING
"
).
innerHTML
=
str
;
break
;
case
"
EBOSS_TARGET1
"
:
var
str
=
sprintf
(
"
<a href='../bitmask_decoder/sdss_bitmask_decoder.html?EBOSS_TARGET1=%s' target=_blank title='decode the EBOSS_TARGET1 flag'>%s</a>
"
,
keyvals
[
i
],
keyvals
[
i
]);
document
.
getElementById
(
"
pipeParams_EBOSS_TARGET1
"
).
innerHTML
=
str
;
break
;
if
(
mode
==
"
SDSS4
"
)
{
var
str
=
sprintf
(
"
<a href='../bitmask_decoder/sdss_bitmask_decoder.html?EBOSS_TARGET1=%s' target=_blank title='decode the EBOSS_TARGET1 flag'>%s</a>
"
,
keyvals
[
i
],
keyvals
[
i
]);
document
.
getElementById
(
"
pipeParams_TARGET_BITMASK
"
).
innerHTML
=
str
;
}
break
;
case
"
SDSSV_BOSS_TARGET0
"
:
if
(
mode
==
"
SDSS5
"
)
{
var
str
=
sprintf
(
"
<a href='../bitmask_decoder/sdss_bitmask_decoder.html?SDSSV_BOSS_TARGET0=%s' target=_blank title='decode the SDSSV_BOSS_TARGET0 flag'>%s</a>
"
,
keyvals
[
i
],
keyvals
[
i
]);
document
.
getElementById
(
"
pipeParams_TARGET_BITMASK
"
).
innerHTML
=
str
;
}
break
;
case
"
FIELD
"
:
if
(
mode
==
"
SDSS5
"
)
{
document
.
getElementById
(
"
pipeParams_PLATE
"
).
innerHTML
=
keyvals
[
i
]};
break
;
case
"
CATALOGID
"
:
if
(
mode
==
"
SDSS5
"
)
{
document
.
getElementById
(
"
pipeParams_FIBERID
"
).
innerHTML
=
keyvals
[
i
]};
break
;
}
}
...
...
@@ -1346,11 +1411,12 @@ function writeLineListTable(linelist){
}
function
downloadPng
(){
var
plate
=
parseInt
(
document
.
getElementById
(
"
pipeParams_PLATE
"
).
innerHTML
);
var
mjd
=
parseInt
(
document
.
getElementById
(
"
pipeParams_MJD
"
).
innerHTML
);
var
fiberid
=
parseInt
(
document
.
getElementById
(
"
pipeParams_FIBERID
"
).
innerHTML
);
var
str_plate
=
(
plate
<
10000
?
(
"
0000
"
+
plate
).
slice
(
-
4
)
:
(
"
00000
"
+
plate
).
slice
(
-
5
));
document
.
getElementById
(
"
downloader
"
).
download
=
"
spec-
"
+
str_plate
+
"
-
"
+
mjd
+
"
-
"
+
(
"
0000
"
+
fiberid
).
slice
(
-
4
)
+
"
.png
"
;
// var plate = parseInt(document.getElementById("pipeParams_PLATE").innerHTML);
// var mjd = parseInt(document.getElementById("pipeParams_MJD").innerHTML);
// var fiberid = parseInt(document.getElementById("pipeParams_FIBERID").innerHTML);
// var str_plate = (plate < 10000 ? ("0000" + plate).slice(-4) : ("00000" + plate).slice(-5));
//document.getElementById("downloader").download = "spec-" + str_plate + "-" + mjd + "-" + ("0000" + fiberid).slice(-4) + ".png";
document
.
getElementById
(
"
downloader
"
).
download
=
specfile_slug
+
"
.png
"
;
document
.
getElementById
(
"
downloader
"
).
href
=
document
.
getElementById
(
"
myCanvas
"
).
toDataURL
(
"
image/png
"
).
replace
(
/^data:image
\/[^
;
]
/
,
'
data:application/octet-stream
'
);
}
...
...
speccy-32x32.png
0 → 100644
View file @
5686af9b
893 Bytes
speccy.html
View file @
5686af9b
<!DOCTYPE html>
<html>
<head>
<title>
Speccy - A dynamic spectrum+template viewer
</title>
<meta
charset=
"UTF-8"
>
<meta
name=
'description'
content=
'Speccy - A dynamic spectrum+template viewer'
/>
<script
type=
"text/javascript"
>
<head>
<title>
Speccy - A dynamic spectrum+template viewer
</title>
<meta
charset=
"UTF-8"
>
<meta
name=
'description'
content=
'Speccy - A dynamic spectrum+template viewer'
/>
<link
rel=
"icon"
type=
"image/png"
sizes=
"32x32"
href=
"speccy-32x32.png"
>
<script
type=
"text/javascript"
>
/*
@licstart The following is the entire license notice for the
JavaScript code in this page.
Copyright (C) 2015
,
201
6
Tom Dwelly
Copyright (C) 2015
-
20
2
1 Tom Dwelly
The JavaScript code in this page is free software: you can
redistribute it and/or modify it under the terms of the GNU
...
...
@@ -29,34 +29,32 @@
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this page.
*/
</script>
<script
src=
"js/jquery-latest.js"
type=
"text/javascript"
></script>
<script
src=
"js/sprintf.js"
type=
"text/javascript"
></script>
<script
src=
"js/fits.js"
type=
"text/javascript"
charset=
"utf-8"
></script>
<style
type=
'text/css'
>
label
{
white-space
:
nowrap
}
pre
{
font-family
:
Courier
,
monospace
;
font-size
:
12px
;
margin
:
0
;
padding
:
0
;
}
table
,
td
,
th
{
padding
:
2px
;
border-collapse
:
collapse
;
border
:
1px
solid
gray
;
}
</style>
</head>
</script>
<script
src=
"js/jquery-latest.js"
type=
"text/javascript"
></script>
<script
src=
"js/sprintf.js"
type=
"text/javascript"
></script>
<script
src=
"js/fits.js"
type=
"text/javascript"
charset=
"utf-8"
></script>
<style
type=
'text/css'
>
label
{
white-space
:
nowrap
}
pre
{
font-family
:
Courier
,
monospace
;
font-size
:
12px
;
margin
:
0
;
padding
:
0
;
}
table
,
td
,
th
{
padding
:
2px
;
border-collapse
:
collapse
;
border
:
1px
solid
gray
;
}
</style>
</head>
<body
onload=
"startUpTasks()"
onresize=
"plotData();"
>
<table>
...
...
@@ -72,19 +70,19 @@
<td
colspan=
"4"
>
<table
title=
"SDSS pipeline parameters"
style=
"padding:3px;"
>
<tr>
<th
title=
"SDSS Plate index"
>
Plate
</th>
<th
title=
"MJD when this
plate
was last observed"
>
MJD
</th>
<th
title=
"SDSS fiber index"
>
FiberID
</th>
<th
title=
"SDSS Plate index"
id=
"th_plate"
>
Plate
</th>
<th
title=
"MJD when this
spectrum
was last observed"
>
MJD
</th>
<th
title=
"SDSS fiber index"
id=
"th_fiberid"
>
FiberID
</th>
<th
title=
"SDSS 'RUN2D/VERS2D' pipeline version"
>
RUN2D
</th>
<th
title=
"Right Ascension of plugged fiber (deg
, J2000
)"
>
RA
<sub>
plug
</sub></th>
<th
title=
"Declination of plugged fiber (deg
, J2000
)"
>
Dec
<sub>
plug
</sub></th>
<th
title=
"Right Ascension of plugged fiber (deg)"
>
RA
<sub>
plug
</sub></th>
<th
title=
"Declination of plugged fiber (deg)"
>
Dec
<sub>
plug
</sub></th>
<th
title=
"SDSS 1D pipeline redshift"
>
Z
<sub>
pipe
</sub></th>
<th
title=
"SDSS 1D pipeline redshift uncertainty"
>
σ
<sub>
Z
</sub></th>
<th
title=
"SDSS 1D pipeline redshift warning flags"
>
Z
<sub>
warning
</sub></th>
<th
title=
"SDSS 1D pipeline template spectral class"
>
Class
</th>
<th
title=
"SDSS 1D pipeline template spectral sub-class"
>
Subclass
</th>
<th
title=
"SDSS SN_MEDIAN_ALL metric"
>
SNR
</th>
<th
title=
"SDSS EBOSS_TARGET1 bitmask"
>
EBOSS_TARGET1
</th>
<th
title=
"SDSS EBOSS_TARGET1 bitmask"
id=
"th_target_bitmask"
>
EBOSS_TARGET1
</th>
<th>
Links
</th>
</tr>
<tr>
...
...
@@ -100,7 +98,7 @@
<td
id=
"pipeParams_CLASS"
></td>
<td
id=
"pipeParams_SUBCLASS"
></td>
<td
id=
"pipeParams_SN_MEDIAN_ALL"
></td>
<td
id=
"pipeParams_
EBOSS_TARGET1
"
></td>
<td
id=
"pipeParams_
TARGET_BITMASK
"
></td>
<td
id=
"pipeParams_links"
></td>
</tr>
</table>
...
...
speccy.png
0 → 100644
View file @
5686af9b
10.9 KB
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment