Skip to content

Commit

Permalink
add more numbers of direction bins
Browse files Browse the repository at this point in the history
  • Loading branch information
Tehforsch committed Sep 18, 2023
1 parent 602c9c2 commit 0690638
Show file tree
Hide file tree
Showing 2 changed files with 237 additions and 90 deletions.
315 changes: 230 additions & 85 deletions src/sweep/direction/healpix.rs
Original file line number Diff line number Diff line change
@@ -1,86 +1,231 @@
pub const DIRECTION_BINS_84: [&[f64; 3]; 84] = [
&[-0.0350007, 0.880555, -0.47265],
&[0.739861, -0.620782, 0.259297],
&[0.918057, 0.137069, -0.372001],
&[-0.0143627, -0.0493037, -0.998681],
&[-0.231169, -0.443199, 0.866104],
&[-0.771831, 0.56671, -0.2883],
&[0.0424294, 0.989419, 0.138741],
&[0.310936, -0.288518, -0.905581],
&[0.080855, -0.215628, 0.973122],
&[-0.858908, -0.358953, 0.365281],
&[0.381088, -0.407118, 0.830077],
&[-0.31503, 0.905885, 0.283069],
&[0.9235, -0.253999, 0.287457],
&[-0.0370429, -0.800832, -0.597742],
&[-0.32801, 0.232215, -0.915689],
&[-0.665645, -0.354557, -0.656663],
&[0.744313, 0.484705, -0.459412],
&[0.159569, 0.660581, -0.733601],
&[0.591782, -0.796509, -0.123966],
&[-0.844399, 0.232951, -0.482415],
&[0.15917, 0.194812, 0.96784],
&[0.247436, 0.949373, -0.193565],
&[-0.582381, 0.460002, -0.670246],
&[0.645869, -0.613889, -0.453866],
&[-0.516269, -0.853742, -0.0677514],
&[0.06325, 0.341056, -0.937913],
&[-0.580505, 0.812527, -0.0530505],
&[-0.185312, 0.428899, 0.884141],
&[0.078506, -0.65055, 0.755395],
&[-0.512406, -0.179724, 0.839726],
&[0.174544, 0.582176, 0.794107],
&[-0.228054, -0.955551, 0.186854],
&[-0.969018, -0.24507, -0.0307468],
&[0.792349, -0.00724308, 0.610025],
&[-0.216691, 0.0363919, 0.975562],
&[0.383166, 0.0921727, -0.919069],
&[-0.170157, 0.76462, 0.621614],
&[0.654046, 0.740711, -0.153528],
&[-0.966434, 0.0504854, 0.251906],
&[0.701621, -0.385141, 0.599495],
&[-0.801386, -0.595309, 0.0581941],
&[0.763442, 0.610264, 0.211503],
&[0.426782, -0.880317, 0.207123],
&[-0.64751, 0.695547, 0.31136],
&[0.33047, -0.644294, -0.689692],
&[0.871103, -0.262806, -0.414864],
&[-0.466664, -0.766744, -0.440827],
&[-0.355637, -0.572438, -0.738808],
&[-0.878332, 0.469864, 0.0880956],
&[-0.154671, -0.95487, -0.253576],
&[0.44948, 0.878173, 0.163642],
&[0.489946, -0.0413798, 0.87077],
&[0.286335, -0.886196, -0.364238],
&[0.63132, -0.29907, -0.715536],
&[0.487599, 0.434987, -0.75699],
&[-0.224972, 0.963962, -0.142003],
&[-0.271644, -0.763058, 0.586475],
&[-0.499843, 0.578159, 0.644895],
&[-0.97839, 0.163911, -0.12604],
&[-0.796757, -0.0542859, 0.601856],
&[0.956315, 0.165336, 0.241091],
&[0.431617, 0.764488, -0.478816],
&[0.499165, 0.341303, 0.796459],
&[-0.597387, -0.496446, 0.629818],
&[-0.442879, 0.777265, -0.446897],
&[0.868085, -0.488662, -0.087393],
&[-0.898665, -0.155478, -0.410155],
&[0.0797905, -0.901932, 0.424443],
&[0.914681, 0.396488, -0.0784603],
&[0.713581, 0.0898074, -0.694792],
&[0.772221, 0.367449, 0.51832],
&[0.167238, 0.862295, 0.477995],
&[-0.0171808, -0.476111, -0.879218],
&[-0.359214, -0.196189, -0.912401],
&[-0.774604, -0.544069, -0.322457],
&[0.135948, -0.990666, -0.00991929],
&[0.439578, -0.705422, 0.556013],
&[0.994526, -0.0861875, -0.0590725],
&[-0.230688, 0.609802, -0.758238],
&[-0.569105, -0.752199, 0.332139],
&[-0.649245, 0.0375767, -0.75965],
&[-0.553892, 0.225701, 0.801413],
&[-0.808676, 0.342276, 0.478425],
&[0.504395, 0.676467, 0.536635],
pub const DIRECTION_BINS_16: [[f64; 3]; 16] = [
[-0.887773, 0.0580969, -0.456601],
[-0.674667, -0.714656, -0.18464],
[-0.00927613, 0.998084, 0.0611669],
[-0.175597, -0.21699, -0.960251],
[-0.175636, -0.797369, 0.577368],
[-0.763412, 0.626161, 0.158509],
[0.567715, 0.614688, 0.547594],
[-0.807106, -0.195955, 0.55694],
[0.661621, -0.224206, -0.715535],
[0.65646, -0.726129, 0.204444],
[-0.254572, 0.395254, 0.882591],
[-0.231413, 0.626322, -0.744425],
[0.994725, 0.0418712, 0.0936475],
[0.116228, -0.898117, -0.42412],
[0.605804, 0.619106, -0.499709],
[0.376898, -0.20616, 0.90302],
];

pub const DIRECTION_BINS_21: [[f64; 3]; 21] = [
[-0.21812, 0.953415, 0.208382],
[0.632711, -0.706968, 0.316026],
[0.877577, -0.345234, -0.332675],
[0.494404, 0.0644753, -0.866838],
[-0.472393, -0.82019, -0.322697],
[-0.826035, -0.122325, -0.550184],
[0.5187, 0.804055, 0.290595],
[-0.089183, -0.444281, -0.891437],
[-0.459981, -0.27435, 0.844482],
[-0.852982, -0.469298, 0.228432],
[0.290946, -0.352099, 0.889593],
[-0.475995, 0.476672, 0.739062],
[0.894331, 0.0539323, 0.444144],
[-0.136318, -0.907742, 0.396764],
[-0.247538, 0.321248, -0.91407],
[-0.625228, 0.686856, -0.370566],
[0.857566, 0.434469, -0.275348],
[0.207314, 0.836646, -0.506996],
[0.310263, -0.870287, -0.382542],
[-0.943535, 0.27867, 0.179119],
[0.263497, 0.402335, 0.876753],
];

pub const DIRECTION_BINS_32: [[f64; 3]; 32] = [
[-0.835689, 0.395278, -0.381288],
[-0.341951, -0.360379, 0.867869],
[-0.335975, 0.837247, 0.431438],
[-0.19292, -0.976372, -0.0973651],
[-0.355858, 0.491008, -0.795158],
[-0.692156, -0.644782, -0.324309],
[0.835689, -0.395278, 0.381288],
[0.988147, 0.139838, 0.0633272],
[0.447964, -0.871712, 0.198611],
[0.198232, 0.651171, 0.732585],
[-0.827863, -0.0838637, 0.554626],
[0.103734, 0.845606, -0.523632],
[0.439369, -0.345526, -0.829196],
[-0.681115, -0.660351, 0.316259],
[0.19292, 0.976372, 0.0973651],
[-0.447964, 0.871712, -0.198611],
[-0.988147, -0.139838, -0.0633272],
[0.689709, 0.134165, 0.711548],
[0.116397, 0.0703386, 0.990709],
[-0.439369, 0.345526, 0.829196],
[-0.116397, -0.0703386, -0.990709],
[0.827862, 0.0838638, -0.554627],
[0.341951, 0.360379, -0.867869],
[0.692156, 0.644782, 0.324309],
[0.681115, 0.660351, -0.316259],
[-0.83874, 0.481828, 0.253685],
[0.83874, -0.481828, -0.253685],
[0.355858, -0.491008, 0.795158],
[-0.103734, -0.845606, 0.523632],
[-0.689709, -0.134165, -0.711548],
[0.335975, -0.837247, -0.431438],
[-0.198232, -0.651171, -0.732585],
];

pub const DIRECTION_BINS_64: [[f64; 3]; 64] = [
[0.247906, 0.83552, -0.490355],
[0.876349, -0.233808, 0.421125],
[0.919741, 0.243178, -0.308126],
[-0.371525, -0.193571, -0.90802],
[-0.0630642, -0.567382, 0.821037],
[-0.807847, 0.374609, -0.45503],
[0.184321, 0.923217, 0.337189],
[0.0952302, -0.27616, -0.956382],
[0.219173, -0.243289, 0.944867],
[-0.788434, -0.222736, 0.573377],
[0.552743, -0.420977, 0.719203],
[-0.317057, 0.944401, 0.087068],
[0.577184, 0.44968, 0.68165],
[0.242177, -0.91363, -0.326545],
[-0.529157, 0.227583, -0.817435],
[-0.591365, -0.526061, -0.611186],
[0.706512, 0.15162, -0.691269],
[-0.0476095, 0.607682, -0.792752],
[0.652221, -0.59794, -0.465915],
[-0.767878, -0.114393, -0.6303],
[-0.823596, -0.529049, 0.204442],
[-0.214378, 0.894893, -0.391419],
[-0.458646, 0.620835, -0.635773],
[0.881334, -0.20698, -0.424747],
[-0.500831, -0.846181, 0.182059],
[-0.108499, 0.202988, -0.973151],
[-0.637156, 0.741844, -0.209047],
[-0.175669, 0.457971, 0.871437],
[0.284433, -0.747364, 0.600453],
[-0.413263, -0.303343, 0.858602],
[0.184638, 0.674164, 0.71513],
[-0.123414, -0.992099, -0.0225655],
[-0.979622, -0.0974461, 0.175628],
[0.63973, 0.00853519, 0.768553],
[-0.143884, 0.0174948, 0.98944],
[0.319166, 0.103484, -0.942032],
[-0.225595, 0.827522, 0.514114],
[0.856931, 0.513406, 0.045652],
[-0.860652, 0.250908, 0.443084],
[0.675841, -0.654983, 0.337988],
[-0.873512, -0.427299, -0.233222],
[0.877934, 0.246874, 0.410226],
[0.269351, -0.944457, 0.188287],
[-0.671628, 0.698724, 0.246373],
[0.26272, -0.662226, -0.701737],
[0.897189, -0.440642, -0.0297806],
[-0.581728, -0.778507, -0.235626],
[-0.177764, -0.595123, -0.783728],
[-0.917871, 0.396715, 0.0114431],
[-0.194526, -0.870221, -0.452631],
[0.591933, 0.725511, 0.351068],
[0.256355, 0.235508, 0.937453],
[0.59947, -0.796376, -0.0801305],
[0.54924, -0.285299, -0.785455],
[0.388608, 0.502286, -0.772459],
[0.101411, 0.991624, -0.0799818],
[-0.132737, -0.877458, 0.460922],
[-0.550363, 0.541364, 0.63563],
[-0.968848, 0.0118342, -0.247374],
[-0.574506, 0.128754, 0.80831],
[0.99903, -0.00333864, 0.0439138],
[0.530141, 0.843995, -0.0813794],
[0.674196, 0.600878, -0.429424],
[-0.520582, -0.627268, 0.579249],
];

pub const DIRECTION_BINS_84: [[f64; 3]; 84] = [
[-0.0350007, 0.880555, -0.47265],
[0.739861, -0.620782, 0.259297],
[0.918057, 0.137069, -0.372001],
[-0.0143627, -0.0493037, -0.998681],
[-0.231169, -0.443199, 0.866104],
[-0.771831, 0.56671, -0.2883],
[0.0424294, 0.989419, 0.138741],
[0.310936, -0.288518, -0.905581],
[0.080855, -0.215628, 0.973122],
[-0.858908, -0.358953, 0.365281],
[0.381088, -0.407118, 0.830077],
[-0.31503, 0.905885, 0.283069],
[0.9235, -0.253999, 0.287457],
[-0.0370429, -0.800832, -0.597742],
[-0.32801, 0.232215, -0.915689],
[-0.665645, -0.354557, -0.656663],
[0.744313, 0.484705, -0.459412],
[0.159569, 0.660581, -0.733601],
[0.591782, -0.796509, -0.123966],
[-0.844399, 0.232951, -0.482415],
[0.15917, 0.194812, 0.96784],
[0.247436, 0.949373, -0.193565],
[-0.582381, 0.460002, -0.670246],
[0.645869, -0.613889, -0.453866],
[-0.516269, -0.853742, -0.0677514],
[0.06325, 0.341056, -0.937913],
[-0.580505, 0.812527, -0.0530505],
[-0.185312, 0.428899, 0.884141],
[0.078506, -0.65055, 0.755395],
[-0.512406, -0.179724, 0.839726],
[0.174544, 0.582176, 0.794107],
[-0.228054, -0.955551, 0.186854],
[-0.969018, -0.24507, -0.0307468],
[0.792349, -0.00724308, 0.610025],
[-0.216691, 0.0363919, 0.975562],
[0.383166, 0.0921727, -0.919069],
[-0.170157, 0.76462, 0.621614],
[0.654046, 0.740711, -0.153528],
[-0.966434, 0.0504854, 0.251906],
[0.701621, -0.385141, 0.599495],
[-0.801386, -0.595309, 0.0581941],
[0.763442, 0.610264, 0.211503],
[0.426782, -0.880317, 0.207123],
[-0.64751, 0.695547, 0.31136],
[0.33047, -0.644294, -0.689692],
[0.871103, -0.262806, -0.414864],
[-0.466664, -0.766744, -0.440827],
[-0.355637, -0.572438, -0.738808],
[-0.878332, 0.469864, 0.0880956],
[-0.154671, -0.95487, -0.253576],
[0.44948, 0.878173, 0.163642],
[0.489946, -0.0413798, 0.87077],
[0.286335, -0.886196, -0.364238],
[0.63132, -0.29907, -0.715536],
[0.487599, 0.434987, -0.75699],
[-0.224972, 0.963962, -0.142003],
[-0.271644, -0.763058, 0.586475],
[-0.499843, 0.578159, 0.644895],
[-0.97839, 0.163911, -0.12604],
[-0.796757, -0.0542859, 0.601856],
[0.956315, 0.165336, 0.241091],
[0.431617, 0.764488, -0.478816],
[0.499165, 0.341303, 0.796459],
[-0.597387, -0.496446, 0.629818],
[-0.442879, 0.777265, -0.446897],
[0.868085, -0.488662, -0.087393],
[-0.898665, -0.155478, -0.410155],
[0.0797905, -0.901932, 0.424443],
[0.914681, 0.396488, -0.0784603],
[0.713581, 0.0898074, -0.694792],
[0.772221, 0.367449, 0.51832],
[0.167238, 0.862295, 0.477995],
[-0.0171808, -0.476111, -0.879218],
[-0.359214, -0.196189, -0.912401],
[-0.774604, -0.544069, -0.322457],
[0.135948, -0.990666, -0.00991929],
[0.439578, -0.705422, 0.556013],
[0.994526, -0.0861875, -0.0590725],
[-0.230688, 0.609802, -0.758238],
[-0.569105, -0.752199, 0.332139],
[-0.649245, 0.0375767, -0.75965],
[-0.553892, 0.225701, 0.801413],
[-0.808676, 0.342276, 0.478425],
[0.504395, 0.676467, 0.536635],
];
12 changes: 7 additions & 5 deletions src/sweep/direction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,19 @@ impl Directions {

#[cfg(not(feature = "2d"))]
fn from_num(num: usize) -> Self {
let bins: &[&[f64; 3]] = match num {
1 => &[&[1.0, 0.0, 0.0]],
let bins: &[[f64; 3]] = match num {
1 => &[[1.0, 0.0, 0.0]],
16 => &healpix::DIRECTION_BINS_16,
21 => &healpix::DIRECTION_BINS_21,
32 => &healpix::DIRECTION_BINS_32,
64 => &healpix::DIRECTION_BINS_64,
84 => &healpix::DIRECTION_BINS_84,
_ => unimplemented!(),
};
Self {
directions: bins
.iter()
.map(|&[x, y, z]| {
Direction(MVec::new(*x, *y, *z) * Dimensionless::dimensionless(1.0))
})
.map(|&[x, y, z]| Direction(MVec::new(x, y, z) * Dimensionless::dimensionless(1.0)))
.collect(),
}
}
Expand Down

0 comments on commit 0690638

Please sign in to comment.