4 releases
0.6.2 | Dec 4, 2024 |
---|---|
0.6.1 | Dec 30, 2022 |
0.6.0 | Nov 30, 2022 |
0.6.0-alpha.0 | Nov 29, 2022 |
#76 in Visualization
152 downloads per month
59KB
1.5K
SLoC
dm–dt map plotter
Rust library (light-curve-dmdt
) and executable (light-curve-dmdt-exec
) to transform light curve into dm–dt space, the implementation is based on papers
Mahabal et al. 2011, Mahabal et al. 2017, Soraisam et al. 2020.
If you are looking for Python bindings for this package, please see https://github.com/light-curve/light-curve-python
Executable
The executable dmdt
can be installed by running cargo install light-curve-dmdt-exec
. You need Rust toolchain to be
installed in your system, consider using your OS package manager or rustup utility.
Example of conditional probability dm–dt map plotting for linear dm grid [-1.5; 1.5)
with 64 cells and logarithmic dt
grid [1; 100)
with 96 cells:
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
dmdt --help
expand
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 (see a summary with '-h')
-V, --version
Print version
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 features:
doc-images
: adds an example image to HTML docs, used for https://docs.rspng
: addto_png()
function to save dm-dt map as a PNG fileserde
:serde
implementation forDmDt
default
:[]
- no default featuresfull
: turns all features on
Dependencies
~7–15MB
~222K SLoC