* rename J2000 to ICRS as HiPSes are built in ICRS
* update the ancient J2000 conversion matrices to ICRS ones.
This commit is contained in:
bmatthieu3
2025-03-25 17:55:38 +01:00
committed by Matthieu Baumann
parent 3b00a79e02
commit 5823901e92
31 changed files with 171 additions and 203 deletions

View File

@@ -1,17 +1,17 @@
use cgmath::Matrix4;
const GAL2FK5J2000: &'static Matrix4<f64> = &Matrix4::new(
-0.44482962996001117814661406161609,
0.74698224449721889052738800455594,
0.49410942787558367352522237135824,
const GAL2ICRS: &'static Matrix4<f64> = &Matrix4::new(
-0.44482972122205372312012370920248,
0.74698218398450941835110635824212,
0.49410943719710765017955928850141,
0.0,
-0.19807637343120152818048609141212,
0.45598377617506692227210047834778,
-0.86766614901900470118161653456955,
-0.19807633727507056817237662907031,
0.45598381369115237931077906137440,
-0.86766613755716255824577781583414,
0.0,
-0.87343709023488504876038316840868,
-0.48383501554871322683177417511638,
-0.05487556041621536849239890045391,
-0.87343705195577915249273984034980,
-0.48383507361641838378786914298189,
-0.05487565771261968232908806948676,
0.0,
0.0,
0.0,
@@ -19,18 +19,18 @@ const GAL2FK5J2000: &'static Matrix4<f64> = &Matrix4::new(
1.0,
);
const FK5J20002GAL: &'static Matrix4<f64> = &Matrix4::new(
-0.44482962996001117814661406161609,
-0.19807637343120152818048609141212,
-0.87343709023488504876038316840868,
const ICRS2GAL: &'static Matrix4<f64> = &Matrix4::new(
-0.44482972122205372312012370920248,
-0.19807633727507056817237662907031,
-0.87343705195577915249273984034980,
0.0,
0.74698224449721889052738800455594,
0.45598377617506692227210047834778,
-0.48383501554871322683177417511638,
0.74698218398450941835110635824212,
0.45598381369115237931077906137440,
-0.48383507361641838378786914298189,
0.0,
0.49410942787558367352522237135824,
-0.86766614901900470118161653456955,
-0.05487556041621536849239890045391,
0.49410943719710765017955928850141,
-0.86766613755716255824577781583414,
-0.05487565771261968232908806948676,
0.0,
0.0,
0.0,
@@ -48,7 +48,7 @@ use wasm_bindgen::prelude::*;
#[wasm_bindgen]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Deserialize, Hash)]
pub enum CooSystem {
FK5J2000,
ICRS,
GAL,
}
@@ -58,8 +58,8 @@ impl CooSystem {
#[inline]
pub fn to(&self, coo_system: Self) -> &Matrix4<f64> {
match (self, coo_system) {
(CooSystem::GAL, CooSystem::FK5J2000) => GAL2FK5J2000,
(CooSystem::FK5J2000, CooSystem::GAL) => FK5J20002GAL,
(CooSystem::GAL, CooSystem::ICRS) => GAL2ICRS,
(CooSystem::ICRS, CooSystem::GAL) => ICRS2GAL,
(_, _) => ID,
}
}

View File

@@ -147,7 +147,7 @@ impl App {
// The tile buffer responsible for the tile requests
let downloader = Rc::new(RefCell::new(Downloader::new()));
let camera = CameraViewPort::new(&gl, CooSystem::FK5J2000, &projection);
let camera = CameraViewPort::new(&gl, CooSystem::ICRS, &projection);
let screen_size = &camera.get_screen_size();
let _fbo_view =
@@ -403,20 +403,20 @@ impl App {
}
pub(crate) fn get_visible_cells(&self, depth: u8) -> Box<[HEALPixCellProjeted]> {
// Convert the camera frame vertices to j2000 before doing the moc
// Convert the camera frame vertices to ICRS before doing the moc
let coverage = crate::camera::build_fov_coverage(
depth,
self.camera.get_field_of_view(),
self.camera.get_center(),
self.camera.get_coo_system(),
CooSystem::FK5J2000,
CooSystem::ICRS,
&self.projection,
);
let cells: Vec<_> = coverage
.flatten_to_fixed_depth_cells()
.filter_map(|ipix| {
// This cell is defined in FK5J2000
// This cell is defined in ICRS
let cell = HEALPixCell(depth, ipix);
let v = cell.vertices();
@@ -425,7 +425,7 @@ impl App {
let xyzw = crate::math::lonlat::radec_to_xyzw(lon.to_angle(), lat.to_angle());
// 2. get it back to the camera frame system
let xyzw = crate::coosys::apply_coo_system(
CooSystem::FK5J2000,
CooSystem::ICRS,
self.camera.get_coo_system(),
&xyzw,
);
@@ -1421,10 +1421,10 @@ impl App {
pub(crate) fn world_to_screen(&self, ra: f64, dec: f64) -> Option<Vector2<f64>> {
let lonlat = LonLatT::new(ArcDeg(ra).into(), ArcDeg(dec).into());
let j2000_pos = lonlat.vector();
let icrs_pos = lonlat.vector();
self.projection
.j2000_celestial_to_screen_space(&j2000_pos, &self.camera)
.icrs_celestial_to_screen_space(&icrs_pos, &self.camera)
}
pub(crate) fn screen_to_world(&self, pos: &Vector2<f64>) -> Option<LonLatT<f64>> {
@@ -1443,19 +1443,19 @@ impl App {
self.camera.get_coo_system()
}
pub(crate) fn view_to_fk5j2000_coosys(&self, lonlat: &LonLatT<f64>) -> LonLatT<f64> {
pub(crate) fn view_to_icrs_coosys(&self, lonlat: &LonLatT<f64>) -> LonLatT<f64> {
let celestial_pos: Vector4<_> = lonlat.vector();
let view_system = self.camera.get_coo_system();
let (ra, dec) = math::lonlat::xyzw_to_radec(&coosys::apply_coo_system(
view_system,
CooSystem::FK5J2000,
CooSystem::ICRS,
&celestial_pos,
));
LonLatT::new(ra, dec)
}
/// lonlat must be given in j2000 frame
/// lonlat must be given in icrs frame
pub(crate) fn set_center(&mut self, lonlat: &LonLatT<f64>) {
self.prev_cam_position = self.camera.get_center().truncate();

View File

@@ -21,7 +21,7 @@ pub fn build_fov_coverage(
) -> HEALPixCoverage {
if let Some(vertices) = fov.get_vertices() {
// The vertices coming from the camera are in a specific coo sys
// but cdshealpix accepts them to be given in FK5J2000 coo sys
// but cdshealpix accepts them to be given in ICRS coo sys
let vertices_iter = vertices
.iter()
.map(|v| crate::coosys::apply_coo_system(camera_frame, frame, v));

View File

@@ -16,7 +16,7 @@ impl ViewHpxCells {
pub(super) fn new() -> Self {
let reg_frames = [0; NUM_COOSYSTEM];
let hpx_cells = [
HpxCells::new(CooSystem::FK5J2000),
HpxCells::new(CooSystem::ICRS),
HpxCells::new(CooSystem::GAL),
];
@@ -116,7 +116,7 @@ pub struct HpxCells {
impl Default for HpxCells {
fn default() -> Self {
Self::new(CooSystem::FK5J2000)
Self::new(CooSystem::ICRS)
}
}

View File

@@ -484,11 +484,11 @@ impl CameraViewPort {
self.update_rot_matrices(proj);
}
/// center lonlat must be given in j2000 frame
/// center lonlat must be given in icrs frame
pub fn set_center(&mut self, lonlat: &LonLatT<f64>, proj: &ProjectionType) {
let j2000_pos: Vector4<_> = lonlat.vector();
let icrs_pos: Vector4<_> = lonlat.vector();
let view_pos = CooSystem::FK5J2000.to(self.get_coo_system()) * j2000_pos;
let view_pos = CooSystem::ICRS.to(self.get_coo_system()) * icrs_pos;
let rot_to_center = Rotation::from_sky_position(&view_pos);
let phi = self.get_center_pos_angle();

View File

@@ -3,8 +3,8 @@ use al_api::coo_system::CooSystem;
/// This is conversion method returning a transformation
/// matrix when the system requested by the user is not
/// fk5j2000.
/// The core projections are always performed in fk5j2000
/// ICRS.
/// The core projections are always performed in ICRS
#[inline]
pub fn apply_coo_system(c1: CooSystem, c2: CooSystem, v: &Vector4<f64>) -> Vector4<f64> {
let c1_2_c2_mat = c1.to(c2);
@@ -22,7 +22,7 @@ mod tests {
}
#[test]
fn j2000_to_gal() {
fn icrs_to_gal() {
use super::CooSystem;
use crate::math::lonlat::LonLat;
use crate::ArcDeg;
@@ -30,7 +30,7 @@ mod tests {
let lonlat: LonLatT<f64> = LonLatT::new(ArcDeg(0.0).into(), ArcDeg(0.0).into());
let gal_lonlat =
super::apply_coo_system(CooSystem::FK5J2000, CooSystem::GAL, &lonlat.vector()).lonlat();
super::apply_coo_system(CooSystem::ICRS, CooSystem::GAL, &lonlat.vector()).lonlat();
let gal_lon_deg = gal_lonlat.lon().to_degrees();
let gal_lat_deg = gal_lonlat.lat().to_degrees();
@@ -40,24 +40,24 @@ mod tests {
}
#[test]
fn gal_to_j2000() {
fn gal_to_icrs() {
use super::CooSystem;
use crate::math::lonlat::LonLat;
use crate::ArcDeg;
use crate::LonLatT;
let lonlat: LonLatT<f64> = LonLatT::new(ArcDeg(0.0).into(), ArcDeg(0.0).into());
let j2000_lonlat =
super::apply_coo_system(CooSystem::GAL, CooSystem::FK5J2000, &lonlat.vector()).lonlat();
let j2000_lon_deg = j2000_lonlat.lon().to_degrees();
let j2000_lat_deg = j2000_lonlat.lat().to_degrees();
let icrs_lonlat =
super::apply_coo_system(CooSystem::GAL, CooSystem::ICRS, &lonlat.vector()).lonlat();
let icrs_lon_deg = icrs_lonlat.lon().to_degrees();
let icrs_lat_deg = icrs_lonlat.lat().to_degrees();
assert_delta!(j2000_lon_deg, 266.40506655, 1e-3);
assert_delta!(j2000_lat_deg, -28.93616241, 1e-3);
assert_delta!(icrs_lon_deg, 266.40506655, 1e-3);
assert_delta!(icrs_lat_deg, -28.93616241, 1e-3);
}
#[test]
fn j2000_gal_roundtrip() {
fn icrs_gal_roundtrip() {
use super::CooSystem;
use crate::math::lonlat::LonLat;
use crate::ArcDeg;
@@ -65,10 +65,10 @@ mod tests {
let gal_lonlat: LonLatT<f64> = LonLatT::new(ArcDeg(0.0).into(), ArcDeg(0.0).into());
let j2000_pos =
super::apply_coo_system(CooSystem::GAL, CooSystem::FK5J2000, &gal_lonlat.vector());
let icrs_pos =
super::apply_coo_system(CooSystem::GAL, CooSystem::ICRS, &gal_lonlat.vector());
let gal_lonlat = super::apply_coo_system(CooSystem::FK5J2000, CooSystem::GAL, &j2000_pos);
let gal_lonlat = super::apply_coo_system(CooSystem::ICRS, CooSystem::GAL, &icrs_pos);
let gal_lon_deg = gal_lonlat.lon().to_degrees();
let gal_lat_deg = gal_lonlat.lat().to_degrees();

View File

@@ -207,7 +207,7 @@ impl HEALPixCell {
}
}
// Given in FK5J2000
// Given in ICRS
#[inline]
pub fn new(depth: u8, theta: f64, delta: f64) -> Self {
let pix = healpix::nested::hash(depth, theta, delta);

View File

@@ -331,36 +331,6 @@ impl WebClient {
/// having the specific form. Please check the file in core/src/hips.rs to see
/// the different semantics accepted.
///
/// # Examples
///
/// ```javascript
/// let al = new Aladin.wasmLibs.core.WebClient(...);
/// const panstarrs = {
/// properties: {
/// url: "http://alasky.u-strasbg.fr/Pan-STARRS/DR1/r",
///
/// maxOrder: 11,
/// frame: { label: "J2000", system: "J2000" },
/// tileSize: 512,
/// format: {
/// FITSImage: {
/// bitpix: 16,
/// }
/// },
/// minCutout: -0.15,
/// maxCutout: 5,
/// },
/// color: {
/// Grayscale2Colormap: {
/// colormap: "RedTemperature",
/// transfer: "asinh",
/// reversed: false,
/// }
/// },
/// };
/// al.setImageSurveys([panstarrs]);
/// ```
///
/// # Panics
///
/// * If the hips do not match SimpleHiPS type
@@ -577,9 +547,9 @@ impl WebClient {
Ok(self.app.get_clip_zoom_factor())
}
/// Set the center of the view in FK5J2000 coosys
/// Set the center of the view in ICRS coosys
///
/// The core works in FK5J2000 system so
/// The core works in ICRS system so
/// the location must be given in this system
///
/// # Arguments
@@ -627,19 +597,19 @@ impl WebClient {
Ok(())
}
/// View frame to FK5J2000 coosys conversion
/// View frame to ICRS coosys conversion
///
/// Coordinates must be given in the FK5J2000 coo system
/// Coordinates must be given in the ICRS coo system
///
/// # Arguments
///
/// * `lon` - A longitude in degrees
/// * `lat` - A latitude in degrees
#[wasm_bindgen(js_name = viewToFK5J2000CooSys)]
pub fn view_to_fk5j2000_coosys(&self, lon: f64, lat: f64) -> Box<[f64]> {
#[wasm_bindgen(js_name = viewToICRSCooSys)]
pub fn view_to_icrs_coosys(&self, lon: f64, lat: f64) -> Box<[f64]> {
let lonlat = LonLatT::new(ArcDeg(lon).into(), ArcDeg(lat).into());
let res = self.app.view_to_fk5j2000_coosys(&lonlat);
let res = self.app.view_to_icrs_coosys(&lonlat);
let lon_deg: ArcDeg<f64> = res.lon().into();
let lat_deg: ArcDeg<f64> = res.lat().into();
@@ -649,7 +619,7 @@ impl WebClient {
/// World to screen projection
///
/// Coordinates must be given in the FK5J2000 or ICRS coo system
/// Coordinates must be given in the ICRS or FK5J2000 coo system
/// ICRS coordinates are lightly different from FK5J2000 but for aladin lite visualization purposes the different is not noticeable.
///
/// # Arguments
@@ -668,7 +638,7 @@ impl WebClient {
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, CooSystem::FK5J2000, &xyz).lonlat();
let lonlat = coosys::apply_coo_system(frame, CooSystem::ICRS, &xyz).lonlat();
lon = lonlat.lon().to_degrees();
lat = lonlat.lat().to_degrees();
}

View File

@@ -220,22 +220,22 @@ impl ProjectionType {
self.world_to_screen_space(&pos_world_space, camera)
}
pub fn j2000_celestial_to_screen_space(
pub fn icrs_celestial_to_screen_space(
&self,
celestial_pos: &XYZWModel<f64>,
camera: &CameraViewPort,
) -> Option<XYScreen<f64>> {
self.j2000_celestial_to_normalized_device_space(celestial_pos, camera)
self.icrs_celestial_to_normalized_device_space(celestial_pos, camera)
.map(|ndc_pos| crate::ndc_to_screen_space(&ndc_pos, camera))
}
pub fn j2000_celestial_to_normalized_device_space(
pub fn icrs_celestial_to_normalized_device_space(
&self,
celestial_pos: &XYZWModel<f64>,
camera: &CameraViewPort,
) -> Option<XYNDC<f64>> {
let view_coosys = camera.get_coo_system();
let c = CooSystem::FK5J2000.to(view_coosys);
let c = CooSystem::ICRS.to(view_coosys);
let m2w = camera.get_m2w();
let pos_world_space = m2w * c * celestial_pos;

View File

@@ -194,7 +194,7 @@ impl Manager {
// Update the number of sources loaded
//self.num_sources += num_instances_in_catalog as usize;
self.catalogs.insert(name, catalog);
camera.register_view_frame(CooSystem::FK5J2000, proj);
camera.register_view_frame(CooSystem::ICRS, proj);
// At this point, all the sources memory will be deallocated here
// These sources have been copied to the GPU so we do not need them
@@ -213,7 +213,7 @@ impl Manager {
// Update the number of sources loaded
//self.num_sources += num_instances_in_catalog as usize;
self.catalogs.remove(&name);
camera.unregister_view_frame(CooSystem::FK5J2000, proj);
camera.unregister_view_frame(CooSystem::ICRS, proj);
}
pub fn set_kernel_size(&mut self, camera: &CameraViewPort) {
@@ -241,7 +241,7 @@ impl Manager {
}
} else {
let depth = camera.get_texture_depth().min(7);
let cells = camera.get_hpx_cells(depth, CooSystem::FK5J2000);
let cells = camera.get_hpx_cells(depth, CooSystem::ICRS);
for catalog in self.catalogs.values_mut() {
catalog.update(&cells);

View File

@@ -12,7 +12,7 @@ fn is_too_large(cell: &HEALPixCell, camera: &CameraViewPort, projection: &Projec
.iter()
.filter_map(|(lon, lat)| {
let vertex = crate::math::lonlat::radec_to_xyzw(lon.to_angle(), lat.to_angle());
projection.j2000_celestial_to_screen_space(&vertex, camera)
projection.icrs_celestial_to_screen_space(&vertex, camera)
})
.collect::<Vec<_>>();

View File

@@ -196,7 +196,7 @@ pub fn vertices(
x_it.clone().map(move |(x, uvx)| {
let ndc = if let Some(xyz) = wcs.unproj_xyz(&ImgXY::new(x as f64, y as f64)) {
let xyzw = crate::coosys::apply_coo_system(
CooSystem::FK5J2000,
CooSystem::ICRS,
camera.get_coo_system(),
&Vector4::new(xyz.y(), xyz.z(), xyz.x(), 1.0),
);

View File

@@ -263,7 +263,7 @@ impl Image {
.ok_or(JsValue::from_str("(w / 2, h / 2) px cannot be unprojected"))?;
let center_xyz = center.to_xyz();
let inside = crate::coosys::apply_coo_system(
CooSystem::FK5J2000,
CooSystem::ICRS,
coo_sys,
&Vector4::new(center_xyz.y(), center_xyz.z(), center_xyz.x(), 1.0),
);
@@ -283,7 +283,7 @@ impl Image {
let xyz = lonlat.to_xyz();
crate::coosys::apply_coo_system(
CooSystem::FK5J2000,
CooSystem::ICRS,
coo_sys,
&Vector4::new(xyz.y(), xyz.z(), xyz.x(), 1.0),
)
@@ -292,8 +292,8 @@ impl Image {
let reg = Region::from_vertices(&vertices, &inside);
// ra and dec must be given in FK5J2000 coo system, which is the case because wcs returns
// only FK5J2000 coo
// ra and dec must be given in ICRS coo system, which is the case because wcs returns
// only ICRS coo
let centered_fov = CenteredFoV {
ra: center.lon().to_degrees(),
dec: center.lat().to_degrees(),
@@ -554,7 +554,7 @@ impl Image {
.ok_or(JsValue::from_str("(w / 2, h / 2) px cannot be unprojected"))?;
let center_xyz = center.to_xyz();
let inside = crate::coosys::apply_coo_system(
CooSystem::FK5J2000,
CooSystem::ICRS,
self.coo_sys,
&Vector4::new(center_xyz.y(), center_xyz.z(), center_xyz.x(), 1.0),
);
@@ -578,7 +578,7 @@ impl Image {
let xyz = lonlat.to_xyz();
crate::coosys::apply_coo_system(
CooSystem::FK5J2000,
CooSystem::ICRS,
self.coo_sys,
&Vector4::new(xyz.y(), xyz.z(), xyz.x(), 1.0),
)

View File

@@ -399,9 +399,9 @@ impl RasterizedLineRenderer {
);
}
CooSpace::LonLat => {
let j20002view = CooSystem::FK5J2000.to(camera.get_coo_system());
let icrs2view = CooSystem::ICRS.to(camera.get_coo_system());
let view2world = camera.get_m2w();
let j20002world = view2world * j20002view;
let icrs2world = view2world * icrs2view;
crate::shader::get_shader(
&self.gl,
@@ -411,7 +411,7 @@ impl RasterizedLineRenderer {
)?
.bind(&self.gl)
.attach_uniforms_from(camera)
.attach_uniform("u_2world", &j20002world)
.attach_uniform("u_2world", &icrs2world)
.attach_uniform("u_color", &meta.color)
.attach_uniform("u_width", &meta.thickness)
.attach_uniform("u_proj", proj)

View File

@@ -235,7 +235,7 @@ impl MOCIntern {
moc: &'a HEALPixCoverage,
camera: &'a mut CameraViewPort,
) -> impl Iterator<Item = [(f64, f64); 4]> + 'a {
let view_moc = camera.get_cov(CooSystem::FK5J2000);
let view_moc = camera.get_cov(CooSystem::ICRS);
moc.overlapped_by_iter(view_moc)
.cells()
@@ -263,7 +263,7 @@ impl MOCIntern {
match self.mode {
RenderModeType::Perimeter { thickness, color } => {
let moc_in_view = moc
.overlapped_by_iter(&camera.get_cov(CooSystem::FK5J2000))
.overlapped_by_iter(&camera.get_cov(CooSystem::ICRS))
.into_range_moc();
let perimeter_vertices_iter = moc_in_view
.border_elementary_edges()
@@ -326,9 +326,9 @@ impl MOCIntern {
let num_instances = buf.len() / 4;
let j20002view = CooSystem::FK5J2000.to(camera.get_coo_system());
let icrs2view = CooSystem::ICRS.to(camera.get_coo_system());
let view2world = camera.get_m2w();
let j20002world = view2world * j20002view;
let icrs2world = view2world * icrs2view;
crate::shader::get_shader(
&self.gl,
@@ -338,7 +338,7 @@ impl MOCIntern {
)?
.bind(&self.gl)
.attach_uniforms_from(camera)
.attach_uniform("u_2world", &j20002world)
.attach_uniform("u_2world", &icrs2world)
.attach_uniform("u_color", &color)
.attach_uniform("u_width", &(camera.get_width()))
.attach_uniform("u_height", &(camera.get_height()))
@@ -364,9 +364,9 @@ impl MOCIntern {
let num_instances = buf.len() / 4;
let j20002view = CooSystem::FK5J2000.to(camera.get_coo_system());
let icrs2view = CooSystem::ICRS.to(camera.get_coo_system());
let view2world = camera.get_m2w();
let j20002world = view2world * j20002view;
let icrs2world = view2world * icrs2view;
crate::shader::get_shader(
&self.gl,
@@ -376,7 +376,7 @@ impl MOCIntern {
)?
.bind(&self.gl)
.attach_uniforms_from(camera)
.attach_uniform("u_2world", &j20002world)
.attach_uniform("u_2world", &icrs2world)
.attach_uniform("u_color", &color)
.attach_uniform("u_width", &(camera.get_width()))
.attach_uniform("u_height", &(camera.get_height()))
@@ -433,16 +433,16 @@ impl MOCIntern {
)
.update_element_array(WebGl2RenderingContext::DYNAMIC_DRAW, VecData(&indices));
let j20002view = CooSystem::FK5J2000.to(camera.get_coo_system());
let icrs2view = CooSystem::ICRS.to(camera.get_coo_system());
let view2world = camera.get_m2w();
let j20002world = view2world * j20002view;
let icrs2world = view2world * icrs2view;
self.gl.enable(WebGl2RenderingContext::CULL_FACE);
crate::shader::get_shader(&self.gl, shaders, "moc_base.vert", "moc_base.frag")?
.bind(&self.gl)
.attach_uniforms_from(camera)
.attach_uniform("u_2world", &j20002world)
.attach_uniform("u_2world", &icrs2world)
.attach_uniform("u_color", &color)
.attach_uniform("u_proj", proj)
.bind_vertex_array_object_ref(&self.vao)

View File

@@ -76,7 +76,7 @@ impl MOCRenderer {
.push(MOCHierarchy::from_full_res_moc(self.gl.clone(), moc, &cfg));
self.cfgs.push(cfg);
camera.register_view_frame(CooSystem::FK5J2000, proj);
camera.register_view_frame(CooSystem::ICRS, proj);
//self.layers.push(key);
}
@@ -96,7 +96,7 @@ impl MOCRenderer {
) -> Option<MOCOptions> {
if let Some(idx) = self.cfgs.iter().position(|cfg| cfg.get_uuid() == moc_uuid) {
self.mocs.remove(idx);
camera.unregister_view_frame(CooSystem::FK5J2000, proj);
camera.unregister_view_frame(CooSystem::ICRS, proj);
Some(self.cfgs.remove(idx))
} else {

View File

@@ -185,14 +185,14 @@ impl PolylineRenderer {
);*/
// draw the instanced lines
let j20002view = CooSystem::FK5J2000.to(camera.get_coo_system());
let icrs2view = CooSystem::ICRS.to(camera.get_coo_system());
let view2world = camera.get_m2w();
let j20002world = view2world * j20002view;
let icrs2world = view2world * icrs2view;
crate::shader::get_shader(&self.gl, shaders, "line_inst_lonlat.vert", "line_base.frag")?
.bind(&self.gl)
.attach_uniforms_from(camera)
.attach_uniform("u_2world", &j20002world)
.attach_uniform("u_2world", &icrs2world)
.attach_uniform("u_color", &self.color)
.attach_uniform("u_width", &self.thickness)
.attach_uniform("u_proj", proj)

View File

@@ -1125,7 +1125,7 @@
.aladin-location {
position: absolute;
top: 0.2rem;
left: 5.2rem;
left: 4.75rem;
font-family: monospace;
color: white;

View File

@@ -688,7 +688,7 @@ A.catalogFromSimbad = function (target, radius, options, successCallback, errorC
// object name, use sesame
Sesame.resolve(target,
function (data) { // success callback
// Location given in icrs at J2000
// Location given in icrs at ICRS
coo = new Coo(data.coo.jradeg, data.coo.jdedeg);
resolve(coo)
},

View File

@@ -87,7 +87,7 @@ import { Polyline } from "./shapes/Polyline";
* This list can have string item (either a CDS ID or an HiPS url) or an object that describes the HiPS
* more exhaustively. See the example below to see the different form that this item can have to describe a HiPS.
* @property {string} [target="0 +0"] - Target coordinates for the initial view.
* @property {CooFrame} [cooFrame="J2000"] - Coordinate frame.
* @property {CooFrame} [cooFrame="ICRS"] - Coordinate frame.
* @property {number} [fov=60] - Field of view in degrees.
* @property {number} [northPoleOrientation=0] - North pole orientation in degrees. By default it is set to 0 deg i.e. the north pole will be found vertically north to the view.
* Positive orientation goes towards east i.e. in counter clockwise order as the east lies in the left direction of the view.
@@ -218,9 +218,8 @@ import { Polyline } from "./shapes/Polyline";
/**
* @typedef {string} CooFrame
* String with possible values: 'equatorial', 'ICRS', 'ICRSd', 'j2000', 'gal, 'galactic'
* Internally, Aladin Lite represents its view in FK5J2000 (ESA method) reference system.
* For Aladin Lite visualization purposes, the difference between ICRS and FK5J2000 is not noticeable and therefore, giving ICRS as CooFrame will be interpreted by Aladin Lite the same way as FK5J2000.
* Nonetheless, the intern coo system of Aladin Lite is FK5J2000 (from the ESA method).
* Internally, Aladin Lite represents its view in ICRS reference system. <br />
* For Aladin Lite visualization purposes, the difference between ICRS and FK5J2000 is not noticeable and therefore, giving `j2000` as CooFrame will be interpreted by Aladin Lite the same way as ICRS.
*/
/**
@@ -664,7 +663,7 @@ export let Aladin = (function () {
hipsList: HiPSList.DEFAULT,
//surveyUrl: ["https://alaskybis.unistra.fr/DSS/DSSColor", "https://alasky.unistra.fr/DSS/DSSColor"],
target: "0 +0",
cooFrame: "J2000",
cooFrame: "ICRS",
fov: 60,
northPoleOrientation: 0,
inertia: true,
@@ -903,7 +902,7 @@ export let Aladin = (function () {
if (!frame) {
return;
}
var newFrame = CooFrameEnum.fromString(frame, CooFrameEnum.J2000);
var newFrame = CooFrameEnum.fromString(frame, CooFrameEnum.ICRS);
if (newFrame == this.view.cooFrame) {
return;
}
@@ -997,10 +996,10 @@ export let Aladin = (function () {
``;
/**
* Returns the current coordinate system: possible values are 'J2000', 'J2000d', and 'Galactic' .
* Returns the current coordinate system: possible values are 'ICRS', 'ICRSd', and 'Galactic' .
*
* @memberof Aladin
* @returns {string} The current coordinate system: possible values are 'J2000', 'J2000d', and 'Galactic' .
* @returns {string} The current coordinate system: possible values are 'ICRS', 'ICRSd', and 'Galactic' .
*
* @example
* const aladin = A.aladin('#aladin-lite-div', {cooFrame: 'galactic'});
@@ -1054,8 +1053,8 @@ export let Aladin = (function () {
if (!isObjectName) {
var coo = new Coo();
coo.parse(targetName);
// Convert from view coo sys to J2000
const [ra, dec] = this.wasm.viewToFK5J2000CooSys(coo.lon, coo.lat);
// Convert from view coo sys to ICRS
const [ra, dec] = this.wasm.viewToICRSCooSys(coo.lon, coo.lat);
this.view.pointTo(ra, dec);
@@ -1079,7 +1078,7 @@ export let Aladin = (function () {
targetName,
function (data) {
// success callback
// Location given in J2000
// Location given in ICRS
const coo = data.coo;
self.view.pointTo(coo.jradeg, coo.jdedeg);
@@ -1150,14 +1149,14 @@ export let Aladin = (function () {
if (frame) {
frame = CooFrameEnum.fromString(
this.options.cooFrame,
CooFrameEnum.J2000
CooFrameEnum.ICRS
);
}
// both are CooFrameEnum
let positionGivenFrame = frame || this.view.cooFrame;
// First, convert to J2000 if needed
// First, convert to ICRS if needed
if (positionGivenFrame === CooFrameEnum.GAL) {
radec = CooConversion.GalacticToJ2000([lon, lat]);
radec = CooConversion.GalacticToICRS([lon, lat]);
} else {
radec = [lon, lat];
}
@@ -1359,7 +1358,7 @@ export let Aladin = (function () {
/**
* Gets the current [Right Ascension, Declination] position of the center of the Aladin view.
*
* This method returns the celestial coordinates of the center of the Aladin view in the FK5J2000 equatorial coordinates.
* This method returns the celestial coordinates of the center of the Aladin view in the ICRS equatorial coordinates.
*
* @memberof Aladin
* @returns {number[]} - An array representing the [Right Ascension, Declination] coordinates in degrees.
@@ -1367,19 +1366,19 @@ export let Aladin = (function () {
*/
Aladin.prototype.getRaDec = function () {
let radec = this.wasm.getCenter(); // This is given in the frame of the view
// We must convert it to FK5J2000
const radec_j2000 = this.wasm.viewToFK5J2000CooSys(radec[0], radec[1]);
// We must convert it to ICRS
const radec_icrs = this.wasm.viewToICRSCooSys(radec[0], radec[1]);
if (radec_j2000[0] < 0) {
return [radec_j2000[0] + 360.0, radec_j2000[1]];
if (radec_icrs[0] < 0) {
return [radec_icrs[0] + 360.0, radec_icrs[1]];
}
return radec_j2000;
return radec_icrs;
};
/**
* Moves the Aladin instance to the specified position given in FK5J2000 frame.
* Giving ICRS coordinates will not show noticeable difference from FK5J2000.
* Moves the Aladin instance to the specified position given in ICRS frame.
* Giving FK5J2000 coordinates will not show noticeable difference from ICRS.
*
* @memberof Aladin
* @param {number} ra - Right-ascension in degrees
@@ -2131,7 +2130,7 @@ export let Aladin = (function () {
* @param {function} myFunction - a callback function.
* Note: <ul>
* <li>positionChanged and zoomChanged are throttled every 100ms.</li>
* <li>positionChanged's callback gives an object having ra and dec keywords of the current position in FK5J2000 frame. See the below example.</li>
* <li>positionChanged's callback gives an object having ra and dec keywords of the current position in ICRS frame. See the below example.</li>
* </ul>
* @example
// define function triggered when a source is hovered
@@ -2486,9 +2485,8 @@ export let Aladin = (function () {
}
} else {
switch (this.getFrame()) {
// FIXME: change radesys to FK5 and EQUINOX to 2000
case "FK5J2000":
case "FK5J2000d":
case "ICRS":
case "ICRSd":
cooType1 = "RA---";
cooType2 = "DEC--";
radesys = "ICRS ";
@@ -2595,7 +2593,7 @@ export let Aladin = (function () {
*/
Aladin.prototype.pix2world = function (x, y, frame) {
if (frame) {
frame = CooFrameEnum.fromString(frame, CooFrameEnum.J2000);
frame = CooFrameEnum.fromString(frame, CooFrameEnum.ICRS);
}
let lonlat = this.view.wasm.pix2world(x, y, frame && frame.system);
@@ -2615,7 +2613,7 @@ export let Aladin = (function () {
* @memberof Aladin
* @param {number} lon - Londitude coordinate in degrees.
* @param {number} lat - Latitude coordinate in degrees.
* @param {CooFrame} [frame] - If not specified, the frame used is FK5J2000
* @param {CooFrame} [frame] - If not specified, the frame used is ICRS
* @returns {number[]} - An array representing the [x, y] coordinates in pixel coordinates in the view.
*
@@ -2624,14 +2622,14 @@ export let Aladin = (function () {
Aladin.prototype.world2pix = function (lon, lat, frame) {
if (frame) {
if (frame instanceof string) {
frame = CooFrameEnum.fromString(frame, CooFrameEnum.J2000);
frame = CooFrameEnum.fromString(frame, CooFrameEnum.ICRS);
}
if (frame.label == CooFrameEnum.SYSTEMS.GAL) {
frame = Aladin.wasmLibs.core.CooSystem.GAL;
}
else {
frame = Aladin.wasmLibs.core.CooSystem.FK5J2000;
frame = Aladin.wasmLibs.core.CooSystem.ICRS;
}
}

View File

@@ -23,15 +23,15 @@ export let CooConversion = (function() {
let CooConversion = {};
CooConversion.GALACTIC_TO_J2000 = [
-0.0548755604024359, 0.4941094279435681, -0.8676661489811610,
-0.8734370902479237, -0.4448296299195045, -0.1980763734646737,
-0.4838350155267381, 0.7469822444763707, 0.4559837762325372 ];
CooConversion.GALACTIC_TO_ICRS = [
-0.05487565771261968232908806948676, 0.49410943719710765017955928850141, -0.86766613755716255824577781583414,
-0.87343705195577915249273984034980, -0.44482972122205372312012370920248, -0.19807633727507056817237662907031,
-0.48383507361641838378786914298189, 0.74698218398450941835110635824212, 0.45598381369115237931077906137440 ];
CooConversion.J2000_TO_GALACTIC = [
-0.0548755604024359, -0.873437090247923, -0.4838350155267381,
0.4941094279435681, -0.4448296299195045, 0.7469822444763707,
-0.8676661489811610, -0.1980763734646737, 0.4559837762325372 ];
CooConversion.ICRS_TO_GALACTIC = [
-0.05487565771261968232908806948676, -0.87343705195577915249273984034980, -0.48383507361641838378786914298189,
0.49410943719710765017955928850141, -0.44482972122205372312012370920248, 0.74698218398450941835110635824212,
-0.86766613755716255824577781583414, -0.19807633727507056817237662907031, 0.45598381369115237931077906137440 ];
// adapted from www.robertmartinayers.org/tools/coordinates.html
// radec : array of ra, dec in degrees
@@ -65,12 +65,12 @@ export let CooConversion = (function() {
};
// coo : array of lon, lat in degrees
CooConversion.GalacticToJ2000 = function(coo) {
return CooConversion.Transform(coo, CooConversion.GALACTIC_TO_J2000);
CooConversion.GalacticToICRS = function(coo) {
return CooConversion.Transform(coo, CooConversion.GALACTIC_TO_ICRS);
};
// coo : array of lon, lat in degrees
CooConversion.J2000ToGalactic = function(coo) {
return CooConversion.Transform(coo, CooConversion.J2000_TO_GALACTIC);
CooConversion.ICRSToGalactic = function(coo) {
return CooConversion.Transform(coo, CooConversion.ICRS_TO_GALACTIC);
};
return CooConversion;
})();

View File

@@ -31,12 +31,12 @@
export let CooFrameEnum = (function() {
// Corresponds to the Rust CooSystem enum possibilities.
var systems = {J2000: 'FK5J2000', GAL: 'GAL'};
var systems = {ICRS: 'ICRS', GAL: 'GAL'};
return {
SYSTEMS: systems,
J2000: {label: "J2000", system: systems.J2000, explain: "Equatorial (FK5 J2000)"},
J2000d: {label: "J2000d", system: systems.J2000, explain: "Equatorial (FK5 J2000) in decimals"},
ICRS: {label: "ICRS", system: systems.ICRS, explain: "International Celestial Reference System"},
ICRSd: {label: "ICRSd", system: systems.ICRS, explain: "International Celestial Reference System in decimals"},
GAL: {label: "GAL", system: systems.GAL, explain: "Galactical"},
fromString: function(str, defaultValue) {
@@ -47,10 +47,10 @@ export let CooFrameEnum = (function() {
str = str.toLowerCase().replace(/^\s+|\s+$/g, ''); // convert to lowercase and trim
if (str.indexOf('j2000d')==0 || str.indexOf('icrsd')==0) {
return CooFrameEnum.J2000d;
return CooFrameEnum.ICRSd;
}
else if (str.indexOf('j2000')==0 || str.indexOf('icrs')==0) {
return CooFrameEnum.J2000;
return CooFrameEnum.ICRS;
}
else if (str.indexOf('gal')==0) {
return CooFrameEnum.GAL;

View File

@@ -53,7 +53,7 @@ PropertyParser.cooFrame = function (properties) {
let cooFrame =
(properties && properties.hips_body && "ICRSd") ||
(properties && properties.hips_frame) ||
"j2000";
"icrs";
return cooFrame;
};
@@ -148,7 +148,7 @@ PropertyParser.isPlanetaryBody = function (properties) {
* @property {Function} [successCallback] - A callback executed when the HiPS has been loaded
* @property {Function} [errorCallback] - A callback executed when the HiPS could not be loaded
* @property {string} [imgFormat] - Formats accepted 'webp', 'png', 'jpeg' or 'fits'. Will raise an error if the HiPS does not contain tiles in this format
* @property {CooFrame} [cooFrame="J2000"] - Coordinate frame of the survey tiles
* @property {CooFrame} [cooFrame="ICRS"] - Coordinate frame of the survey tiles
* @property {number} [maxOrder] - The maximum HEALPix order of the HiPS, i.e the HEALPix order of the most refined tile images of the HiPS.
* @property {number} [numBitsPerPixel] - Useful if you want to display the FITS tiles of a HiPS. It specifies the number of bits per pixel. Possible values are:
* -64: double, -32: float, 8: unsigned byte, 16: short, 32: integer 32 bits, 64: integer 64 bits
@@ -333,8 +333,8 @@ export let HiPS = (function () {
let cooFrame =
PropertyParser.cooFrame(properties);
// Parse the cooframe from the properties but if it fails, take the one given by the user
// If the user gave nothing, then take J2000 as the default one
self.cooFrame = CooFrameEnum.fromString(cooFrame, self.cooFrame || CooFrameEnum.J2000);
// If the user gave nothing, then take ICRS as the default one
self.cooFrame = CooFrameEnum.fromString(cooFrame, self.cooFrame || CooFrameEnum.ICRS);
// sky fraction
self.skyFraction = PropertyParser.skyFraction(properties);

View File

@@ -270,8 +270,8 @@ export let MOC = (function() {
* Tests whether a given (ra, dec) point on the sky is within the current MOC object
*
* @memberof MOC
* @param {number} ra - Right-Ascension of the location in degrees and FK5J2000 frame
* @param {number} dec - Declination of the location in degrees and FK5J2000 frame
* @param {number} ra - Right-Ascension of the location in degrees and ICRS frame
* @param {number} dec - Declination of the location in degrees and ICRS frame
*
* @returns {boolean} True if the point is contained, false otherwise
*/

View File

@@ -121,8 +121,8 @@ export let GraphicOverlay = (function() {
};
/**
* Parse a STCS string and returns a list of footprints (only circles, polygons and ellipses given in ICRS/FK5J2000 frame are handled).
* For visualization purposes, the difference between FK5J2000 (ESA method) and ICRS system is not noticeable. Therefore one can be interpreted as the other.
* Parse a STCS string and returns a list of footprints (only circles, polygons and ellipses given in ICRS or FK5J2000 frame are handled).
* For visualization purposes, the difference between FK5J2000 and ICRS system is not noticeable. Therefore one can be interpreted as the other.
*
* @memberof GraphicOverlay
*

View File

@@ -54,7 +54,7 @@ export let ProgressiveCat = (function() {
}
this.frameStr = frameStr;
this.frame = CooFrameEnum.fromString(frameStr) || CooFrameEnum.J2000;
this.frame = CooFrameEnum.fromString(frameStr) || CooFrameEnum.ICRS;
this.maxOrder = parseInt(maxOrder);
this.isShowing = true; // TODO : inherit from catalogue

View File

@@ -204,7 +204,7 @@ export let View = (function () {
this.viewCenter = { lon, lat }; // position of center of view
// Coo frame setting
const cooFrame = CooFrameEnum.fromString(this.options.cooFrame, CooFrameEnum.J2000);
const cooFrame = CooFrameEnum.fromString(this.options.cooFrame, CooFrameEnum.ICRS);
this.changeFrame(cooFrame);
this.selector = new Selector(this, this.options.selector);
@@ -1959,7 +1959,7 @@ export let View = (function () {
this.wasm.setCooSystem(this.cooFrame.system);
// Set the grid label format
if (this.cooFrame.label == "J2000") {
if (this.cooFrame.label == "ICRS") {
this.setGridOptions({fmt: "sexagesimal"});
}
else {
@@ -2009,8 +2009,8 @@ export let View = (function () {
*
* @API Point to a specific location
*
* @param ra ra expressed in ICRS or FK5J2000 frame
* @param dec dec expressed in ICRS or FK5J2000 frame
* @param ra ra expressed in ICRS or ICRS frame
* @param dec dec expressed in ICRS or ICRS frame
* @param options
*
*/

View File

@@ -332,7 +332,7 @@ export class OverlayStackBox extends Box {
self.aladin.pix2world(
c.x,
c.y,
"j2000"
"icrs"
);
let radius =
self.aladin.angularDist(
@@ -380,25 +380,25 @@ export class OverlayStackBox extends Box {
self.aladin.pix2world(
r.x,
r.y,
"j2000"
"icrs"
);
let [ra2, dec2] =
self.aladin.pix2world(
r.x + r.w,
r.y,
"j2000"
"icrs"
);
let [ra3, dec3] =
self.aladin.pix2world(
r.x + r.w,
r.y + r.h,
"j2000"
"icrs"
);
let [ra4, dec4] =
self.aladin.pix2world(
r.x,
r.y + r.h,
"j2000"
"icrs"
);
let moc = A.MOCFromPolygon(
@@ -453,7 +453,7 @@ export class OverlayStackBox extends Box {
self.aladin.pix2world(
v.x,
v.y,
"j2000"
"icrs"
);
ra.push(lon);
dec.push(lat);

View File

@@ -38,13 +38,13 @@
// constructor
constructor(aladin, options) {
let self;
let cooFrame = CooFrameEnum.fromString(aladin.options.cooFrame, CooFrameEnum.J2000);
let cooFrame = CooFrameEnum.fromString(aladin.options.cooFrame, CooFrameEnum.ICRS);
super({
name: 'cooFrame',
type: 'select',
value: cooFrame.label,
options: [CooFrameEnum.J2000.label, CooFrameEnum.J2000d.label, CooFrameEnum.GAL.label],
options: [CooFrameEnum.ICRS.label, CooFrameEnum.ICRSd.label, CooFrameEnum.GAL.label],
change(e) {
aladin.setFrame(e.target.value)
},

View File

@@ -146,7 +146,7 @@ export class Location extends DOMElement {
// convert to the view frame
let lonlat = radec;
if (aladin.getFrame() === "GAL") {
lonlat = CooConversion.J2000ToGalactic(radec)
lonlat = CooConversion.ICRSToGalactic(radec)
}
let [lon, lat] = lonlat;
@@ -212,10 +212,10 @@ export class Location extends DOMElement {
let self = this;
const updateFromLonLatFunc = (lon, lat, cooFrame) => {
var coo = new Coo(lon, lat, Location.prec);
if (cooFrame == CooFrameEnum.J2000) {
if (cooFrame == CooFrameEnum.ICRS) {
self.field.set(coo.format('s/'));
}
else if (cooFrame == CooFrameEnum.J2000d) {
else if (cooFrame == CooFrameEnum.ICRSd) {
self.field.set(coo.format('d/'))
}
else {

View File

@@ -107,9 +107,9 @@ export class ContextMenu extends DOMElement {
const pos = this.aladin.pix2world(xymouse.x, xymouse.y);
const coo = new Coo(pos[0], pos[1], 6);
let posStr;
if (this.aladin.view.cooFrame == CooFrameEnum.J2000) {
if (this.aladin.view.cooFrame == CooFrameEnum.ICRS) {
posStr = coo.format('s/');
} else if (this.aladin.view.cooFrame == CooFrameEnum.J2000d) {
} else if (this.aladin.view.cooFrame == CooFrameEnum.ICRSd) {
posStr = coo.format('d/');
} else {
posStr = coo.format('d/');