set url when querying simbad cone search as well

This commit is contained in:
Matthieu Baumann
2024-05-19 17:43:14 +10:00
parent 219761c512
commit 00f7005bce
18 changed files with 167 additions and 132 deletions

View File

@@ -8,8 +8,8 @@
"dateModified": "2023-01-31",
"issueTracker": "https://github.com/cds-astro/aladin-lite/issues",
"name": "Aladin Lite",
"version": "3.4.0-beta",
"softwareVersion": "3.4.0-beta",
"version": "3.4.1-beta",
"softwareVersion": "3.4.1-beta",
"description": "An astronomical HiPS visualizer in the browser.",
"identifier": "10.5281/zenodo.7638833",
"applicationCategory": "Astronomy, Visualization",

View File

@@ -13,6 +13,7 @@
inertia: false,
fov: 1,
showContextMenu: true,
showZoomControl: true,
});
// define custom draw function
@@ -24,12 +25,12 @@
color: "cyan",
hoverColor: "red",
shape: (s) => {
let galaxy = ["Seyfert","Seyfert_1", "Seyfert_2","LSB_G","PartofG","RadioG","Gin","GinPair","HII_G","LensedG","BClG","BlueCompG","EmG","GinCl","GinGroup","StarburstG","LINER","AGN","Galaxy"].some((n) => s.data.main_type.indexOf(n) >= 0);
if (!galaxy) return;
let a = +s.data.size_maj;
let b = +s.data.size_min;
let galaxy = ["Seyfert","Gin","StarburstG","LINER","AGN","Galaxy"].some((n) => s.data.main_type.indexOf(n) >= 0);
if (!galaxy) return;
let theta = +s.data.size_angle || 0.0;
return A.ellipse(s.ra, s.dec, a / 60, b / 60, theta, { color: "cyan" });
},

View File

@@ -21,7 +21,7 @@ var pessto = 'https://archive.eso.org/tap_cat/sync?REQUEST=doQuery&LANG=ADQL&MAX
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: 'https://alasky.cds.unistra.fr/DSS/DSSColor/', target: 'LMC', fov: 5, showContextMenu: true});
aladin = A.aladin('#aladin-lite-div', {survey: 'https://alasky.cds.unistra.fr/DSS/DSSColor/', target: 'LMC', fov: 5, showContextMenu: true, showSettingsControl:true, samp:true});
aladin.addCatalog(A.catalogFromURL('https://vizier.u-strasbg.fr/viz-bin/votable?-source=HIP2&-c=LMC&-out.add=_RAJ,_DEJ&-oc.form=dm&-out.meta=DhuL&-out.max=9999&-c.rm=180', {sourceSize:12, color: '#f08080'}));

View File

@@ -9,69 +9,69 @@
import A from "../src/js/A.js";
let aladin;
A.init.then(() => {
aladin = A.aladin("#aladin-lite-div", {
fullScreen: true,
target: "m51",
fov: 15,
projection: "AIT",
showContextMenu: true,
showShareControl: true,
hipsList: [
// High energy (Gamma and X-rays)
"CDS/P/HGPS/Flux",
"CDS/P/Fermi/5",
"CDS/P/Fermi/4",
"CDS/P/Fermi/3",
"ov-gso/P/Fermi/Band2",
"ov-gso/P/BAT/150-195keV",
"ov-gso/P/BAT/35-50keV",
"ov-gso/P/BAT/14-20keV",
"erosita/dr1/rate/023",
"erosita/dr1/rate/024",
// Uv/Optical/Infrared
"CDS/P/GALEXGR6_7/FUV",
"CDS/P/GALEXGR6_7/NUV",
"CDS/P/DSS2/color",
"CDS/P/PanSTARRS/DR1/g",
"CDS/P/PanSTARRS/DR1/r",
"CDS/P/Finkbeiner",
"CDS/P/PanSTARRS/DR1/i",
"CDS/P/PanSTARRS/DR1/color-i-r-g",
"CDS/P/PanSTARRS/DR1/z",
"CDS/P/PanSTARRS/DR1/y",
"CDS/P/DES-DR2/ColorIRG",
"CDS/P/2MASS/color",
"ov-gso/P/GLIMPSE/irac1",
"ov-gso/P/GLIMPSE/irac2",
"CDS/P/unWISE/color-W2-W1W2-W1",
"ov-gso/P/GLIMPSE/irac3",
"ov-gso/P/GLIMPSE/irac4",
"CDS/P/IRIS/color",
"ESAVO/P/AKARI/N60",
"ESAVO/P/AKARI/WideL",
"ESAVO/P/HERSCHEL/SPIRE-250",
"ESAVO/P/HERSCHEL/SPIRE-350",
"ESAVO/P/HERSCHEL/SPIRE-500",
// sub-mm/mm/radio
"CDS/P/PLANCK/R3/HFI/color",
"CDS/P/ACT_Planck/DR5/f220",
"CDS/P/CO",
"CDS/P/PLANCK/R3/HFI100",
"CDS/P/PLANCK/R3/LFI30",
"CDS/P/NVSS",
"CSIRO/P/RACS/mid/I",
"ov-gso/P/CGPS/VGPS",
"CDS/C/HI4PI/HI",
"CDS/P/MeerKAT/Galactic-Centre-1284MHz-StokesI",
"CSIRO/P/RACS/low/I",
"astron.nl/P/tgssadr",
"ov-gso/P/GLEAM/170-231",
"ov-gso/P/GLEAM/139-170",
"astron.nl/P/lotss_dr2_high",
"ov-gso/P/GLEAM/103-134",
"ov-gso/P/GLEAM/072-103",
],
});
aladin = A.aladin("#aladin-lite-div", {
fullScreen: true,
target: "m51",
fov: 15,
projection: "AIT",
showContextMenu: true,
showShareControl: true,
hipsList: [
// High energy (Gamma and X-rays)
"CDS/P/HGPS/Flux",
"CDS/P/Fermi/5",
"CDS/P/Fermi/4",
"CDS/P/Fermi/3",
"ov-gso/P/Fermi/Band2",
"ov-gso/P/BAT/150-195keV",
"ov-gso/P/BAT/35-50keV",
"ov-gso/P/BAT/14-20keV",
"erosita/dr1/rate/023",
"erosita/dr1/rate/024",
// Uv/Optical/Infrared
"CDS/P/GALEXGR6_7/FUV",
"CDS/P/GALEXGR6_7/NUV",
"CDS/P/DSS2/color",
"CDS/P/PanSTARRS/DR1/g",
"CDS/P/PanSTARRS/DR1/r",
"CDS/P/Finkbeiner",
"CDS/P/PanSTARRS/DR1/i",
"CDS/P/PanSTARRS/DR1/color-i-r-g",
"CDS/P/PanSTARRS/DR1/z",
"CDS/P/PanSTARRS/DR1/y",
"CDS/P/DES-DR2/ColorIRG",
"CDS/P/2MASS/color",
"ov-gso/P/GLIMPSE/irac1",
"ov-gso/P/GLIMPSE/irac2",
"CDS/P/unWISE/color-W2-W1W2-W1",
"ov-gso/P/GLIMPSE/irac3",
"ov-gso/P/GLIMPSE/irac4",
"CDS/P/IRIS/color",
"ESAVO/P/AKARI/N60",
"ESAVO/P/AKARI/WideL",
"ESAVO/P/HERSCHEL/SPIRE-250",
"ESAVO/P/HERSCHEL/SPIRE-350",
"ESAVO/P/HERSCHEL/SPIRE-500",
// sub-mm/mm/radio
"CDS/P/PLANCK/R3/HFI/color",
"CDS/P/ACT_Planck/DR5/f220",
"CDS/P/CO",
"CDS/P/PLANCK/R3/HFI100",
"CDS/P/PLANCK/R3/LFI30",
"CDS/P/NVSS",
"CSIRO/P/RACS/mid/I",
"ov-gso/P/CGPS/VGPS",
"CDS/C/HI4PI/HI",
"CDS/P/MeerKAT/Galactic-Centre-1284MHz-StokesI",
"CSIRO/P/RACS/low/I",
"astron.nl/P/tgssadr",
"ov-gso/P/GLEAM/170-231",
"ov-gso/P/GLEAM/139-170",
"astron.nl/P/lotss_dr2_high",
"ov-gso/P/GLEAM/103-134",
"ov-gso/P/GLEAM/072-103",
],
});
aladin.setImageLayer(A.imageHiPS("P/DSS2/color"));
@@ -81,6 +81,18 @@ aladin = A.aladin("#aladin-lite-div", {
hoverColor: "yellow",
})
);
aladin.addCatalog(
A.catalogFromSKAORucio("0 -30", 15, {
onClick: 'showTable',
hoverColor: "yellow",
})
);
aladin.addCatalog(
A.catalogFromSKAORucio("Abell 194", 30, {
onClick: 'showTable',
hoverColor: "yellow",
})
);
//aladin.addCatalog(A.catalogFromURL('https://aladin.cds.unistra.fr/ObsCoreRucioScs.xml', {onClick: 'showTable'}));
});
</script>

View File

@@ -2,7 +2,7 @@
"homepage": "https://aladin.u-strasbg.fr/",
"name": "aladin-lite",
"type": "module",
"version": "3.4.1-beta",
"version": "3.4.2-beta",
"description": "An astronomical HiPS visualizer in the browser",
"author": "Thomas Boch and Matthieu Baumann",
"license": "GPL-3",

View File

@@ -3,7 +3,7 @@ name = "aladin-lite"
description = "Aladin Lite v3 introduces a new graphical engine written in Rust with the use of WebGL"
license = "BSD-3-Clause"
repository = "https://github.com/cds-astro/aladin-lite"
version = "3.4.0-beta"
version = "3.4.1-beta"
authors = [ "baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr",]
edition = "2018"

View File

@@ -1433,6 +1433,10 @@ impl App {
crate::math::projection::screen_to_clip_space(pos, &self.camera)
}
pub(crate) fn get_coo_system(&self) -> CooSystem {
self.camera.get_coo_system()
}
pub(crate) fn view_to_icrs_coosys(&self, lonlat: &LonLatT<f64>) -> LonLatT<f64> {
let icrs_pos: Vector4<_> = lonlat.vector();
let view_system = self.camera.get_coo_system();

View File

@@ -2,18 +2,20 @@ use cgmath::{BaseFloat, Vector4};
use al_api::coo_system::CooBaseFloat;
use al_api::coo_system::CooSystem;
use crate::math::lonlat::LonLat;
/// This is conversion method returning a transformation
/// matrix when the system requested by the user is not
/// icrs j2000.
/// The core projections are always performed in icrs j2000
/// so one must call these methods to convert them to icrs before.
#[inline]
pub fn apply_coo_system<S>(c1: CooSystem, c2: CooSystem, v1: &Vector4<S>) -> Vector4<S>
pub fn apply_coo_system<S>(c1: CooSystem, c2: CooSystem, v: &Vector4<S>) -> Vector4<S>
where
S: BaseFloat + CooBaseFloat,
{
let c1_2_c2_mat = c1.to::<S>(c2);
c1_2_c2_mat * (*v1)
c1_2_c2_mat * (*v)
}
mod tests {

View File

@@ -625,8 +625,23 @@ impl WebClient {
///
/// * `lon` - A longitude in degrees
/// * `lat` - A latitude in degrees
#[wasm_bindgen(js_name = worldToScreen)]
pub fn world_to_screen(&self, lon: f64, lat: f64) -> Option<Box<[f64]>> {
#[wasm_bindgen(js_name = world2pix)]
pub fn world_to_pixel(
&self,
mut lon: f64,
mut lat: f64,
frame: Option<CooSystem>,
) -> Option<Box<[f64]>> {
if let Some(frame) = frame {
// first convert the coo to the view frame
use crate::math::lonlat::LonLat;
let xyz =
LonLatT::new(lon.to_radians().to_angle(), lat.to_radians().to_angle()).vector();
let lonlat = coosys::apply_coo_system(frame, self.app.get_coo_system(), &xyz).lonlat();
lon = lonlat.lon().to_degrees();
lat = lonlat.lat().to_degrees();
}
self.app
.world_to_screen(lon, lat)
.map(|v| Box::new([v.x, v.y]) as Box<[f64]>)
@@ -700,11 +715,24 @@ impl WebClient {
///
/// * `pos_x` - The x screen coordinate in pixels
/// * `pos_y` - The y screen coordinate in pixels
#[wasm_bindgen(js_name = screenToWorld)]
pub fn screen_to_world(&self, pos_x: f64, pos_y: f64) -> Option<Box<[f64]>> {
/// * `frame` - If not given, use the current view frame
#[wasm_bindgen(js_name = pix2world)]
pub fn pixel_to_world(
&self,
pos_x: f64,
pos_y: f64,
frame: Option<CooSystem>,
) -> Option<Box<[f64]>> {
self.app
.screen_to_world(&Vector2::new(pos_x, pos_y))
.map(|lonlat| {
.map(|mut lonlat| {
if let Some(frame) = frame {
use crate::math::lonlat::LonLat;
let xyz = lonlat.vector();
lonlat =
coosys::apply_coo_system(self.app.get_coo_system(), frame, &xyz).lonlat();
}
let lon_deg: ArcDeg<f64> = lonlat.lon().into();
let lat_deg: ArcDeg<f64> = lonlat.lat().into();

View File

@@ -684,14 +684,8 @@ A.catalogFromSimbad = function (target, radius, options, successCallback, errorC
const processVOTable = function (table) {
let {sources, fields} = table;
cat.setFields(fields);
if (cat.type === 'ObsCore') {
// The fields corresponds to obscore ones
// Set the name of the catalog to be ObsCore:<catalog name>
cat.name = "ObsCore:" + url;
}
cat.addSources(sources);
cat.url = url;
if (successCallback) {
successCallback(cat);
@@ -700,13 +694,8 @@ A.catalogFromSimbad = function (target, radius, options, successCallback, errorC
if (sources.length === 0) {
console.warn(cat.name + ' has no sources!')
}
// Even if the votable is not a proper ObsCore one, try to see if specific columns are given
// e.g. access_format and access_url
//ObsCore.handleActions(catalog);
};
Catalog.parseVOTable(
url,
processVOTable,

View File

@@ -2285,19 +2285,18 @@ aladin.on("positionChanged", ({ra, dec}) => {
* @throws {Error} Throws an error if an issue occurs during the transformation.
*/
Aladin.prototype.pix2world = function (x, y, frame) {
let radec = this.view.wasm.screenToWorld(x, y);
frame = frame || this.view.cooFrame.label;
frame = CooFrameEnum.fromString(frame, CooFrameEnum.J2000);
if (frame !== this.view.cooFrame) {
if (frame.label === "Galactic") {
console.warn("Conversion from icrs to galactic not yet impl");
} else {
radec = this.view.wasm.viewToICRSCooSys(radec[0], radec[1]);
if (frame) {
frame = CooFrameEnum.fromString(frame, CooFrameEnum.J2000);
if (frame.label == CooFrameEnum.SYSTEMS.GAL) {
frame = Aladin.wasmLibs.core.CooSystem.GAL;
}
else {
frame = Aladin.wasmLibs.core.CooSystem.ICRS;
}
}
let radec = this.view.wasm.pix2world(x, y, frame);
let [ra, dec] = radec;
if (ra < 0) {
@@ -2311,15 +2310,26 @@ aladin.on("positionChanged", ({ra, dec}) => {
* Transform world coordinates to pixel coordinates in the view.
*
* @memberof Aladin
* @param {number} ra - The Right Ascension (RA) coordinate in degrees. Frame considered is the current view frame
* @param {number} dec - The Declination (Dec) coordinate in degrees. Frame considered is the current view frame
*
* @param {number} ra - The Right Ascension (RA) coordinate in degrees.
* @param {number} dec - The Declination (Dec) coordinate in degrees.
* @param {CooFrame} [frame] - If not specified, the frame considered is the current view frame
* @returns {number[]} - An array representing the [x, y] coordinates in pixel coordinates in the view.
*
* @throws {Error} Throws an error if an issue occurs during the transformation.
*/
Aladin.prototype.world2pix = function (ra, dec) {
return this.view.wasm.worldToScreen(ra, dec);
Aladin.prototype.world2pix = function (ra, dec, frame) {
if (frame) {
frame = CooFrameEnum.fromString(frame, CooFrameEnum.J2000);
if (frame.label == CooFrameEnum.SYSTEMS.GAL) {
frame = Aladin.wasmLibs.core.CooSystem.GAL;
}
else {
frame = Aladin.wasmLibs.core.CooSystem.ICRS;
}
}
return this.view.wasm.world2pix(ra, dec, frame);
};
/**

View File

@@ -440,7 +440,7 @@ export let Catalog = (function () {
}
let source = null;
if (ra && dec) {
if (ra !== undefined && ra !== null && dec !== undefined && dec !== null) {
if (!Utils.isNumber(ra) || !Utils.isNumber(dec)) {
coo.parse(ra + " " + dec);
ra = coo.lon;
@@ -453,21 +453,7 @@ export let Catalog = (function () {
mesures
);
source.rowIdx = rowIdx;
}
//let footprint = null;
/*if (region) {
let shapes = A.footprintsFromSTCS(region, {lineWidth: 2})
footprint = new Footprint(shapes, source);
}*/
/*if (footprint) {
footprints.push(footprint);
if (maxNbSources && footprints.length == maxNbSources) {
return false;
}
} else */
if (source) {
sources.push(source);
if (maxNbSources && sources.length == maxNbSources) {
return false;

View File

@@ -68,6 +68,7 @@ export let Circle = (function() {
this.isShowing = true;
this.isSelected = false;
this.isHovered = false;
this.frame = options.frame || "icrs";
};
Circle.prototype.setColor = function(color) {

View File

@@ -44,6 +44,7 @@ import { requestAnimFrame } from "./libs/RequestAnimationFrame";
* @property {number} [options.opacity=1] - The opacity, between 0 (totally transparent) and 1 (totally opaque)
* @property {string} [options.selectionColor='#00ff00'] - A selection color
* @property {string} [options.hoverColor] - A hovered color
* @property {CooFrame} [options.frame] - Frame in which the coordinates are given. If none, the frame used is icrs/j2000.
*/
/**

View File

@@ -50,13 +50,12 @@ export let Line = (function() {
* @param {number} dec1 - Declination (Dec) coordinate of the center in degrees.
* @param {number} ra2 - Right Ascension (RA) coordinate of the center in degrees.
* @param {number} dec2 - Declination (Dec) coordinate of the center in degrees.
* @param {CooFrame} [frame] - Frame in which the coordinates are given. If none, the frame used is icrs/j2000.
* @param {ShapeOptions} options - Options for configuring the line. Additional properties:
* @param {boolean} [options.arrow=false] - Add an arrow pointing from (ra1, dec1) to (ra2, dec2)
*
* @returns {Line} - The line shape object
*/
let Line = function(ra1, dec1, ra2, dec2, frame, options) {
let Line = function(ra1, dec1, ra2, dec2, options) {
options = options || {};
this.color = options['color'] || undefined;
this.opacity = options['opacity'] || undefined;
@@ -78,7 +77,7 @@ export let Line = (function() {
this.dec1 = dec1;
this.ra2 = ra2;
this.dec2 = dec2;
this.frame = frame;
this.frame = options.frame || "icrs";
};
Line.prototype = {
@@ -104,10 +103,10 @@ export let Line = (function() {
noStroke = noStroke===true || false;
noSmallCheck = noSmallCheck===true || false;
// project
const v1 = view.aladin.world2pix(this.ra1, this.dec1, this.frame);
const v1 = view.aladin.world2pix(this.ra1, this.dec1);
if (!v1)
return false;
const v2 = view.aladin.world2pix(this.ra2, this.dec2, this.frame);
const v2 = view.aladin.world2pix(this.ra2, this.dec2);
if (!v2)
return false;

View File

@@ -86,15 +86,14 @@ export class OverlayStackBox extends Box {
hoverColor: 'red',
onClick: "showTable",
shape: (s) => {
let galaxy = ["Seyfert","Seyfert_1", "Seyfert_2","LSB_G","PartofG","RadioG","Gin","GinPair","HII_G","LensedG","BClG","BlueCompG","EmG","GinCl","GinGroup","StarburstG","LINER","AGN","Galaxy"].some((n) => s.data.main_type.indexOf(n) >= 0);
if (!galaxy) return;
let a = +s.data.size_maj;
let b = +s.data.size_min;
let galaxy = ['Seyfert', 'Gin', 'StarburstG', 'LINER', 'AGN', 'Galaxy'].some((n) => s.data.main_type.indexOf(n) >= 0)
if (!galaxy)
return;
let theta = +s.data.size_angle || 0.0;
return A.ellipse(s.ra, s.dec, a / 60, b / 60, theta);
return A.ellipse(s.ra, s.dec, a / 60, b / 60, theta, { color: "cyan" });
}
},
},

View File

@@ -139,6 +139,7 @@ options = {
for (const objects of aladin.view.selection) {
let s0 = getSource(objects[0]);
const cat = s0.catalog;
console.log(cat)
const {url, name} = cat;
conn.loadVOTable(url, name, url);

View File

@@ -173,6 +173,8 @@ export let Datalink = (function() {
value: idxSlice,
tooltip: {content: (idxSlice + 1) + '/' + numSlices, position: {direction: 'bottom'}},
})
cubeDisplayer.update({content: Layout.horizontal([prevBtn, nextBtn, slicer, (idxSlice + 1) + '/' + numSlices])})
};
let slicer = Input.slider({
@@ -227,7 +229,7 @@ export let Datalink = (function() {
title: 'HiPS cube player',
draggable: true,
},
content: Layout.horizontal([prevBtn, nextBtn, slicer]),
content: Layout.horizontal([prevBtn, nextBtn, slicer, (idxSlice + 1) + '/' + numSlices]),
position: {anchor: 'center top'},
});
aladinInstance.addUI(cubeDisplayer)