1.1.5 • Published 6 years ago

astrometry.js v1.1.5

Weekly downloads
2
License
BSD-3-Clause
Repository
github
Last release
6 years ago

astrometry.js

Extract star pixel coordinates from a FITS image using JavaScript (supported on Node.js and your Browser)

image2xy

A port of the blind image2xy solver utility from astrometry.net using Emscripten.


Install (Node.js)

npm install astrometry.js

Usage

Read a FITS image file into a buffer (or Uint8Array in the browser, see browser example below))

const fs = require('fs');
const buf = fs.readFileSync('./example.fits');

const image2xy = require('astrometry.js').image2xy;

const result = image2xy(buf, { verbose: true, extension: 0 });

Install (Browser)

<script src="https://cdn.jsdelivr.net/npm/astrometry.js"></script>

Usage

You'll need to do a little bit of work to get a file buffer on the browser.

var reader = new FileReader();

reader.onload = function (e) {
    // Get the image file as a buffer
    var buf = new Uint8Array(e.currentTarget.result);

    // Get a fits file buffer containing a star list
    const results = astrometry(buf, { verbose: true, extension: 0 });
};

reader.readAsArrayBuffer(file);

Example

The following shows an example output.

const result = image2xy(buf, { verbose: true, extension: 0 });

>   infile=fits_buf.fits
    outfile=fits_buf.xy.fits
    nhdus=1
    Got naxis=2, na1=4096, na2=4096
    simplexy: nx=4096, ny=4096
    simplexy: dpsf=1.000000, plim=8.000000, dlim=1.000000, saddle=5.000000
    simplexy: maxper=1000, maxnpeaks=10000, maxsize=2000, halfbox=100
    simplexy: median smoothing...
    simplexy: measuring image noise (sigma)...
    Sampling sigma at 42025 points
    Nsigma=0.7, s=13.132
    simplexy: found sigma=13.132.
    simplexy: finding objects...
    simplexy: found 734 blobs
    simplexy: finding peaks...
    simplexy: found 743 sources.

Options

You may use the same options that image2xy supports by providing the flags directly, or you may use the following human friendly versions.

Options List
OptionFlagTypeDescription
help'h'booleanPrint available options and usage instructions
verbose'v'booleanPrint verbose messages
extension'e'numberRead from a single FITS extension
downsampleFactor'D'numberDownsample, if necessary, by this many factors of two
medianFilteringScale's'numberSet median-filter box size (default 100 pixels)
psfWidth'w'numberSet Gaussian PSF sigma (default 1 pixel)
noiseLevel'g'numberSet image noise level
peakSigma'p'numberSet significance level of peaks (default 8 sigmas)
saddleLevel'a'numberSet saddle level joining peaks (default 5 sigmas)
disableBackgroundSubtraction'b'booleanDon't do (median-based) background subtraction
backgroundLevel'G'numberSubtract this 'global' background value; implies -b
outputFilename'o'filenameWrite XYlist to given filename.
backgroundSubtractedImageName'S'filenameSave background-subtracted image to this filename (FITS float image)
backgroundImageName'B'filenameSave background image to filename
smoothedImageName'U'filenameSave smoothed background-subtracted image to filename
maskImageName'M'filenameSave mask image to filename
blobImageName'C'filenameSave connected-components image to filename
1.1.5

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.0.0

6 years ago