Giter Site home page Giter Site logo

wcsjs's Introduction

astrojs

astrojs is a project to develop and consolidate javascript libraries for astronomical applications. Similar to the astropy project, astrojs is gathering useful libraries under a single namespace so they may become shared resources to the astronomical community. There are many codes floating around the web, which if they were consolidated in a central location, would be of much greater value.

If you have a javascript resource that you would like to contribute, please contact Amit Kapadia.

astrojs library

This library is a development tool that provides a library template and convenience functions for developing under the javascript astro namespace. It is most useful when developing astrojs libraries using the coffeescript language. A future release will support development for pure javascript libraries. There are four functions available from the command line.

astrojs new [project name]
astrojs class [class name]
astrojs server
astrojs build

installation

The astrojs module is built using NodeJS. Why Node? Node is another flavor of javascript, javascript that runs server side. A Node module may be developed and run in a similar why to any other scripting language, such as python. As this is a javascript initiative, any utilities should be developed in javascript. If Node is not installed, please refer to its documentation and downloads page.

Upon installation of Node a package manager called NPM will be available. The astrojs module is available via the Node Packaged Modules service. To install the astrojs module run

npm install astrojs -g

This will install astrojs globally, and it will function as a command line utility. (It most likely needs to be run using sudo).

creating an astrojs project

To create an astrojs project run

astrojs new [project name]

This will generate the following project files under a directory named by [project name]:

Cakefile
index.js
lib/
package.json
README.md
src/
  |----[project name].coffee
test/
  |----favicon.ico
  |----lib/jasmine-html.js
  |----lib/jasmine.css
  |----lib/jasmine.js
  |----lib/MIT.LICENSE
  |----SpecRunner.html
  |----specs/

generating a new class

Javascript is a prototype-based language, however a class-like structure can be emulated using particular development patterns. Use of this modules means that the developer is adopting a module pattern for library development. Executing

astrojs new [class name]

from within an astrojs project directory will generate template code for a new class and test functions.

starting a local development server

Development always requires testing. When developing an astrojs module, it is encouraged to test all functionality. Frequently a local testing server is needed. Calling

astrojs server

will spin up a local testing server at http://0.0.0.0:8000. This is useful when tests require data that must be accessed on the same domain as the script (e.g. ajax requests for json or binary files).

This command support two options.

astrojs server -p 8001

allows a port to be specified, and

astrojs server -m

minifies the code, which is useful in some development edge cases.

building an astrojs project

This module encourages development to occur in a modular fashion. Often development of libraries can quickly become overwhelming. Good practice encourages codes to be modulated into separate files, however this requires a build step when delivering the final javascript library. Calling

astrojs build

concatenates all files in the src directory, and provides the final product in the lib directory. It is important to specify the dependency order using the key _dependencyOrder in package.json.

example

For an example of using this module for development, please refer to the fitsjs library.

wcsjs's People

Contributors

kapadia avatar sesotek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cdeil

wcsjs's Issues

wcsjs for CAR

Hello!

Currently i'm using your libraries wcsjs.

I have a fits with GLON-CAR e GLON-CAR.
I see that your library not implement for now this value.

Can you help me for this value?

Anyway, thank you for all your contributions, work perfectly!

Problems to rebuild wcsjs from source

Hi,

I know that this project is one quite old of yours, but I do hope that you can provide me with some help.
Extremely interested in having wcsjs in the browser, in the context of a radio astronomy data mining and visualization ( see artemix.obspm.fr ), I tried in the first place to use wcsjs as it comes after a git clone.

Unfortunately, when it's used in the browser it exhibits a strange behaviour. E.g. successive calls to w.pix2sky(x,y) with varying (x,y) would return the same result ( the one returned by the 1st call).

Then I thought I had to rebuild wcs.js from the source, using the build procedure coming the project. Alas I end up with a message saying :

wasm-ld: error: unknown file type: wcs.o

I have the feeling that I'm quite close to the success, so any clue would be more than welcome !

Below the log of the build

/home/caillat/emsdk/upstream/emscripten/emcc -v -O2 src/wrapper.c -I/usr/local/include -L/usr/local/lib -lwcs -lm -o wcslib.js -s EXPORTED_FUNCTIONS="['_getWcs', '_pix2sky', '_sky2pix']";
shared:INFO: (Emscripten: Running sanity checks)
 "/home/caillat/emsdk/upstream/bin/clang" -DEMSCRIPTEN -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -Xclang -isystem/home/caillat/emsdk/upstream/emscripten/system/include/SDL -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=10 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration --sysroot=/home/caillat/emsdk/upstream/emscripten/system -Xclang -isystem/home/caillat/emsdk/upstream/emscripten/cache/wasm/include -Xclang -iwithsysroot/include/compat -Xclang -iwithsysroot/include/libc -Xclang -iwithsysroot/lib/libc/musl/arch/emscripten -Xclang -iwithsysroot/local/include -Xclang -iwithsysroot/include/SSE -Xclang -iwithsysroot/include/neon -Xclang -iwithsysroot/lib/compiler-rt/include -Xclang -iwithsysroot/lib/libunwind/include -v -O2 -I/usr/local/include -o wcslib.js src/wrapper.c -c -o /tmp/emscripten_temp_t7nv0e97/wrapper_0.o
clang version 12.0.0 (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project 445289aa63e1b82b9eea6497fb2d0443813a9d4e)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/caillat/emsdk/upstream/bin
 (in-process)
 "/home/caillat/emsdk/upstream/bin/clang-12" -cc1 -triple wasm32-unknown-emscripten -emit-obj --mrelax-relocations -disable-free -main-file-name wrapper.c -mrelocation-model static -mframe-pointer=none -fno-rounding-math -mconstructor-aliases -target-cpu generic -fvisibility hidden -debugger-tuning=gdb -v -resource-dir /home/caillat/emsdk/upstream/lib/clang/12.0.0 -D EMSCRIPTEN -D __EMSCRIPTEN_major__=2 -D __EMSCRIPTEN_minor__=0 -D __EMSCRIPTEN_tiny__=10 -D _LIBCPP_ABI_VERSION=2 -D unix -D __unix -D __unix__ -I /usr/local/include -isysroot /home/caillat/emsdk/upstream/emscripten/system -internal-isystem /home/caillat/emsdk/upstream/lib/clang/12.0.0/include -internal-isystem /home/caillat/emsdk/upstream/emscripten/system/include/wasm32-emscripten -internal-isystem /home/caillat/emsdk/upstream/emscripten/system/include -O2 -Werror=implicit-function-declaration -fdebug-compilation-dir /home/caillat/wcsjs-master -ferror-limit 19 -fgnuc-version=4.2.1 -fignore-exceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -isystem/home/caillat/emsdk/upstream/emscripten/system/include/SDL -isystem/home/caillat/emsdk/upstream/emscripten/cache/wasm/include -iwithsysroot/include/compat -iwithsysroot/include/libc -iwithsysroot/lib/libc/musl/arch/emscripten -iwithsysroot/local/include -iwithsysroot/include/SSE -iwithsysroot/include/neon -iwithsysroot/lib/compiler-rt/include -iwithsysroot/lib/libunwind/include -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -o /tmp/emscripten_temp_t7nv0e97/wrapper_0.o -x c src/wrapper.c
clang -cc1 version 12.0.0 based upon LLVM 12.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/home/caillat/emsdk/upstream/emscripten/cache/wasm/include"
ignoring nonexistent directory "/home/caillat/emsdk/upstream/emscripten/system/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /home/caillat/emsdk/upstream/emscripten/system/include/SDL
 /home/caillat/emsdk/upstream/emscripten/system/include/compat
 /home/caillat/emsdk/upstream/emscripten/system/include/libc
 /home/caillat/emsdk/upstream/emscripten/system/lib/libc/musl/arch/emscripten
 /home/caillat/emsdk/upstream/emscripten/system/local/include
 /home/caillat/emsdk/upstream/emscripten/system/include/SSE
 /home/caillat/emsdk/upstream/emscripten/system/include/neon
 /home/caillat/emsdk/upstream/emscripten/system/lib/compiler-rt/include
 /home/caillat/emsdk/upstream/emscripten/system/lib/libunwind/include
 /home/caillat/emsdk/upstream/lib/clang/12.0.0/include
 /home/caillat/emsdk/upstream/emscripten/system/include
End of search list.
 "/home/caillat/emsdk/upstream/bin/wasm-ld" -o wcslib.wasm /tmp/emscripten_temp_t7nv0e97/wrapper_0.o -L/usr/local/lib /usr/local/lib/libwcs.a -L/home/caillat/emsdk/upstream/emscripten/system/lib -L/home/caillat/emsdk/upstream/emscripten/cache/wasm /home/caillat/emsdk/upstream/emscripten/cache/wasm/libc.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libcompiler_rt.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libc++-noexcept.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libc++abi-noexcept.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libdlmalloc.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libc_rt_wasm.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libsockets.a -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined --strip-debug --export-table --export getWcs --export pix2sky --export sky2pix --export stackSave --export stackRestore --export stackAlloc --export __wasm_call_ctors --export __errno_location --export malloc --export free -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024
wasm-ld: error: unknown file type: wcs.o
emcc: error: '/home/caillat/emsdk/upstream/bin/wasm-ld -o wcslib.wasm /tmp/emscripten_temp_t7nv0e97/wrapper_0.o -L/usr/local/lib /usr/local/lib/libwcs.a -L/home/caillat/emsdk/upstream/emscripten/system/lib -L/home/caillat/emsdk/upstream/emscripten/cache/wasm /home/caillat/emsdk/upstream/emscripten/cache/wasm/libc.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libcompiler_rt.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libc++-noexcept.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libc++abi-noexcept.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libdlmalloc.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libc_rt_wasm.a /home/caillat/emsdk/upstream/emscripten/cache/wasm/libsockets.a -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined --strip-debug --export-table --export getWcs --export pix2sky --export sky2pix --export stackSave --export stackRestore --export stackAlloc --export __wasm_call_ctors --export __errno_location --export malloc --export free -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (1)
Makefile:9: recipe for target 'wcslib.js' failed
make: *** [wcslib.js] Error 1


Support CD matrix - recall

Hello!

Currently we are using your libraries : fitsjs, sampjs and wcsjs in our project called : MIZAR (Module for Interactive visualiZation from Astronomical Repositories) in WebGL. You can check it out here.

So the issue is the same as yours, opened a year ago, about rotation matrix. MIZAR allows user to extract fits data corresponding to visible tiles only from larger fits vector containing all the sky. If the camera is aligned with north there is no problem, otherwise once extraction has been done, if we drag'n'drop the result to Mizar, we observe that it was rotated, but has been declined..
I've coded some tests: one with fits aligned with north and the other one rotated by 90°. They could be downloaded here and here and must be putted in "tests" directory. (I've not commited them because of size)

If you have an idea..
Anyway, thank you for all your contributions, work perfectly!

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.