Crates.io | rustronomy-fits |
lib.rs | rustronomy-fits |
version | 0.2.0 |
source | src |
created_at | 2022-04-27 11:18:25.391038 |
updated_at | 2022-11-16 14:44:25.192808 |
description | a rust library for reading and writing fits files |
homepage | https://github.com/smups/rustronomy-fits/ |
repository | https://github.com/smups/rustronomy-fits/ |
max_upload_size | |
id | 575989 |
size | 170,987 |
Rustronomy-fits provides I/O tools for reading, writing and parsing FITS files. It is currently still under heavy development.
Features included in the latest release of rustronomy-fits are marked with ✔️. Features that are coming in the next release are marked with ✴️ (these might already be implemented in the main branch of this repo). Features that are coming some time in the future are marked with ❌.
Latest release: v0.1.0 - image support
Next feature-update: v0.2.0 - table support
Reading Fits Files
Writing Fits Files
To use the latest release of Rustronomy-fits in a cargo project, add the rustronomy-fits crate as a dependency to your Cargo.toml
file:
[dependencies]
rustronomy-fits = "0.1.0"
To use Rustronomy-fits in a Jupyter notebook, execute a cell containing the following code:
:dep rustronomy-fits = {version = "0.1"}
If you want to use the latest (unstable) development version of rustronomy-fits, you can do so by using the git
field (which fetches the latest version from the repo) rather than the version
field (which downloads the latest released version from crates.io).
{git = "https://github.com/smups/rustronomy-fits"}
In this example, we create a Fits struct using the open()
method, which takes
the path to the file as an argument. Next, we get a reference to the second
header-data-unit (HDU) in the file, wich contains an f64
encoded Image
extension. We can get the Image from the HDU by matching the data contained in
the HDU with the Extension::Image
variant and then calling as_f64_array()
on
the unwrapped Image.
use rustronomy_fits::prelude::*;
let fits = Fits::open("somefile.fits")?;
let data_array = match fits.get_hdu(1).unwrap().get_data() {
Extension::Image(img) => img.as_f64_array()?,
_ => panic!()
};
Check out the examples folder in the repo root for Jupyter notebooks with more in-depth explanations and examples!
If you want to contribute to this module, please keep in mind the following points regarding testing:
resources/tests/
folder, located in the root of the rustronomy_fits/
folder.resources/tests/
folder.Rustronomy-fits is part of the Rustronomy project and inherits the gpl license from the overarching Rustronomy project
Rustronomy is explicitly not licensed under the dual Apache/MIT license common to the Rust ecosystem. Instead it is licensed under the terms of the GNU GPLv3.
Rustronomy is a science project and embraces the values of open science and free and open software. Closed and paid scientific software suites hinder the development of new technologies and research methods, as well as diverting much- needed public funds away from researchers to large publishing and software companies.
Rustronomy-fits is free software. It is licensed under the GNU GPL version 3 or later. That means you are free to use this program for any purpose; free to study and modify this program to suit your needs; and free to share this program or your modifications with anyone. If you share this program or your modifications you must grant the recipients the same freedoms. To be more specific: you must share the source code under the same license. For details see https://www.gnu.org/licenses/gpl-3.0.html or the LICENSE file in this github repository.