/coordtxl

coordinate translation library

Primary LanguageJavaGNU General Public License v2.0GPL-2.0

Introduction

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.

Building Java JAR

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.

Running Java Tests

While the build steps above run the Java tests, they can also be run directly with ./gradlew test --tests 'coordtxl.*'.

Generating TypeScript

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.

Generating JavaScript

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.

Running Typescript Tests

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.

Build NPM Package

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

Publishing NPM package

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.

FITS Header Keywords Used

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.

  1. getDoubleValue: NAXIS1, 4.0
  2. getDoubleValue: NAXIS2, 512.0
  3. getDoubleValue: EQUINOX, 2000.0
  4. findKey: PLTRAH
  5. getStringValue: CTYPE1, RA---SIN
  6. getStringValue: CTYPE2, DEC--SIN
  7. getDoubleValue: CRPIX1, 257.0
  8. getDoubleValue: CRPIX2, 257.0
  9. getDoubleValue: CRVAL1, 299.86875000000003
  10. getDoubleValue: CRVAL2, 40.73375000000001
  11. getDoubleValue: CDELT1, -0.0033333333333333335
  12. getDoubleValue: CDELT2, 0.0033333333333333335
  13. getDoubleValue: CROTA1, <default: 0.0>
  14. getDoubleValue: CROTA2, <default: 0.0>
  15. getDoubleValue: CCPIX1, <default: 0.0>
  16. getDoubleValue: CCPIX2, <default: 0.0>
  17. getDoubleValue: CCROT1, <default: 0.0>
  18. findKey: EQUINOX
  19. getDoubleValue: EQUINOX, 2000.0
  20. getDoubleValue: DATE-OBS, <default: 0.0>
  21. getDoubleValue: EPOCH, <default: 0.0>
  22. findKey: RADECSYS