GithubHelp home page GithubHelp logo

caphindsight / fits-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fifth-postulate/fits-rs

0.0 2.0 0.0 6.22 MB

FITS encoder and decoder in Rust

Home Page: https://docs.rs/fits-rs/0.3.0/fits_rs/

License: MIT License

Rust 100.00%

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

Watchers

 avatar  avatar

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.