Giter Site home page Giter Site logo

fits-rs's Introduction

fits-rs Build Status Coverage Status Crate

FITS encoder and decoder in Rust.

Make sure to check out the documentation of this crate. The build can be followed as well. The coverage report is provided by coveralls.

FITS

The Flexible Image Transport System (FITS) is

an open standard defining a digital file format useful for storage, transmission and processing of scientific and other images.

The reference documentation on the FITS standard can be found an NASA's FITS pages. You can get a copy by executing the following command:

wget --output-document=fits-reference.pdf "https://www.aanda.org/articles/aa/pdf/2010/16/aa15362-10.pdf"

Reading Primary Header

Even though the headers of FITS files are in ASCII, you can use this crate to read the primary header.

    let args: Vec<String> = env::args().collect();
    let filename = &args[1];
    let header_index = u64::from_str(&args[2]).expect("should be a non-negative number");

    let mut f = File::open(filename).expect("file not found");
    let mut buffer: Vec<u8> = vec!();
    let _ = f.read_to_end(&mut buffer);

    let result = fits(&buffer);

    match result {
        IResult::Done(_, trappist1) => {
            let header: &Header = if header_index = 0 {
                &trappist1.primary_hdu.header
            } else {
                &trappist1.extensions[header_index].header
            }

            for record in header.keyword_records {
                println!("{:?}", record);
            }
        },
        _ => panic!("Whoops, something went wrong")
    }

You can find this binary in src/bin/headers.rs.

Unfortunately, some extensions are in binary.

fits-rs's People

Contributors

dvberkel avatar

Stargazers

Grégoire Henry avatar Cap. Hindsight avatar あめ avatar Ben Kimock avatar Simon Walker avatar

Watchers

 avatar James Cloos avatar  avatar

fits-rs's Issues

Issue parsing most fits files

This package seems to be tightly coupled to the example file:
k2-trappist1-unofficial-tpf-long-cadence.fits

And cannot parse most other fits files that have been passed to it. Dies with the following error: Tag

Please add examples

Hello. Can you please add an examples directory of how to use this API? Because you have a Fits struct and you also return a IResult which is an impl that wraps Result I think there is alot of confusing stuff happening and it is difficult to make this work. Your help is greatly appreciated.

Make use of docs.rs

This basically means removing the deployment to GitHub pages. This frees up that address to go into some examples, or tutorials

How to get data

Hello. How does one go about getting the data out of the parsed packet? It's a private field and there is no evidence of a getter method. Help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.