npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jsfitsio

v1.1.15

Published

FITS I/O javascript library.

Downloads

47

Readme

jsFITS I/O library

Project available in github at https://github.com/fab77/FITSParser#readme

Library used to handle FITS files as defined in the "Definition of the Flexible Image Transport System (FITS)" document defined by internation Astronomical Union (IAU)

This library is capable to read and write FITS files where the data are represented in the following formats (BITPIX):

8 Character or unsigned binary integer 16 16-bit two’s complement binary integer 32 32-bit two’s complement binary integer 64 64-bit two’s complement binary integer −32 IEEE single-precision floating point −64 IEEE double-precision floating point

Only ImageHDU are supported at the moment.

jsFITS I/O can be used as standalone Node module or integrated in the browser.

Getting Started

Installing as node module

$ npm install jsfitio

Installing as Javascript external file in a web page

Download the file "jfitsio.js" and include it in your web page as below:

Running the tests (still manual)

First compile the code:

$ node start:dev

To test jsfitsio in node:

$ node test/test01.js
$ node test/test02.js

Deployment as Node module

reading FITS file available in the web:

import { FITSParser } from 'jsfitio';

const fileuri = "http://skies.esac.esa.int/Herschel/normalized/PACS_hips160//Norder8/Dir40000/Npix47180.fits";
const fp = new FITSParser(fileuri);
const promise = fp.loadFITS();
promise.then(function (fits) {
    if (fits !== null) {
        console.log(fits === null || fits === void 0 ? void 0 : fits.header);

        console.log(`BITPIX: ${fits.header.get('BITPIX')}`);
        console.log(`NAXIS1: ${fits.header.get('NAXIS1')}`);
        console.log(`NAXIS2: ${fits.header.get('NAXIS2')}`);
        console.log(`payload bytes length ${fits.data.length * fits.data[0].length}`);

    }
    else {
        console.log("Empty data");
    }
});

using FITS available in the local filesystem:

import { FITSParser } from 'jsfitio';
import { FITSHeader } from 'jsfitio';
import { FITSWriter } from 'jsfitio';
import { writeFITS } from 'jsfitio'
import { FITSHeaderItem } from 'jsfitio';

const fileuri: string = "./test/inputs/x0c70103t_c1f.fits";
const fp = new FITSParser(fileuri);
const fitsPromise = fp.loadFITS();
fitsPromise.then( (fitsProcessed) => {
    let fitsHeader = fitsProcessed.header;
    let fitsData = fitsProcessed.data;
    let fw = new FITSWriter();
    fw.run(fits.header, fits.data);
    writeFITS("./MyFITS.fits", fw._fitsData);
});

Deployment as a Javascript library

You need to include "jsfitsio.js" (take it from _bundles directory in git the repo https://github.com/fab77/FITSParser ) file in your HTML page. Below a sample.

<!doctype html>
<html>

<head>
    <meta charset="utf-8" />
    <title>Webpack App</title>
    <base href="."/>
</head>

<body>
    <h1>Hello world!</h1>
    <h2>jsFITS I/O web integration sample</h2>
    <script src="./jsfitsio.js"></script>
    <script>
        let fitsURL = "http://skies.esac.esa.int/Herschel/normalized/PACS_hips160//Norder8/Dir40000/Npix47180.fits"
        let fp = new jsfitsio.FITSParser(fitsURL);
        let promise = fp.loadFITS();
        promise.then( (fits) => {
            if (fits !== null) {
                console.log(fits?.header);
                const blobUrl = jsfitsio.FITSParser.generateFITS(fits.header, fits.data);
                console.log(blobUrl);
            } else {
                console.log("Empty data");
            }
        });
    </script>
</body>

</html>

Built With

Node: v16.17.0 webpack: 5.74.0

Contributing

Versioning

Authors

  • Fabrizio Giordano

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Yago Ascasibar