-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP refactor + fixes + github actions + readme
- Loading branch information
1 parent
95a0591
commit 1315d92
Showing
24 changed files
with
2,549 additions
and
455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Publish to npm | ||
|
||
on: | ||
push: | ||
branches: | ||
- npm-repository | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install npm | ||
run: sudo apt-get install npm -y | ||
|
||
- name: Publish to npm | ||
env: | ||
TOKEN: ${{secrets.token}} | ||
run: | | ||
cd dist/fits-reader | ||
npm publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Build Library | ||
|
||
on: | ||
push: | ||
branches: | ||
- prod | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build library | ||
run: npx webpack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,55 @@ | ||
# fits-reader | ||
--- | ||
FITS reader library | ||
--- | ||
|
||
|
||
Javascript library for parsing FITS file | ||
|
||
**Usage** | ||
|
||
<script src="fits-reader.js"></script> | ||
<script> | ||
|
||
function getFile(file_path) { | ||
return fetch(file_path) | ||
.then((response) => { | ||
if (!response.ok) { | ||
throw new Error(`HTTP error, status = ${response.status}`); | ||
} | ||
return response.arrayBuffer(); | ||
}).then((buffer) => readFile(buffer)); | ||
} | ||
function readFile(arrayBuffer) { | ||
//FITS file object containing the file headers and data units | ||
//Library entry point expects a FITS file array buffer | ||
let fits_file = window.FITSReader.parseFITS(arrayBuffer); | ||
//Position of the header and data unit | ||
let hdu_index = 1; | ||
|
||
let hdu = fits_file.getHDU(hdu_index); | ||
let header = hdu.header; | ||
let data = hdu.data; | ||
let card_name = "CARDNAME"; | ||
|
||
//Get a specific card value | ||
let card_value = header.get(card_name); | ||
let col_name = "column"; | ||
|
||
//Specific to BINTABLE and TABLE extension | ||
let col_data; | ||
data.getColumn(col_name, function(col){col_data = col}); | ||
} | ||
|
||
//Get array buffer from file | ||
getFile("file.fits"); | ||
</script> | ||
|
||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "fits-reader", | ||
"version": "1.0.0", | ||
"description": "Javascript library for reading FITS file", | ||
"main": "fits-reader.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "MIT" | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.