shorten table name in measurement table

This commit is contained in:
Matthieu BAUMANN
2023-04-26 11:35:20 +02:00
parent a58ade5801
commit c35d8e4e8c
11 changed files with 102 additions and 67 deletions

View File

@@ -13,11 +13,13 @@
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {target: '14 18 16.868 +56 44 29.37', fov: 5, showContextMenu: true});
const catalog = A.catalogFromURL('./ObsCore_003.xml', {onClick: 'showTable'});
//const catalog = A.catalogFromURL('https://vo.astron.nl/tap/sync?REQUEST=doQuery&LANG=ADQL&MAXREC=20000000&QUERY=SELECT+TOP+9999+*+FROM+ivoa.obscore+WHERE+CONTAINS%28POINT%28%27ICRS%27%2C+s_ra%2C+s_dec%29%2C+CIRCLE%28%27ICRS%27%2C+214.92068%2C+56.81529%2C+3.03%29%29+%3D+1+', {onClick: 'showTable'});
// const catalog = A.catalogFromURL('http://archive.eso.org/tap_obs/sync?REQUEST=doQuery&LANG=ADQL&MAXREC=20000000&QUERY=SELECT+TOP+9999+*+FROM+ivoa.ObsCore+WHERE+CONTAINS%28POINT%28%27ICRS%27%2C+s_ra%2C+s_dec%29%2C+CIRCLE%28%27ICRS%27%2C+83.82184%2C+-5.38635%2C+0.14798%29%29+%3D+1+AND+obs_collection+%3D+%27MUSE%27+', {onClick: 'showTable'});
//const c1 = A.catalogFromURL('./ObsCore_003.xml', {onClick: 'showTable'});
const catalog = A.catalogFromURL('https://vo.astron.nl/tap/sync?REQUEST=doQuery&LANG=ADQL&MAXREC=20000000&QUERY=SELECT+TOP+9999+*+FROM+ivoa.obscore+WHERE+CONTAINS%28POINT%28%27ICRS%27%2C+s_ra%2C+s_dec%29%2C+CIRCLE%28%27ICRS%27%2C+214.92068%2C+56.81529%2C+3.03%29%29+%3D+1+', {onClick: 'showTable'});
//const c2 = A.catalogFromURL('http://archive.eso.org/tap_obs/sync?REQUEST=doQuery&LANG=ADQL&MAXREC=20000000&QUERY=SELECT+TOP+9999+*+FROM+ivoa.ObsCore+WHERE+CONTAINS%28POINT%28%27ICRS%27%2C+s_ra%2C+s_dec%29%2C+CIRCLE%28%27ICRS%27%2C+83.82184%2C+-5.38635%2C+0.14798%29%29+%3D+1+AND+obs_collection+%3D+%27MUSE%27+', {onClick: 'showTable'});
aladin.addCatalog(catalog);
//aladin.addCatalog(c2);
});
</script>
</body>

View File

@@ -18,8 +18,8 @@
<TR>
<TD>ivo://SKA/SrcNet/APERTIF_DR1/200110007_AP_B037/HI_image_cube3</TD>
<TD>https://vo.astron.nl/getproduct/APERTIF_DR1/200110007_AP_B037/HI_image_cube3.fits</TD>
<TD>a</TD>
<TD>a</TD>
<TD></TD>
<TD></TD>
<TD>#this</TD>
<TD>The full dataset</TD>
<TD>image/fits</TD>
@@ -29,8 +29,8 @@
<TR>
<TD>ivo://SKA/SrcNet/APERTIF_DR1/200110007_AP_B037/HI_image_cube3</TD>
<TD>https://alasky.cds.unistra.fr/hips-cube-services/compute/hips:httpsalasky.cds.unistra.fr;SKA-demo;hips;APERTIF;HiPS_APERTIF_cube_NGC5585-cubic-tiles%7Cexpr:s0_1211</TD>
<TD>a</TD>
<TD>a</TD>
<TD></TD>
<TD></TD>
<TD>#derived</TD>
<TD>Moment zero map of the cube (in HiPS format)</TD>
<TD>application/hips</TD>
@@ -40,8 +40,8 @@
<TR>
<TD>ivo://SKA/SrcNet/APERTIF_DR1/200110007_AP_B037/HI_image_cube3</TD>
<TD>https://alasky.cds.unistra.fr/hips-cube-services/compute/hips:httpsalasky.cds.unistra.fr;SKA-demo;hips;APERTIF;HiPS_APERTIF_cube_NGC5585-cubic-tiles%7Cexpr:s345_410-(s0_1211;24)</TD>
<TD>a</TD>
<TD>a</TD>
<TD></TD>
<TD></TD>
<TD>#derived</TD>
<TD>HI Line map derived from the cube (in HiPS format)</TD>
<TD>application/hips</TD>
@@ -51,8 +51,8 @@
<TR>
<TD>ivo://SKA/SrcNet/APERTIF_DR1/200110007_AP_B037/HI_image_cube3</TD>
<TD>https://alasky.cds.unistra.fr/hips-cube-services/color/hips:httpsalasky.cds.unistra.fr;SKA-demo;hips;APERTIF;HiPS_APERTIF_cube_NGC5585%7Cblue:345-365%7Cgreen:365-385%7Cred:385-405</TD>
<TD>a</TD>
<TD>a</TD>
<TD></TD>
<TD></TD>
<TD>#derived</TD>
<TD>velocity variation color map derived from the cube (in HiPS format)</TD>
<TD>application/hips</TD>
@@ -61,36 +61,36 @@
</TR>
<TR>
<TD>ivo://SKA/SrcNet/APERTIF_DR1/200110007_AP_B037/HI_image_cube3</TD>
<TD>a</TD>
<TD></TD>
<TD>soda-HiPS</TD>
<TD>a</TD>
<TD></TD>
<TD>#cutout</TD>
<TD>SODA-HiPS cutout of moment zero map of ivo://SKA/SrcNet/APERTIF_DR1/200110007_AP_B037/HI_image_cube3</TD>
<TD>image/fits</TD>
<TD>0</TD>
<TD>a</TD>
<TD></TD>
</TR>
<TR>
<TD>ivo://SKA/SrcNet/APERTIF_DR1/200110007_AP_B037/HI_image_cube3</TD>
<TD>a</TD>
<TD></TD>
<TD>soda-sync</TD>
<TD>a</TD>
<TD></TD>
<TD>#cutout</TD>
<TD>SODA-sync cutout of ivo://SKA/SrcNet/APERTIF_DR1/200110007_AP_B037/HI_image_cube3</TD>
<TD>image/fits</TD>
<TD>0</TD>
<TD>a</TD>
<TD></TD>
</TR>
<TR>
<TD>ivo://SKA/SrcNet/APERTIF_DR1/200110007_AP_B037/HI_image_cube3</TD>
<TD>a</TD>
<TD></TD>
<TD>soda-async</TD>
<TD>a</TD>
<TD></TD>
<TD>#cutout</TD>
<TD>SODA-async cutout of ivo://SKA/SrcNet/APERTIF_DR1/200110007_AP_B037/HI_image_cube3</TD>
<TD>image/fits</TD>
<TD>0</TD>
<TD>a</TD>
<TD></TD>
</TR>
</TABLEDATA>
</DATA>

View File

@@ -30,7 +30,7 @@ serde = { version = "^1.0.59", features = ["derive"] }
serde_json = "1.0"
serde-wasm-bindgen = "0.4"
console_error_panic_hook = "0.1.7"
fitsrs = "0.2.6"
fitsrs = "0.2.7"
enum_dispatch = "0.3.8"
wasm-bindgen = "0.2.79"
wasm-streams = "0.3.0"
@@ -42,6 +42,7 @@ mapproj = "0.3.0"
wcs = "0.2.4"
colorgrad = "0.6.2"
image-decoder = { package = "image", version = "0.24.2", default-features = false, features = ["jpeg", "png"] }
#votable = { git = "https://github.com/cds-astro/cds-votable-rust", branch = "main" }
votable = "0.2.0"
[features]
@@ -88,6 +89,7 @@ features = [
'WebGlUniformLocation',
'WebGlTexture',
'WebGlActiveInfo',
'Headers',
'Window',
'Request',

View File

@@ -9,7 +9,7 @@ js-sys = "0.3.47"
cgmath = "*"
jpeg-decoder = "0.3.0"
png = "0.17.6"
fitsrs = "0.2.6"
fitsrs = "0.2.7"
al-api = { path = "../al-api" }
serde = { version = "^1.0.59", features = ["derive"] }
serde_json = "1.0"

View File

@@ -894,9 +894,16 @@ impl App {
use crate::renderable::image::Image;
use futures::TryStreamExt;
use futures::future::Either;
use web_sys::{Request, RequestInit, RequestMode, Headers};
let mut opts = RequestInit::new();
opts.method("GET");
opts.mode(RequestMode::Cors);
let window = window().unwrap();
let resp_value = JsFuture::from(window.fetch_with_str(&url))
let request = Request::new_with_str_and_init(&url, &opts)?;
let resp_value = JsFuture::from(window.fetch_with_request(&request))
.await?;
let resp: Response = resp_value.dyn_into()?;

View File

@@ -98,6 +98,8 @@ impl Image {
// Load the fits file
let header = hdu.get_header();
al_core::log(&format!("header: {:?}", header));
let naxis = header.get_xtension().get_naxis();
if naxis == 0 {
@@ -129,7 +131,7 @@ impl Image {
let data = hdu.get_data_mut();
let (textures, channel, cuts) = match data {
let (textures, channel, mut cuts) = match data {
stream::Data::U8(data) => {
let reader = data
.map_ok(|v| {
@@ -221,7 +223,7 @@ impl Image {
v[0].to_le_bytes()
})
.into_async_read();
//al_core::log(&format!("{:?}", ))
let (textures, samples) = subdivide_texture::build::<R32F, _>(gl, w, h, reader, max_tex_size).await?;
let mut samples = samples
@@ -314,6 +316,10 @@ impl Image {
vao
};
// apply bscale to the cuts
cuts.start = cuts.start * scale + offset;
cuts.end = cuts.end * scale + offset;
let gl = gl.clone();
// Compute the fov

View File

@@ -30,6 +30,8 @@ where
let mut pixels_written = 0;
let num_pixels = width * height;
al_core::log(&format!("pixels written {:?}, num pixels {:?}", pixels_written, num_pixels));
let step_x_cut = (width / 50) as usize;
let step_y_cut = (height / 50) as usize;
@@ -55,48 +57,49 @@ where
};
let num_bytes_to_read = (num_pixels_to_read as usize) * std::mem::size_of::<<F::P as Pixel>::Item>();
reader.read_exact(&mut buf[..num_bytes_to_read])
.await
.map_err(|_| JsValue::from_str("Read some bytes error"))?;
al_core::log(&format!("max tex size {:?} written {:?}, {:?}", max_tex_size, pixels_written, num_pixels));
if let Ok(()) = reader.read_exact(&mut buf[..num_bytes_to_read]).await {
// Tell where the data must go inside the texture
let off_y_px = id_ty * max_tex_size;
// Tell where the data must go inside the texture
let off_y_px = id_ty * max_tex_size;
let dy = (pixels_written / width) - off_y_px;
let view = unsafe {
let slice = std::slice::from_raw_parts(
buf[..num_bytes_to_read].as_ptr() as *const <F::P as Pixel>::Item,
num_pixels_to_read as usize
);
let dy = (pixels_written / width) - off_y_px;
let view = unsafe {
let slice = std::slice::from_raw_parts(
buf[..num_bytes_to_read].as_ptr() as *const <F::P as Pixel>::Item,
num_pixels_to_read as usize
);
// fill the samples buffer
if (pixels_written / width) % (step_cut as u64) == 0 {
// We are in a good line
let xmin = pixels_written % width;
// fill the samples buffer
if (pixels_written / width) % (step_cut as u64) == 0 {
// We are in a good line
let xmin = pixels_written % width;
for i in (0..width).step_by(step_cut) {
if (xmin..(xmin + num_pixels_to_read)).contains(&i) {
let j = (i - xmin) as usize;
samples.push(slice[j]);
for i in (0..width).step_by(step_cut) {
if (xmin..(xmin + num_pixels_to_read)).contains(&i) {
let j = (i - xmin) as usize;
samples.push(slice[j]);
}
}
}
}
F::view(slice)
};
F::view(slice)
};
(&mut tex_chunks[id_t as usize])
.bind()
.tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_array_buffer_view(
0,
dy as i32,
num_pixels_to_read as i32,
1,
Some(view.as_ref())
);
(&mut tex_chunks[id_t as usize])
.bind()
.tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_array_buffer_view(
0,
dy as i32,
num_pixels_to_read as i32,
1,
Some(view.as_ref())
);
pixels_written += num_pixels_to_read;
pixels_written += num_pixels_to_read;
} else {
pixels_written = num_pixels;
}
}
Ok((tex_chunks, samples))

View File

@@ -138,13 +138,13 @@ export let DefaultActionsForContextMenu = (function () {
window.open(hips2fitsUrl, '_blank');
}
},
/*
{
label: "Select sources", action(o) {
aladinInstance.select();
const a = aladinInstance;
a.select();
}
},
*/
]
}

View File

@@ -226,7 +226,15 @@ export let MeasurementTable = (function() {
let self = this;
this.tables.forEach(function(table, index) {
let tabButtonElement = document.createElement("button");
tabButtonElement.setAttribute('title', table["name"])
tabButtonElement.innerText = table["name"];
tabButtonElement.style.overflow = 'hidden';
tabButtonElement.style.textOverflow = 'ellipsis';
tabButtonElement.style.whiteSpace = 'nowrap';
tabButtonElement.style.maxWidth = '20%';
tabButtonElement
tabButtonElement.addEventListener(
'click',

View File

@@ -652,8 +652,6 @@ export let View = (function () {
return; // when in TOOL_SIMBAD_POINTER mode, we do not call the listeners
}
// popup to show ?
var objs = view.closestObjects(xymouse.x, xymouse.y, 5);
if (!wasDragging && objs) {
@@ -674,6 +672,9 @@ export let View = (function () {
if (view.lastClickedObject) {
view.lastClickedObject.actionOtherObjectClicked && view.lastClickedObject.actionOtherObjectClicked();
}
}
if (o.actionClicked) {
o.actionClicked();
}
@@ -681,7 +682,6 @@ export let View = (function () {
var objClickedFunction = view.aladin.callbacksByEventName['objectClicked'];
(typeof objClickedFunction === 'function') && objClickedFunction(o);
} else {
if (!wasDragging) {
// Deselect objects if any
view.deselectObjects();

View File

@@ -56,22 +56,29 @@ export let VOTable = (function() {
let tables = resource.get("tables")
if (tables) {
tables.forEach((table) => {
console.log(table.get("elems"))
let fields = table.get("elems")
.filter((elem) => {
const elemType = elem["elem_type"] || elem.get("elem_type")
return elemType === "Field";
})
.map((field) => {
// convert a map into a javascript object
return Object.fromEntries(field);
})
try {
fields = ObsCore.parseFields(fields);
fields.subtype = "ObsCore";
console.log("obscore")
} catch(e) {
// It is not an ObsCore table
fields = Catalog.parseFields(fields, raField, decField);
}
let data = table.get("data");
if (data) {
let rows = data.get("rows");