This library was created from the coordinates package of JSky version 3.0. The primary goal is to create a JavaScript coordinate conversion library for use in a browser. Secondary goals are to make the library available for Java applications and node.js applications. It is implemented in Java and is converted to JavaScript using JSweet. This project is available for NPM and Yarn from the NPM repository.
You can build and test the Java libraries by running:
./gradlew build
This builds the core coordtxl
JAR file in build/libs/
. There is an extra JAR file which can be built with:
./gradlew nomtamJar
This builds a JAR file which depends on the nom.tam.fits package. This JAR implements a FITS keyword handler based on the nom.tam.fits
header object.
While the build steps above run the Java tests, they can also be run directly with ./gradlew test --tests 'coordtxl.*'
.
The TypeScript library can be built with:
./gradlew jsweet
This will build the typescript library in build/typescript/coordtxl
. The TypeScript library is a union of TypeScript generated by JSweet and the TypeScript code found in src/main/typescript/coordtxl
.
This may fail if Java isn't configured properly or JAVA_HOME
is not set.
The TypeScript library can then be transformed into JavaScript using the TypeScript compiler (tsc
). While the Yarn build tool is used as the intermediate build too which runs tsc
, gradle
is used to run yarn
:
./gradlew tsc
This will build the javascript library in build/javascript/coordtxl
.
A basic Typescript test is included which checks the coordinate conversion is found in src/test/typescript/tstest.ts
. It can be run with:
./gradlew tstest
This test uses a JSON file (src/test/resources/coordtxl/test-residual-header.json
) created from a CASA image to initialize a WCSTransform
object and convert the pixel origin coordinate to the J2000 coordinate 20:02:54.100, +39:52:37.50 J2000
.
The coordtxl
npm package can be created in dist/coordtxl
by running:
./gradlew npmbuild
It can then be tested by installing this newly built package in a separate npm package (created for the purpose of testing) with:
npm install file://path/to/work/directory/coordtxl/dist/coordtxl
coordtxl
can be published to npm by running:
./gradlew npmpub
running npmbuild
is not required before running npmpub
, but it does provide a way to check the package before making it available.
This is a list of the FITS header keywords used from a WCSKeywordProvider
(circa July, 2023) by the WCSTransform
conversion class. Each line includes the member function called, the keyword retrieved and along with sample values from a test test.residual
interactive clean residual image. The <default: ...>
return values indicates the value actually returned and the fact that the default value was returned instead of a value supplied from the CASA FITS header.
getDoubleValue
: NAXIS1, 4.0getDoubleValue
: NAXIS2, 512.0getDoubleValue
: EQUINOX, 2000.0findKey
: PLTRAHgetStringValue
: CTYPE1, RA---SINgetStringValue
: CTYPE2, DEC--SINgetDoubleValue
: CRPIX1, 257.0getDoubleValue
: CRPIX2, 257.0getDoubleValue
: CRVAL1, 299.86875000000003getDoubleValue
: CRVAL2, 40.73375000000001getDoubleValue
: CDELT1, -0.0033333333333333335getDoubleValue
: CDELT2, 0.0033333333333333335getDoubleValue
: CROTA1, <default: 0.0>getDoubleValue
: CROTA2, <default: 0.0>getDoubleValue
: CCPIX1, <default: 0.0>getDoubleValue
: CCPIX2, <default: 0.0>getDoubleValue
: CCROT1, <default: 0.0>findKey
: EQUINOXgetDoubleValue
: EQUINOX, 2000.0getDoubleValue
: DATE-OBS, <default: 0.0>getDoubleValue
: EPOCH, <default: 0.0>findKey
: RADECSYS