3 个版本
新 0.1.2 | 2024年8月20日 |
---|---|
0.1.1 | 2024年8月9日 |
0.1.0 | 2024年8月8日 |
#339 在 数学
每月 327 次下载
58KB
898 行
rao
用 Rust 编写的自适应光学工具
lib.rs
:
rao
rao
- Rust 中的自适应光学工具 - 是一套快速且鲁棒的自适应光学实用工具。当前 rao
的范围是用于自适应光学中的大矩阵计算,用于实时自适应光学配置和控制。具体来说,我们旨在提供快速、可扩展且可靠的 API,用于生成
rao::IMat
- 测量和执行器之间的相互作用矩阵,rao::CovMat
- 测量之间的协方差矩阵。
这两个矩阵通常是实时控制 (RTC) 配置中的最大计算负担,也是 RTC 中性能最敏感的部分。
示例
构建一个交互矩阵和平方网格 SH-WFS
use crate::rao::Matrix;
const N_SUBX: i32 = 8; // 8 x 8 subapertures
const PITCH: f64 = 0.2; // 0.2 metres gap between actuators
const COUPLING: f64 = 0.5; // actuator cross-coupling
// build list of measurements
let mut measurements = vec![];
for i in 0..N_SUBX {
for j in 0..N_SUBX {
let x0 = ((j-N_SUBX/2) as f64 + 0.5)*PITCH;
let y0 = ((i-N_SUBX/2) as f64 + 0.5)*PITCH;
let xz = 0.0; // angular x-component (radians)
let yz = 0.0; // angular y-compenent (radians)
// define the optical axis of subaperture
let line = rao::Line::new(x0,xz,y0,yz);
// slope-style measurement
// x-slope
measurements.push(rao::Measurement::SlopeTwoEdge{
central_line: line.clone(),
edge_separation: PITCH,
edge_length: PITCH,
npoints: 5,
gradient_axis: rao::Vec2D::x_unit(),
});
// y-slope
measurements.push(rao::Measurement::SlopeTwoEdge{
central_line: line.clone(),
edge_separation: PITCH,
edge_length: PITCH,
npoints: 5,
gradient_axis: rao::Vec2D::y_unit(),
});
}
}
// build list of actuators
let mut actuators = vec![];
for i in 0..(N_SUBX+1) {
for j in 0..(N_SUBX+1) {
let x = ((j-N_SUBX/2) as f64)*PITCH;
let y = ((i-N_SUBX/2) as f64)*PITCH;
actuators.push(
// Gaussian influence functions
rao::Actuator::Gaussian{
// std defined by coupling and pitch
sigma: rao::coupling_to_sigma(COUPLING, PITCH),
// position of actuator in 3D (z=altitude)
position: rao::Vec3D::new(x, y, 0.0),
}
);
}
}
// instanciate imat from (actu,meas)
let imat = rao::IMat::new(&measurements, &actuators);
// serialise imat for saving
let data: Vec<f64> = imat.flattened_array();
依赖项
~1.5MB
~32K SLoC