27 个版本

0.7.1 2022年12月30日
0.6.1 2022年12月27日
0.6.0 2022年11月30日
0.5.0 2021年10月16日
0.2.6 2021年3月30日

#193 in 图像

Download history 32/week @ 2024-03-13 75/week @ 2024-03-20 272/week @ 2024-03-27 113/week @ 2024-04-03 282/week @ 2024-04-10 268/week @ 2024-04-17 44/week @ 2024-04-24 150/week @ 2024-05-01 11/week @ 2024-05-08 43/week @ 2024-05-15 32/week @ 2024-05-22 260/week @ 2024-05-29 374/week @ 2024-06-05 204/week @ 2024-06-12 43/week @ 2024-06-19 248/week @ 2024-06-26

1,008 每月下载量
light-curve-dmdt-exec 中使用

MIT 许可证

39KB
941

dm–dt 地图绘制器

docs.rs badge testing pre-commit.ci status

Rust 库 (light-curve-dmdt) 和可执行文件 (light-curve-dmdt-exec),用于将光曲线转换为 dm–dt 空间,实现基于以下论文:Mahabal et al. 2011Mahabal et al. 2017Soraisam et al. 2020

如果您在寻找此包的 Python 绑定,请参阅 https://github.com/light-curve/light-curve-python

可执行文件

可执行文件 dmdt 可以通过运行 cargo install light-curve-dmdt-exec 来安装。您需要在系统上安装 Rust 工具链,建议使用您的操作系统包管理器或 rustup 工具。

线性 dm 网格 [-1.5; 1.5) 和对数 dt 网格 [1; 100)(96 个单元格)的条件下概率 dm–dt 地图绘制的示例

curl https://ztf.snad.space/dr4/csv/633207400004730 | # Get some ZTF data
tail +2 | # chomp CSV header
awk -F, '{print $3"	"$4"	"$5}' | # print needed columns and change separator to tab
dmdt \
  --max-abs-dm=1.5 --height=64 \
  --min-lgdt=0 --max-lgdt=2 --width=96 \
  --smear --approx-smearing \
  --norm=lgdt --norm=max \
  --output=example.png

Example dm-dt map

dmdt--帮助

展开
Program for dm-dt maps generator from light curves
Usage: dmdt [OPTIONS] --min-lgdt <FLOAT> --max-lgdt <FLOAT> --max-abs-dm <FLOAT>
Options:
  -i, --input <FILE>
          Path of the input file, should be built of space-separated columns of time, magnitude and
          magnitude error (required for --smare only). If '-' is given (the default), then the input
          is taken from the stdin
          [default: -]
  -o, --output <FILE>
          Path of the output PNG file. If '-' is given (the default), then outputs to the stdout
          [default: -]
  -s, --smear
          Produce dm-``smeared'' output using observation errors, which must be the third column of
          the input. Instead of just adding some value to the lg(dt)-dm cell, the whole lg(dt) =
          const row is filled by normally distributed dm-probabilities
      --min-lgdt <FLOAT>
          Left border of the lg(dt) grid, note that decimal logarithm is required, i.e. -1.0 input
          means 0.1 time units
      --max-lgdt <FLOAT>
          Right border of the lg(dt) grid, note that decimal logarithm is required, i.e. 2.0 input
          means 100.0 time units
      --max-abs-dm <FLOAT>
          Maximum dm value, the considered dm interval would be [-max-abs-dm, +max-abs-dm)
      --width <INT>
          number of lg(dt) cells, width of the output image
          [default: 128]
      --height <INT>
          number of dm cells, height of the output image
          [default: 128]
      --approx-smearing
          speed up smearing using approximate error function
  -n, --norm <normalisation>
          Normalisation to do after dmdt map building. The order of operations is:1) build dmdt map,
          each dm-lgdt pair brings a unity value to dmdt space;2) if --norm=lgdt, then divide each
          cell value by the total number of the corresponding lgdt pairs, i.e. divide each cell of
          some column by the integral value in the column (including values out of the interval of
          [-max_abs_dm; max_abs_dm)); 3) if --norm=max, then divide each cell by the overall maximum
          value; 4) if any of --norm=lgdt or --norm=max is specified, then all values should be in
          [0; 1] interval, so they are multiplied by 255 and casted to uint8 to make it possible to
          save dmdt map as a PNG file.
          [possible values: lgdt, max]
  -h, --help
          Print help information (use `-h` for a summary)
  -V, --version
          Print version information

Rust crate

use light_curve_dmdt::{DmDt, Eps1Over1e3Erf};
use ndarray::Array1;

let dmdt = DmDt::from_lgdt_dm_limits(0.0, 2.0, 96, 1.5, 64);

let t = Array1::linspace(0.0, 100.0, 101);
let m = t.mapv(|x| 2.0 * f64::sin(x));
let err2 = Array1::ones(t.len()) * 0.01;

let prob = dmdt.cond_prob::<Eps1Over1e3Erf>(t.as_slice().unwrap(), m.as_slice().unwrap(), err2.as_slice().unwrap());

Cargo 功能

  • doc-images:向 HTML 文档添加示例图像,用于 https://docs.rs
  • png:添加 to_png() 函数,用于将 dm-dt 地图保存为 PNG 文件
  • serde:为 DmDt 实现 serde
  • 默认[] - 没有默认功能
  • 完整:打开所有功能

依赖关系

~2.4–3.5MB
~67K SLoC