pyref_core

Module documentation

Source
Expand description

§Rust Backend for accessing CCD data in FITS files

This crate is a light wrapper over the astrors crate. It provides a simple interface to access CCD data in FITS files.

§Usage

use pyref_ccd::*;
use std::path::Path;

fn main() {
    let path = "path/to/fits/file.fits";
    let df = read_fits(path).unwrap();
    println!("{:?}", df);

    // Or to load all data in a directory

    let path = "path/to/directory";
    let all_df = read_experiment(path, ExperimentType::Xrr).unwrap();
    println!("{:?}", all_df);
}

output:

┌──────────────┬─────────────────┬──────────┬─────────────────────────────────┐
│ Sample Theta ┆ Beamline Energy ┆ EXPOSURE ┆ Image                           │
│ ---          ┆ ---             ┆ ---      ┆ ---                             │
│ f64          ┆ f64             ┆ f64      ┆ list[list[u32]]                 │
╞══════════════╪═════════════════╪══════════╪═════════════════════════════════╡
│ 60.0         249.99291       1.0      ┆ [[33356, 33372, … 33365], [333… │
│ 56.112       249.996694      1.0      ┆ [[33367, 33368, … 33395], [333… │
└──────────────┴─────────────────┴──────────┴─────────────────────────────────┘
┌──────────────┬─────────────────┬──────────┬─────────────────────────────────┐
│ Sample Theta ┆ Beamline Energy ┆ EXPOSURE ┆ Image                           │
│ ---          ┆ ---             ┆ ---      ┆ ---                             │
│ f64          ┆ f64             ┆ f64      ┆ list[list[u32]]                 │
╞══════════════╪═════════════════╪══════════╪═════════════════════════════════╡
│ 60.0         249.99291       1.0      ┆ [[33356, 33372, … 33365], [333… │
│ 0.0          249.998585      0.001    ┆ [[33352, 33347, … 33347], [333… │
│ 0.0          249.996694      0.001    ┆ [[33317, 33324, … 33327], [333… │
│ 0.0          249.99291       0.001    ┆ [[33354, 33359, … 33351], [333… │
│ 0.0          249.99291       0.001    ┆ [[33332, 33358, … 33330], [333… │
│ …            ┆ …               ┆ …        ┆ …                               │
│ 40.556       250.008062      1.0      ┆ [[33366, 33358, … 33355], [333… │
│ 44.444       250.008062      1.0      ┆ [[33367, 33358, … 33350], [333… │
│ 48.334       250.009961      1.0      ┆ [[33363, 33344, … 33352], [333… │
│ 52.222       249.998585      1.0      ┆ [[33366, 33369, … 33359], [333… │
│ 56.112       249.996694      1.0      ┆ [[33367, 33368, … 33395], [333… │
└──────────────┴─────────────────┴──────────┴─────────────────────────────────┘