Open imbasimba opened 1 year ago
The api to do that is the following:
const pmCat = A.catalogFromURL('./data/proper_motion.xml', {
onClick: 'showTable',
name: 'mean pm over HPX cells around LMC from GaiaDR2',
hoverColor: 'yellow',
selectionColor: 'white',
// Footprint associated to sources
shape: (s) => {
// discard drawing a vector for big pm
let totalPmSquared = s.data.pmra*s.data.pmra + s.data.pmdec*s.data.pmdec;
if (totalPmSquared > 6) {
return;
}
let color = rainbowColorMap((totalPmSquared - 2.5) / 2)
// Compute the mean of pm over the catalog sources
if (!pmraMean || !pmdecMean) {
pmraMean = 0, pmdecMean = 0;
for (var s of pmCat.getSources()) {
pmraMean += +s.data.pmra;
pmdecMean += +s.data.pmdec;
}
const numSources = pmCat.getSources().length;
pmraMean /= numSources
pmdecMean /= numSources
}
let dra = +s.data.pmra - pmraMean;
let ddec = +s.data.pmdec - pmdecMean;
return A.vector(
s.ra,
s.dec,
s.ra + dra,
s.dec + ddec,
{lineWidth: 3, color}
)
}
});
aladin.addCatalog(pmCat);
There is a shape method you can pass that is executed for each source and for which you can associate a footprint (circle, ellipsis, arrowed vector). I will not close that issue because it still need to be polished in terms of API and performance. We would like to also be able to associate an Image or a HTMLCanvasElement to a source.
I would like to see proper motion support in Aladin Lite 3. This was implemented by the ESASky team in our Aladin Lite 2 fork, but I fear that it is not a simple integration now that Aladin Lite 3 is heavily using Rust and WASM.
See the video of how this feature is used in ESASky: https://www.youtube.com/watch?v=HtszrCCx7Dw&t=503s
Description of what I would like to see in Aladin Lite 3:
The bulk of the implementation within the Aladin Lite 2 system, can be found in the below file, row 18085 - 18259 https://sky.esa.int/esasky/esasky_cl_5_0_2_2023_03_27T13_10_11Z/aladinESDC.js